本文整理了Java中org.apache.calcite.rel.core.Filter.getInput()
方法的一些代码示例,展示了Filter.getInput()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Filter.getInput()
方法的具体详情如下:
包路径:org.apache.calcite.rel.core.Filter
类名称:Filter
方法名:getInput
暂无
代码示例来源:origin: apache/hive
public void handle(Filter filter) {
RelNode child = filter.getInput();
if (child instanceof Aggregate && !((Aggregate) child).getGroupSet().isEmpty()) {
ASTConverter.this.having = filter;
} else {
ASTConverter.this.where = filter;
}
}
代码示例来源:origin: apache/hive
static HiveTableScan getTableScan(RelNode r, boolean traverseProject) {
while (r != null && !(r instanceof HiveTableScan)) {
if (r instanceof HepRelVertex) {
r = ((HepRelVertex) r).getCurrentRel();
} else if (r instanceof Filter) {
r = ((Filter) r).getInput();
} else if (traverseProject && r instanceof Project) {
r = ((Project) r).getInput();
} else {
r = null;
}
}
return r == null ? null : (HiveTableScan) r;
}
}
代码示例来源:origin: apache/drill
public void handle(Filter filter) {
RelNode child = filter.getInput();
if (child instanceof Aggregate && !((Aggregate) child).getGroupSet().isEmpty()) {
ASTConverter.this.having = filter;
} else {
ASTConverter.this.where = filter;
}
}
代码示例来源:origin: apache/hive
public RelNode align(Filter rel, List<RelFieldCollation> collations) {
final RelNode child = dispatchAlign(rel.getInput(), collations);
return rel.copy(rel.getTraitSet(), ImmutableList.of(child));
}
代码示例来源:origin: apache/drill
static HiveTableScan getTableScan(RelNode r, boolean traverseProject) {
while (r != null && !(r instanceof HiveTableScan)) {
if (r instanceof HepRelVertex) {
r = ((HepRelVertex) r).getCurrentRel();
} else if (r instanceof Filter) {
r = ((Filter) r).getInput();
} else if (traverseProject && r instanceof Project) {
r = ((Project) r).getInput();
} else {
r = null;
}
}
return r == null ? null : (HiveTableScan) r;
}
代码示例来源:origin: apache/drill
public RelNode align(Filter rel, List<RelFieldCollation> collations) {
final RelNode child = dispatchAlign(rel.getInput(), collations);
return rel.copy(rel.getTraitSet(), ImmutableList.of(child));
}
代码示例来源:origin: apache/storm
@Override
public RelNode convert(RelNode rel) {
final Filter filter = (Filter) rel;
final RelNode input = filter.getInput();
return new StreamsFilterRel(filter.getCluster(),
filter.getTraitSet().replace(StreamsLogicalConvention.INSTANCE),
convert(input, input.getTraitSet().replace(StreamsLogicalConvention.INSTANCE)),
filter.getCondition());
}
}
代码示例来源:origin: apache/hive
private boolean isPartitionPredicate(RexNode expr, RelNode r) {
if (r instanceof Project) {
expr = RelOptUtil.pushFilterPastProject(expr, (Project) r);
return isPartitionPredicate(expr, ((Project) r).getInput());
} else if (r instanceof Filter) {
return isPartitionPredicate(expr, ((Filter) r).getInput());
} else if (r instanceof HiveTableScan) {
RelOptHiveTable table = (RelOptHiveTable) ((HiveTableScan) r).getTable();
ImmutableBitSet cols = RelOptUtil.InputFinder.bits(expr);
return table.containsPartitionColumnsOnly(cols);
}
return false;
}
代码示例来源:origin: apache/drill
private boolean isPartitionPredicate(RexNode expr, RelNode r) {
if (r instanceof Project) {
expr = RelOptUtil.pushFilterPastProject(expr, (Project) r);
return isPartitionPredicate(expr, ((Project) r).getInput());
} else if (r instanceof Filter) {
return isPartitionPredicate(expr, ((Filter) r).getInput());
} else if (r instanceof HiveTableScan) {
RelOptHiveTable table = (RelOptHiveTable) ((HiveTableScan) r).getTable();
ImmutableBitSet cols = RelOptUtil.InputFinder.bits(expr);
return table.containsPartitionColumnsOnly(cols);
}
return false;
}
代码示例来源:origin: apache/hive
if (!inputRef.getType().isNullable()) {
if (alwaysTrue) {
call.transformTo(filter.getInput());
} else {
call.transformTo(createEmptyRelOrEquivalent(call, filter));
代码示例来源:origin: apache/hive
@Override
public void onMatch(RelOptRuleCall call) {
final Filter filter = call.rel(0);
final RexBuilder rexBuilder = filter.getCluster().getRexBuilder();
final RexNode condition = RexUtil.pullFactors(rexBuilder, filter.getCondition());
RexNode newCondition = analyzeRexNode(rexBuilder, condition);
// If we could not transform anything, we bail out
if (newCondition.toString().equals(condition.toString())) {
return;
}
RelNode newNode = filter.copy(filter.getTraitSet(), filter.getInput(), newCondition);
call.transformTo(newNode);
}
}
代码示例来源:origin: apache/drill
if (!inputRef.getType().isNullable()) {
if (alwaysTrue) {
call.transformTo(filter.getInput());
} else {
call.transformTo(createEmptyRelOrEquivalent(call, filter));
代码示例来源:origin: apache/hive
final RelMetadataQuery mq = call.getMetadataQuery();
final RelOptPredicateList predicates =
mq.getPulledUpPredicates(filter.getInput());
if (reduceExpressions(filter, expList, predicates, true, false)) {
assert expList.size() == 1;
filter.getInput());
} else if (reduced) {
if (RexUtil.isNullabilityCast(filter.getCluster().getTypeFactory(),
push(filter.getInput()).filter(newConditionExp).build());
} else {
if (newConditionExp instanceof RexCall) {
代码示例来源:origin: apache/hive
@Override
public void onMatch(RelOptRuleCall call) {
final Filter filter = call.rel(0);
final RexBuilder rexBuilder = filter.getCluster().getRexBuilder();
final RelMetadataQuery metadataProvider = call.getMetadataQuery();
// 1. Recompose filter possibly by pulling out common elements from DNF
// expressions
RexNode newFilterCondition = RexUtil.pullFactors(rexBuilder, filter.getCondition());
// 2. Reduce filter with stats information
RexReplacer replacer = new RexReplacer(filter, rexBuilder, metadataProvider);
newFilterCondition = replacer.apply(newFilterCondition);
// 3. Transform if we have created a new filter operator
if (!filter.getCondition().toString().equals(newFilterCondition.toString())) {
Filter newFilter = filter.copy(filter.getTraitSet(), filter.getInput(), newFilterCondition);
call.transformTo(newFilter);
}
}
代码示例来源:origin: apache/drill
@Override
public void onMatch(RelOptRuleCall call) {
final Filter filter = call.rel(0);
final RexBuilder rexBuilder = filter.getCluster().getRexBuilder();
final RelMetadataQuery metadataProvider = RelMetadataQuery.instance();
// 1. Recompose filter possibly by pulling out common elements from DNF
// expressions
RexNode newFilterCondition = RexUtil.pullFactors(rexBuilder, filter.getCondition());
// 2. Reduce filter with stats information
RexReplacer replacer = new RexReplacer(filter, rexBuilder, metadataProvider);
newFilterCondition = replacer.apply(newFilterCondition);
// 3. Transform if we have created a new filter operator
if (!filter.getCondition().toString().equals(newFilterCondition.toString())) {
Filter newFilter = filter.copy(filter.getTraitSet(), filter.getInput(), newFilterCondition);
call.transformTo(newFilter);
}
}
代码示例来源:origin: apache/drill
public void onMatch(RelOptRuleCall call) {
final Filter filter = call.rel(0);
final RexBuilder rexBuilder = filter.getCluster().getRexBuilder();
final RexNode condition = RexUtil.pullFactors(rexBuilder, filter.getCondition());
// 1. We try to transform possible candidates
RexTransformIntoInClause transformIntoInClause = new RexTransformIntoInClause(rexBuilder, filter,
minNumORClauses);
RexNode newCondition = transformIntoInClause.apply(condition);
// 2. We merge IN expressions
RexMergeInClause mergeInClause = new RexMergeInClause(rexBuilder);
newCondition = mergeInClause.apply(newCondition);
// 3. If we could not transform anything, we bail out
if (newCondition.toString().equals(condition.toString())) {
return;
}
// 4. We create the filter with the new condition
RelNode newFilter = filter.copy(filter.getTraitSet(), filter.getInput(), newCondition);
call.transformTo(newFilter);
}
代码示例来源:origin: apache/incubator-druid
newWhereFilter = whereFilter.copy(
whereFilter.getTraitSet(),
whereFilter.getInput(),
RexUtil.flatten(
getCluster().getRexBuilder(),
代码示例来源:origin: apache/drill
public void onMatch(RelOptRuleCall call) {
final Filter filter = call.rel(0);
//final RelBuilder builder = call.builder();
//TODO: replace HiveSubQRemoveRelBuilder with calcite's once calcite 1.11.0 is released
final HiveSubQRemoveRelBuilder builder = new HiveSubQRemoveRelBuilder(null, call.rel(0).getCluster(), null);
final RexSubQuery e =
RexUtil.SubQueryFinder.find(filter.getCondition());
assert e != null;
final RelOptUtil.Logic logic =
LogicVisitor.find(RelOptUtil.Logic.TRUE,
ImmutableList.of(filter.getCondition()), e);
builder.push(filter.getInput());
final int fieldCount = builder.peek().getRowType().getFieldCount();
assert(filter instanceof HiveFilter);
Set<RelNode> corrScalarQueries = filter.getCluster().getPlanner().getContext().unwrap(Set.class);
boolean isCorrScalarQuery = corrScalarQueries.contains(e.rel);
final RexNode target = apply(e, HiveFilter.getVariablesSet(e), logic,
builder, 1, fieldCount, isCorrScalarQuery);
final RexShuttle shuttle = new ReplaceSubQueryShuttle(e, target);
builder.filter(shuttle.apply(filter.getCondition()));
builder.project(fields(builder, filter.getRowType().getFieldCount()));
call.transformTo(builder.build());
}
};
代码示例来源:origin: apache/hive
LogicVisitor.find(RelOptUtil.Logic.TRUE,
ImmutableList.of(filter.getCondition()), e);
builder.push(filter.getInput());
final int fieldCount = builder.peek().getRowType().getFieldCount();
代码示例来源:origin: apache/drill
final MutableRel input = toMutable(filter.getInput());
return MutableFilter.of(input, filter.getCondition());
内容来源于网络,如有侵权,请联系作者删除!