Java Code Examples for org.apache.calcite.rex.RexSubQuery#clone()

The following examples show how to use org.apache.calcite.rex.RexSubQuery#clone() . 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: RexSubQueryUtils.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Override
public RexNode visitSubQuery(RexSubQuery subQuery) {
  RelNode transformed;
  try {
    transformed = PrelTransformer.transform(config, PlannerType.HEP_AC, PlannerPhase.JDBC_PUSHDOWN, subQuery.rel, traitSet, false);

    // We may need to run the planner again on the sub-queries in the sub-tree this produced.
    final RelsWithRexSubQueryTransformer nestedSubqueryTransformer = new RelsWithRexSubQueryTransformer(config);
    transformed = transformed.accept(nestedSubqueryTransformer);
    if (!(transformed instanceof JdbcCrel) || nestedSubqueryTransformer.failed()) {
      failed = true;
      return subQuery;
    }
  } catch (Throwable t) {
    failed = true;
    return subQuery;
  }
  return subQuery.clone(((JdbcCrel) transformed).getInput());
}
 
Example 2
Source File: CorrelationReferenceFinder.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public RexNode visitSubQuery(RexSubQuery subQuery) {
    final RelNode r = subQuery.getRel().accept(finder); // look inside sub-queries
    if (r != subQuery.getRel()) {
        subQuery = subQuery.clone(r);
    }
    return super.visitSubQuery(subQuery);
}
 
Example 3
Source File: DeduplicateCorrelateVariables.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public RexNode visitSubQuery(RexSubQuery subQuery) {
    if (shuttle != null) {
        RelNode r = subQuery.getRel().accept(shuttle); // look inside sub-queries
        if (r != subQuery.getRel()) {
            subQuery = subQuery.clone(r);
        }
    }
    return super.visitSubQuery(subQuery);
}
 
Example 4
Source File: CorrelationReferenceFinder.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Override public RexNode visitSubQuery(RexSubQuery subQuery) {
  final RelNode r = subQuery.rel.accept(finder); // look inside sub-queries
  if (r != subQuery.rel) {
    subQuery = subQuery.clone(r);
  }
  return super.visitSubQuery(subQuery);
}
 
Example 5
Source File: DeduplicateCorrelateVariables.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Override public RexNode visitSubQuery(RexSubQuery subQuery) {
  if (shuttle != null) {
    RelNode r = subQuery.rel.accept(shuttle); // look inside sub-queries
    if (r != subQuery.rel) {
      subQuery = subQuery.clone(r);
    }
  }
  return super.visitSubQuery(subQuery);
}
 
Example 6
Source File: RexSubQueryUtils.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RexNode visitSubQuery(RexSubQuery subQuery) {
  final RelNode transformed = converter.flattenTypes(subQuery.rel, true);
  final RelNode transformed2 = transformed.accept(new RelsWithRexSubQueryFlattener(converter));
  return subQuery.clone(transformed2);
}