[ 
https://issues.apache.org/jira/browse/DRILL-7406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17004222#comment-17004222
 ] 

ASF GitHub Bot commented on DRILL-7406:
---------------------------------------

vvysotskyi commented on pull request #1940: DRILL-7406: Update Calcite to 1.21.0
URL: https://github.com/apache/drill/pull/1940#discussion_r361677218
 
 

 ##########
 File path: 
logical/src/main/java/org/apache/drill/common/expression/FunctionCallFactory.java
 ##########
 @@ -18,52 +18,49 @@
 package org.apache.drill.common.expression;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.drill.common.exceptions.DrillRuntimeException;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 
+import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableMap;
 import org.apache.drill.shaded.guava.com.google.common.collect.Lists;
 
 public class FunctionCallFactory {
   static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(FunctionCallFactory.class);
 
-  private static Map<String, String> opToFuncTable = new HashMap<>();
-
-  static {
-    opToFuncTable.put("+", "add");
-    opToFuncTable.put("-", "subtract");
-    opToFuncTable.put("/", "divide");
-    opToFuncTable.put("*", "multiply");
-    opToFuncTable.put("%", "modulo");
-    opToFuncTable.put("^", "xor");
-    opToFuncTable.put("||", "concatOperator");
-    opToFuncTable.put("or", "booleanOr");
-    opToFuncTable.put("and", "booleanAnd");
-    opToFuncTable.put(">", "greater_than");
-    opToFuncTable.put("<", "less_than");
-    opToFuncTable.put("==", "equal");
-    opToFuncTable.put("=", "equal");
-    opToFuncTable.put("!=", "not_equal");
-    opToFuncTable.put("<>", "not_equal");
-    opToFuncTable.put(">=", "greater_than_or_equal_to");
-    opToFuncTable.put("<=", "less_than_or_equal_to");
-    opToFuncTable.put("is null", "isnull");
-    opToFuncTable.put("is not null", "isnotnull");
-    opToFuncTable.put("is true", "istrue");
-    opToFuncTable.put("is not true", "isnottrue");
-    opToFuncTable.put("is false", "isfalse");
-    opToFuncTable.put("is not false", "isnotfalse");
-    opToFuncTable.put("similar to", "similar_to");
-
-    opToFuncTable.put("!", "not");
-    opToFuncTable.put("u-", "negative");
-  }
+  private static final Map<String, String> OP_TO_FUNC_NAME = 
ImmutableMap.<String, String>builder()
+      .put("+", "add")
+      .put("-", "subtract")
+      .put("/", "divide")
+      .put("*", "multiply")
+      .put("%", "modulo")
+      .put("^", "xor")
+      .put("||", "concatOperator")
+      .put("or", "booleanOr")
+      .put("and", "booleanAnd")
+      .put(">", "greater_than")
+      .put("<", "less_than")
+      .put("==", "equal")
+      .put("=", "equal")
+      .put("!=", "not_equal")
+      .put("<>", "not_equal")
+      .put(">=", "greater_than_or_equal_to")
+      .put("<=", "less_than_or_equal_to")
+      .put("is null", "isnull")
+      .put("is not null", "isnotnull")
+      .put("is true", "istrue")
+      .put("is not true", "isnottrue")
+      .put("is false", "isfalse")
+      .put("is not false", "isnotfalse")
+      .put("similar to", "similar_to")
+      .put("!", "not")
+      .put("u-", "negative")
+      .build();
 
   public static String replaceOpWithFuncName(String op) {
 
 Review comment:
   Could you please rename this method, since its implementation differs from 
its name.
 
----------------------------------------------------------------
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:
[email protected]


> Update Calcite to 1.21.0
> ------------------------
>
>                 Key: DRILL-7406
>                 URL: https://issues.apache.org/jira/browse/DRILL-7406
>             Project: Apache Drill
>          Issue Type: Task
>          Components: Query Planning &amp; Optimization, SQL Parser
>    Affects Versions: 1.17.0
>            Reporter: Igor Guzenko
>            Assignee: Igor Guzenko
>            Priority: Major
>             Fix For: 1.18.0
>
>
> DRILL-7340 should be fixed by this update.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to