本文整理了Java中org.apache.calcite.rel.RelNode.getVariablesSet
方法的一些代码示例,展示了RelNode.getVariablesSet
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RelNode.getVariablesSet
方法的具体详情如下:
包路径:org.apache.calcite.rel.RelNode
类名称:RelNode
方法名:getVariablesSet
[英]Returns the variables that are set in this relational expression but also used and therefore not available to parents of this relational expression.
Note: only org.apache.calcite.rel.core.Correlate should set variables.
[中]返回在此关系表达式中设置但也已使用的变量,因此此关系表达式的父级不可用。
注:仅适用于组织。阿帕奇。方解石雷尔。果心应该设置变量。
代码示例来源:origin: apache/hive
private void parseCorrelTable(RelNode relNode, Result x) {
for (CorrelationId id : relNode.getVariablesSet()) {
correlTableMap.put(id, x.qualifiedContext());
}
}
}
代码示例来源:origin: apache/hive
for (final CorrelationId correlation : rel.getVariablesSet()) {
rel.accept(
new CorrelationReferenceFinder() {
代码示例来源:origin: Qihoo360/Quicksql
private void parseCorrelTable(RelNode relNode, Result x) {
for (CorrelationId id : relNode.getVariablesSet()) {
correlTableMap.put(id, x.qualifiedContext());
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
private void parseCorrelTable(RelNode relNode, Result x) {
for (CorrelationId id : relNode.getVariablesSet()) {
correlTableMap.put(id, x.qualifiedContext());
}
}
代码示例来源:origin: Qihoo360/Quicksql
public void visit(
RelNode p,
int ordinal,
RelNode parent) {
super.visit(p, ordinal, parent);
p.collectVariablesUsed(variables);
// Important! Remove stopped variables AFTER we visit children
// (which what super.visit() does)
variables.removeAll(p.getVariablesSet());
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
public void visit(
RelNode p,
int ordinal,
RelNode parent) {
super.visit(p, ordinal, parent);
p.collectVariablesUsed(variables);
// Important! Remove stopped variables AFTER we visit children
// (which what super.visit() does)
variables.removeAll(p.getVariablesSet());
}
}
代码示例来源:origin: Qihoo360/Quicksql
public Set<CorrelationId> correlationIds() {
final ImmutableSet.Builder<CorrelationId> builder =
ImmutableSet.builder();
for (RelNode r : stack) {
builder.addAll(r.getVariablesSet());
}
return builder.build();
}
代码示例来源:origin: org.apache.calcite/calcite-core
public Set<CorrelationId> correlationIds() {
final ImmutableSet.Builder<CorrelationId> builder =
ImmutableSet.builder();
for (RelNode r : stack) {
builder.addAll(r.getVariablesSet());
}
return builder.build();
}
代码示例来源:origin: Qihoo360/Quicksql
@Override public RelNode visit(RelNode other) {
other.collectVariablesUsed(vuv.variables);
other.accept(vuv);
RelNode result = super.visit(other);
// Important! Remove stopped variables AFTER we visit
// children. (which what super.visit() does)
vuv.variables.removeAll(other.getVariablesSet());
return result;
}
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Override public RelNode visit(RelNode other) {
other.collectVariablesUsed(vuv.variables);
other.accept(vuv);
RelNode result = super.visit(other);
// Important! Remove stopped variables AFTER we visit
// children. (which what super.visit() does)
vuv.variables.removeAll(other.getVariablesSet());
return result;
}
}
代码示例来源:origin: com.alibaba.blink/flink-table
@Override
public RelNode visit(LogicalFilter filter) {
final boolean hasSubQuery = RexUtil.SubQueryFinder.find(filter.getCondition()) != null;
try {
if (!corNodeStack.isEmpty()) {
mapSubQueryNodeToCorSet.put(filter, corNodeStack.peek().getVariablesSet());
}
if (hasSubQuery) {
corNodeStack.push(filter);
}
checkCorCondition(filter);
filter.getCondition().accept(rexVisitor(filter));
for (CorrelationId correlationId : filter.getVariablesSet()) {
mapCorToCorRel.put(correlationId, filter);
}
} finally {
if (hasSubQuery) {
corNodeStack.pop();
}
}
return super.visit(filter);
}
代码示例来源:origin: org.apache.calcite/calcite-core
protected TrimResult result(RelNode r, final Mapping mapping) {
final RexBuilder rexBuilder = relBuilder.getRexBuilder();
for (final CorrelationId correlation : r.getVariablesSet()) {
r = r.accept(
new CorrelationReferenceFinder() {
protected RexNode handle(RexFieldAccess fieldAccess) {
final RexCorrelVariable v =
(RexCorrelVariable) fieldAccess.getReferenceExpr();
if (v.id.equals(correlation)
&& v.getType().getFieldCount() == mapping.getSourceCount()) {
final int old = fieldAccess.getField().getIndex();
final int new_ = mapping.getTarget(old);
final RelDataTypeFactory.Builder typeBuilder =
relBuilder.getTypeFactory().builder();
for (int target : Util.range(mapping.getTargetCount())) {
typeBuilder.add(
v.getType().getFieldList().get(mapping.getSource(target)));
}
final RexNode newV =
rexBuilder.makeCorrel(typeBuilder.build(), v.id);
if (old != new_) {
return rexBuilder.makeFieldAccess(newV, new_);
}
}
return fieldAccess;
}
});
}
return new TrimResult(r, mapping);
}
代码示例来源:origin: com.alibaba.blink/flink-table
@Override
public RelNode visit(LogicalProject project) {
hasOverNode = RexOver.containsOver(project.getProjects(), null);
final boolean hasSubQuery = RexUtil.SubQueryFinder.find(project.getProjects()) != null;
try {
if (!corNodeStack.isEmpty()) {
mapSubQueryNodeToCorSet.put(project, corNodeStack.peek().getVariablesSet());
}
if (hasSubQuery) {
corNodeStack.push(project);
}
checkCorCondition(project);
for (RexNode node : project.getProjects()) {
node.accept(rexVisitor(project));
}
} finally {
if (hasSubQuery) {
corNodeStack.pop();
}
}
return super.visit(project);
}
代码示例来源:origin: Qihoo360/Quicksql
protected TrimResult result(RelNode r, final Mapping mapping) {
final RexBuilder rexBuilder = relBuilder.getRexBuilder();
for (final CorrelationId correlation : r.getVariablesSet()) {
r = r.accept(
new CorrelationReferenceFinder() {
protected RexNode handle(RexFieldAccess fieldAccess) {
final RexCorrelVariable v =
(RexCorrelVariable) fieldAccess.getReferenceExpr();
if (v.id.equals(correlation)
&& v.getType().getFieldCount() == mapping.getSourceCount()) {
final int old = fieldAccess.getField().getIndex();
final int new_ = mapping.getTarget(old);
final RelDataTypeFactory.Builder typeBuilder =
relBuilder.getTypeFactory().builder();
for (int target : Util.range(mapping.getTargetCount())) {
typeBuilder.add(
v.getType().getFieldList().get(mapping.getSource(target)));
}
final RexNode newV =
rexBuilder.makeCorrel(typeBuilder.build(), v.id);
if (old != new_) {
return rexBuilder.makeFieldAccess(newV, new_);
}
}
return fieldAccess;
}
});
}
return new TrimResult(r, mapping);
}
代码示例来源:origin: com.alibaba.blink/flink-table
@Override
public Void visitSubQuery(RexSubQuery subQuery) {
RelNode newRel = subQuery.rel;
if (subQuery.getKind() == SqlKind.IN) {
newRel = addProjectionForIn(subQuery.rel);
}
final Frame frame = decorrelator.getInvoke(newRel);
if (frame != null && frame.c != null) {
Frame target = frame;
if (subQuery.getKind() == SqlKind.EXISTS) {
target = addProjectionForExists(frame);
}
final DecorrelateRexShuttle shuttle = new DecorrelateRexShuttle(
rel.getRowType(),
target.r.getRowType(),
rel.getVariablesSet());
final RexNode newCondition = target.c.accept(shuttle);
Pair<RelNode, RexNode> newNodeAndCondition = new Pair<>(target.r, newCondition);
subQueryMap.put(subQuery, newNodeAndCondition);
}
return null;
}
};
代码示例来源:origin: com.alibaba.blink/flink-table
try {
if (!corNodeStack.isEmpty()) {
mapSubQueryNodeToCorSet.put(join, corNodeStack.peek().getVariablesSet());
代码示例来源:origin: Qihoo360/Quicksql
Util.minus(
RelOptUtil.getVariablesSet(rel),
rel.getVariablesSet()),
RelOptUtil.getVariablesUsed(rel));
this.allSets.add(set);
代码示例来源:origin: org.apache.calcite/calcite-core
Util.minus(
RelOptUtil.getVariablesSet(rel),
rel.getVariablesSet()),
RelOptUtil.getVariablesUsed(rel));
this.allSets.add(set);
代码示例来源:origin: Qihoo360/Quicksql
for (final CorrelationId correlation : rel.getVariablesSet()) {
rel.accept(
new CorrelationReferenceFinder() {
代码示例来源:origin: org.apache.calcite/calcite-core
for (final CorrelationId correlation : rel.getVariablesSet()) {
rel.accept(
new CorrelationReferenceFinder() {
内容来源于网络,如有侵权,请联系作者删除!