本文整理汇总了Java中org.apache.calcite.util.ImmutableIntList.identity方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableIntList.identity方法的具体用法?Java ImmutableIntList.identity怎么用?Java ImmutableIntList.identity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.util.ImmutableIntList
的用法示例。
在下文中一共展示了ImmutableIntList.identity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: of
import org.apache.calcite.util.ImmutableIntList; //导入方法依赖的package包/类
/** Creates a simple RelRoot. */
public static RelRoot of(RelNode rel, RelDataType rowType, SqlKind kind) {
final ImmutableIntList refs =
ImmutableIntList.identity(rowType.getFieldCount());
final List<String> names = rowType.getFieldNames();
return new RelRoot(rel, rowType, kind, Pair.zip(refs, names),
RelCollations.EMPTY);
}
示例2: identity
import org.apache.calcite.util.ImmutableIntList; //导入方法依赖的package包/类
/** Returns an identity projection for the given table. */
public static ImmutableIntList identity(RelOptTable table) {
return ImmutableIntList.identity(table.getRowType().getFieldCount());
}
示例3: createProjectableFilterable
import org.apache.calcite.util.ImmutableIntList; //导入方法依赖的package包/类
private static TableScanNode createProjectableFilterable(Compiler compiler,
TableScan rel, ImmutableList<RexNode> filters, ImmutableIntList projects,
ProjectableFilterableTable pfTable) {
final DataContext root = compiler.getDataContext();
final ImmutableIntList originalProjects = projects;
for (;;) {
final List<RexNode> mutableFilters = Lists.newArrayList(filters);
final int[] projectInts;
if (projects == null
|| projects.equals(TableScan.identity(rel.getTable()))) {
projectInts = null;
} else {
projectInts = projects.toIntArray();
}
final Enumerable<Object[]> enumerable1 =
pfTable.scan(root, mutableFilters, projectInts);
for (RexNode filter : mutableFilters) {
if (!filters.contains(filter)) {
throw RESOURCE.filterableTableInventedFilter(filter.toString())
.ex();
}
}
final ImmutableBitSet usedFields =
RelOptUtil.InputFinder.bits(mutableFilters, null);
if (projects != null) {
int changeCount = 0;
for (int usedField : usedFields) {
if (!projects.contains(usedField)) {
// A field that is not projected is used in a filter that the
// table rejected. We won't be able to apply the filter later.
// Try again without any projects.
projects =
ImmutableIntList.copyOf(
Iterables.concat(projects, ImmutableList.of(usedField)));
++changeCount;
}
}
if (changeCount > 0) {
continue;
}
}
final Enumerable<Row> rowEnumerable = Enumerables.toRow(enumerable1);
final ImmutableIntList rejectedProjects;
if (Objects.equals(projects, originalProjects)) {
rejectedProjects = null;
} else {
// We projected extra columns because they were needed in filters. Now
// project the leading columns.
rejectedProjects = ImmutableIntList.identity(originalProjects.size());
}
return createEnumerable(compiler, rel, rowEnumerable, projects,
mutableFilters, rejectedProjects);
}
}