Skip to content

Commit a957fcd

Browse files
authored
Update capabilities to support different Join types (#2805)
This is to support datasources that don't necessarily support all Join types like DV which doesn't support right joins
1 parent eb0d80d commit a957fcd

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

src/libraries/Microsoft.PowerFx.Core/Functions/Delegation/DelegationCapability.cs

+29-5
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ internal struct DelegationCapability
8888
{ DelegationMetadataOperatorConstants.AsType, new DelegationCapability(AsType) },
8989
{ DelegationMetadataOperatorConstants.ArrayLookup, new DelegationCapability(ArrayLookup) },
9090
{ DelegationMetadataOperatorConstants.Distinct, new DelegationCapability(Distinct) },
91-
{ DelegationMetadataOperatorConstants.Join, new DelegationCapability(Join) }
91+
{ DelegationMetadataOperatorConstants.JoinInner, new DelegationCapability(JoinInner) },
92+
{ DelegationMetadataOperatorConstants.JoinLeft, new DelegationCapability(JoinLeft) },
93+
{ DelegationMetadataOperatorConstants.JoinRight, new DelegationCapability(JoinRight) },
94+
{ DelegationMetadataOperatorConstants.JoinFull, new DelegationCapability(JoinFull) }
9295
}, isThreadSafe: true);
9396

9497
// Supported delegatable operations.
@@ -140,10 +143,13 @@ internal struct DelegationCapability
140143
public static readonly BigInteger AsType = BigInteger.Pow(2, 44); // 0x100000000000
141144
public static readonly BigInteger ArrayLookup = BigInteger.Pow(2, 45); // 0x200000000000
142145
public static readonly BigInteger Distinct = BigInteger.Pow(2, 46); // 0x400000000000
143-
public static readonly BigInteger Join = BigInteger.Pow(2, 47); // 0x800000000000
146+
public static readonly BigInteger JoinInner = BigInteger.Pow(2, 47); // 0x800000000000
147+
public static readonly BigInteger JoinLeft = BigInteger.Pow(2, 48); // 0x1000000000000
148+
public static readonly BigInteger JoinRight = BigInteger.Pow(2, 49); // 0x2000000000000
149+
public static readonly BigInteger JoinFull = BigInteger.Pow(2, 50); // 0x4000000000000
144150

145151
// Please update it as max value changes.
146-
private static BigInteger maxSingleCapabilityValue = Join;
152+
private static BigInteger maxSingleCapabilityValue = JoinFull;
147153

148154
// Indicates support all functionality.
149155
public static BigInteger SupportsAll
@@ -481,10 +487,28 @@ internal string DebugString
481487
sb.Append(nameof(Distinct));
482488
}
483489

484-
if (HasCapability(Join))
490+
if (HasCapability(JoinInner))
485491
{
486492
AddCommaIfNeeded(sb);
487-
sb.Append(nameof(Join));
493+
sb.Append(nameof(JoinInner));
494+
}
495+
496+
if (HasCapability(JoinLeft))
497+
{
498+
AddCommaIfNeeded(sb);
499+
sb.Append(nameof(JoinLeft));
500+
}
501+
502+
if (HasCapability(JoinRight))
503+
{
504+
AddCommaIfNeeded(sb);
505+
sb.Append(nameof(JoinRight));
506+
}
507+
508+
if (HasCapability(JoinFull))
509+
{
510+
AddCommaIfNeeded(sb);
511+
sb.Append(nameof(JoinFull));
488512
}
489513

490514
return sb.ToString();

src/libraries/Microsoft.PowerFx.Core/Functions/Delegation/DelegationMetadataOperatorConstants.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ internal static class DelegationMetadataOperatorConstants
5252
public const string AsType = "astype";
5353
public const string ArrayLookup = "arraylookup";
5454
public const string Distinct = "distinct";
55-
public const string Join = "join";
55+
public const string JoinInner = "joininner";
56+
public const string JoinLeft = "joinleft";
57+
public const string JoinRight = "joinright";
58+
public const string JoinFull = "joinfull";
5659
}
5760

5861
public enum DelegationOperator
@@ -98,6 +101,9 @@ public enum DelegationOperator
98101
Astype,
99102
Arraylookup,
100103
Distinct,
101-
Join
104+
JoinInner,
105+
JoinLeft,
106+
JoinRight,
107+
JoinFull
102108
}
103109
}

0 commit comments

Comments
 (0)