Java Code Examples for org.apache.calcite.plan.RelOptRule#convert()

The following examples show how to use org.apache.calcite.plan.RelOptRule#convert() . 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: SubsetTransformer.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
boolean go(T n, RelNode candidateSet) throws E {
  if ( !(candidateSet instanceof RelSubset) ) {
    return false;
  }

  boolean transform = false;
  for (RelNode rel : ((RelSubset)candidateSet).getRelList()) {
    if (isPhysical(rel)) {
      RelNode newRel = RelOptRule.convert(candidateSet, rel.getTraitSet().plus(Prel.PHYSICAL).simplify());
      RelNode out = convertChild(n, newRel);
      if (out != null) {
        call.transformTo(out);
        transform = true;
      }
    }
  }


  return transform;
}
 
Example 2
Source File: Prule.java    From Bats with Apache License 2.0 5 votes vote down vote up
public static RelNode convert(RelNode rel, RelTraitSet toTraits) {
  toTraits = toTraits.simplify();

  PlannerSettings settings = PrelUtil.getSettings(rel.getCluster());
  if(settings.isSingleMode()){
    toTraits = toTraits.replace(DrillDistributionTrait.ANY);
  }

  return RelOptRule.convert(rel, toTraits.simplify());
}
 
Example 3
Source File: Prule.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
public static RelNode convert(RelNode rel, RelTraitSet toTraits){
  toTraits = toTraits.simplify();

  PlannerSettings settings = PrelUtil.getSettings(rel.getCluster());
  if(settings.isSingleMode()){
    toTraits = toTraits.replace(DistributionTrait.ANY);
  }

  return RelOptRule.convert(rel, toTraits.simplify());
}
 
Example 4
Source File: AbstractPythonCorrelateRuleBase.java    From flink with Apache License 2.0 5 votes vote down vote up
public PythonCorrelateFactoryBase(RelNode rel, Convention physicalConvention) {
	this.correlateRel = rel;
	this.join = (FlinkLogicalCorrelate) rel;
	this.traitSet = rel.getTraitSet().replace(physicalConvention);
	this.convInput = RelOptRule.convert(join.getInput(0), physicalConvention);
	this.right = join.getInput(1);
}
 
Example 5
Source File: StreamExecPythonCorrelateRule.java    From flink with Apache License 2.0 5 votes vote down vote up
StreamExecPythonCorrelateFactory(RelNode rel) {
	this.correlate = (FlinkLogicalCorrelate) rel;
	this.traitSet = rel.getTraitSet().replace(FlinkConventions.STREAM_PHYSICAL());
	this.convInput = RelOptRule.convert(
		correlate.getInput(0), FlinkConventions.STREAM_PHYSICAL());
	this.right = correlate.getInput(1);
}
 
Example 6
Source File: BatchExecPythonCorrelateRule.java    From flink with Apache License 2.0 5 votes vote down vote up
BatchExecPythonCorrelateFactory(RelNode rel) {
	this.correlate = (FlinkLogicalCorrelate) rel;
	this.traitSet = rel.getTraitSet().replace(FlinkConventions.BATCH_PHYSICAL());
	this.convInput = RelOptRule.convert(
		correlate.getInput(0), FlinkConventions.BATCH_PHYSICAL());
	this.right = correlate.getInput(1);
}