drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [drill] ihuzenko commented on a change in pull request #1854: DRILL-7373: Fix problems involving reading from DICT type
Date Fri, 13 Sep 2019 16:18:47 GMT
ihuzenko commented on a change in pull request #1854: DRILL-7373: Fix problems involving reading
from DICT type
URL: https://github.com/apache/drill/pull/1854#discussion_r324243533
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java
 ##########
 @@ -259,15 +265,116 @@ public LogicalExpression visitCall(RexCall call) {
             return SchemaPath.getSimplePath(rootSegName + literal.getValue2().toString());
           }
 
-          final RexLiteral literal = (RexLiteral) call.getOperands().get(1);
-          switch(literal.getTypeName()){
-          case DECIMAL:
-          case INTEGER:
-            return left.getChild(((BigDecimal)literal.getValue()).intValue());
-          case CHAR:
-            return left.getChild(literal.getValue2().toString());
-          default:
-            // fall through
+          final RexLiteral literal;
+          RexNode operand = call.getOperands().get(1);
+          if (operand instanceof RexLiteral) {
+            literal = (RexLiteral) operand;
+          } else {
+            if (isMap && operand.getKind() == SqlKind.CAST) {
 
 Review comment:
   The nested ```if-else``` could be combined with outer one. 
   ```java
   if (operand instanceof RexLiteral) {
      // simple cast 
   } else if (isMap && operand.getKind() == SqlKind.CAST){
       // sql cast
   } else {
      // assertion error
   }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message