本文整理汇总了Java中org.apache.calcite.rex.RexShuttle.apply方法的典型用法代码示例。如果您正苦于以下问题:Java RexShuttle.apply方法的具体用法?Java RexShuttle.apply怎么用?Java RexShuttle.apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.rex.RexShuttle
的用法示例。
在下文中一共展示了RexShuttle.apply方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shuttleReferences
import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
/**
* Replaces all the input references by the position in the
* input column set. If a reference index cannot be found in
* the input set, then we return null.
*/
private static RexNode shuttleReferences(final RexBuilder rexBuilder,
final RexNode node, final Mapping mapping) {
try {
RexShuttle visitor =
new RexShuttle() {
@Override public RexNode visitInputRef(RexInputRef inputRef) {
int pos = mapping.getTargetOpt(inputRef.getIndex());
if (pos != -1) {
// Found it
return rexBuilder.makeInputRef(inputRef.getType(), pos);
}
throw Util.FoundOne.NULL;
}
};
return visitor.apply(node);
} catch (Util.FoundOne ex) {
Util.swallow(ex, null);
return null;
}
}
示例2: accept
import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public RelNode accept(RexShuttle shuttle) {
RexNode joinFilter = shuttle.apply(this.joinFilter);
List<RexNode> outerJoinConditions = shuttle.apply(this.outerJoinConditions);
RexNode postJoinFilter = shuttle.apply(this.postJoinFilter);
if (joinFilter == this.joinFilter
&& outerJoinConditions == this.outerJoinConditions
&& postJoinFilter == this.postJoinFilter) {
return this;
}
return new MultiJoin(
getCluster(),
inputs,
joinFilter,
rowType,
isFullOuterJoin,
outerJoinConditions,
joinTypes,
projFields,
joinFieldRefCountsMap,
postJoinFilter);
}
示例3: transformRex
import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
private static List<RexNode> transformRex(
List<RexNode> nodes,
final List<RelDataTypeField> oldFields,
final List<RelDataTypeField> newFields) {
RexShuttle shuttle = new RexShuttle() {
@Override public RexNode visitInputRef(RexInputRef ref) {
RelDataTypeField f = oldFields.get(ref.getIndex());
for (int index = 0; index < newFields.size(); index++) {
RelDataTypeField newf = newFields.get(index);
if (f.getKey().equals(newf.getKey())
&& f.getValue() == newf.getValue()) {
return new RexInputRef(index, f.getValue());
}
}
throw MatchFailed.INSTANCE;
}
};
return shuttle.apply(nodes);
}
示例4: apply
import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public UnifyResult apply(UnifyRuleCall call) {
final MutableProject target = (MutableProject) call.target;
final MutableScan query = (MutableScan) call.query;
// We do not need to check query's parent type to avoid duplication
// of ProjectToProjectUnifyRule or FilterToProjectUnifyRule, since
// SubstitutionVisitor performs a top-down match.
if (!query.equals(target.getInput())) {
return null;
}
final RexShuttle shuttle = getRexShuttle(target);
final RexBuilder rexBuilder = target.cluster.getRexBuilder();
final List<RexNode> newProjects;
try {
newProjects = (List<RexNode>)
shuttle.apply(rexBuilder.identityProjects(query.rowType));
} catch (MatchFailed e) {
return null;
}
final MutableProject newProject =
MutableProject.of(query.rowType, target, newProjects);
final MutableRel newProject2 = MutableRels.strip(newProject);
return call.result(newProject2);
}
示例5: accept
import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
@Override public RelNode accept(RexShuttle shuttle) {
RexNode condition = shuttle.apply(this.condition);
if (this.condition == condition) {
return this;
}
return copy(traitSet, condition, left, right, joinType, isSemiJoinDone());
}
示例6: accept
import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public RelNode accept(RexShuttle shuttle) {
RexNode condition = shuttle.apply(this.condition);
if (this.condition == condition) {
return this;
}
return copy(traitSet, getInput(), condition);
}
示例7: accept
import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public RelNode accept(RexShuttle shuttle) {
List<RexNode> exps = shuttle.apply(this.exps);
if (this.exps == exps) {
return this;
}
return copy(traitSet, getInput(), exps, rowType);
}
示例8: accept
import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public RelNode accept(RexShuttle shuttle) {
RexNode rexCall = shuttle.apply(this.rexCall);
if (rexCall == this.rexCall) {
return this;
}
return copy(traitSet, inputs, rexCall, elementType, rowType,
columnMappings);
}