Search in sources :

Example 1 with RelHomogeneousShuttle

use of org.apache.calcite.rel.RelHomogeneousShuttle in project hive by apache.

the class CorrelateProjectExtractor method findCorrelationDependentCalls.

/**
 * Traverses a plan and finds all simply correlated row expressions with the specified id.
 */
private static Set<RexNode> findCorrelationDependentCalls(CorrelationId corrId, RelNode plan) {
    SimpleCorrelationCollector finder = new SimpleCorrelationCollector(corrId);
    plan.accept(new RelHomogeneousShuttle() {

        @Override
        public RelNode visit(RelNode other) {
            if (other instanceof Project || other instanceof Filter) {
                other.accept(finder);
            }
            return super.visit(other);
        }
    });
    return finder.correlations;
}
Also used : Project(org.apache.calcite.rel.core.Project) RelNode(org.apache.calcite.rel.RelNode) Filter(org.apache.calcite.rel.core.Filter) RelHomogeneousShuttle(org.apache.calcite.rel.RelHomogeneousShuttle)

Aggregations

RelHomogeneousShuttle (org.apache.calcite.rel.RelHomogeneousShuttle)1 RelNode (org.apache.calcite.rel.RelNode)1 Filter (org.apache.calcite.rel.core.Filter)1 Project (org.apache.calcite.rel.core.Project)1