本文整理了Java中org.apache.calcite.rel.RelNode.getInputs
方法的一些代码示例,展示了RelNode.getInputs
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RelNode.getInputs
方法的具体详情如下:
包路径:org.apache.calcite.rel.RelNode
类名称:RelNode
方法名:getInputs
[英]Returns an array of this relational expression's inputs. If there are no inputs, returns an empty list, not null.
[中]返回此关系表达式的输入数组。如果没有输入,则返回一个空列表,而不是null。
代码示例来源:origin: apache/hive
private static boolean validFilterParent(RelNode filterNode, RelNode parent) {
boolean validParent = true;
// TODO: Verify GB having is not a separate filter (if so we shouldn't
// introduce derived table)
if (parent instanceof Filter || parent instanceof Join || parent instanceof SetOp ||
(parent instanceof Aggregate && filterNode.getInputs().get(0) instanceof Aggregate)) {
validParent = false;
}
return validParent;
}
代码示例来源:origin: apache/drill
private static boolean validFilterParent(RelNode filterNode, RelNode parent) {
boolean validParent = true;
// TODO: Verify GB having is not a separate filter (if so we shouldn't
// introduce derived table)
if (parent instanceof Filter || parent instanceof Join || parent instanceof SetOp ||
(parent instanceof Aggregate && filterNode.getInputs().get(0) instanceof Aggregate)) {
validParent = false;
}
return validParent;
}
代码示例来源:origin: apache/hive
public Set<String> getPushedPredicates(RelNode operator, int pos) {
if (!this.registryPushedPredicates.containsKey(operator)) {
for (int i = 0; i < operator.getInputs().size(); i++) {
this.registryPushedPredicates.get(operator).add(Sets.<String>newHashSet());
}
}
return this.registryPushedPredicates.get(operator).get(pos);
}
代码示例来源:origin: apache/hive
public RelNode align(RelNode rel, List<RelFieldCollation> collations) {
ImmutableList.Builder<RelNode> newInputs = new ImmutableList.Builder<>();
for (RelNode input : rel.getInputs()) {
newInputs.add(dispatchAlign(input, ImmutableList.<RelFieldCollation>of()));
}
return rel.copy(rel.getTraitSet(), newInputs.build());
}
代码示例来源:origin: apache/kylin
public void fixSharedOlapTableScanAt(RelNode parent, int ordinalInParent) {
OLAPTableScan copy = copyTableScanIfNeeded(parent.getInputs().get(ordinalInParent));
if (copy != null)
parent.replaceInput(ordinalInParent, copy);
}
代码示例来源:origin: apache/hive
protected RelNode visitChildren(RelNode rel) {
for (Ord<RelNode> input : Ord.zip(rel.getInputs())) {
rel = visitChild(rel, input.i, input.e);
}
return rel;
}
代码示例来源:origin: apache/hive
private static RelNode introduceDerivedTable(final RelNode rel, RelNode parent) {
int i = 0;
int pos = -1;
List<RelNode> childList = parent.getInputs();
for (RelNode child : childList) {
if (child == rel) {
pos = i;
break;
}
i++;
}
if (pos == -1) {
throw new RuntimeException("Couldn't find child node in parent's inputs");
}
RelNode select = introduceDerivedTable(rel);
parent.replaceInput(pos, select);
return select;
}
代码示例来源:origin: apache/drill
protected RelNode visitChildren(RelNode rel) {
for (Ord<RelNode> input : Ord.zip(rel.getInputs())) {
rel = visitChild(rel, input.i, input.e);
}
return rel;
}
代码示例来源:origin: apache/drill
public Set<String> getPushedPredicates(RelNode operator, int pos) {
if (!this.registryPushedPredicates.containsKey(operator)) {
for (int i = 0; i < operator.getInputs().size(); i++) {
this.registryPushedPredicates.get(operator).add(Sets.<String>newHashSet());
}
}
return this.registryPushedPredicates.get(operator).get(pos);
}
代码示例来源:origin: apache/drill
private static RelNode introduceDerivedTable(final RelNode rel, RelNode parent) {
int i = 0;
int pos = -1;
List<RelNode> childList = parent.getInputs();
for (RelNode child : childList) {
if (child == rel) {
pos = i;
break;
}
i++;
}
if (pos == -1) {
throw new RuntimeException("Couldn't find child node in parent's inputs");
}
RelNode select = introduceDerivedTable(rel);
parent.replaceInput(pos, select);
return select;
}
代码示例来源:origin: apache/hive
private boolean isAggZeroOnEmpty(RexSubQuery e) {
//as this is corr scalar subquery with agg we expect one aggregate
assert(e.getKind() == SqlKind.SCALAR_QUERY);
assert(e.rel.getInputs().size() == 1);
Aggregate relAgg = (Aggregate)e.rel.getInput(0);
assert(relAgg.getAggCallList().size() == 1); //should only have one aggregate
if(relAgg.getAggCallList().get(0).getAggregation().getKind() == SqlKind.COUNT) {
return true;
}
return false;
}
代码示例来源:origin: apache/hive
private SqlTypeName getAggTypeForScalarSub(RexSubQuery e) {
assert(e.getKind() == SqlKind.SCALAR_QUERY);
assert(e.rel.getInputs().size() == 1);
Aggregate relAgg = (Aggregate)e.rel.getInput(0);
assert(relAgg.getAggCallList().size() == 1); //should only have one aggregate
return relAgg.getAggCallList().get(0).getType().getSqlTypeName();
}
代码示例来源:origin: apache/drill
private boolean isAggZeroOnEmpty(RexSubQuery e) {
//as this is corr scalar subquery with agg we expect one aggregate
assert(e.getKind() == SqlKind.SCALAR_QUERY);
assert(e.rel.getInputs().size() == 1);
Aggregate relAgg = (Aggregate)e.rel.getInput(0);
assert( relAgg.getAggCallList().size() == 1); //should only have one aggregate
if( relAgg.getAggCallList().get(0).getAggregation().getKind() == SqlKind.COUNT ) {
return true;
}
return false;
}
private SqlTypeName getAggTypeForScalarSub(RexSubQuery e) {
代码示例来源:origin: apache/drill
private SqlTypeName getAggTypeForScalarSub(RexSubQuery e) {
assert(e.getKind() == SqlKind.SCALAR_QUERY);
assert(e.rel.getInputs().size() == 1);
Aggregate relAgg = (Aggregate)e.rel.getInput(0);
assert( relAgg.getAggCallList().size() == 1); //should only have one aggregate
return relAgg.getAggCallList().get(0).getType().getSqlTypeName();
}
代码示例来源:origin: apache/hive
public Integer splitCount(RelNode rel, RelMetadataQuery mq) {
Boolean newPhase = mq.isPhaseTransition(rel);
if (newPhase == null) {
return null;
}
if (newPhase) {
// We repartition: new number of splits
return splitCountRepartition(rel, mq);
}
// We do not repartition: take number of splits from children
Integer splitCount = 0;
for (RelNode input : rel.getInputs()) {
splitCount += mq.splitCount(input);
}
return splitCount;
}
代码示例来源:origin: apache/hive
/**
* Visits a particular child of a parent.
*/
protected RelNode visitChild(RelNode parent, int i, RelNode child) {
Stacks.push(stack, parent);
try {
RelNode child2 = child.accept(this);
if (child2 != child) {
final List<RelNode> newInputs =
new ArrayList<RelNode>(parent.getInputs());
newInputs.set(i, child2);
return parent.copy(parent.getTraitSet(), newInputs);
}
return parent;
} finally {
Stacks.pop(stack, parent);
}
}
代码示例来源:origin: apache/drill
public Integer splitCount(RelNode rel, RelMetadataQuery mq) {
Boolean newPhase = mq.isPhaseTransition(rel);
if (newPhase == null) {
return null;
}
if (newPhase) {
// We repartition: new number of splits
return splitCountRepartition(rel, mq);
}
// We do not repartition: take number of splits from children
Integer splitCount = 0;
for (RelNode input : rel.getInputs()) {
splitCount += mq.splitCount(input);
}
return splitCount;
}
代码示例来源:origin: apache/drill
/**
* Visits a particular child of a parent.
*/
protected RelNode visitChild(RelNode parent, int i, RelNode child) {
Stacks.push(stack, parent);
try {
RelNode child2 = child.accept(this);
if (child2 != child) {
final List<RelNode> newInputs =
new ArrayList<RelNode>(parent.getInputs());
newInputs.set(i, child2);
return parent.copy(parent.getTraitSet(), newInputs);
}
return parent;
} finally {
Stacks.pop(stack, parent);
}
}
代码示例来源:origin: apache/drill
public RelNode align(RelNode rel, List<RelFieldCollation> collations) {
ImmutableList.Builder<RelNode> newInputs = new ImmutableList.Builder<>();
for (RelNode input : rel.getInputs()) {
newInputs.add(dispatchAlign(input, ImmutableList.<RelFieldCollation>of()));
}
return rel.copy(rel.getTraitSet(), newInputs.build());
}
代码示例来源:origin: apache/hive
private static String getTblAlias(RelNode rel) {
if (null == rel) {
return null;
}
if (rel instanceof HiveTableScan) {
return ((HiveTableScan)rel).getTableAlias();
}
if (rel instanceof DruidQuery) {
DruidQuery dq = (DruidQuery) rel;
return ((HiveTableScan) dq.getTableScan()).getTableAlias();
}
if (rel instanceof HiveJdbcConverter) {
HiveJdbcConverter conv = (HiveJdbcConverter) rel;
return conv.getTableScan().getHiveTableScan().getTableAlias();
}
if (rel instanceof Project) {
return null;
}
if (rel.getInputs().size() == 1) {
return getTblAlias(rel.getInput(0));
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!