Class UpsertKeyUtil

java.lang.Object
org.apache.flink.table.planner.plan.utils.UpsertKeyUtil

public class UpsertKeyUtil extends Object
Utility for upsertKey which represented as a Set of ImmutableBitSet.
  • Constructor Details

    • UpsertKeyUtil

      public UpsertKeyUtil()
  • Method Details

    • getSmallestKey

      @Nonnull public static int[] getSmallestKey(@Nullable Set<org.apache.calcite.util.ImmutableBitSet> upsertKeys)
      Returns the smallest key of given upsert keys. The rule of 'small' is an upsert key represented by ImmutableBitSet has smaller cardinality or has a smaller leading element when the same cardinality. E.g., '{0,1}' is smaller than '{0,1,2}' and '{0,1}' is smaller than '{0,2}'.
      Parameters:
      upsertKeys - input upsert keys
      Returns:
      the smallest key
    • smallestKey

      public static Optional<int[]> smallestKey(@Nullable Set<org.apache.calcite.util.ImmutableBitSet> upsertKeys)
      Returns the smallest key of given upsert keys wrapped with a java Optional. Different from getSmallestKey(Set), it'll return result with an empty Optional if the input set is null or empty.