Java Code Examples for org.apache.calcite.util.Util#transform()
The following examples show how to use
org.apache.calcite.util.Util#transform() .
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: LatticeSuggesterTest.java From calcite with Apache License 2.0 | 6 votes |
private Matcher<List<Lattice>> hasMeasureNames(int ordinal, String... names) { final List<String> nameList = ImmutableList.copyOf(names); return new TypeSafeMatcher<List<Lattice>>() { public void describeTo(Description description) { description.appendValue(names); } protected boolean matchesSafely(List<Lattice> lattices) { final Lattice lattice = lattices.get(ordinal); final List<String> actualNameList = Util.transform(lattice.defaultMeasures, measure -> measure.name); return actualNameList.equals(nameList); } }; }
Example 2
Source File: RelBuilder.java From Bats with Apache License 2.0 | 5 votes |
private GroupKey groupKey_(ImmutableBitSet groupSet, boolean indicator, ImmutableList<ImmutableBitSet> groupSets) { if (groupSet.length() > peek().getRowType().getFieldCount()) { throw new IllegalArgumentException("out of bounds: " + groupSet); } Objects.requireNonNull(groupSets); final ImmutableList<RexNode> nodes = fields(ImmutableIntList.of(groupSet.toArray())); final List<ImmutableList<RexNode>> nodeLists = Util.transform(groupSets, bitSet -> fields(ImmutableIntList.of(bitSet.toArray()))); return groupKey_(nodes, indicator, nodeLists); }
Example 3
Source File: RelBuilder.java From Bats with Apache License 2.0 | 5 votes |
/** Assigns a table alias to the top entry on the stack. */ public RelBuilder as(final String alias) { final Frame pair = stack.pop(); List<Field> newFields = Util.transform(pair.fields, field -> field.addAlias(alias)); stack.push(new Frame(pair.rel, ImmutableList.copyOf(newFields))); return this; }
Example 4
Source File: RelBuilder.java From calcite with Apache License 2.0 | 5 votes |
/** Assigns a table alias to the top entry on the stack. */ public RelBuilder as(final String alias) { final Frame pair = stack.pop(); List<Field> newFields = Util.transform(pair.fields, field -> field.addAlias(alias)); stack.push(new Frame(pair.rel, ImmutableList.copyOf(newFields))); return this; }
Example 5
Source File: SubstitutionVisitor.java From calcite with Apache License 2.0 | 5 votes |
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 6
Source File: LatticeSuggester.java From Bats with Apache License 2.0 | 4 votes |
List<String> tableAliases() { return Util.transform(tableRefs, tableRef -> tableRef.table.alias); }
Example 7
Source File: Lattice.java From Bats with Apache License 2.0 | 4 votes |
/** Copies this measure, mapping its arguments using a given function. */ Measure copy(Function<Column, Column> mapper) { return new Measure(agg, distinct, name, Util.transform(args, mapper)); }
Example 8
Source File: SubstitutionVisitor.java From Bats with Apache License 2.0 | 4 votes |
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 9
Source File: LatticeSuggester.java From calcite with Apache License 2.0 | 4 votes |
List<String> tableAliases() { return Util.transform(tableRefs, tableRef -> tableRef.table.alias); }
Example 10
Source File: Lattice.java From calcite with Apache License 2.0 | 4 votes |
/** Copies this measure, mapping its arguments using a given function. */ Measure copy(Function<Column, Column> mapper) { return new Measure(agg, distinct, name, Util.transform(args, mapper)); }
Example 11
Source File: EnumUtils.java From calcite with Apache License 2.0 | 4 votes |
static List<Type> internalTypes(List<? extends RexNode> operandList) { return Util.transform(operandList, node -> toInternal(node.getType())); }