io.deephaven.sql.RelNodeVisitor Maven / Gradle / Ivy
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.sql;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.RelShuttle;
import org.apache.calcite.rel.core.TableScan;
import org.apache.calcite.rel.logical.LogicalAggregate;
import org.apache.calcite.rel.logical.LogicalFilter;
import org.apache.calcite.rel.logical.LogicalJoin;
import org.apache.calcite.rel.logical.LogicalProject;
import org.apache.calcite.rel.logical.LogicalSort;
import org.apache.calcite.rel.logical.LogicalUnion;
import org.apache.calcite.rel.logical.LogicalValues;
/**
* This is an improvement on {@link RelShuttle} that visitors to return any type.
*
* @param the type
*/
interface RelNodeVisitor {
static T accept(RelNode node, RelNodeVisitor visitor) {
final RelNodeVisitorAdapter adapter = new RelNodeVisitorAdapter<>(visitor);
node.accept(adapter);
return adapter.out();
}
T visit(LogicalProject project);
T visit(LogicalUnion union);
T visit(LogicalSort sort);
T visit(TableScan scan);
T visit(LogicalFilter filter);
T visit(LogicalJoin join);
T visit(LogicalAggregate aggregate);
T visit(LogicalValues values);
}