[
https://issues.apache.org/jira/browse/CALCITE-4183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17184978#comment-17184978
]
Julian Hyde commented on CALCITE-4183:
--------------------------------------
There's no general rule, besides use your discretion. I added
{{withOperandFor}} where creating the operands was moderately complex (e.g.
there were predicates) and/or where there are multiple instances of a rule in
the code base, some with logical classes and some not.
I certainly wouldn't deprecate {{withOperandFor}} (because then we'd have to
stop using it internally) but maybe some comments would help.
I'm wary of creating a "best practice" that then becomes a rule and forces
authors of rules to write a lot of boilerplate code. I've already had push-back
that creating a rule now requires creating two classes - a sub-class of
{{RelRule}} and a {{Config}} interface - where you previously needed only one.
Good catch that there are no tests for {{FilterSetOpTranspose}}.
{{CoreRules.FILTER_SET_OP_TRANSPOSE}} is used in 3 tests in {{RelOptRulesTest}}
but it's not the main thing being tested in any of those. We could use one or
two tests, but it is sufficient if those tests use the default instance, so
they won't need to call {{withOperandFor}} or {{withOperandSupplier}}.
> FilterSetOpTransposeRule constructor should allow for user defined Filter and
> SetOp classes
> -------------------------------------------------------------------------------------------
>
> Key: CALCITE-4183
> URL: https://issues.apache.org/jira/browse/CALCITE-4183
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.24.0
> Reporter: Sean Broeder
> Priority: Major
> Labels: pull-request-available
> Original Estimate: 168h
> Time Spent: 20m
> Remaining Estimate: 167h 50m
>
> The current FilterSetOpTransposeRule constructor simply takes a
> RelBuilderFactory. Adding an additional constructor would allow more
> flexibility for user specific Filter and SetOp classes and follows behavior
> already allowed for several other rules.
> For example:
> {code}
> /**
> * Creates a FilterSetOpTransposeRule that uses a generic
> * {@link Filter} and {@link SetOp}
> * @param filterClass filter class
> * @param setOpClass setOp class
> * @param relBuilderFactory builder factory for relational expressions
> */
> public FilterSetOpTransposeRule(Class<? extends Filter> filterClass,
> Class<? extends SetOp> setOpClass,
> RelBuilderFactory relBuilderFactory) {
> super(
> operand(filterClass,
> operand(setOpClass, any())),
> relBuilderFactory, null);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)