hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject hive git commit: HIVE-11597 : [CBO new return path] Handling of strings of zero-length (Ashutosh Chauhan via Jesus Camacho Rodriguez)
Date Wed, 19 Aug 2015 16:16:09 GMT
Repository: hive
Updated Branches:
  refs/heads/master e1b88a19a -> c3c2bdacd


HIVE-11597 : [CBO new return path] Handling of strings of zero-length (Ashutosh Chauhan via
Jesus Camacho Rodriguez)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/c3c2bdac
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/c3c2bdac
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/c3c2bdac

Branch: refs/heads/master
Commit: c3c2bdacdbfbcad5a92959e05313c6ff677af89c
Parents: e1b88a1
Author: Ashutosh Chauhan <hashutosh@apache.org>
Authored: Wed Aug 19 09:15:18 2015 -0700
Committer: Ashutosh Chauhan <hashutosh@apache.org>
Committed: Wed Aug 19 09:15:18 2015 -0700

----------------------------------------------------------------------
 .../ql/optimizer/calcite/translator/TypeConverter.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/c3c2bdac/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java
index 13c8c23..2825f77 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java
@@ -31,6 +31,8 @@ import org.apache.calcite.rex.RexBuilder;
 import org.apache.calcite.sql.parser.SqlParserPos;
 import org.apache.calcite.sql.SqlIntervalQualifier;
 import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.hadoop.hive.common.type.HiveChar;
+import org.apache.hadoop.hive.common.type.HiveVarchar;
 import org.apache.hadoop.hive.ql.exec.ColumnInfo;
 import org.apache.hadoop.hive.ql.exec.RowSchema;
 import org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSemanticException;
@@ -300,12 +302,17 @@ public class TypeConverter {
     case DECIMAL:
       return TypeInfoFactory.getDecimalTypeInfo(rType.getPrecision(), rType.getScale());
     case VARCHAR:
-      if (rType.getPrecision() == Integer.MAX_VALUE)
+      int varcharLength = rType.getPrecision();
+      if (varcharLength < 1 || varcharLength > HiveVarchar.MAX_VARCHAR_LENGTH)
         return TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME);
       else
-        return TypeInfoFactory.getVarcharTypeInfo(rType.getPrecision());
+        return TypeInfoFactory.getVarcharTypeInfo(varcharLength);
     case CHAR:
-      return TypeInfoFactory.getCharTypeInfo(rType.getPrecision());
+      int charLength = rType.getPrecision();
+      if (charLength < 1 || charLength > HiveChar.MAX_CHAR_LENGTH)
+        return TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME);
+      else
+        return TypeInfoFactory.getCharTypeInfo(charLength);
     case OTHER:
     default:
       return TypeInfoFactory.voidTypeInfo;


Mime
View raw message