You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/03/12 08:40:51 UTC

[GitHub] [pinot] richardstartin commented on a change in pull request #8341: Canonicalize the function name for SQL parser

richardstartin commented on a change in pull request #8341:
URL: https://github.com/apache/pinot/pull/8341#discussion_r825269775



##########
File path: pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
##########
@@ -757,6 +757,23 @@ private static Expression compileFunctionExpression(SqlBasicCall functionNode) {
     }
   }
 
+  private static final Map<String, FilterKind> CANONICAL_NAME_TO_FILTER_KIND_MAP = new HashMap<String, FilterKind>() {{
+    for (FilterKind filterKind : FilterKind.values()) {
+      put(StringUtils.remove(filterKind.name(), '_'), filterKind);
+    }
+  }};

Review comment:
       This is widely considered an antipattern because it creates a new class for each map this is done for. Doing this in a static block or using a factory method doesn’t add much code but doesn’t increase the number of class files, classes to load etc.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org