Java Code Examples for org.apache.calcite.rex.RexUtil#containsCorrelation()

The following examples show how to use org.apache.calcite.rex.RexUtil#containsCorrelation() . 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: FilterProjectTransposeRule.java    From Bats with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a FilterProjectTransposeRule.
 *
 * <p>Equivalent to the rule created by
 * {@link #FilterProjectTransposeRule(Class, Predicate, Class, Predicate, boolean, boolean, RelBuilderFactory)}
 * with some default predicates that do not allow a filter to be pushed
 * past the project if there is a correlation condition anywhere in the
 * filter (since in some cases it can prevent a
 * {@link org.apache.calcite.rel.core.Correlate} from being de-correlated).
 */
public FilterProjectTransposeRule(
    Class<? extends Filter> filterClass,
    Class<? extends Project> projectClass,
    boolean copyFilter, boolean copyProject,
    RelBuilderFactory relBuilderFactory) {
  this(filterClass,
      filter -> !RexUtil.containsCorrelation(filter.getCondition()),
      projectClass, project -> true,
      copyFilter, copyProject, relBuilderFactory);
}
 
Example 2
Source File: FilterProjectTransposeRule.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Deprecated // to be removed before 2.0
public FilterProjectTransposeRule(
    Class<? extends Filter> filterClass,
    RelFactories.FilterFactory filterFactory,
    Class<? extends Project> projectClass,
    RelFactories.ProjectFactory projectFactory) {
  this(filterClass, filter -> !RexUtil.containsCorrelation(filter.getCondition()),
      projectClass, project -> true,
      filterFactory == null,
      projectFactory == null,
      RelBuilder.proto(filterFactory, projectFactory));
}
 
Example 3
Source File: RelDecorrelator.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Rewrite LogicalSnapshot.
 *
 * @param rel the snapshot rel to rewrite
 */
public Frame decorrelateRel(LogicalSnapshot rel) {
  if (RexUtil.containsCorrelation(rel.getPeriod())) {
    return null;
  }
  return decorrelateRel((RelNode) rel);
}
 
Example 4
Source File: RelDecorrelator.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Rewrite LogicalSnapshot.
 *
 * @param rel the snapshot rel to rewrite
 */
public Frame decorrelateRel(LogicalSnapshot rel) {
  if (RexUtil.containsCorrelation(rel.getPeriod())) {
    return null;
  }
  return decorrelateRel((RelNode) rel);
}
 
Example 5
Source File: FilterProjectNLJRule.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public boolean matches(RelOptRuleCall call) {
  FilterPrel filter = call.rel(0);
  ProjectPrel project = call.rel(1);
  if (RexOver.containsOver(project.getProjects(), null) ||
      RexUtil.containsCorrelation(filter.getCondition())) {
    return false;
  }

  NestedLoopJoinPrel join = call.rel(2);
  return join.getJoinType() == JoinRelType.INNER &&
      PrelUtil.getPlannerSettings(call.getPlanner()).getOptions().getOption(NestedLoopJoinPrel.VECTORIZED);
}
 
Example 6
Source File: FilterProjectTransposeRule.java    From calcite with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a FilterProjectTransposeRule.
 *
 * <p>Equivalent to the rule created by
 * {@link #FilterProjectTransposeRule(Class, Predicate, Class, Predicate, boolean, boolean, RelBuilderFactory)}
 * with some default predicates that do not allow a filter to be pushed
 * past the project if there is a correlation condition anywhere in the
 * filter (since in some cases it can prevent a
 * {@link org.apache.calcite.rel.core.Correlate} from being de-correlated).
 */
public FilterProjectTransposeRule(
    Class<? extends Filter> filterClass,
    Class<? extends Project> projectClass,
    boolean copyFilter, boolean copyProject,
    RelBuilderFactory relBuilderFactory) {
  this(filterClass,
      filter -> !RexUtil.containsCorrelation(filter.getCondition()),
      projectClass, project -> true,
      copyFilter, copyProject, relBuilderFactory);
}
 
Example 7
Source File: FilterProjectTransposeRule.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Deprecated // to be removed before 2.0
public FilterProjectTransposeRule(
    Class<? extends Filter> filterClass,
    RelFactories.FilterFactory filterFactory,
    Class<? extends Project> projectClass,
    RelFactories.ProjectFactory projectFactory) {
  this(filterClass, filter -> !RexUtil.containsCorrelation(filter.getCondition()),
      projectClass, project -> true,
      filterFactory == null,
      projectFactory == null,
      RelBuilder.proto(filterFactory, projectFactory));
}
 
Example 8
Source File: RelDecorrelator.java    From calcite with Apache License 2.0 4 votes vote down vote up
public Frame decorrelateRel(LogicalSnapshot rel) {
  if (RexUtil.containsCorrelation(rel.getPeriod())) {
    return null;
  }
  return decorrelateRel((RelNode) rel);
}
 
Example 9
Source File: RelDecorrelator.java    From calcite with Apache License 2.0 4 votes vote down vote up
public Frame decorrelateRel(LogicalTableFunctionScan rel) {
  if (RexUtil.containsCorrelation(rel.getCall())) {
    return null;
  }
  return decorrelateRel((RelNode) rel);
}