Java Code Examples for org.apache.calcite.util.mapping.Mappings#apply2()

The following examples show how to use org.apache.calcite.util.mapping.Mappings#apply2() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RelDistributions.java    From calcite with Apache License 2.0 5 votes vote down vote up
public RelDistribution apply(Mappings.TargetMapping mapping) {
  if (keys.isEmpty()) {
    return this;
  }
  for (int key : keys) {
    if (mapping.getTargetOpt(key) == -1) {
      return ANY; // Some distribution keys are not mapped => any.
    }
  }
  List<Integer> mappedKeys0 = Mappings.apply2((Mapping) mapping, keys);
  ImmutableIntList mappedKeys = normalizeKeys(mappedKeys0);
  return of(type, mappedKeys);
}
 
Example 2
Source File: SubstitutionVisitor.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static MutableAggregate permute(MutableAggregate aggregate,
    MutableRel input, Mapping mapping) {
  ImmutableBitSet groupSet = Mappings.apply(mapping, aggregate.groupSet);
  ImmutableList<ImmutableBitSet> groupSets =
      Mappings.apply2(mapping, aggregate.groupSets);
  List<AggregateCall> aggregateCalls =
      Util.transform(aggregate.aggCalls, call -> call.transform(mapping));
  return MutableAggregate.of(input, groupSet, groupSets, aggregateCalls);
}
 
Example 3
Source File: SubstitutionVisitor.java    From Bats with Apache License 2.0 4 votes vote down vote up
public static MutableAggregate permute(MutableAggregate aggregate, MutableRel input, Mapping mapping) {
    ImmutableBitSet groupSet = Mappings.apply(mapping, aggregate.groupSet);
    ImmutableList<ImmutableBitSet> groupSets = Mappings.apply2(mapping, aggregate.groupSets);
    List<AggregateCall> aggregateCalls = Util.transform(aggregate.aggCalls, call -> call.transform(mapping));
    return MutableAggregate.of(input, groupSet, groupSets, aggregateCalls);
}