[GitHub] [calcite] danny0405 commented on a change in pull request #1397: [CALCITE-3115] Cannot add JdbcRules which have different JdbcConvention to same VolcanoPlanner's RuleSet.
danny0405 commented on a change in pull request #1397: [CALCITE-3115] Cannot add JdbcRules which have different JdbcConvention to same VolcanoPlanner's RuleSet. URL: https://github.com/apache/calcite/pull/1397#discussion_r317048633 ## File path: core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java ## @@ -262,6 +263,17 @@ private JdbcRules() { this(clazz, (Predicate) predicate, in, out, relBuilderFactory, description); } + +/** + * Creates name for child JdbcConverter rules in format: + * RuleName(out:CONVENTION_NAME) + * + * @param out output convention + * @return rule name + */ +protected static String getRuleName(Class clazz, JdbcConvention out) { + return String.format(Locale.ROOT, "%s(out:%s)", clazz.getSimpleName(), out); +} Review comment: I checked again and almost every adapter converter rules do not include the convention in their description, maybe we can alway include the convention into the rule description and unify the logic into `ConverterRule`. 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 With regards, Apache Git Services
[GitHub] [calcite] danny0405 commented on a change in pull request #1397: [CALCITE-3115] Cannot add JdbcRules which have different JdbcConvention to same VolcanoPlanner's RuleSet.
danny0405 commented on a change in pull request #1397: [CALCITE-3115] Cannot add JdbcRules which have different JdbcConvention to same VolcanoPlanner's RuleSet. URL: https://github.com/apache/calcite/pull/1397#discussion_r317048633 ## File path: core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java ## @@ -262,6 +263,17 @@ private JdbcRules() { this(clazz, (Predicate) predicate, in, out, relBuilderFactory, description); } + +/** + * Creates name for child JdbcConverter rules in format: + * RuleName(out:CONVENTION_NAME) + * + * @param out output convention + * @return rule name + */ +protected static String getRuleName(Class clazz, JdbcConvention out) { + return String.format(Locale.ROOT, "%s(out:%s)", clazz.getSimpleName(), out); +} Review comment: I checked again and almost every adapter converter rules do not include the convention in their description, maybe we can alway include the convention into the rule name and unify the logic into `ConverterRule`. 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 With regards, Apache Git Services
[GitHub] [calcite] danny0405 commented on a change in pull request #1397: [CALCITE-3115] Cannot add JdbcRules which have different JdbcConvention to same VolcanoPlanner's RuleSet.
danny0405 commented on a change in pull request #1397: [CALCITE-3115] Cannot add JdbcRules which have different JdbcConvention to same VolcanoPlanner's RuleSet. URL: https://github.com/apache/calcite/pull/1397#discussion_r316954972 ## File path: core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java ## @@ -262,6 +263,17 @@ private JdbcRules() { this(clazz, (Predicate) predicate, in, out, relBuilderFactory, description); } + +/** + * Creates name for child JdbcConverter rules in format: + * RuleName(out:CONVENTION_NAME) + * + * @param out output convention + * @return rule name + */ +protected static String getRuleName(Class clazz, JdbcConvention out) { + return String.format(Locale.ROOT, "%s(out:%s)", clazz.getSimpleName(), out); +} Review comment: Even though other conventions are singletons, we didn't use it as part of the description, i.e. the ElasticSearchConverter rules [1], i believe they have the same issue. [1] https://github.com/apache/calcite/blob/22577e488e04d4056e15af96bac4246fd810f0fa/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchRules.java#L240 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 With regards, Apache Git Services
[GitHub] [calcite] danny0405 commented on a change in pull request #1397: [CALCITE-3115] Cannot add JdbcRules which have different JdbcConvention to same VolcanoPlanner's RuleSet.
danny0405 commented on a change in pull request #1397: [CALCITE-3115] Cannot add JdbcRules which have different JdbcConvention to same VolcanoPlanner's RuleSet. URL: https://github.com/apache/calcite/pull/1397#discussion_r316480310 ## File path: core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java ## @@ -262,6 +263,17 @@ private JdbcRules() { this(clazz, (Predicate) predicate, in, out, relBuilderFactory, description); } + +/** + * Creates name for child JdbcConverter rules in format: + * RuleName(out:CONVENTION_NAME) + * + * @param out output convention + * @return rule name + */ +protected static String getRuleName(Class clazz, JdbcConvention out) { + return String.format(Locale.ROOT, "%s(out:%s)", clazz.getSimpleName(), out); +} Review comment: Just one question, can we make more effort to move this method to super class ConverterRule ? It seems that this is a common pattern, it would be nice if we can unify the naming rules so there is less chance we encounter the similar problem. 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 With regards, Apache Git Services