Java Code Examples for org.apache.calcite.rel.logical.LogicalUnion#getInputs()

The following examples show how to use org.apache.calcite.rel.logical.LogicalUnion#getInputs() . 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: DrillUnionAllRule.java    From Bats with Apache License 2.0 6 votes vote down vote up
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalUnion union = 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).simplify());
    convertedInputs.add(convertedInput);
  }
  try {
    call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all,
        true /* check compatibility */));
  } catch (InvalidRelException e) {
    tracer.warn(e.toString());
  }
}
 
Example 2
Source File: UnionAllRule.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@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()) ;
  }
}
 
Example 3
Source File: PreProcessLogicalRel.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public RelNode visit(LogicalUnion union) {
    for (RelNode child : union.getInputs()) {
        for (RelDataTypeField dataField : child.getRowType().getFieldList()) {
            if (dataField.getName().contains(SchemaPath.DYNAMIC_STAR)) {
                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);
}
 
Example 4
Source File: PreProcessRel.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@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);
}