本文整理汇总了Java中org.apache.calcite.util.Pair.left方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.left方法的具体用法?Java Pair.left怎么用?Java Pair.left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.util.Pair
的用法示例。
在下文中一共展示了Pair.left方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookupOrCreateGroupExpr
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
private int lookupOrCreateGroupExpr(RexNode expr) {
int index = 0;
for (RexNode convertedInputExpr : Pair.left(convertedInputExprs)) {
if (expr.toString().equals(convertedInputExpr.toString())) {
return index;
}
++index;
}
// not found -- add it
addExpr(expr, null);
return index;
}
示例2: lookupOrCreateGroupExpr
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
private int lookupOrCreateGroupExpr(RexNode expr) {
int index = 0;
for (RexNode convertedInputExpr : Pair.left(convertedInputExprs)) {
if (expr.toString().equals(convertedInputExpr.toString())) {
return index;
}
++index;
}
// not found -- add it
addExpr(expr, null);
return index;
}
示例3: create
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
public static RelOptTableImpl create(RelOptSchema schema, RelDataType rowType,
Table table, Path path) {
final SchemaPlus schemaPlus = MySchemaPlus.create(path);
Function<Class, Expression> expressionFunction =
getClassExpressionFunction(schemaPlus, Util.last(path).left, table);
return new RelOptTableImpl(schema, rowType, Pair.left(path), table,
expressionFunction, table.getStatistic().getRowCount());
}
示例4: field
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
/** Creates a reference to a field of given input relational expression
* by name.
*
* @param inputCount Number of inputs
* @param inputOrdinal Input ordinal
* @param fieldName Field name
*/
public RexInputRef field(int inputCount, int inputOrdinal, String fieldName) {
final Frame frame = peek_(inputCount, inputOrdinal);
final List<String> fieldNames = Pair.left(frame.fields());
int i = fieldNames.indexOf(fieldName);
if (i >= 0) {
return field(inputCount, inputOrdinal, i);
} else {
throw new IllegalArgumentException("field [" + fieldName
+ "] not found; input fields are: " + fieldNames);
}
}
示例5: ref
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
private Node ref(String testCaseName, List<Pair<String, Element>> map) {
if (map.isEmpty()) {
return null;
}
// Compute the position that the new element should be if the map were
// sorted.
int i = 0;
final List<String> names = Pair.left(map);
for (String s : names) {
if (s.compareToIgnoreCase(testCaseName) <= 0) {
++i;
}
}
// Starting at a proportional position in the list,
// move forwards through lesser names, then
// move backwards through greater names.
//
// The intended effect is that if the list is already sorted, the new item
// will end up in exactly the right position, and if the list is not sorted,
// the new item will end up in approximately the right position.
while (i < map.size()
&& names.get(i).compareToIgnoreCase(testCaseName) < 0) {
++i;
}
if (i >= map.size() - 1) {
return null;
}
while (i >= 0 && names.get(i).compareToIgnoreCase(testCaseName) > 0) {
--i;
}
return map.get(i + 1).right;
}
示例6: implement
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
@Override protected PreparedResult implement(RelRoot root) {
RelDataType resultType = root.rel.getRowType();
boolean isDml = root.kind.belongsTo(SqlKind.DML);
final Bindable bindable;
if (resultConvention == BindableConvention.INSTANCE) {
bindable = Interpreters.bindable(root.rel);
} else {
EnumerableRel enumerable = (EnumerableRel) root.rel;
if (!root.isRefTrivial()) {
final List<RexNode> projects = new ArrayList<>();
final RexBuilder rexBuilder = enumerable.getCluster().getRexBuilder();
for (int field : Pair.left(root.fields)) {
projects.add(rexBuilder.makeInputRef(enumerable, field));
}
RexProgram program = RexProgram.create(enumerable.getRowType(),
projects, null, root.validatedRowType, rexBuilder);
enumerable = EnumerableCalc.create(enumerable, program);
}
try {
CatalogReader.THREAD_LOCAL.set(catalogReader);
bindable = EnumerableInterpretable.toBindable(internalParameters,
context.spark(), enumerable, prefer);
} finally {
CatalogReader.THREAD_LOCAL.remove();
}
}
if (timingTracer != null) {
timingTracer.traceTime("end codegen");
}
if (timingTracer != null) {
timingTracer.traceTime("end compilation");
}
return new PreparedResultImpl(
resultType,
parameterRowType,
fieldOrigins,
root.collation.getFieldCollations().isEmpty()
? ImmutableList.<RelCollation>of()
: ImmutableList.of(root.collation),
root.rel,
mapTableModOp(isDml, root.kind),
isDml) {
public String getCode() {
throw new UnsupportedOperationException();
}
public Bindable getBindable(Meta.CursorFactory cursorFactory) {
return bindable;
}
public Type getElementType() {
return ((Typed) bindable).getElementType();
}
};
}
示例7: onMatch
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
public void onMatch(RelOptRuleCall call) {
final Join origJoin = call.rel(0);
final RelNode left = call.rel(1);
final RelNode right = call.rel(2);
// combine the children MultiJoin inputs into an array of inputs
// for the new MultiJoin
final List<ImmutableBitSet> projFieldsList = Lists.newArrayList();
final List<int[]> joinFieldRefCountsList = Lists.newArrayList();
final List<RelNode> newInputs =
combineInputs(
origJoin,
left,
right,
projFieldsList,
joinFieldRefCountsList);
// combine the outer join information from the left and right
// inputs, and include the outer join information from the current
// join, if it's a left/right outer join
final List<Pair<JoinRelType, RexNode>> joinSpecs = Lists.newArrayList();
combineOuterJoins(
origJoin,
newInputs,
left,
right,
joinSpecs);
// pull up the join filters from the children MultiJoinRels and
// combine them with the join filter associated with this LogicalJoin to
// form the join filter for the new MultiJoin
List<RexNode> newJoinFilters = combineJoinFilters(origJoin, left, right);
// add on the join field reference counts for the join condition
// associated with this LogicalJoin
final ImmutableMap<Integer, ImmutableIntList> newJoinFieldRefCountsMap =
addOnJoinFieldRefCounts(newInputs,
origJoin.getRowType().getFieldCount(),
origJoin.getCondition(),
joinFieldRefCountsList);
List<RexNode> newPostJoinFilters =
combinePostJoinFilters(origJoin, left, right);
final RexBuilder rexBuilder = origJoin.getCluster().getRexBuilder();
RelNode multiJoin =
new MultiJoin(
origJoin.getCluster(),
newInputs,
RexUtil.composeConjunction(rexBuilder, newJoinFilters, false),
origJoin.getRowType(),
origJoin.getJoinType() == JoinRelType.FULL,
Pair.right(joinSpecs),
Pair.left(joinSpecs),
projFieldsList,
newJoinFieldRefCountsMap,
RexUtil.composeConjunction(rexBuilder, newPostJoinFilters, true));
call.transformTo(multiJoin);
}
示例8: getFieldNames
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
public List<String> getFieldNames() {
return Pair.left(fieldList);
}
示例9: getFieldNames
import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
public List<String> getFieldNames() {
return Pair.left(fields);
}