org.apache.calcite.rel.logical.LogicalIntersect Java Examples

The following examples show how to use org.apache.calcite.rel.logical.LogicalIntersect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HepPlannerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test 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));

  final String sql = "(select name from dept union select ename from emp)\n"
      + "intersect (select fname from customer.contact)";
  sql(sql).with(planner).check();
}
 
Example #2
Source File: Bindables.java    From calcite with Apache License 2.0 5 votes vote down vote up
public RelNode convert(RelNode rel) {
  final SetOp setOp = (SetOp) rel;
  final BindableConvention out = BindableConvention.INSTANCE;
  final RelTraitSet traitSet = setOp.getTraitSet().replace(out);
  if (setOp instanceof LogicalUnion) {
    return new BindableUnion(rel.getCluster(), traitSet,
        convertList(setOp.getInputs(), out), setOp.all);
  } else if (setOp instanceof LogicalIntersect) {
    return new BindableIntersect(rel.getCluster(), traitSet,
        convertList(setOp.getInputs(), out), setOp.all);
  } else {
    return new BindableMinus(rel.getCluster(), traitSet,
        convertList(setOp.getInputs(), out), setOp.all);
  }
}
 
Example #3
Source File: RelFactories.java    From Bats with Apache License 2.0 5 votes vote down vote up
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);
  }
}
 
Example #4
Source File: EnumerableIntersectRule.java    From calcite with Apache License 2.0 5 votes vote down vote up
public RelNode convert(RelNode rel) {
  final LogicalIntersect intersect = (LogicalIntersect) rel;
  final EnumerableConvention out = EnumerableConvention.INSTANCE;
  final RelTraitSet traitSet = intersect.getTraitSet().replace(out);
  return new EnumerableIntersect(rel.getCluster(), traitSet,
      convertList(intersect.getInputs(), out), intersect.all);
}
 
Example #5
Source File: RelFactories.java    From calcite with Apache License 2.0 5 votes vote down vote up
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);
  }
}
 
Example #6
Source File: CopyWithCluster.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public RelNode visit(LogicalIntersect intersect) {
  return new LogicalIntersect(
    cluster,
    copyOf(intersect.getTraitSet()),
    visitAll(intersect.getInputs()),
    intersect.all
  );
}
 
Example #7
Source File: SubQueryDecorrelator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public RelNode visit(LogicalIntersect intersect) {
	checkCorConditionOfSetOpInputs(intersect);
	return super.visit(intersect);
}
 
Example #8
Source File: RelStructuredTypeFlattener.java    From calcite with Apache License 2.0 4 votes vote down vote up
public void rewriteRel(LogicalIntersect rel) {
  rewriteGeneric(rel);
}
 
Example #9
Source File: EnumerableIntersectRule.java    From calcite with Apache License 2.0 4 votes vote down vote up
EnumerableIntersectRule() {
  super(LogicalIntersect.class, Convention.NONE,
      EnumerableConvention.INSTANCE, "EnumerableIntersectRule");
}
 
Example #10
Source File: CalciteMaterializer.java    From calcite with Apache License 2.0 4 votes vote down vote up
public RelNode visit(LogicalIntersect intersect) {
  return intersect;
}
 
Example #11
Source File: RelShuttleImpl.java    From calcite with Apache License 2.0 4 votes vote down vote up
public RelNode visit(LogicalIntersect intersect) {
  return visitChildren(intersect);
}
 
Example #12
Source File: RelHomogeneousShuttle.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Override public RelNode visit(LogicalIntersect intersect) {
  return visit((RelNode) intersect);
}
 
Example #13
Source File: RoutingShuttle.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RelNode visit(LogicalIntersect intersect) {
  return visit((RelNode) intersect);
}
 
Example #14
Source File: MycatSqlPlanner.java    From Mycat2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public RelNode visit(LogicalIntersect intersect) {
    hasSetOp = true;
    return super.visit(intersect);
}
 
Example #15
Source File: SubQueryDecorrelator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public RelNode visit(LogicalIntersect intersect) {
	checkCorConditionOfSetOpInputs(intersect);
	return super.visit(intersect);
}
 
Example #16
Source File: JoinUtils.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public RelNode visit(LogicalIntersect intersect) {
  return intersect;
}
 
Example #17
Source File: FindLimit0Visitor.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public RelNode visit(LogicalIntersect intersect) {
  return intersect;
}
 
Example #18
Source File: RelStructuredTypeFlattener.java    From Bats with Apache License 2.0 4 votes vote down vote up
public void rewriteRel(LogicalIntersect rel) {
    rewriteGeneric(rel);
}
 
Example #19
Source File: RelShuttleImpl.java    From Bats with Apache License 2.0 4 votes vote down vote up
public RelNode visit(LogicalIntersect intersect) {
  return visitChildren(intersect);
}
 
Example #20
Source File: RelHomogeneousShuttle.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override public RelNode visit(LogicalIntersect intersect) {
  return visit((RelNode) intersect);
}
 
Example #21
Source File: RelShuttle.java    From calcite with Apache License 2.0 votes vote down vote up
RelNode visit(LogicalIntersect intersect); 
Example #22
Source File: RelShuttle.java    From Bats with Apache License 2.0 votes vote down vote up
RelNode visit(LogicalIntersect intersect);