jcamachor commented on a change in pull request #970: Hive 23100
URL: https://github.com/apache/hive/pull/970#discussion_r406496073
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java
 ##########
 @@ -227,160 +228,165 @@ public ExprNodeDesc visitCall(RexCall call) {
 
   @Override
   public ExprNodeDesc visitLiteral(RexLiteral literal) {
+    return toExprNodeConstantDesc(literal);
+  }
+
+  public static ExprNodeConstantDesc toExprNodeConstantDesc(RexLiteral 
literal) {
     RelDataType lType = literal.getType();
 
     if (RexLiteral.value(literal) == null) {
       switch (literal.getType().getSqlTypeName()) {
-      case BOOLEAN:
-        return new ExprNodeConstantDesc(TypeInfoFactory.booleanTypeInfo, null);
-      case TINYINT:
-        return new ExprNodeConstantDesc(TypeInfoFactory.byteTypeInfo, null);
-      case SMALLINT:
-        return new ExprNodeConstantDesc(TypeInfoFactory.shortTypeInfo, null);
-      case INTEGER:
-        return new ExprNodeConstantDesc(TypeInfoFactory.intTypeInfo, null);
-      case BIGINT:
-        return new ExprNodeConstantDesc(TypeInfoFactory.longTypeInfo, null);
-      case FLOAT:
-      case REAL:
-        return new ExprNodeConstantDesc(TypeInfoFactory.floatTypeInfo, null);
-      case DOUBLE:
-        return new ExprNodeConstantDesc(TypeInfoFactory.doubleTypeInfo, null);
-      case DATE:
-        return new ExprNodeConstantDesc(TypeInfoFactory.dateTypeInfo, null);
-      case TIME:
-      case TIMESTAMP:
-        return new ExprNodeConstantDesc(TypeInfoFactory.timestampTypeInfo, 
null);
-      case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
-        HiveConf conf;
-        try {
-          conf = Hive.get().getConf();
-        } catch (HiveException e) {
-          throw new RuntimeException(e);
-        }
-        return new ExprNodeConstantDesc(
-                
TypeInfoFactory.getTimestampTZTypeInfo(conf.getLocalTimeZone()), null);
-      case BINARY:
-        return new ExprNodeConstantDesc(TypeInfoFactory.binaryTypeInfo, null);
-      case DECIMAL:
-        return new ExprNodeConstantDesc(
-                TypeInfoFactory.getDecimalTypeInfo(lType.getPrecision(), 
lType.getScale()), null);
-      case VARCHAR:
-      case CHAR:
-        return new ExprNodeConstantDesc(TypeInfoFactory.stringTypeInfo, null);
-      case INTERVAL_YEAR:
-      case INTERVAL_MONTH:
-      case INTERVAL_YEAR_MONTH:
-        return new 
ExprNodeConstantDesc(TypeInfoFactory.intervalYearMonthTypeInfo, null);
-      case INTERVAL_DAY:
-      case INTERVAL_DAY_HOUR:
-      case INTERVAL_DAY_MINUTE:
-      case INTERVAL_DAY_SECOND:
-      case INTERVAL_HOUR:
-      case INTERVAL_HOUR_MINUTE:
-      case INTERVAL_HOUR_SECOND:
-      case INTERVAL_MINUTE:
-      case INTERVAL_MINUTE_SECOND:
-      case INTERVAL_SECOND:
-        return new 
ExprNodeConstantDesc(TypeInfoFactory.intervalDayTimeTypeInfo, null);
-      default:
-        return new ExprNodeConstantDesc(TypeInfoFactory.voidTypeInfo, null);
+        case BOOLEAN:
 
 Review comment:
   Good catch! It was IntelliJ auto-formatting.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to