This commit is contained in:
Luc Genetier 2024-10-14 20:55:16 +02:00 коммит произвёл GitHub
Родитель b89656de2e
Коммит 7b7a1bb21e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 71 добавлений и 61 удалений

Просмотреть файл

@ -86,60 +86,62 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
{ DelegationMetadataOperatorConstants.CdsIn, new DelegationCapability(CdsIn) }, { DelegationMetadataOperatorConstants.CdsIn, new DelegationCapability(CdsIn) },
{ DelegationMetadataOperatorConstants.Top, new DelegationCapability(Top) }, { DelegationMetadataOperatorConstants.Top, new DelegationCapability(Top) },
{ DelegationMetadataOperatorConstants.AsType, new DelegationCapability(AsType) }, { DelegationMetadataOperatorConstants.AsType, new DelegationCapability(AsType) },
{ DelegationMetadataOperatorConstants.ArrayLookup, new DelegationCapability(ArrayLookup) } { DelegationMetadataOperatorConstants.ArrayLookup, new DelegationCapability(ArrayLookup) },
{ DelegationMetadataOperatorConstants.Distinct, new DelegationCapability(Distinct) }
}, isThreadSafe: true); }, isThreadSafe: true);
// Supported delegatable operations. // Supported delegatable operations.
public static readonly BigInteger None = 0x0; public static readonly BigInteger None = BigInteger.Zero;
public static readonly BigInteger Sort = 0x1; public static readonly BigInteger Sort = BigInteger.One; // 0x1
public static readonly BigInteger Filter = 0x2; public static readonly BigInteger Filter = BigInteger.Pow(2, 1); // 0x2
public static readonly BigInteger GreaterThan = 0x4; public static readonly BigInteger GreaterThan = BigInteger.Pow(2, 2); // 0x4
public static readonly BigInteger GreaterThanOrEqual = 0x8; public static readonly BigInteger GreaterThanOrEqual = BigInteger.Pow(2, 3); // 0x8
public static readonly BigInteger LessThan = 0x10; public static readonly BigInteger LessThan = BigInteger.Pow(2, 4); // 0x10
public static readonly BigInteger LessThanOrEqual = 0x20; public static readonly BigInteger LessThanOrEqual = BigInteger.Pow(2, 5); // 0x20
public static readonly BigInteger And = 0x40; public static readonly BigInteger And = BigInteger.Pow(2, 6); // 0x40
public static readonly BigInteger Or = 0x80; public static readonly BigInteger Or = BigInteger.Pow(2, 7); // 0x80
public static readonly BigInteger In = 0x100; public static readonly BigInteger In = BigInteger.Pow(2, 8); // 0x100
public static readonly BigInteger Exactin = 0x200; public static readonly BigInteger Exactin = BigInteger.Pow(2, 9); // 0x200
public static readonly BigInteger Not = 0x400; public static readonly BigInteger Not = BigInteger.Pow(2, 10); // 0x400
public static readonly BigInteger Equal = 0x800; public static readonly BigInteger Equal = BigInteger.Pow(2, 11); // 0x800
public static readonly BigInteger NotEqual = 0x1000; public static readonly BigInteger NotEqual = BigInteger.Pow(2, 12); // 0x1000
public static readonly BigInteger SortAscendingOnly = 0x2000; public static readonly BigInteger SortAscendingOnly = BigInteger.Pow(2, 13); // 0x2000
public static readonly BigInteger Contains = 0x4000; public static readonly BigInteger Contains = BigInteger.Pow(2, 14); // 0x4000
public static readonly BigInteger IndexOf = 0x8000; public static readonly BigInteger IndexOf = BigInteger.Pow(2, 15); // 0x8000
public static readonly BigInteger SubStringOf = 0x10000; public static readonly BigInteger SubStringOf = BigInteger.Pow(2, 16); // 0x10000
public static readonly BigInteger Year = 0x20000; public static readonly BigInteger Year = BigInteger.Pow(2, 17); // 0x20000
public static readonly BigInteger Month = 0x40000; public static readonly BigInteger Month = BigInteger.Pow(2, 18); // 0x40000
public static readonly BigInteger Day = 0x80000; public static readonly BigInteger Day = BigInteger.Pow(2, 19); // 0x80000
public static readonly BigInteger Hour = 0x100000; public static readonly BigInteger Hour = BigInteger.Pow(2, 20); // 0x100000
public static readonly BigInteger Minute = 0x200000; public static readonly BigInteger Minute = BigInteger.Pow(2, 21); // 0x200000
public static readonly BigInteger Second = 0x400000; public static readonly BigInteger Second = BigInteger.Pow(2, 22); // 0x400000
public static readonly BigInteger Lower = 0x800000; public static readonly BigInteger Lower = BigInteger.Pow(2, 23); // 0x800000
public static readonly BigInteger Upper = 0x1000000; public static readonly BigInteger Upper = BigInteger.Pow(2, 24); // 0x1000000
public static readonly BigInteger Trim = 0x2000000; public static readonly BigInteger Trim = BigInteger.Pow(2, 25); // 0x2000000
public static readonly BigInteger Null = 0x4000000; public static readonly BigInteger Null = BigInteger.Pow(2, 26); // 0x4000000
public static readonly BigInteger Date = 0x8000000; public static readonly BigInteger Date = BigInteger.Pow(2, 27); // 0x8000000
public static readonly BigInteger Length = 0x10000000; public static readonly BigInteger Length = BigInteger.Pow(2, 28); // 0x10000000
public static readonly BigInteger Sum = 0x20000000; public static readonly BigInteger Sum = BigInteger.Pow(2, 29); // 0x20000000
public static readonly BigInteger Min = 0x40000000; public static readonly BigInteger Min = BigInteger.Pow(2, 30); // 0x40000000
public static readonly BigInteger Max = 0x80000000; public static readonly BigInteger Max = BigInteger.Pow(2, 31); // 0x80000000
public static readonly BigInteger Average = 0x100000000; public static readonly BigInteger Average = BigInteger.Pow(2, 32); // 0x100000000
public static readonly BigInteger Count = 0x200000000; public static readonly BigInteger Count = BigInteger.Pow(2, 33); // 0x200000000
public static readonly BigInteger Add = 0x400000000; public static readonly BigInteger Add = BigInteger.Pow(2, 34); // 0x400000000
public static readonly BigInteger Sub = 0x800000000; public static readonly BigInteger Sub = BigInteger.Pow(2, 35); // 0x800000000
public static readonly BigInteger StartsWith = 0x1000000000; public static readonly BigInteger StartsWith = BigInteger.Pow(2, 36); // 0x1000000000
public static readonly BigInteger Mul = 0x2000000000; public static readonly BigInteger Mul = BigInteger.Pow(2, 37); // 0x2000000000
public static readonly BigInteger Div = 0x4000000000; public static readonly BigInteger Div = BigInteger.Pow(2, 38); // 0x4000000000
public static readonly BigInteger EndsWith = 0x8000000000; public static readonly BigInteger EndsWith = BigInteger.Pow(2, 39); // 0x8000000000
public static readonly BigInteger CountDistinct = 0x10000000000; public static readonly BigInteger CountDistinct = BigInteger.Pow(2, 40); // 0x10000000000
public static readonly BigInteger CdsIn = 0x20000000000; public static readonly BigInteger CdsIn = BigInteger.Pow(2, 41); // 0x20000000000
public static readonly BigInteger Top = 0x40000000000; public static readonly BigInteger Top = BigInteger.Pow(2, 42); // 0x40000000000
public static readonly BigInteger Group = 0x80000000000; public static readonly BigInteger Group = BigInteger.Pow(2, 43); // 0x80000000000
public static readonly BigInteger AsType = 0x100000000000; public static readonly BigInteger AsType = BigInteger.Pow(2, 44); // 0x100000000000
public static readonly BigInteger ArrayLookup = 0x200000000000; public static readonly BigInteger ArrayLookup = BigInteger.Pow(2, 45); // 0x200000000000
public static readonly BigInteger Distinct = BigInteger.Pow(2, 46); // 0x400000000000
// Please update it as max value changes. // Please update it as max value changes.
private static BigInteger maxSingleCapabilityValue = ArrayLookup; private static BigInteger maxSingleCapabilityValue = Distinct;
// Indicates support all functionality. // Indicates support all functionality.
public static BigInteger SupportsAll public static BigInteger SupportsAll
@ -392,37 +394,37 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(Average)); sb.Append(nameof(Average));
} }
if (HasCapability(Count)) if (HasCapability(Count))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(Count)); sb.Append(nameof(Count));
} }
if (HasCapability(Add)) if (HasCapability(Add))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(Add)); sb.Append(nameof(Add));
} }
if (HasCapability(Sub)) if (HasCapability(Sub))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(Sub)); sb.Append(nameof(Sub));
} }
if (HasCapability(StartsWith)) if (HasCapability(StartsWith))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(StartsWith)); sb.Append(nameof(StartsWith));
} }
if (HasCapability(Mul)) if (HasCapability(Mul))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(Mul)); sb.Append(nameof(Mul));
} }
if (HasCapability(Div)) if (HasCapability(Div))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
@ -434,31 +436,31 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(EndsWith)); sb.Append(nameof(EndsWith));
} }
if (HasCapability(CountDistinct)) if (HasCapability(CountDistinct))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(CountDistinct)); sb.Append(nameof(CountDistinct));
} }
if (HasCapability(CdsIn)) if (HasCapability(CdsIn))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(CdsIn)); sb.Append(nameof(CdsIn));
} }
if (HasCapability(Top)) if (HasCapability(Top))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(Top)); sb.Append(nameof(Top));
} }
if (HasCapability(Group)) if (HasCapability(Group))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
sb.Append(nameof(Group)); sb.Append(nameof(Group));
} }
if (HasCapability(AsType)) if (HasCapability(AsType))
{ {
AddCommaIfNeeded(sb); AddCommaIfNeeded(sb);
@ -471,6 +473,12 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
sb.Append(nameof(ArrayLookup)); sb.Append(nameof(ArrayLookup));
} }
if (HasCapability(Distinct))
{
AddCommaIfNeeded(sb);
sb.Append(nameof(Distinct));
}
return sb.ToString(); return sb.ToString();
} }
} }

Просмотреть файл

@ -51,6 +51,7 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
public const string Top = "top"; public const string Top = "top";
public const string AsType = "astype"; public const string AsType = "astype";
public const string ArrayLookup = "arraylookup"; public const string ArrayLookup = "arraylookup";
public const string Distinct = "distinct";
} }
public enum DelegationOperator public enum DelegationOperator
@ -94,6 +95,7 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
Cdsin, Cdsin,
Top, Top,
Astype, Astype,
Arraylookup Arraylookup,
Distinct
} }
} }