You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2015/08/25 23:28:58 UTC
[28/50] [abbrv] hive git commit: HIVE-11597 : [CBO new return path]
Handling of strings of zero-length (Ashutosh Chauhan via Jesus Camacho
Rodriguez)
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/llap
Commit: c3c2bdacdbfbcad5a92959e05313c6ff677af89c
Parents: e1b88a1
Author: Ashutosh Chauhan <ha...@apache.org>
Authored: Wed Aug 19 09:15:18 2015 -0700
Committer: Ashutosh Chauhan <ha...@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;