本文整理汇总了Java中org.apache.calcite.rel.logical.LogicalUnion类的典型用法代码示例。如果您正苦于以下问题:Java LogicalUnion类的具体用法?Java LogicalUnion怎么用?Java LogicalUnion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogicalUnion类属于org.apache.calcite.rel.logical包,在下文中一共展示了LogicalUnion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onMatch
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalUnion union = (LogicalUnion) call.rel(0);
// This rule applies to Union-All only
if(!union.all) {
return;
}
final RelTraitSet traits = union.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
final List<RelNode> convertedInputs = new ArrayList<>();
for (RelNode input : union.getInputs()) {
final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
convertedInputs.add(convertedInput);
}
try {
call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all,
true /* check compatibility */));
} catch (InvalidRelException e) {
tracer.warning(e.toString()) ;
}
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:DrillUnionAllRule.java
示例2: onMatch
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalUnion union = (LogicalUnion) call.rel(0);
// This rule applies to Union-All only
if(!union.all) {
return;
}
final RelTraitSet traits = union.getTraitSet().plus(Rel.LOGICAL);
final List<RelNode> convertedInputs = new ArrayList<>();
for (RelNode input : union.getInputs()) {
final RelNode convertedInput = convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify());
convertedInputs.add(convertedInput);
}
try {
call.transformTo(new UnionRel(union.getCluster(), traits, convertedInputs, union.all,
true /* check compatibility */));
} catch (InvalidRelException e) {
tracer.warn(e.toString()) ;
}
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:UnionAllRule.java
示例3: convertSetOp
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
/**
* Converts a set operation (UNION, INTERSECT, MINUS) into relational
* expressions.
*
* @param call Call to set operator
* @return Relational expression
*/
protected RelNode convertSetOp(SqlCall call) {
final RelNode left =
convertQueryRecursive(call.operand(0), false, null).project();
final RelNode right =
convertQueryRecursive(call.operand(1), false, null).project();
switch (call.getKind()) {
case UNION:
return LogicalUnion.create(ImmutableList.of(left, right), all(call));
case INTERSECT:
return LogicalIntersect.create(ImmutableList.of(left, right), all(call));
case EXCEPT:
return LogicalMinus.create(ImmutableList.of(left, right), all(call));
default:
throw Util.unexpected(call.getKind());
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:SqlToRelConverter.java
示例4: convertSetOp
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
/**
* Converts a set operation (UNION, INTERSECT, MINUS) into relational
* expressions.
*
* @param call Call to set operator
* @return Relational expression
*/
protected RelNode convertSetOp(SqlCall call) {
final RelNode left =
convertQueryRecursive(call.operand(0), false, null).project();
final RelNode right =
convertQueryRecursive(call.operand(1), false, null).project();
switch (call.getKind()) {
case UNION:
return LogicalUnion.create(ImmutableList.of(left, right), all(call));
case INTERSECT:
return LogicalIntersect.create(ImmutableList.of(left, right), all(call));
case EXCEPT:
return LogicalMinus.create(ImmutableList.of(left, right), all(call));
default:
throw Util.unexpected(call.getKind());
}
}
开发者ID:apache,项目名称:kylin,代码行数:27,代码来源:SqlToRelConverter.java
示例5: onMatch
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
final Delta delta = call.rel(0);
Util.discard(delta);
final Join join = call.rel(1);
final RelNode left = join.getLeft();
final RelNode right = join.getRight();
final LogicalDelta rightWithDelta = LogicalDelta.create(right);
final LogicalJoin joinL = LogicalJoin.create(left, rightWithDelta,
join.getCondition(), join.getVariablesSet(), join.getJoinType(),
join.isSemiJoinDone(),
ImmutableList.copyOf(join.getSystemFieldList()));
final LogicalDelta leftWithDelta = LogicalDelta.create(left);
final LogicalJoin joinR = LogicalJoin.create(leftWithDelta, right,
join.getCondition(), join.getVariablesSet(), join.getJoinType(),
join.isSemiJoinDone(),
ImmutableList.copyOf(join.getSystemFieldList()));
List<RelNode> inputsToUnion = Lists.newArrayList();
inputsToUnion.add(joinL);
inputsToUnion.add(joinR);
final LogicalUnion newNode = LogicalUnion.create(inputsToUnion, true);
call.transformTo(newNode);
}
开发者ID:apache,项目名称:calcite,代码行数:27,代码来源:StreamRules.java
示例6: testRuleClass
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
@Test public void testRuleClass() throws Exception {
// Verify that an entire class of rules can be applied.
HepProgramBuilder programBuilder = HepProgram.builder();
programBuilder.addRuleClass(CoerceInputsRule.class);
HepPlanner planner =
new HepPlanner(
programBuilder.build());
planner.addRule(
new CoerceInputsRule(LogicalUnion.class, false,
RelFactories.LOGICAL_BUILDER));
planner.addRule(
new CoerceInputsRule(LogicalIntersect.class, false,
RelFactories.LOGICAL_BUILDER));
checkPlanning(planner,
"(select name from dept union select ename from emp)"
+ " intersect (select fname from customer.contact)");
}
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:HepPlannerTest.java
示例7: visit
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
@Override
public RelNode visit(LogicalUnion union) {
for(RelNode child : union.getInputs()) {
for(RelDataTypeField dataField : child.getRowType().getFieldList()) {
if(dataField.getName().contains(StarColumnHelper.STAR_COLUMN)) {
unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.RELATIONAL,
"Union-All over schema-less tables must specify the columns explicitly\n" +
"See Apache Drill JIRA: DRILL-2414");
throw new UnsupportedOperationException();
}
}
}
return visitChildren(union);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:PreProcessLogicalRel.java
示例8: visit
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
@Override
public RelNode visit(LogicalUnion union) {
return new LogicalUnion(
cluster,
copyOf(union.getTraitSet()),
visitAll(union.getInputs()),
union.all
);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:CopyWithCluster.java
示例9: visit
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
@Override
public RelNode visit(LogicalUnion union) {
for(RelNode child : union.getInputs()) {
for(RelDataTypeField dataField : child.getRowType().getFieldList()) {
if(dataField.getName().contains(StarColumnHelper.STAR_COLUMN)) {
// see DRILL-2414
unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.RELATIONAL,
"Union-All over schema-less tables must specify the columns explicitly");
throw new UnsupportedOperationException();
}
}
}
return visitChildren(union);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:PreProcessRel.java
示例10: convert
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
public RelNode convert(RelNode rel) {
final LogicalUnion union = (LogicalUnion) rel;
final RelTraitSet traitSet =
union.getTraitSet().replace(getOut());
return new JdbcUnion(rel.getCluster(), traitSet,
convertList(union.getInputs(), getOut()), union.all);
}
开发者ID:bitnine-oss,项目名称:octopus,代码行数:8,代码来源:JdbcRules.java
示例11: createSetOp
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
public RelNode createSetOp(SqlKind kind, List<RelNode> inputs,
boolean all) {
switch (kind) {
case UNION:
return LogicalUnion.create(inputs, all);
case EXCEPT:
return LogicalMinus.create(inputs, all);
case INTERSECT:
return LogicalIntersect.create(inputs, all);
default:
throw new AssertionError("not a set op: " + kind);
}
}
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:RelFactories.java
示例12: convert
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
public RelNode convert(RelNode rel) {
final LogicalUnion union = (LogicalUnion) rel;
final RelTraitSet traitSet =
union.getTraitSet().replace(out);
return new JdbcUnion(rel.getCluster(), traitSet,
convertList(union.getInputs(), out), union.all);
}
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:JdbcRules.java
示例13: convert
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
public RelNode convert(RelNode rel) {
final LogicalUnion union = (LogicalUnion) rel;
final EnumerableConvention out = EnumerableConvention.INSTANCE;
final RelTraitSet traitSet = union.getTraitSet().replace(out);
return new EnumerableUnion(rel.getCluster(), traitSet,
convertList(union.getInputs(), out), union.all);
}
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:EnumerableUnionRule.java
示例14: convert
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
public RelNode convert(RelNode rel) {
final LogicalUnion union = (LogicalUnion) rel;
final BindableConvention out = BindableConvention.INSTANCE;
final RelTraitSet traitSet = union.getTraitSet().replace(out);
return new BindableUnion(rel.getCluster(), traitSet,
convertList(union.getInputs(), out), union.all);
}
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:Bindables.java
示例15: DrillUnionAllRule
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
private DrillUnionAllRule() {
super(RelOptHelper.any(LogicalUnion.class, Convention.NONE), "DrillUnionRule");
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:DrillUnionAllRule.java
示例16: visit
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
@Override
public RelNode visit(LogicalUnion union) {
return union;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:FindLimit0Visitor.java
示例17: visit
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
@Override
public RelNode visit(LogicalUnion union) {
return visit((RelNode) union);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:RoutingShuttle.java
示例18: UnionAllRule
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
private UnionAllRule() {
super(RelOptHelper.any(LogicalUnion.class, Convention.NONE), "UnionAllRule");
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:4,代码来源:UnionAllRule.java
示例19: BeamUnionRule
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
private BeamUnionRule() {
super(LogicalUnion.class, Convention.NONE, BeamLogicalConvention.INSTANCE,
"BeamUnionRule");
}
开发者ID:apache,项目名称:beam,代码行数:5,代码来源:BeamUnionRule.java
示例20: convertValuesImpl
import org.apache.calcite.rel.logical.LogicalUnion; //导入依赖的package包/类
/**
* Converts a values clause (as in "INSERT INTO T(x,y) VALUES (1,2)") into a
* relational expression.
*
* @param bb Blackboard
* @param values Call to SQL VALUES operator
* @param targetRowType Target row type
*/
private void convertValuesImpl(
Blackboard bb,
SqlCall values,
RelDataType targetRowType) {
// Attempt direct conversion to LogicalValues; if that fails, deal with
// fancy stuff like sub-queries below.
RelNode valuesRel =
convertRowValues(
bb,
values,
values.getOperandList(),
true,
targetRowType);
if (valuesRel != null) {
bb.setRoot(valuesRel, true);
return;
}
final List<RelNode> unionRels = new ArrayList<>();
for (SqlNode rowConstructor1 : values.getOperandList()) {
SqlCall rowConstructor = (SqlCall) rowConstructor1;
Blackboard tmpBb = createBlackboard(bb.scope, null, false);
replaceSubQueries(tmpBb, rowConstructor,
RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
final List<Pair<RexNode, String>> exps = new ArrayList<>();
for (Ord<SqlNode> operand : Ord.zip(rowConstructor.getOperandList())) {
exps.add(
Pair.of(
tmpBb.convertExpression(operand.e),
validator.deriveAlias(operand.e, operand.i)));
}
RelNode in =
(null == tmpBb.root)
? LogicalValues.createOneRow(cluster)
: tmpBb.root;
unionRels.add(
RelOptUtil.createProject(
in,
Pair.left(exps),
Pair.right(exps),
true));
}
if (unionRels.size() == 0) {
throw new AssertionError("empty values clause");
} else if (unionRels.size() == 1) {
bb.setRoot(
unionRels.get(0),
true);
} else {
bb.setRoot(
LogicalUnion.create(unionRels, true),
true);
}
// REVIEW jvs 22-Jan-2004: should I add
// mapScopeToLux.put(validator.getScope(values),bb.root);
// ?
}
开发者ID:axbaretto,项目名称:flink,代码行数:68,代码来源:SqlToRelConverter.java
注:本文中的org.apache.calcite.rel.logical.LogicalUnion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论