Sergey Nuyanzin created FLINK-30847:
---------------------------------------
Summary: Some rel rules vioaltes Calcite guidance rule about
instance creation
Key: FLINK-30847
URL: https://issues.apache.org/jira/browse/FLINK-30847
Project: Flink
Issue Type: Technical Debt
Components: Table SQL / Planner
Affects Versions: 1.17.0
Reporter: Sergey Nuyanzin
This is a follow up ticket based on review
[https://github.com/apache/flink/pull/21519#pullrequestreview-1267744410]
Calcite guidance rule 5 says that
{quote}
5. Do not create an INSTANCE constant inside your rule. Instead, create a named
instance of your rule, with default configuration, in a holder class. The
holder class must not be a sub-class of RelOptRule (otherwise cyclic
class-loading issues may arise). Generally it will be called XxxRules, for
example CsvRules. The rule instance is named after your rule, and is based on
the default config (Config.DEFAULT, or DEFAULT_CONFIG for converter rules):
{code:java}
/** Rule that matches a {@code Project} on a
* {@code CsvTableScan} and pushes down projects if possible. */
public static final CsvProjectTableScanRule PROJECT_SCAN =
CsvProjectTableScanRule.Config.DEFAULT.toRule();
{code}
{quote}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)