本文整理汇总了Java中org.apache.calcite.rel.RelNode.replaceInput方法的典型用法代码示例。如果您正苦于以下问题:Java RelNode.replaceInput方法的具体用法?Java RelNode.replaceInput怎么用?Java RelNode.replaceInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.rel.RelNode
的用法示例。
在下文中一共展示了RelNode.replaceInput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replace
import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
private RelNode replace(RelNode original, ForcedRule[] rules, JdbcRelBuilderFactory relBuilderFactory) {
RelNode p = original;
for (ForcedRule rule : rules) {
RelNode updated = rule.apply(p, relBuilderFactory);
if (updated != null) {
logger.trace("Rule: " + rule.toString() +
"\nReplacing:\n" + RelOptUtil.toString(p) +
"\nWith:\n" + RelOptUtil.toString(updated)
);
// Must maintain row types so that nothing explodes
RelOptUtil.equal(
"RowType of original", p.getRowType(),
"RowType of replaced", updated.getRowType(),
Litmus.THROW
);
p = updated;
break;
}
}
List<RelNode> oldInputs = p.getInputs();
for (int i = 0; i < oldInputs.size(); i++) {
RelNode originalInput = oldInputs.get(i);
RelNode replacedInput = replace(originalInput, rules, relBuilderFactory);
if (replacedInput != originalInput) {
p.replaceInput(i, replacedInput);
}
}
return p;
}
示例2: visitChild
import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
protected RelNode visitChild(RelNode parent, int i, RelNode child) {
// Ignore the root node.
if (null == parent) {
return super.visitChild(parent, i, child);
}
// Ignore non-sort child nodes.
if (!(child instanceof Sort)) {
return super.visitChild(parent, i, child);
}
// Ignore the sort for the top level SELECT. It's valid to use ORDER BY
// without FETCH / OFFSET here.
if (child == topLevelSort) {
return super.visitChild(parent, i, child);
}
// If the child Sort has FETCH and LIMIT clauses, do not touch them.
Sort childAsSort = (Sort) child;
if (childAsSort.offset == null &&
childAsSort.fetch == null) {
parent.replaceInput(i, childAsSort.getInput());
return super.visitChild(parent, i, childAsSort.getInput());
}
return super.visitChild(parent, i, child);
}