danny0405 commented on a change in pull request #1737: URL: https://github.com/apache/calcite/pull/1737#discussion_r414957602
########## File path: core/src/main/java/org/apache/calcite/interpreter/Bindables.java ########## @@ -545,6 +557,58 @@ public RelNode convert(RelNode rel) { } } + /** + * Rule to convert an {@link org.apache.calcite.rel.logical.LogicalIntersect} + * to a {@link BindableIntersect}. + */ + public static class BindableIntersectRule extends ConverterRule { + + /** + * Creates a BindableIntersectRule. + * + * @param relBuilderFactory Builder for relational expressions + */ + public BindableIntersectRule(RelBuilderFactory relBuilderFactory) { + super(LogicalIntersect.class, (Predicate<RelNode>) r -> true, + Convention.NONE, BindableConvention.INSTANCE, relBuilderFactory, + "BindableIntersectRule"); + } + + public RelNode convert(RelNode rel) { + final LogicalIntersect intersect = (LogicalIntersect) rel; + final BindableConvention out = BindableConvention.INSTANCE; + final RelTraitSet traitSet = intersect.getTraitSet().replace(out); + return new BindableIntersect(rel.getCluster(), traitSet, + convertList(intersect.getInputs(), out), intersect.all); + } + } + + /** + * Rule to convert an {@link org.apache.calcite.rel.logical.LogicalMinus} + * to a {@link BindableMinus}. + */ + public static class BindableMinusRule extends ConverterRule { Review comment: But at least the rule can be unified. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org