зеркало из https://github.com/microsoft/Power-Fx.git
Add distinct capability (#2694)
This commit is contained in:
Родитель
b89656de2e
Коммит
7b7a1bb21e
|
@ -86,60 +86,62 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
|
|||
{ DelegationMetadataOperatorConstants.CdsIn, new DelegationCapability(CdsIn) },
|
||||
{ DelegationMetadataOperatorConstants.Top, new DelegationCapability(Top) },
|
||||
{ DelegationMetadataOperatorConstants.AsType, new DelegationCapability(AsType) },
|
||||
{ DelegationMetadataOperatorConstants.ArrayLookup, new DelegationCapability(ArrayLookup) }
|
||||
{ DelegationMetadataOperatorConstants.ArrayLookup, new DelegationCapability(ArrayLookup) },
|
||||
{ DelegationMetadataOperatorConstants.Distinct, new DelegationCapability(Distinct) }
|
||||
}, isThreadSafe: true);
|
||||
|
||||
// Supported delegatable operations.
|
||||
public static readonly BigInteger None = 0x0;
|
||||
public static readonly BigInteger Sort = 0x1;
|
||||
public static readonly BigInteger Filter = 0x2;
|
||||
public static readonly BigInteger GreaterThan = 0x4;
|
||||
public static readonly BigInteger GreaterThanOrEqual = 0x8;
|
||||
public static readonly BigInteger LessThan = 0x10;
|
||||
public static readonly BigInteger LessThanOrEqual = 0x20;
|
||||
public static readonly BigInteger And = 0x40;
|
||||
public static readonly BigInteger Or = 0x80;
|
||||
public static readonly BigInteger In = 0x100;
|
||||
public static readonly BigInteger Exactin = 0x200;
|
||||
public static readonly BigInteger Not = 0x400;
|
||||
public static readonly BigInteger Equal = 0x800;
|
||||
public static readonly BigInteger NotEqual = 0x1000;
|
||||
public static readonly BigInteger SortAscendingOnly = 0x2000;
|
||||
public static readonly BigInteger Contains = 0x4000;
|
||||
public static readonly BigInteger IndexOf = 0x8000;
|
||||
public static readonly BigInteger SubStringOf = 0x10000;
|
||||
public static readonly BigInteger Year = 0x20000;
|
||||
public static readonly BigInteger Month = 0x40000;
|
||||
public static readonly BigInteger Day = 0x80000;
|
||||
public static readonly BigInteger Hour = 0x100000;
|
||||
public static readonly BigInteger Minute = 0x200000;
|
||||
public static readonly BigInteger Second = 0x400000;
|
||||
public static readonly BigInteger Lower = 0x800000;
|
||||
public static readonly BigInteger Upper = 0x1000000;
|
||||
public static readonly BigInteger Trim = 0x2000000;
|
||||
public static readonly BigInteger Null = 0x4000000;
|
||||
public static readonly BigInteger Date = 0x8000000;
|
||||
public static readonly BigInteger Length = 0x10000000;
|
||||
public static readonly BigInteger Sum = 0x20000000;
|
||||
public static readonly BigInteger Min = 0x40000000;
|
||||
public static readonly BigInteger Max = 0x80000000;
|
||||
public static readonly BigInteger Average = 0x100000000;
|
||||
public static readonly BigInteger Count = 0x200000000;
|
||||
public static readonly BigInteger Add = 0x400000000;
|
||||
public static readonly BigInteger Sub = 0x800000000;
|
||||
public static readonly BigInteger StartsWith = 0x1000000000;
|
||||
public static readonly BigInteger Mul = 0x2000000000;
|
||||
public static readonly BigInteger Div = 0x4000000000;
|
||||
public static readonly BigInteger EndsWith = 0x8000000000;
|
||||
public static readonly BigInteger CountDistinct = 0x10000000000;
|
||||
public static readonly BigInteger CdsIn = 0x20000000000;
|
||||
public static readonly BigInteger Top = 0x40000000000;
|
||||
public static readonly BigInteger Group = 0x80000000000;
|
||||
public static readonly BigInteger AsType = 0x100000000000;
|
||||
public static readonly BigInteger ArrayLookup = 0x200000000000;
|
||||
public static readonly BigInteger None = BigInteger.Zero;
|
||||
public static readonly BigInteger Sort = BigInteger.One; // 0x1
|
||||
public static readonly BigInteger Filter = BigInteger.Pow(2, 1); // 0x2
|
||||
public static readonly BigInteger GreaterThan = BigInteger.Pow(2, 2); // 0x4
|
||||
public static readonly BigInteger GreaterThanOrEqual = BigInteger.Pow(2, 3); // 0x8
|
||||
public static readonly BigInteger LessThan = BigInteger.Pow(2, 4); // 0x10
|
||||
public static readonly BigInteger LessThanOrEqual = BigInteger.Pow(2, 5); // 0x20
|
||||
public static readonly BigInteger And = BigInteger.Pow(2, 6); // 0x40
|
||||
public static readonly BigInteger Or = BigInteger.Pow(2, 7); // 0x80
|
||||
public static readonly BigInteger In = BigInteger.Pow(2, 8); // 0x100
|
||||
public static readonly BigInteger Exactin = BigInteger.Pow(2, 9); // 0x200
|
||||
public static readonly BigInteger Not = BigInteger.Pow(2, 10); // 0x400
|
||||
public static readonly BigInteger Equal = BigInteger.Pow(2, 11); // 0x800
|
||||
public static readonly BigInteger NotEqual = BigInteger.Pow(2, 12); // 0x1000
|
||||
public static readonly BigInteger SortAscendingOnly = BigInteger.Pow(2, 13); // 0x2000
|
||||
public static readonly BigInteger Contains = BigInteger.Pow(2, 14); // 0x4000
|
||||
public static readonly BigInteger IndexOf = BigInteger.Pow(2, 15); // 0x8000
|
||||
public static readonly BigInteger SubStringOf = BigInteger.Pow(2, 16); // 0x10000
|
||||
public static readonly BigInteger Year = BigInteger.Pow(2, 17); // 0x20000
|
||||
public static readonly BigInteger Month = BigInteger.Pow(2, 18); // 0x40000
|
||||
public static readonly BigInteger Day = BigInteger.Pow(2, 19); // 0x80000
|
||||
public static readonly BigInteger Hour = BigInteger.Pow(2, 20); // 0x100000
|
||||
public static readonly BigInteger Minute = BigInteger.Pow(2, 21); // 0x200000
|
||||
public static readonly BigInteger Second = BigInteger.Pow(2, 22); // 0x400000
|
||||
public static readonly BigInteger Lower = BigInteger.Pow(2, 23); // 0x800000
|
||||
public static readonly BigInteger Upper = BigInteger.Pow(2, 24); // 0x1000000
|
||||
public static readonly BigInteger Trim = BigInteger.Pow(2, 25); // 0x2000000
|
||||
public static readonly BigInteger Null = BigInteger.Pow(2, 26); // 0x4000000
|
||||
public static readonly BigInteger Date = BigInteger.Pow(2, 27); // 0x8000000
|
||||
public static readonly BigInteger Length = BigInteger.Pow(2, 28); // 0x10000000
|
||||
public static readonly BigInteger Sum = BigInteger.Pow(2, 29); // 0x20000000
|
||||
public static readonly BigInteger Min = BigInteger.Pow(2, 30); // 0x40000000
|
||||
public static readonly BigInteger Max = BigInteger.Pow(2, 31); // 0x80000000
|
||||
public static readonly BigInteger Average = BigInteger.Pow(2, 32); // 0x100000000
|
||||
public static readonly BigInteger Count = BigInteger.Pow(2, 33); // 0x200000000
|
||||
public static readonly BigInteger Add = BigInteger.Pow(2, 34); // 0x400000000
|
||||
public static readonly BigInteger Sub = BigInteger.Pow(2, 35); // 0x800000000
|
||||
public static readonly BigInteger StartsWith = BigInteger.Pow(2, 36); // 0x1000000000
|
||||
public static readonly BigInteger Mul = BigInteger.Pow(2, 37); // 0x2000000000
|
||||
public static readonly BigInteger Div = BigInteger.Pow(2, 38); // 0x4000000000
|
||||
public static readonly BigInteger EndsWith = BigInteger.Pow(2, 39); // 0x8000000000
|
||||
public static readonly BigInteger CountDistinct = BigInteger.Pow(2, 40); // 0x10000000000
|
||||
public static readonly BigInteger CdsIn = BigInteger.Pow(2, 41); // 0x20000000000
|
||||
public static readonly BigInteger Top = BigInteger.Pow(2, 42); // 0x40000000000
|
||||
public static readonly BigInteger Group = BigInteger.Pow(2, 43); // 0x80000000000
|
||||
public static readonly BigInteger AsType = BigInteger.Pow(2, 44); // 0x100000000000
|
||||
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.
|
||||
private static BigInteger maxSingleCapabilityValue = ArrayLookup;
|
||||
private static BigInteger maxSingleCapabilityValue = Distinct;
|
||||
|
||||
// Indicates support all functionality.
|
||||
public static BigInteger SupportsAll
|
||||
|
@ -392,37 +394,37 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
|
|||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(Average));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(Count))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(Count));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(Add))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(Add));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(Sub))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(Sub));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(StartsWith))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(StartsWith));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(Mul))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(Mul));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(Div))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
|
@ -434,31 +436,31 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
|
|||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(EndsWith));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(CountDistinct))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(CountDistinct));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(CdsIn))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(CdsIn));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(Top))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(Top));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(Group))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(Group));
|
||||
}
|
||||
|
||||
|
||||
if (HasCapability(AsType))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
|
@ -471,6 +473,12 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
|
|||
sb.Append(nameof(ArrayLookup));
|
||||
}
|
||||
|
||||
if (HasCapability(Distinct))
|
||||
{
|
||||
AddCommaIfNeeded(sb);
|
||||
sb.Append(nameof(Distinct));
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
|
|||
public const string Top = "top";
|
||||
public const string AsType = "astype";
|
||||
public const string ArrayLookup = "arraylookup";
|
||||
public const string Distinct = "distinct";
|
||||
}
|
||||
|
||||
public enum DelegationOperator
|
||||
|
@ -94,6 +95,7 @@ namespace Microsoft.PowerFx.Core.Functions.Delegation
|
|||
Cdsin,
|
||||
Top,
|
||||
Astype,
|
||||
Arraylookup
|
||||
Arraylookup,
|
||||
Distinct
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче