本文整理汇总了Java中org.apache.calcite.util.ImmutableIntList类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableIntList类的具体用法?Java ImmutableIntList怎么用?Java ImmutableIntList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableIntList类属于org.apache.calcite.util包,在下文中一共展示了ImmutableIntList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mergeJoin
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
/** Helper method to determine a {@link Join}'s collation assuming that it
* uses a merge-join algorithm.
*
* <p>If the inputs are sorted on other keys <em>in addition to</em> the join
* key, the result preserves those collations too. */
public static List<RelCollation> mergeJoin(RelMetadataQuery mq,
RelNode left, RelNode right,
ImmutableIntList leftKeys, ImmutableIntList rightKeys) {
final ImmutableList.Builder<RelCollation> builder = ImmutableList.builder();
final ImmutableList<RelCollation> leftCollations = mq.collations(left);
assert RelCollations.contains(leftCollations, leftKeys)
: "cannot merge join: left input is not sorted on left keys";
builder.addAll(leftCollations);
final ImmutableList<RelCollation> rightCollations = mq.collations(right);
assert RelCollations.contains(rightCollations, rightKeys)
: "cannot merge join: right input is not sorted on right keys";
final int leftFieldCount = left.getRowType().getFieldCount();
for (RelCollation collation : rightCollations) {
builder.add(RelCollations.shift(collation, leftFieldCount));
}
return builder.build();
}
示例2: createAggregateCallWithBinding
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
private AggregateCall createAggregateCallWithBinding(
RelDataTypeFactory typeFactory,
SqlAggFunction aggFunction,
RelDataType operandType,
Aggregate oldAggRel,
AggregateCall oldCall,
int argOrdinal) {
final Aggregate.AggCallBinding binding =
new Aggregate.AggCallBinding(typeFactory, aggFunction,
ImmutableList.of(operandType), oldAggRel.getGroupCount(),
oldCall.filterArg >= 0);
return AggregateCall.create(aggFunction,
oldCall.isDistinct(),
oldCall.isApproximate(),
ImmutableIntList.of(argOrdinal),
oldCall.filterArg,
aggFunction.inferReturnType(binding),
null);
}
示例3: apply
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
protected void apply(RelOptRuleCall call, Filter filter, TableScan scan) {
final ImmutableIntList projects;
final ImmutableList.Builder<RexNode> filters = ImmutableList.builder();
if (scan instanceof Bindables.BindableTableScan) {
final Bindables.BindableTableScan bindableScan =
(Bindables.BindableTableScan) scan;
filters.addAll(bindableScan.filters);
projects = bindableScan.projects;
} else {
projects = scan.identity();
}
final Mapping mapping = Mappings.target(projects,
scan.getTable().getRowType().getFieldCount());
filters.add(
RexUtil.apply(mapping, filter.getCondition()));
call.transformTo(
Bindables.BindableTableScan.create(scan.getCluster(), scan.getTable(),
filters.build(), projects));
}
示例4: SemiJoin
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
/**
* Creates a SemiJoin.
*
* <p>Use {@link #create} unless you know what you're doing.
*
* @param cluster cluster that join belongs to
* @param traitSet Trait set
* @param left left join input
* @param right right join input
* @param condition join condition
* @param leftKeys left keys of the semijoin
* @param rightKeys right keys of the semijoin
*/
public SemiJoin(
RelOptCluster cluster,
RelTraitSet traitSet,
RelNode left,
RelNode right,
RexNode condition,
ImmutableIntList leftKeys,
ImmutableIntList rightKeys) {
super(
cluster,
traitSet,
left,
right,
condition,
leftKeys,
rightKeys,
ImmutableSet.<CorrelationId>of(),
JoinRelType.INNER);
}
示例5: of
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
/** Creates a {@code JoinInfo} by analyzing a condition. */
public static JoinInfo of(RelNode left, RelNode right, RexNode condition) {
final List<Integer> leftKeys = new ArrayList<Integer>();
final List<Integer> rightKeys = new ArrayList<Integer>();
final List<Boolean> filterNulls = new ArrayList<Boolean>();
RexNode remaining =
RelOptUtil.splitJoinCondition(left, right, condition, leftKeys,
rightKeys, filterNulls);
if (remaining.isAlwaysTrue()) {
return new EquiJoinInfo(ImmutableIntList.copyOf(leftKeys),
ImmutableIntList.copyOf(rightKeys));
} else {
return new NonEquiJoinInfo(ImmutableIntList.copyOf(leftKeys),
ImmutableIntList.copyOf(rightKeys), remaining);
}
}
示例6: EnumerableJoin
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
/** Creates an EnumerableJoin.
*
* <p>Use {@link #create} unless you know what you're doing. */
protected EnumerableJoin(
RelOptCluster cluster,
RelTraitSet traits,
RelNode left,
RelNode right,
RexNode condition,
ImmutableIntList leftKeys,
ImmutableIntList rightKeys,
Set<CorrelationId> variablesSet,
JoinRelType joinType)
throws InvalidRelException {
super(
cluster,
traits,
left,
right,
condition,
leftKeys,
rightKeys,
variablesSet,
joinType);
}
示例7: create
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
/** Creates an EnumerableJoin. */
public static EnumerableJoin create(
RelNode left,
RelNode right,
RexNode condition,
ImmutableIntList leftKeys,
ImmutableIntList rightKeys,
Set<CorrelationId> variablesSet,
JoinRelType joinType)
throws InvalidRelException {
final RelOptCluster cluster = left.getCluster();
final RelTraitSet traitSet =
cluster.traitSetOf(EnumerableConvention.INSTANCE);
return new EnumerableJoin(cluster, traitSet, left, right, condition,
leftKeys, rightKeys, variablesSet, joinType);
}
示例8: EnumerableMergeJoin
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
EnumerableMergeJoin(
RelOptCluster cluster,
RelTraitSet traits,
RelNode left,
RelNode right,
RexNode condition,
ImmutableIntList leftKeys,
ImmutableIntList rightKeys,
Set<CorrelationId> variablesSet,
JoinRelType joinType)
throws InvalidRelException {
super(cluster, traits, left, right, condition, leftKeys, rightKeys,
variablesSet, joinType);
final List<RelCollation> collations =
traits.getTraits(RelCollationTraitDef.INSTANCE);
assert collations == null || RelCollations.contains(collations, leftKeys);
}
示例9: groupKey_
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
private GroupKey groupKey_(ImmutableBitSet groupSet, boolean indicator,
ImmutableList<ImmutableBitSet> groupSets) {
if (groupSet.length() > peek().getRowType().getFieldCount()) {
throw new IllegalArgumentException("out of bounds: " + groupSet);
}
if (groupSets == null) {
groupSets = ImmutableList.of(groupSet);
}
final ImmutableList<RexNode> nodes =
fields(ImmutableIntList.of(groupSet.toArray()));
final List<ImmutableList<RexNode>> nodeLists =
Lists.transform(groupSets,
new Function<ImmutableBitSet, ImmutableList<RexNode>>() {
public ImmutableList<RexNode> apply(ImmutableBitSet input) {
return fields(ImmutableIntList.of(input.toArray()));
}
});
return groupKey(nodes, indicator, nodeLists);
}
示例10: getNewColumnMapping
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
/**
* Creates a mapping from the view index to the index in the underlying table.
*/
private static ImmutableIntList getNewColumnMapping(Table underlying,
ImmutableIntList oldColumnMapping, List<RelDataTypeField> extendedColumns,
RelDataTypeFactory typeFactory) {
final List<RelDataTypeField> baseColumns =
underlying.getRowType(typeFactory).getFieldList();
final Map<String, Integer> nameToIndex = mapNameToIndex(baseColumns);
final ImmutableList.Builder<Integer> newMapping = ImmutableList.builder();
newMapping.addAll(oldColumnMapping);
int newMappedIndex = baseColumns.size();
for (RelDataTypeField extendedColumn : extendedColumns) {
if (nameToIndex.containsKey(extendedColumn.getName())) {
// The extended column duplicates a column in the underlying table.
// Map to the index in the underlying table.
newMapping.add(nameToIndex.get(extendedColumn.getName()));
} else {
// The extended column is not in the underlying table.
newMapping.add(newMappedIndex++);
}
}
return ImmutableIntList.copyOf(newMapping.build());
}
示例11: create
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
/** Creates a BindableTableScan. */
public static BindableTableScan create(RelOptCluster cluster,
RelOptTable relOptTable, List<RexNode> filters,
List<Integer> projects) {
final Table table = relOptTable.unwrap(Table.class);
final RelTraitSet traitSet =
cluster.traitSetOf(BindableConvention.INSTANCE)
.replaceIfs(RelCollationTraitDef.INSTANCE,
new Supplier<List<RelCollation>>() {
public List<RelCollation> get() {
if (table != null) {
return table.getStatistic().getCollations();
}
return ImmutableList.of();
}
});
return new BindableTableScan(cluster, traitSet, relOptTable,
ImmutableList.copyOf(filters), ImmutableIntList.copyOf(projects));
}
示例12: createFilterable
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
private static TableScanNode createFilterable(Compiler compiler,
TableScan rel, ImmutableList<RexNode> filters, ImmutableIntList projects,
FilterableTable filterableTable) {
final DataContext root = compiler.getDataContext();
final List<RexNode> mutableFilters = Lists.newArrayList(filters);
final Enumerable<Object[]> enumerable =
filterableTable.scan(root, mutableFilters);
for (RexNode filter : mutableFilters) {
if (!filters.contains(filter)) {
throw RESOURCE.filterableTableInventedFilter(filter.toString()).ex();
}
}
final Enumerable<Row> rowEnumerable = Enumerables.toRow(enumerable);
return createEnumerable(compiler, rel, rowEnumerable, null,
mutableFilters, projects);
}
示例13: remap
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
private static List<Integer> remap(ImmutableBitSet groupSet,
List<Integer> argList) {
ImmutableIntList list = ImmutableIntList.of();
for (int arg : argList) {
list = list.append(remap(groupSet, arg));
}
return list;
}
示例14: AnalyzeViewResult
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
AnalyzeViewResult(CalcitePrepareImpl prepare,
SqlValidator validator, String sql, SqlNode sqlNode,
RelDataType rowType, RelRoot root, Table table,
ImmutableList<String> tablePath, RexNode constraint,
ImmutableIntList columnMapping) {
super(prepare, validator, sql, sqlNode, rowType, root);
this.table = table;
this.tablePath = tablePath;
this.constraint = constraint;
this.columnMapping = columnMapping;
}
示例15: OLAPJoinRel
import org.apache.calcite.util.ImmutableIntList; //导入依赖的package包/类
public OLAPJoinRel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, //
RexNode condition, ImmutableIntList leftKeys, ImmutableIntList rightKeys, //
Set<CorrelationId> variablesSet, JoinRelType joinType) throws InvalidRelException {
super(cluster, traits, left, right, condition, leftKeys, rightKeys, variablesSet, joinType);
Preconditions.checkArgument(getConvention() == OLAPRel.CONVENTION);
this.rowType = getRowType();
this.isTopJoin = false;
}