Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
It takes a lot to implement RelRule.Config even for trivial cases when no extra configuration options needed.
Sample:
It requires users:
1) Use immutables or implement Config manually. Adding immutables processor adds compile-time overhead, and implementing the interface manually is not trivial
2) Implement CustomRule(Config) constructor
3) Implement Config.toRule() by calling CustomRule(Config)
—
I suggest:
1) Drop method Config.toRule(), and suggest users to call new ...Rule(config) directly. Config.toRule() adds no value, and it creates excessive coupling of Config with the Rule.
2) Provide default Config implementation along with Calcite. For instance DefaultConfig.EMPTY, DefaultConfigBuilder...
3) Use composition for custom configurations, in other words, let custom rules have their own attributes, and one of the attributes could be default config.
For instance: data class AggregateExpandDistinctAggregatesRule.Config(config RelRule.Config, usingGroupingSets Boolean)
It would make it easier for users to implement config objects, and it would reduce the code size (generated bytecode and native image size) as the current Calcite approach duplicates the same "Config" methods like withOperandSupplier across all the Config implementations
Attachments
Issue Links
- is caused by
-
CALCITE-4787 Move core to use Immutables instead of ImmutableBeans
- Closed