Skip to content

Commit

Permalink
Update capabilities to support different Join types (#2805)
Browse files Browse the repository at this point in the history
This is to support datasources that don't necessarily support all Join
types like DV which doesn't support right joins
  • Loading branch information
LucGenetier authored Jan 6, 2025
1 parent eb0d80d commit a957fcd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ internal struct DelegationCapability
{ DelegationMetadataOperatorConstants.AsType, new DelegationCapability(AsType) },
{ DelegationMetadataOperatorConstants.ArrayLookup, new DelegationCapability(ArrayLookup) },
{ DelegationMetadataOperatorConstants.Distinct, new DelegationCapability(Distinct) },
{ DelegationMetadataOperatorConstants.Join, new DelegationCapability(Join) }
{ DelegationMetadataOperatorConstants.JoinInner, new DelegationCapability(JoinInner) },
{ DelegationMetadataOperatorConstants.JoinLeft, new DelegationCapability(JoinLeft) },
{ DelegationMetadataOperatorConstants.JoinRight, new DelegationCapability(JoinRight) },
{ DelegationMetadataOperatorConstants.JoinFull, new DelegationCapability(JoinFull) }
}, isThreadSafe: true);

// Supported delegatable operations.
Expand Down Expand Up @@ -140,10 +143,13 @@ internal struct DelegationCapability
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
public static readonly BigInteger Join = BigInteger.Pow(2, 47); // 0x800000000000
public static readonly BigInteger JoinInner = BigInteger.Pow(2, 47); // 0x800000000000
public static readonly BigInteger JoinLeft = BigInteger.Pow(2, 48); // 0x1000000000000
public static readonly BigInteger JoinRight = BigInteger.Pow(2, 49); // 0x2000000000000
public static readonly BigInteger JoinFull = BigInteger.Pow(2, 50); // 0x4000000000000

// Please update it as max value changes.
private static BigInteger maxSingleCapabilityValue = Join;
private static BigInteger maxSingleCapabilityValue = JoinFull;

// Indicates support all functionality.
public static BigInteger SupportsAll
Expand Down Expand Up @@ -481,10 +487,28 @@ internal string DebugString
sb.Append(nameof(Distinct));
}

if (HasCapability(Join))
if (HasCapability(JoinInner))
{
AddCommaIfNeeded(sb);
sb.Append(nameof(Join));
sb.Append(nameof(JoinInner));
}

if (HasCapability(JoinLeft))
{
AddCommaIfNeeded(sb);
sb.Append(nameof(JoinLeft));
}

if (HasCapability(JoinRight))
{
AddCommaIfNeeded(sb);
sb.Append(nameof(JoinRight));
}

if (HasCapability(JoinFull))
{
AddCommaIfNeeded(sb);
sb.Append(nameof(JoinFull));
}

return sb.ToString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ internal static class DelegationMetadataOperatorConstants
public const string AsType = "astype";
public const string ArrayLookup = "arraylookup";
public const string Distinct = "distinct";
public const string Join = "join";
public const string JoinInner = "joininner";
public const string JoinLeft = "joinleft";
public const string JoinRight = "joinright";
public const string JoinFull = "joinfull";
}

public enum DelegationOperator
Expand Down Expand Up @@ -98,6 +101,9 @@ public enum DelegationOperator
Astype,
Arraylookup,
Distinct,
Join
JoinInner,
JoinLeft,
JoinRight,
JoinFull
}
}

0 comments on commit a957fcd

Please sign in to comment.