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 2016/07/07 19:50:15 UTC
[30/30] hive git commit: HIVE-13945 : Decimal value is displayed as
rounded when selecting where clause with that decimal value (Sergey Shelukhin,
reviewed by Ashutosh Chauhan)
HIVE-13945 : Decimal value is displayed as rounded when selecting where clause with that decimal value (Sergey Shelukhin, reviewed by Ashutosh Chauhan)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1b5ee3d8
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1b5ee3d8
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1b5ee3d8
Branch: refs/heads/master
Commit: 1b5ee3d88799a5e80948b7b0f5ca96bba8580efe
Parents: e1171c9
Author: Sergey Shelukhin <se...@apache.org>
Authored: Thu Jul 7 12:40:38 2016 -0700
Committer: Sergey Shelukhin <se...@apache.org>
Committed: Thu Jul 7 12:44:46 2016 -0700
----------------------------------------------------------------------
.../queries/clientpositive/udf_example_format.q | 4 +-
.../clientpositive/udf_example_format.q.out | 8 +-
.../orc/impl/ConvertTreeReaderFactory.java | 1 +
.../org/apache/orc/impl/RecordReaderImpl.java | 2 +-
.../hadoop/hive/ql/exec/FileSinkOperator.java | 2 +-
.../ql/exec/vector/VectorizationContext.java | 2 +-
.../vector/expressions/CastDecimalToLong.java | 2 +-
.../hive/ql/io/sarg/ConvertAstToSearchArg.java | 7 +-
.../optimizer/ConstantPropagateProcFactory.java | 21 +-
.../calcite/translator/ASTBuilder.java | 12 +-
.../hive/ql/parse/DDLSemanticAnalyzer.java | 27 +-
.../org/apache/hadoop/hive/ql/parse/HiveLexer.g | 18 +-
.../hadoop/hive/ql/parse/IdentifiersParser.g | 6 +-
.../apache/hadoop/hive/ql/parse/ParseUtils.java | 6 +-
.../hadoop/hive/ql/parse/SemanticAnalyzer.java | 8 +-
.../hive/ql/parse/TypeCheckProcFactory.java | 59 +-
.../apache/hadoop/hive/ql/udf/UDFToInteger.java | 2 +-
.../apache/hadoop/hive/ql/udf/UDFToLong.java | 2 +-
.../apache/hadoop/hive/ql/udf/UDFToShort.java | 2 +-
.../generic/GenericUDAFPercentileApprox.java | 43 +-
.../hive/ql/udf/generic/GenericUDFLeadLag.java | 15 +-
.../hive/ql/udf/generic/GenericUDFOPDivide.java | 9 +-
.../hive/ql/udf/generic/GenericUDFPrintf.java | 18 +-
.../hive/ql/udf/ptf/WindowingTableFunction.java | 2 +-
.../ql/udf/generic/TestGenericUDFOPDivide.java | 54 +-
.../clientnegative/compare_double_bigint.q | 2 +-
.../queries/clientpositive/implicit_decimal.q | 14 +
.../queries/clientpositive/input_lazyserde.q | 2 +-
.../queries/clientpositive/udf_java_method.q | 12 +-
.../test/queries/clientpositive/udf_reflect.q | 12 +-
.../queries/clientpositive/vector_struct_in.q | 80 +-
.../clientnegative/no_matching_udf.q.out | 2 +-
.../clientnegative/udf_add_months_error_2.q.out | 2 +-
.../udf_format_number_wrong4.q.out | 2 +-
.../udf_format_number_wrong5.q.out | 2 +-
.../clientnegative/udf_trunc_error2.q.out | 2 +-
.../clientnegative/wrong_column_type.q.out | 2 +-
.../clientpositive/annotate_stats_select.q.out | 16 +-
.../clientpositive/ansi_sql_arithmetic.q.out | 4 +-
ql/src/test/results/clientpositive/cast1.q.out | 6 +-
.../test/results/clientpositive/decimal_6.q.out | 2 +-
.../clientpositive/decimal_precision.q.out | 186 +--
.../results/clientpositive/decimal_udf.q.out | 72 +-
.../clientpositive/implicit_decimal.q.out | 85 ++
.../clientpositive/infer_const_type.q.out | 4 +-
.../test/results/clientpositive/input49.q.out | 2 +-
.../clientpositive/input_lazyserde.q.out | 4 +-
.../test/results/clientpositive/lineage3.q.out | 4 +-
.../results/clientpositive/literal_double.q.out | 6 +-
.../clientpositive/llap/orc_ppd_basic.q.out | 4 +-
.../llap/vectorization_short_regress.q.out | 670 ++++++-----
.../clientpositive/metadata_only_queries.q.out | 56 +-
.../clientpositive/orc_predicate_pushdown.q.out | 6 +-
.../parquet_predicate_pushdown.q.out | 6 +-
.../results/clientpositive/perf/query13.q.out | 4 +-
.../results/clientpositive/perf/query32.q.out | 2 +-
.../results/clientpositive/perf/query48.q.out | 2 +-
.../results/clientpositive/perf/query58.q.out | 4 +-
.../results/clientpositive/perf/query65.q.out | 2 +-
.../results/clientpositive/perf/query75.q.out | 2 +-
.../results/clientpositive/perf/query85.q.out | 4 +-
.../results/clientpositive/perf/query89.q.out | 8 +-
.../spark/metadata_only_queries.q.out | 56 +-
.../spark/vector_between_in.q.out | 3 +
.../clientpositive/spark/vectorization_0.q.out | 2 +-
.../clientpositive/spark/vectorization_1.q.out | 2 +-
.../clientpositive/spark/vectorization_12.q.out | 1064 +++++++++---------
.../clientpositive/spark/vectorization_13.q.out | 32 +-
.../clientpositive/spark/vectorization_14.q.out | 596 +++++-----
.../clientpositive/spark/vectorization_15.q.out | 82 +-
.../clientpositive/spark/vectorization_16.q.out | 724 ++++++------
.../clientpositive/spark/vectorization_17.q.out | 18 +-
.../clientpositive/spark/vectorization_3.q.out | 1 -
.../clientpositive/spark/vectorization_9.q.out | 724 ++++++------
.../spark/vectorization_div0.q.out | 188 ++--
.../spark/vectorization_short_regress.q.out | 424 ++++---
.../spark/vectorized_math_funcs.q.out | 2 +-
.../clientpositive/tez/explainuser_1.q.out | 42 +-
.../tez/metadata_only_queries.q.out | 56 +-
.../clientpositive/tez/orc_ppd_basic.q.out | 4 +-
.../clientpositive/tez/vector_between_in.q.out | 3 +
.../clientpositive/tez/vector_decimal_6.q.out | 42 +-
.../tez/vector_decimal_expressions.q.out | 28 +-
.../tez/vector_decimal_math_funcs.q.out | 2 +-
.../tez/vector_decimal_precision.q.out | 186 +--
.../clientpositive/tez/vector_decimal_udf.q.out | 72 +-
.../clientpositive/tez/vector_struct_in.q.out | 160 +--
.../clientpositive/tez/vectorization_0.q.out | 2 +-
.../clientpositive/tez/vectorization_1.q.out | 2 +-
.../clientpositive/tez/vectorization_12.q.out | 1064 +++++++++---------
.../clientpositive/tez/vectorization_13.q.out | 32 +-
.../clientpositive/tez/vectorization_14.q.out | 596 +++++-----
.../clientpositive/tez/vectorization_15.q.out | 82 +-
.../clientpositive/tez/vectorization_16.q.out | 724 ++++++------
.../clientpositive/tez/vectorization_17.q.out | 18 +-
.../clientpositive/tez/vectorization_3.q.out | 1 -
.../clientpositive/tez/vectorization_8.q.out | 16 +-
.../clientpositive/tez/vectorization_9.q.out | 724 ++++++------
.../clientpositive/tez/vectorization_div0.q.out | 188 ++--
.../tez/vectorization_short_regress.q.out | 424 ++++---
.../tez/vectorized_math_funcs.q.out | 2 +-
ql/src/test/results/clientpositive/udf4.q.out | 8 +-
ql/src/test/results/clientpositive/udf6.q.out | 4 +-
.../test/results/clientpositive/udf_abs.q.out | 6 +-
.../results/clientpositive/udf_bround.q.out | 6 +-
.../test/results/clientpositive/udf_case.q.out | 2 +-
.../results/clientpositive/udf_coalesce.q.out | 6 +-
.../clientpositive/udf_format_number.q.out | 2 +-
ql/src/test/results/clientpositive/udf_if.q.out | 4 +-
.../clientpositive/udf_java_method.q.out | 24 +-
.../test/results/clientpositive/udf_least.q.out | 2 +-
.../results/clientpositive/udf_reflect.q.out | 24 +-
.../test/results/clientpositive/udf_round.q.out | 4 +-
.../results/clientpositive/udf_round_3.q.out | 2 +-
.../results/clientpositive/udf_sort_array.q.out | 2 +-
.../test/results/clientpositive/udf_union.q.out | 4 +-
.../test/results/clientpositive/udf_when.q.out | 2 +-
.../clientpositive/vector_between_in.q.out | 3 +
.../clientpositive/vector_decimal_6.q.out | 42 +-
.../vector_decimal_expressions.q.out | 28 +-
.../vector_decimal_math_funcs.q.out | 2 +-
.../vector_decimal_precision.q.out | 186 +--
.../clientpositive/vector_decimal_udf.q.out | 72 +-
.../clientpositive/vector_struct_in.q.out | 160 +--
.../clientpositive/vectorization_0.q.out | 2 +-
.../clientpositive/vectorization_1.q.out | 2 +-
.../clientpositive/vectorization_12.q.out | 1064 +++++++++---------
.../clientpositive/vectorization_13.q.out | 32 +-
.../clientpositive/vectorization_14.q.out | 596 +++++-----
.../clientpositive/vectorization_15.q.out | 82 +-
.../clientpositive/vectorization_16.q.out | 724 ++++++------
.../clientpositive/vectorization_17.q.out | 18 +-
.../clientpositive/vectorization_3.q.out | 1 -
.../clientpositive/vectorization_8.q.out | 16 +-
.../clientpositive/vectorization_9.q.out | 724 ++++++------
.../clientpositive/vectorization_div0.q.out | 188 ++--
.../vectorization_short_regress.q.out | 424 ++++---
.../clientpositive/vectorized_math_funcs.q.out | 2 +-
.../test/results/clientpositive/view_cast.q.out | 16 +-
.../PrimitiveObjectInspectorUtils.java | 5 +-
.../hadoop/hive/common/type/HiveDecimal.java | 8 +-
141 files changed, 7328 insertions(+), 7186 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/contrib/src/test/queries/clientpositive/udf_example_format.q
----------------------------------------------------------------------
diff --git a/contrib/src/test/queries/clientpositive/udf_example_format.q b/contrib/src/test/queries/clientpositive/udf_example_format.q
index 38069dc..edda00b 100644
--- a/contrib/src/test/queries/clientpositive/udf_example_format.q
+++ b/contrib/src/test/queries/clientpositive/udf_example_format.q
@@ -5,13 +5,13 @@ CREATE TEMPORARY FUNCTION example_format AS 'org.apache.hadoop.hive.contrib.udf.
EXPLAIN
SELECT example_format("abc"),
example_format("%1$s", 1.1),
- example_format("%1$s %2$e", 1.1, 1.2),
+ example_format("%1$s %2$e", 1.1D, 1.2D),
example_format("%1$x %2$o %3$d", 10, 10, 10)
FROM src LIMIT 1;
SELECT example_format("abc"),
example_format("%1$s", 1.1),
- example_format("%1$s %2$e", 1.1, 1.2),
+ example_format("%1$s %2$e", 1.1D, 1.2D),
example_format("%1$x %2$o %3$d", 10, 10, 10)
FROM src LIMIT 1;
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/contrib/src/test/results/clientpositive/udf_example_format.q.out
----------------------------------------------------------------------
diff --git a/contrib/src/test/results/clientpositive/udf_example_format.q.out b/contrib/src/test/results/clientpositive/udf_example_format.q.out
index 34b10c4..75c6496 100644
--- a/contrib/src/test/results/clientpositive/udf_example_format.q.out
+++ b/contrib/src/test/results/clientpositive/udf_example_format.q.out
@@ -7,14 +7,14 @@ POSTHOOK: Output: example_format
PREHOOK: query: EXPLAIN
SELECT example_format("abc"),
example_format("%1$s", 1.1),
- example_format("%1$s %2$e", 1.1, 1.2),
+ example_format("%1$s %2$e", 1.1D, 1.2D),
example_format("%1$x %2$o %3$d", 10, 10, 10)
FROM src LIMIT 1
PREHOOK: type: QUERY
POSTHOOK: query: EXPLAIN
SELECT example_format("abc"),
example_format("%1$s", 1.1),
- example_format("%1$s %2$e", 1.1, 1.2),
+ example_format("%1$s %2$e", 1.1D, 1.2D),
example_format("%1$x %2$o %3$d", 10, 10, 10)
FROM src LIMIT 1
POSTHOOK: type: QUERY
@@ -40,7 +40,7 @@ STAGE PLANS:
PREHOOK: query: SELECT example_format("abc"),
example_format("%1$s", 1.1),
- example_format("%1$s %2$e", 1.1, 1.2),
+ example_format("%1$s %2$e", 1.1D, 1.2D),
example_format("%1$x %2$o %3$d", 10, 10, 10)
FROM src LIMIT 1
PREHOOK: type: QUERY
@@ -48,7 +48,7 @@ PREHOOK: Input: default@src
#### A masked pattern was here ####
POSTHOOK: query: SELECT example_format("abc"),
example_format("%1$s", 1.1),
- example_format("%1$s %2$e", 1.1, 1.2),
+ example_format("%1$s %2$e", 1.1D, 1.2D),
example_format("%1$x %2$o %3$d", 10, 10, 10)
FROM src LIMIT 1
POSTHOOK: type: QUERY
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/orc/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
----------------------------------------------------------------------
diff --git a/orc/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java b/orc/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
index 9e5f5cc..c0c6964 100644
--- a/orc/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
+++ b/orc/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
@@ -619,6 +619,7 @@ public class ConvertTreeReaderFactory extends TreeReaderFactory {
longColVector.isNull[elementNum] = true;
longColVector.noNulls = false;
} else {
+ // TODO: lossy conversion!
downCastAnyInteger(longColVector, elementNum, decimalValue.longValue(), readerType);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/orc/src/java/org/apache/orc/impl/RecordReaderImpl.java
----------------------------------------------------------------------
diff --git a/orc/src/java/org/apache/orc/impl/RecordReaderImpl.java b/orc/src/java/org/apache/orc/impl/RecordReaderImpl.java
index 36a802e..23f532c 100644
--- a/orc/src/java/org/apache/orc/impl/RecordReaderImpl.java
+++ b/orc/src/java/org/apache/orc/impl/RecordReaderImpl.java
@@ -655,7 +655,7 @@ public class RecordReaderImpl implements RecordReader {
// widening conversion
return ((Number) obj).longValue();
} else if (obj instanceof HiveDecimal) {
- return ((HiveDecimal) obj).longValue();
+ return ((HiveDecimal) obj).longValue(); // TODO: lossy conversion!
} else if (obj instanceof String) {
return Long.valueOf(obj.toString());
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
index e154d13..6a0e8c7 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
@@ -147,7 +147,7 @@ public class FileSinkOperator extends TerminalOperator<FileSinkDesc> implements
Path taskOutputTempPath;
Path[] outPaths;
Path[] finalPaths;
- RecordWriter[] outWriters; // TODO# this
+ RecordWriter[] outWriters;
RecordUpdater[] updaters;
Stat stat;
int acidLastBucket = -1;
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
index 2887395..c0b9a4c 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
@@ -1703,7 +1703,7 @@ public class VectorizationContext {
return ((Number) scalar).longValue();
case DECIMAL:
HiveDecimal decimalVal = (HiveDecimal) scalar;
- return decimalVal.longValue();
+ return decimalVal.longValueExact();
default:
throw new HiveException("Unsupported type "+typename+" for cast to Long");
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastDecimalToLong.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastDecimalToLong.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastDecimalToLong.java
index 045f0ab..2ff6b79 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastDecimalToLong.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastDecimalToLong.java
@@ -37,6 +37,6 @@ public class CastDecimalToLong extends FuncDecimalToLong {
@Override
protected void func(LongColumnVector outV, DecimalColumnVector inV, int i) {
- outV.vector[i] = inV.vector[i].getHiveDecimal().longValue();
+ outV.vector[i] = inV.vector[i].getHiveDecimal().longValue(); // TODO: lossy conversion!
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java b/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java
index 1fa94b9..300ed20 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java
@@ -25,6 +25,7 @@ import java.util.List;
import org.apache.commons.codec.binary.Base64;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.common.type.HiveChar;
+import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc;
import org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc;
@@ -139,6 +140,9 @@ public class ConvertAstToSearchArg {
}
switch (type) {
case LONG:
+ if (lit instanceof HiveDecimal) {
+ return ((HiveDecimal)lit).longValueExact();
+ }
return ((Number) lit).longValue();
case STRING:
if (lit instanceof HiveChar) {
@@ -149,7 +153,7 @@ public class ConvertAstToSearchArg {
return lit.toString();
}
case FLOAT:
- if (lit instanceof Float) {
+ if (lit instanceof Float || lit instanceof HiveDecimal) {
// converting a float directly to a double causes annoying conversion
// problems
return Double.parseDouble(lit.toString());
@@ -161,7 +165,6 @@ public class ConvertAstToSearchArg {
case DATE:
return Date.valueOf(lit.toString());
case DECIMAL:
- LOG.warn("boxing " + lit);
return new HiveDecimalWritable(lit.toString());
case BOOLEAN:
return lit;
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
index 6952ffb..8d7b4ab 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
@@ -139,7 +139,6 @@ public final class ConstantPropagateProcFactory {
private static final Set<PrimitiveCategory> unSupportedTypes = ImmutableSet
.<PrimitiveCategory>builder()
- .add(PrimitiveCategory.DECIMAL)
.add(PrimitiveCategory.VARCHAR)
.add(PrimitiveCategory.CHAR).build();
@@ -180,20 +179,26 @@ public final class ConstantPropagateProcFactory {
PrimitiveTypeInfo priti = (PrimitiveTypeInfo) ti;
PrimitiveTypeInfo descti = (PrimitiveTypeInfo) desc.getTypeInfo();
+
if (unSupportedTypes.contains(priti.getPrimitiveCategory())
|| unSupportedTypes.contains(descti.getPrimitiveCategory())) {
- // FIXME: support template types. It currently has conflict with
- // ExprNodeConstantDesc
+ // FIXME: support template types. It currently has conflict with ExprNodeConstantDesc
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Unsupported types " + priti + "; " + descti);
+ }
return null;
}
- // We shouldn't cast strings to other types because that can broke original data in cases of
+ // We shouldn't cast strings to other types because that can break original data in cases of
// leading zeros or zeros trailing after decimal point.
// Example: "000126" => 126 => "126"
-
- boolean brokingDataTypesCombination = (unsafeConversionTypes.contains(priti.getPrimitiveCategory()) &&
- !unsafeConversionTypes.contains(descti.getPrimitiveCategory()));
- if (performSafeTypeCast && brokingDataTypesCombination) {
+ boolean brokenDataTypesCombination = unsafeConversionTypes.contains(
+ priti.getPrimitiveCategory()) && !unsafeConversionTypes.contains(
+ descti.getPrimitiveCategory());
+ if (performSafeTypeCast && brokenDataTypesCombination) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Unsupported cast " + priti + "; " + descti);
+ }
return null;
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
index 2e1384a..78c76ab 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
@@ -190,7 +190,7 @@ class ASTBuilder {
} else {
val = literal.getValue3();
}
- type = HiveParser.TinyintLiteral;
+ type = HiveParser.IntegralLiteral;
break;
case SMALLINT:
if (useTypeQualInLiteral) {
@@ -198,11 +198,11 @@ class ASTBuilder {
} else {
val = literal.getValue3();
}
- type = HiveParser.SmallintLiteral;
+ type = HiveParser.IntegralLiteral;
break;
case INTEGER:
val = literal.getValue3();
- type = HiveParser.BigintLiteral;
+ type = HiveParser.IntegralLiteral;
break;
case BIGINT:
if (useTypeQualInLiteral) {
@@ -210,15 +210,15 @@ class ASTBuilder {
} else {
val = literal.getValue3();
}
- type = HiveParser.BigintLiteral;
+ type = HiveParser.IntegralLiteral;
break;
case DOUBLE:
val = literal.getValue3() + "D";
- type = HiveParser.Number;
+ type = HiveParser.NumberLiteral;
break;
case DECIMAL:
val = literal.getValue3() + "BD";
- type = HiveParser.DecimalLiteral;
+ type = HiveParser.NumberLiteral;
break;
case FLOAT:
case REAL:
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
index 5b32f56..9355d25 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
@@ -3483,37 +3483,18 @@ public class DDLSemanticAnalyzer extends BaseSemanticAnalyzer {
* @return
*/
private boolean isConstant(ASTNode node) {
- boolean result = false;
switch(node.getToken().getType()) {
case HiveParser.Number:
- result = true;
- break;
case HiveParser.StringLiteral:
- result = true;
- break;
- case HiveParser.BigintLiteral:
- result = true;
- break;
- case HiveParser.SmallintLiteral:
- result = true;
- break;
- case HiveParser.TinyintLiteral:
- result = true;
- break;
- case HiveParser.DecimalLiteral:
- result = true;
- break;
+ case HiveParser.IntegralLiteral:
+ case HiveParser.NumberLiteral:
case HiveParser.CharSetName:
- result = true;
- break;
case HiveParser.KW_TRUE:
case HiveParser.KW_FALSE:
- result = true;
- break;
+ return true;
default:
- break;
+ return false;
}
- return result;
}
private void validateSkewedLocationString(String newLocation) throws SemanticException {
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
index 67d8b86..665c3bb 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
@@ -410,24 +410,14 @@ CharSetLiteral
| '0' 'X' (HexDigit|Digit)+
;
-BigintLiteral
+IntegralLiteral
:
- (Digit)+ 'L'
+ (Digit)+ ('L' | 'S' | 'Y')
;
-SmallintLiteral
+NumberLiteral
:
- (Digit)+ 'S'
- ;
-
-TinyintLiteral
- :
- (Digit)+ 'Y'
- ;
-
-DecimalLiteral
- :
- Number 'B' 'D'
+ Number ('D' | 'B' 'D')
;
ByteLengthLiteral
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
index a1909a7..16251d3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
@@ -251,10 +251,8 @@ constant
| intervalLiteral
| StringLiteral
| stringLiteralSequence
- | BigintLiteral
- | SmallintLiteral
- | TinyintLiteral
- | DecimalLiteral
+ | IntegralLiteral
+ | NumberLiteral
| charSetStringLiteral
| booleanValue
;
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseUtils.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseUtils.java
index a9e503d..943e6af 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseUtils.java
@@ -174,10 +174,8 @@ public final class ParseUtils {
case HiveParser.Identifier:
case HiveParser.Number:
case HiveParser.StringLiteral:
- case HiveParser.BigintLiteral:
- case HiveParser.SmallintLiteral:
- case HiveParser.TinyintLiteral:
- case HiveParser.DecimalLiteral:
+ case HiveParser.IntegralLiteral:
+ case HiveParser.NumberLiteral:
case HiveParser.TOK_STRINGLITERALSEQUENCE:
case HiveParser.TOK_CHARSETLITERAL:
case HiveParser.TOK_DATELITERAL:
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 20d9649..96ad809 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -2487,15 +2487,13 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
break;
case HiveParser.Number:
case HiveParser.StringLiteral:
- case HiveParser.BigintLiteral:
- case HiveParser.SmallintLiteral:
- case HiveParser.TinyintLiteral:
- case HiveParser.DecimalLiteral:
+ case HiveParser.IntegralLiteral:
+ case HiveParser.NumberLiteral:
case HiveParser.TOK_STRINGLITERALSEQUENCE:
case HiveParser.TOK_CHARSETLITERAL:
case HiveParser.KW_TRUE:
case HiveParser.KW_FALSE:
- break;
+ break;
case HiveParser.TOK_FUNCTION:
// check all the arguments
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
index 239cc61..82080eb 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
@@ -174,10 +174,8 @@ public class TypeCheckProcFactory {
opRules.put(new RuleRegExp("R1", HiveParser.TOK_NULL + "%"),
tf.getNullExprProcessor());
opRules.put(new RuleRegExp("R2", HiveParser.Number + "%|" +
- HiveParser.TinyintLiteral + "%|" +
- HiveParser.SmallintLiteral + "%|" +
- HiveParser.BigintLiteral + "%|" +
- HiveParser.DecimalLiteral + "%"),
+ HiveParser.IntegralLiteral + "%|" +
+ HiveParser.NumberLiteral + "%"),
tf.getNumExprProcessor());
opRules
.put(new RuleRegExp("R3", HiveParser.Identifier + "%|"
@@ -288,6 +286,7 @@ public class TypeCheckProcFactory {
}
Number v = null;
+ ExprNodeConstantDesc decimalNode = null;
ASTNode expr = (ASTNode) nd;
// The expression can be any one of Double, Long and Integer. We
// try to parse the expression in that order to ensure that the
@@ -295,41 +294,55 @@ public class TypeCheckProcFactory {
try {
if (expr.getText().endsWith("L")) {
// Literal bigint.
- v = Long.valueOf(expr.getText().substring(
- 0, expr.getText().length() - 1));
+ v = Long.valueOf(expr.getText().substring(0, expr.getText().length() - 1));
} else if (expr.getText().endsWith("S")) {
// Literal smallint.
- v = Short.valueOf(expr.getText().substring(
- 0, expr.getText().length() - 1));
+ v = Short.valueOf(expr.getText().substring(0, expr.getText().length() - 1));
} else if (expr.getText().endsWith("Y")) {
// Literal tinyint.
- v = Byte.valueOf(expr.getText().substring(
- 0, expr.getText().length() - 1));
+ v = Byte.valueOf(expr.getText().substring(0, expr.getText().length() - 1));
} else if (expr.getText().endsWith("BD")) {
// Literal decimal
String strVal = expr.getText().substring(0, expr.getText().length() - 2);
- HiveDecimal hd = HiveDecimal.create(strVal);
- int prec = 1;
- int scale = 0;
- if (hd != null) {
- prec = hd.precision();
- scale = hd.scale();
- }
- DecimalTypeInfo typeInfo = TypeInfoFactory.getDecimalTypeInfo(prec, scale);
- return new ExprNodeConstantDesc(typeInfo, hd);
+ return createDecimal(strVal, false);
+ } else if (expr.getText().endsWith("D")) {
+ // Literal double.
+ v = Double.valueOf(expr.getText().substring(0, expr.getText().length() - 1));
} else {
v = Double.valueOf(expr.getText());
+ if (expr.getText() != null && !expr.getText().toLowerCase().contains("e")) {
+ decimalNode = createDecimal(expr.getText(), true);
+ if (decimalNode != null) {
+ v = null; // We will use decimal if all else fails.
+ }
+ }
v = Long.valueOf(expr.getText());
v = Integer.valueOf(expr.getText());
}
} catch (NumberFormatException e) {
// do nothing here, we will throw an exception in the following block
}
- if (v == null) {
- throw new SemanticException(ErrorMsg.INVALID_NUMERICAL_CONSTANT
- .getMsg(expr));
+ if (v == null && decimalNode == null) {
+ throw new SemanticException(ErrorMsg.INVALID_NUMERICAL_CONSTANT.getMsg(expr));
+ }
+ return v != null ? new ExprNodeConstantDesc(v) : decimalNode;
+ }
+
+ public static ExprNodeConstantDesc createDecimal(String strVal, boolean notNull) {
+ // Note: the normalize() call with rounding in HiveDecimal will currently reduce the
+ // precision and scale of the value by throwing away trailing zeroes. This may or may
+ // not be desirable for the literals; however, this used to be the default behavior
+ // for explicit decimal literals (e.g. 1.0BD), so we keep this behavior for now.
+ HiveDecimal hd = HiveDecimal.create(strVal);
+ if (notNull && hd == null) return null;
+ int prec = 1;
+ int scale = 0;
+ if (hd != null) {
+ prec = hd.precision();
+ scale = hd.scale();
}
- return new ExprNodeConstantDesc(v);
+ DecimalTypeInfo typeInfo = TypeInfoFactory.getDecimalTypeInfo(prec, scale);
+ return new ExprNodeConstantDesc(typeInfo, hd);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToInteger.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToInteger.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToInteger.java
index fc6540e..a7551cb 100755
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToInteger.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToInteger.java
@@ -204,7 +204,7 @@ public class UDFToInteger extends UDF {
if (i == null) {
return null;
} else {
- intWritable.set(i.getHiveDecimal().intValue());
+ intWritable.set(i.getHiveDecimal().intValue()); // TODO: lossy conversion!
return intWritable;
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToLong.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToLong.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToLong.java
index 3d85abd..c961d14 100755
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToLong.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToLong.java
@@ -207,7 +207,7 @@ public class UDFToLong extends UDF {
if (i == null) {
return null;
} else {
- longWritable.set(i.getHiveDecimal().longValue());
+ longWritable.set(i.getHiveDecimal().longValue()); // TODO: lossy conversion!
return longWritable;
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToShort.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToShort.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToShort.java
index 24533d6..570408a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToShort.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToShort.java
@@ -197,7 +197,7 @@ public class UDFToShort extends UDF {
if (i == null) {
return null;
} else {
- shortWritable.set(i.getHiveDecimal().shortValue());
+ shortWritable.set(i.getHiveDecimal().shortValue()); // TODO: lossy conversion!
return shortWritable;
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFPercentileApprox.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFPercentileApprox.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFPercentileApprox.java
index 795013a..8c5d436 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFPercentileApprox.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFPercentileApprox.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
import org.apache.hadoop.hive.serde2.objectinspector.StandardListObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.DoubleObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
@@ -66,6 +67,20 @@ import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectIn
public class GenericUDAFPercentileApprox extends AbstractGenericUDAFResolver {
static final Logger LOG = LoggerFactory.getLogger(GenericUDAFPercentileApprox.class.getName());
+ private static void verifyFractionType(ObjectInspector oi) throws UDFArgumentTypeException {
+ PrimitiveCategory pc = ((PrimitiveObjectInspector)oi).getPrimitiveCategory();
+ switch(pc) {
+ case FLOAT:
+ case DOUBLE:
+ case DECIMAL:
+ break;
+ default:
+ throw new UDFArgumentTypeException(1, "Only a floating point or decimal, or "
+ + "floating point or decimal array argument is accepted as parameter 2, but "
+ + pc + " was passed instead.");
+ }
+ }
+
@Override
public GenericUDAFEvaluator getEvaluator(GenericUDAFParameterInfo info) throws SemanticException {
ObjectInspector[] parameters = info.getParameterObjectInspectors();
@@ -91,7 +106,6 @@ public class GenericUDAFPercentileApprox extends AbstractGenericUDAFResolver {
case TIMESTAMP:
case DECIMAL:
break;
- case DATE:
default:
throw new UDFArgumentTypeException(0,
"Only numeric type arguments are accepted but "
@@ -103,15 +117,7 @@ public class GenericUDAFPercentileApprox extends AbstractGenericUDAFResolver {
switch(parameters[1].getCategory()) {
case PRIMITIVE:
// Only a single double was passed as parameter 2, a single quantile is being requested
- switch(((PrimitiveObjectInspector) parameters[1]).getPrimitiveCategory()) {
- case FLOAT:
- case DOUBLE:
- break;
- default:
- throw new UDFArgumentTypeException(1,
- "Only a float/double or float/double array argument is accepted as parameter 2, but "
- + parameters[1].getTypeName() + " was passed instead.");
- }
+ verifyFractionType(parameters[1]);
break;
case LIST:
@@ -119,28 +125,19 @@ public class GenericUDAFPercentileApprox extends AbstractGenericUDAFResolver {
if(((ListObjectInspector) parameters[1]).getListElementObjectInspector().getCategory() !=
ObjectInspector.Category.PRIMITIVE) {
throw new UDFArgumentTypeException(1,
- "A float/double array argument may be passed as parameter 2, but "
+ "A floating point or decimal array argument may be passed as parameter 2, but "
+ parameters[1].getTypeName() + " was passed instead.");
}
// Now make sure it's an array of doubles or floats. We don't allow integer types here
// because percentile (really, quantile) values should generally be strictly between 0 and 1.
- switch(((PrimitiveObjectInspector)((ListObjectInspector) parameters[1]).getListElementObjectInspector()).
- getPrimitiveCategory()) {
- case FLOAT:
- case DOUBLE:
- break;
- default:
- throw new UDFArgumentTypeException(1,
- "A float/double array argument may be passed as parameter 2, but "
- + parameters[1].getTypeName() + " was passed instead.");
- }
+ verifyFractionType(((ListObjectInspector) parameters[1]).getListElementObjectInspector());
wantManyQuantiles = true;
break;
default:
throw new UDFArgumentTypeException(1,
- "Only a float/double or float/double array argument is accepted as parameter 2, but "
- + parameters[1].getTypeName() + " was passed instead.");
+ "Only a floating point or decimal, or floating point or decimal array argument is accepted"
+ + " as parameter 2, but " + parameters[1].getTypeName() + " was passed instead.");
}
// Also make sure it is a constant.
if (!ObjectInspectorUtils.isConstantObjectInspector(parameters[1])) {
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLeadLag.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLeadLag.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLeadLag.java
index 351b593..b3b36bc 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLeadLag.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLeadLag.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hive.ql.udf.generic;
import org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator;
import org.apache.hadoop.hive.ql.exec.PTFPartition.PTFPartitionIterator;
-import org.apache.hadoop.hive.ql.exec.PTFUtils;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
@@ -37,7 +36,6 @@ public abstract class GenericUDFLeadLag extends GenericUDF {
transient ExprNodeEvaluator exprEvaluator;
transient PTFPartitionIterator<Object> pItr;
transient ObjectInspector firstArgOI;
- transient ObjectInspector defaultArgOI;
transient Converter defaultValueConverter;
int amt;
@@ -46,7 +44,7 @@ public abstract class GenericUDFLeadLag extends GenericUDF {
Object defaultVal = null;
if (arguments.length == 3) {
defaultVal = ObjectInspectorUtils.copyToStandardObject(
- defaultValueConverter.convert(arguments[2].get()), defaultArgOI);
+ defaultValueConverter.convert(arguments[2].get()), firstArgOI);
}
int idx = pItr.getIndex() - 1;
@@ -98,10 +96,7 @@ public abstract class GenericUDFLeadLag extends GenericUDF {
}
if (arguments.length == 3) {
- defaultArgOI = arguments[2];
- ObjectInspectorConverters.getConverter(arguments[2], arguments[0]);
defaultValueConverter = ObjectInspectorConverters.getConverter(arguments[2], arguments[0]);
-
}
firstArgOI = arguments[0];
@@ -133,14 +128,6 @@ public abstract class GenericUDFLeadLag extends GenericUDF {
this.firstArgOI = firstArgOI;
}
- public ObjectInspector getDefaultArgOI() {
- return defaultArgOI;
- }
-
- public void setDefaultArgOI(ObjectInspector defaultArgOI) {
- this.defaultArgOI = defaultArgOI;
- }
-
public Converter getDefaultValueConverter() {
return defaultValueConverter;
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDivide.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDivide.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDivide.java
index 89e69be..746d87a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDivide.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDivide.java
@@ -110,19 +110,24 @@ public class GenericUDFOPDivide extends GenericUDFBaseNumeric {
return decimalWritable;
}
+ private final static int MIN_START_DEC_DIGITS = 6;
+ private final static int DEFAULT_DEC_DIGITS = 18;
/**
* A balanced way to determine the precision/scale of decimal division result. Integer digits and
* decimal digits are computed independently. However, when the precision from above reaches above
- * HiveDecimal.MAX_PRECISION, interger digit and decimal digits are shrunk equally to fit.
+ * HiveDecimal.MAX_PRECISION, integer digit and decimal digits are shrunk equally to fit.
*/
@Override
protected DecimalTypeInfo deriveResultDecimalTypeInfo(int prec1, int scale1, int prec2, int scale2) {
int intDig = Math.min(HiveDecimal.MAX_SCALE, prec1 - scale1 + scale2);
- int decDig = Math.min(HiveDecimal.MAX_SCALE, Math.max(6, scale1 + prec2 + 1));
+ int decDig = Math.min(HiveDecimal.MAX_SCALE,
+ Math.max(MIN_START_DEC_DIGITS, scale1 + prec2 + 1));
int diff = intDig + decDig - HiveDecimal.MAX_SCALE;
if (diff > 0) {
decDig -= diff/2 + 1; // Slight negative bias.
intDig = HiveDecimal.MAX_SCALE - decDig;
+ } else if (diff < 0 && decDig < DEFAULT_DEC_DIGITS) {
+ decDig += Math.min(-diff, DEFAULT_DEC_DIGITS - decDig);
}
return TypeInfoFactory.getDecimalTypeInfo(intDig + decDig, decDig);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFPrintf.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFPrintf.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFPrintf.java
index e52e431..e087986 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFPrintf.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFPrintf.java
@@ -18,10 +18,13 @@
package org.apache.hadoop.hive.ql.udf.generic;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Formatter;
+import java.util.IllegalFormatConversionException;
import java.util.Locale;
+import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
@@ -111,7 +114,8 @@ public class GenericUDFPrintf extends GenericUDF {
ArrayList<Object> argumentList = new ArrayList<Object>();
for (int i = 1; i < arguments.length; i++) {
- switch (((PrimitiveObjectInspector)argumentOIs[i]).getPrimitiveCategory()) {
+ PrimitiveObjectInspector poi = (PrimitiveObjectInspector)argumentOIs[i];
+ switch (poi.getPrimitiveCategory()) {
case BOOLEAN:
case BYTE:
case SHORT:
@@ -123,9 +127,17 @@ public class GenericUDFPrintf extends GenericUDF {
case VARCHAR:
case STRING:
case TIMESTAMP:
+ argumentList.add(poi.getPrimitiveJavaObject(arguments[i].get()));
+ break;
case DECIMAL:
- argumentList.add(((PrimitiveObjectInspector)argumentOIs[i])
- .getPrimitiveJavaObject(arguments[i].get()));
+ // Decimal classes cannot be converted by printf, so convert them to doubles.
+ Object obj = poi.getPrimitiveJavaObject(arguments[i].get());
+ if (obj instanceof HiveDecimal) {
+ obj = ((HiveDecimal)obj).doubleValue();
+ } else if (obj instanceof BigDecimal) {
+ obj = ((BigDecimal)obj).doubleValue();
+ }
+ argumentList.add(obj);
break;
default:
argumentList.add(arguments[i].get());
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
index b89c14e..3a2bc4f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
@@ -1255,7 +1255,7 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
HiveDecimal d2 = PrimitiveObjectInspectorUtils.getHiveDecimal(v2,
(PrimitiveObjectInspector) expressionDef.getOI());
if ( d1 != null && d2 != null ) {
- return d1.subtract(d2).intValue() > amt;
+ return d1.subtract(d2).intValue() > amt; // TODO: lossy conversion!
}
return d1 != null || d2 != null; // True if only one value is null
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPDivide.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPDivide.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPDivide.java
index 6fa3b3f..59fb7dc 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPDivide.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPDivide.java
@@ -45,7 +45,6 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
@Test
public void testByteDivideShort() throws HiveException {
GenericUDFOPDivide udf = new GenericUDFOPDivide();
-
ByteWritable left = new ByteWritable((byte) 4);
ShortWritable right = new ShortWritable((short) 6);
ObjectInspector[] inputOIs = {
@@ -58,9 +57,9 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
};
PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
- Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.getDecimalTypeInfo(9, 6));
+ Assert.assertEquals(oi.getTypeInfo(), TypeInfoFactory.getDecimalTypeInfo(21, 18));
HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
- Assert.assertEquals(HiveDecimal.create("0.666667"), res.getHiveDecimal());
+ Assert.assertEquals(HiveDecimal.create("0.666666666666666667"), res.getHiveDecimal());
}
@Test
@@ -109,12 +108,12 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
@Test
public void testLongDivideDecimal() throws HiveException {
GenericUDFOPDivide udf = new GenericUDFOPDivide();
-
LongWritable left = new LongWritable(104);
HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
ObjectInspector[] inputOIs = {
PrimitiveObjectInspectorFactory.writableLongObjectInspector,
- PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(9, 4))
+ PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
+ TypeInfoFactory.getDecimalTypeInfo(38, 15))
};
DeferredObject[] args = {
new DeferredJavaObject(left),
@@ -122,9 +121,9 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
};
PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
- Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(33, 10), oi.getTypeInfo());
+ Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(38, 20), oi.getTypeInfo());
HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
- Assert.assertEquals(HiveDecimal.create("0.4426096949"), res.getHiveDecimal());
+ Assert.assertEquals(HiveDecimal.create("0.44260969485466229731"), res.getHiveDecimal());
}
@Test
@@ -149,7 +148,7 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
}
@Test
- public void testDouleDivideDecimal() throws HiveException {
+ public void testDoubleDivideDecimal() throws HiveException {
GenericUDFOPDivide udf = new GenericUDFOPDivide();
DoubleWritable left = new DoubleWritable(74.52);
@@ -176,24 +175,25 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
HiveDecimalWritable left = new HiveDecimalWritable(HiveDecimal.create("14.5"));
HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("234.97"));
ObjectInspector[] inputOIs = {
- PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(3, 1)),
- PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory.getDecimalTypeInfo(5, 2))
+ PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
+ TypeInfoFactory.getDecimalTypeInfo(3, 1)),
+ PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
+ TypeInfoFactory.getDecimalTypeInfo(5, 2))
};
DeferredObject[] args = {
new DeferredJavaObject(left),
new DeferredJavaObject(right),
};
-
+
PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
- Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(11, 7), oi.getTypeInfo());
+ Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(22, 18), oi.getTypeInfo());
HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
- Assert.assertEquals(HiveDecimal.create("0.06171"), res.getHiveDecimal());
+ Assert.assertEquals(HiveDecimal.create("0.061710005532621186"), res.getHiveDecimal());
}
@Test
public void testDecimalDivideDecimal2() throws HiveException {
GenericUDFOPDivide udf = new GenericUDFOPDivide();
-
HiveDecimalWritable left = new HiveDecimalWritable(HiveDecimal.create("5"));
HiveDecimalWritable right = new HiveDecimalWritable(HiveDecimal.create("25"));
ObjectInspector[] inputOIs = {
@@ -206,7 +206,7 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
};
PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
- Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(7, 6), oi.getTypeInfo());
+ Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(19, 18), oi.getTypeInfo());
HiveDecimalWritable res = (HiveDecimalWritable) udf.evaluate(args);
Assert.assertEquals(HiveDecimal.create("0.2"), res.getHiveDecimal());
}
@@ -221,19 +221,19 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
};
PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
- Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(13, 8), oi.getTypeInfo());
+ Assert.assertEquals(TypeInfoFactory.getDecimalTypeInfo(23, 18), oi.getTypeInfo());
}
@Test
public void testDecimalDivisionResultType() throws HiveException {
- testDecimalDivisionResultType(5, 2, 3, 2, 11, 6);
+ testDecimalDivisionResultType(5, 2, 3, 2, 23, 18);
testDecimalDivisionResultType(38, 18, 38, 18, 38, 18);
testDecimalDivisionResultType(38, 18, 20, 0, 38, 27);
- testDecimalDivisionResultType(20, 0, 8, 5, 34, 9);
- testDecimalDivisionResultType(10, 0, 10, 0, 21, 11);
- testDecimalDivisionResultType(5, 2, 5, 5, 16, 8);
- testDecimalDivisionResultType(10, 10, 5, 0, 16, 16);
- testDecimalDivisionResultType(10, 10, 5, 5, 21, 16);
+ testDecimalDivisionResultType(20, 0, 8, 5, 38, 13);
+ testDecimalDivisionResultType(10, 0, 10, 0, 28, 18);
+ testDecimalDivisionResultType(5, 2, 5, 5, 26, 18);
+ testDecimalDivisionResultType(10, 10, 5, 0, 18, 18);
+ testDecimalDivisionResultType(10, 10, 5, 5, 23, 18);
testDecimalDivisionResultType(38, 38, 38, 38, 38, 18);
testDecimalDivisionResultType(38, 0, 38, 0, 38, 18);
}
@@ -259,7 +259,7 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
verifyReturnType(new GenericUDFOPDivide(), "int", "int", "double"); // different from sql compat mode
verifyReturnType(new GenericUDFOPDivide(), "int", "float", "double");
verifyReturnType(new GenericUDFOPDivide(), "int", "double", "double");
- verifyReturnType(new GenericUDFOPDivide(), "int", "decimal(10,2)", "decimal(23,11)");
+ verifyReturnType(new GenericUDFOPDivide(), "int", "decimal(10,2)", "decimal(30,18)");
verifyReturnType(new GenericUDFOPDivide(), "float", "float", "double");
verifyReturnType(new GenericUDFOPDivide(), "float", "double", "double");
@@ -268,7 +268,7 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
verifyReturnType(new GenericUDFOPDivide(), "double", "double", "double");
verifyReturnType(new GenericUDFOPDivide(), "double", "decimal(10,2)", "double");
- verifyReturnType(new GenericUDFOPDivide(), "decimal(10,2)", "decimal(10,2)", "decimal(23,13)");
+ verifyReturnType(new GenericUDFOPDivide(), "decimal(10,2)", "decimal(10,2)", "decimal(28,18)");
// Most tests are done with ANSI SQL mode enabled, set it back to true
SessionState.get().getConf().setVar(HiveConf.ConfVars.HIVE_COMPAT, "latest");
@@ -278,10 +278,10 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
public void testReturnTypeAnsiSql() throws Exception {
SessionState.get().getConf().setVar(HiveConf.ConfVars.HIVE_COMPAT, "latest");
- verifyReturnType(new GenericUDFOPDivide(), "int", "int", "decimal(21,11)");
+ verifyReturnType(new GenericUDFOPDivide(), "int", "int", "decimal(28,18)");
verifyReturnType(new GenericUDFOPDivide(), "int", "float", "double");
verifyReturnType(new GenericUDFOPDivide(), "int", "double", "double");
- verifyReturnType(new GenericUDFOPDivide(), "int", "decimal(10,2)", "decimal(23,11)");
+ verifyReturnType(new GenericUDFOPDivide(), "int", "decimal(10,2)", "decimal(30,18)");
verifyReturnType(new GenericUDFOPDivide(), "float", "float", "double");
verifyReturnType(new GenericUDFOPDivide(), "float", "double", "double");
@@ -290,6 +290,6 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
verifyReturnType(new GenericUDFOPDivide(), "double", "double", "double");
verifyReturnType(new GenericUDFOPDivide(), "double", "decimal(10,2)", "double");
- verifyReturnType(new GenericUDFOPDivide(), "decimal(10,2)", "decimal(10,2)", "decimal(23,13)");
+ verifyReturnType(new GenericUDFOPDivide(), "decimal(10,2)", "decimal(10,2)", "decimal(28,18)");
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/queries/clientnegative/compare_double_bigint.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/compare_double_bigint.q b/ql/src/test/queries/clientnegative/compare_double_bigint.q
index 8ee4b27..f85c526 100644
--- a/ql/src/test/queries/clientnegative/compare_double_bigint.q
+++ b/ql/src/test/queries/clientnegative/compare_double_bigint.q
@@ -2,4 +2,4 @@ set hive.mapred.mode=strict;
-- This should fail until we fix the issue with precision when casting a bigint to a double
-select * from src where cast(1 as bigint) = 1.0 limit 10;
\ No newline at end of file
+select * from src where cast(1 as bigint) = cast(1.0 as double) limit 10;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/queries/clientpositive/implicit_decimal.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/implicit_decimal.q b/ql/src/test/queries/clientpositive/implicit_decimal.q
new file mode 100644
index 0000000..b32f9d0
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/implicit_decimal.q
@@ -0,0 +1,14 @@
+set hive.fetch.task.conversion=none;
+
+drop table decimal_test;
+create table decimal_test (dc decimal(38,18));
+insert into table decimal_test values (4327269606205.029297);
+
+explain
+select * from decimal_test where dc = 4327269606205.029297;
+select * from decimal_test where dc = 4327269606205.029297;
+
+set hive.cbo.enable=false;
+select * from decimal_test where dc = 4327269606205.029297;
+
+drop table decimal_test;
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/queries/clientpositive/input_lazyserde.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/input_lazyserde.q b/ql/src/test/queries/clientpositive/input_lazyserde.q
index 74d7a2a..c29cb82 100644
--- a/ql/src/test/queries/clientpositive/input_lazyserde.q
+++ b/ql/src/test/queries/clientpositive/input_lazyserde.q
@@ -32,7 +32,7 @@ INSERT OVERWRITE TABLE dest1 SELECT src_thrift.mstringstring FROM src_thrift DIS
SELECT * from dest1;
CREATE TABLE destBin(a UNIONTYPE<int, double, array<string>, struct<col1:int,col2:string>>) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe' STORED AS SEQUENCEFILE;
-INSERT OVERWRITE TABLE destBin SELECT create_union( CASE WHEN key < 100 THEN 0 WHEN key < 200 THEN 1 WHEN key < 300 THEN 2 WHEN key < 400 THEN 3 ELSE 0 END, key, 2.0, array("one","two"), struct(5,"five")) FROM srcbucket2;
+INSERT OVERWRITE TABLE destBin SELECT create_union( CASE WHEN key < 100 THEN 0 WHEN key < 200 THEN 1 WHEN key < 300 THEN 2 WHEN key < 400 THEN 3 ELSE 0 END, key, 2.0D, array("one","two"), struct(5,"five")) FROM srcbucket2;
SELECT * from destBin;
DROP TABLE destBin;
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/queries/clientpositive/udf_java_method.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/udf_java_method.q b/ql/src/test/queries/clientpositive/udf_java_method.q
index c0598cd..8ed2b44 100644
--- a/ql/src/test/queries/clientpositive/udf_java_method.q
+++ b/ql/src/test/queries/clientpositive/udf_java_method.q
@@ -10,9 +10,9 @@ SELECT java_method("java.lang.String", "valueOf", 1),
java_method("java.lang.String", "isEmpty"),
java_method("java.lang.Math", "max", 2, 3),
java_method("java.lang.Math", "min", 2, 3),
- java_method("java.lang.Math", "round", 2.5),
- round(java_method("java.lang.Math", "exp", 1.0), 6),
- java_method("java.lang.Math", "floor", 1.9)
+ java_method("java.lang.Math", "round", 2.5D),
+ round(java_method("java.lang.Math", "exp", 1.0D), 6),
+ java_method("java.lang.Math", "floor", 1.9D)
FROM src tablesample (1 rows);
@@ -20,8 +20,8 @@ SELECT java_method("java.lang.String", "valueOf", 1),
java_method("java.lang.String", "isEmpty"),
java_method("java.lang.Math", "max", 2, 3),
java_method("java.lang.Math", "min", 2, 3),
- java_method("java.lang.Math", "round", 2.5),
- round(java_method("java.lang.Math", "exp", 1.0), 6),
- java_method("java.lang.Math", "floor", 1.9)
+ java_method("java.lang.Math", "round", 2.5D),
+ round(java_method("java.lang.Math", "exp", 1.0D), 6),
+ java_method("java.lang.Math", "floor", 1.9D)
FROM src tablesample (1 rows);
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/queries/clientpositive/udf_reflect.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/udf_reflect.q b/ql/src/test/queries/clientpositive/udf_reflect.q
index 97fa817..7fa9bf1 100644
--- a/ql/src/test/queries/clientpositive/udf_reflect.q
+++ b/ql/src/test/queries/clientpositive/udf_reflect.q
@@ -8,9 +8,9 @@ SELECT reflect("java.lang.String", "valueOf", 1),
reflect("java.lang.String", "isEmpty"),
reflect("java.lang.Math", "max", 2, 3),
reflect("java.lang.Math", "min", 2, 3),
- reflect("java.lang.Math", "round", 2.5),
- round(reflect("java.lang.Math", "exp", 1.0), 6),
- reflect("java.lang.Math", "floor", 1.9),
+ reflect("java.lang.Math", "round", 2.5D),
+ round(reflect("java.lang.Math", "exp", 1.0D), 6),
+ reflect("java.lang.Math", "floor", 1.9D),
reflect("java.lang.Integer", "valueOf", key, 16)
FROM src tablesample (1 rows);
@@ -19,8 +19,8 @@ SELECT reflect("java.lang.String", "valueOf", 1),
reflect("java.lang.String", "isEmpty"),
reflect("java.lang.Math", "max", 2, 3),
reflect("java.lang.Math", "min", 2, 3),
- reflect("java.lang.Math", "round", 2.5),
- round(reflect("java.lang.Math", "exp", 1.0), 6),
- reflect("java.lang.Math", "floor", 1.9),
+ reflect("java.lang.Math", "round", 2.5D),
+ round(reflect("java.lang.Math", "exp", 1.0D), 6),
+ reflect("java.lang.Math", "floor", 1.9D),
reflect("java.lang.Integer", "valueOf", key, 16)
FROM src tablesample (1 rows);
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/queries/clientpositive/vector_struct_in.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/vector_struct_in.q b/ql/src/test/queries/clientpositive/vector_struct_in.q
index 0e3a4ca..42ee938 100644
--- a/ql/src/test/queries/clientpositive/vector_struct_in.q
+++ b/ql/src/test/queries/clientpositive/vector_struct_in.q
@@ -191,57 +191,57 @@ insert into table test_4 values (1, "b", 1.5), (1, "a", 0.5), (2, "b", 1.5);
explain
select * from test_4 where struct(`my_bigint`, `my_string`, `my_double`)
IN (
-struct(1L, "a", 1.5),
-struct(1L, "b", -0.5),
-struct(3L, "b", 1.5),
-struct(1L, "d", 1.5),
-struct(1L, "c", 1.5),
-struct(1L, "b", 2.5),
-struct(1L, "b", 0.5),
-struct(5L, "b", 1.5),
-struct(1L, "a", 0.5),
-struct(3L, "b", 1.5)
+struct(1L, "a", 1.5D),
+struct(1L, "b", -0.5D),
+struct(3L, "b", 1.5D),
+struct(1L, "d", 1.5D),
+struct(1L, "c", 1.5D),
+struct(1L, "b", 2.5D),
+struct(1L, "b", 0.5D),
+struct(5L, "b", 1.5D),
+struct(1L, "a", 0.5D),
+struct(3L, "b", 1.5D)
);
select * from test_4 where struct(`my_bigint`, `my_string`, `my_double`)
IN (
-struct(1L, "a", 1.5),
-struct(1L, "b", -0.5),
-struct(3L, "b", 1.5),
-struct(1L, "d", 1.5),
-struct(1L, "c", 1.5),
-struct(1L, "b", 2.5),
-struct(1L, "b", 0.5),
-struct(5L, "b", 1.5),
-struct(1L, "a", 0.5),
-struct(3L, "b", 1.5)
+struct(1L, "a", 1.5D),
+struct(1L, "b", -0.5D),
+struct(3L, "b", 1.5D),
+struct(1L, "d", 1.5D),
+struct(1L, "c", 1.5D),
+struct(1L, "b", 2.5D),
+struct(1L, "b", 0.5D),
+struct(5L, "b", 1.5D),
+struct(1L, "a", 0.5D),
+struct(3L, "b", 1.5D)
);
explain
select `my_bigint`, `my_string`, `my_double`, struct(`my_bigint`, `my_string`, `my_double`)
IN (
-struct(1L, "a", 1.5),
-struct(1L, "b", -0.5),
-struct(3L, "b", 1.5),
-struct(1L, "d", 1.5),
-struct(1L, "c", 1.5),
-struct(1L, "b", 2.5),
-struct(1L, "b", 0.5),
-struct(5L, "b", 1.5),
-struct(1L, "a", 0.5),
-struct(3L, "b", 1.5)
+struct(1L, "a", 1.5D),
+struct(1L, "b", -0.5D),
+struct(3L, "b", 1.5D),
+struct(1L, "d", 1.5D),
+struct(1L, "c", 1.5D),
+struct(1L, "b", 2.5D),
+struct(1L, "b", 0.5D),
+struct(5L, "b", 1.5D),
+struct(1L, "a", 0.5D),
+struct(3L, "b", 1.5D)
) as b from test_4;
select `my_bigint`, `my_string`, `my_double`, struct(`my_bigint`, `my_string`, `my_double`)
IN (
-struct(1L, "a", 1.5),
-struct(1L, "b", -0.5),
-struct(3L, "b", 1.5),
-struct(1L, "d", 1.5),
-struct(1L, "c", 1.5),
-struct(1L, "b", 2.5),
-struct(1L, "b", 0.5),
-struct(5L, "b", 1.5),
-struct(1L, "a", 0.5),
-struct(3L, "b", 1.5)
+struct(1L, "a", 1.5D),
+struct(1L, "b", -0.5D),
+struct(3L, "b", 1.5D),
+struct(1L, "d", 1.5D),
+struct(1L, "c", 1.5D),
+struct(1L, "b", 2.5D),
+struct(1L, "b", 0.5D),
+struct(5L, "b", 1.5D),
+struct(1L, "a", 0.5D),
+struct(3L, "b", 1.5D)
) as b from test_4;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientnegative/no_matching_udf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/no_matching_udf.q.out b/ql/src/test/results/clientnegative/no_matching_udf.q.out
index cd3e72d..cf17668 100644
--- a/ql/src/test/results/clientnegative/no_matching_udf.q.out
+++ b/ql/src/test/results/clientnegative/no_matching_udf.q.out
@@ -1 +1 @@
-FAILED: NoMatchingMethodException No matching method for class org.apache.hadoop.hive.ql.udf.UDAFPercentile with (double, double). Possible choices: _FUNC_(bigint, array<double>) _FUNC_(bigint, double)
+FAILED: NoMatchingMethodException No matching method for class org.apache.hadoop.hive.ql.udf.UDAFPercentile with (decimal(2,1), decimal(2,2)). Possible choices: _FUNC_(bigint, array<double>) _FUNC_(bigint, double)
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientnegative/udf_add_months_error_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_add_months_error_2.q.out b/ql/src/test/results/clientnegative/udf_add_months_error_2.q.out
index 897f4f2..fd142d7 100644
--- a/ql/src/test/results/clientnegative/udf_add_months_error_2.q.out
+++ b/ql/src/test/results/clientnegative/udf_add_months_error_2.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10016]: Line 1:32 Argument type mismatch '2.4': add_months only takes INT/SHORT/BYTE types as 2nd argument, got DOUBLE
+FAILED: SemanticException [Error 10016]: Line 1:32 Argument type mismatch '2.4': add_months only takes INT/SHORT/BYTE types as 2nd argument, got DECIMAL
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientnegative/udf_format_number_wrong4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_format_number_wrong4.q.out b/ql/src/test/results/clientnegative/udf_format_number_wrong4.q.out
index 6eca7f8..1536041 100644
--- a/ql/src/test/results/clientnegative/udf_format_number_wrong4.q.out
+++ b/ql/src/test/results/clientnegative/udf_format_number_wrong4.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10016]: Line 2:35 Argument type mismatch '4.01': Argument 2 of function FORMAT_NUMBER must be "tinyint" or "smallint" or "int" or "bigint" or "string", but "double" was found.
+FAILED: SemanticException [Error 10016]: Line 2:35 Argument type mismatch '4.01': Argument 2 of function FORMAT_NUMBER must be "tinyint" or "smallint" or "int" or "bigint" or "string", but "decimal(3,2)" was found.
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientnegative/udf_format_number_wrong5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_format_number_wrong5.q.out b/ql/src/test/results/clientnegative/udf_format_number_wrong5.q.out
index 6d7a3c1..5db7248 100644
--- a/ql/src/test/results/clientnegative/udf_format_number_wrong5.q.out
+++ b/ql/src/test/results/clientnegative/udf_format_number_wrong5.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10016]: Line 2:21 Argument type mismatch '321.23': Argument 1 of function FORMAT_NUMBER must be "tinyint" or "smallint" or "int" or "bigint" or "double" or "float" or "decimal", but "array<double>" was found.
+FAILED: SemanticException [Error 10016]: Line 2:21 Argument type mismatch '321.23': Argument 1 of function FORMAT_NUMBER must be "tinyint" or "smallint" or "int" or "bigint" or "double" or "float" or "decimal", but "array<decimal(11,6)>" was found.
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientnegative/udf_trunc_error2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_trunc_error2.q.out b/ql/src/test/results/clientnegative/udf_trunc_error2.q.out
index 7d089fd..55a2185 100644
--- a/ql/src/test/results/clientnegative/udf_trunc_error2.q.out
+++ b/ql/src/test/results/clientnegative/udf_trunc_error2.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10016]: Line 1:13 Argument type mismatch '1.0': TRUNC() only takes STRING/TIMESTAMP/DATEWRITABLE types as first argument, got DOUBLE
+FAILED: SemanticException [Error 10016]: Line 1:13 Argument type mismatch '1.0': TRUNC() only takes STRING/TIMESTAMP/DATEWRITABLE types as first argument, got DECIMAL
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientnegative/wrong_column_type.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/wrong_column_type.q.out b/ql/src/test/results/clientnegative/wrong_column_type.q.out
index be48c4e..6ff90ea 100644
--- a/ql/src/test/results/clientnegative/wrong_column_type.q.out
+++ b/ql/src/test/results/clientnegative/wrong_column_type.q.out
@@ -6,4 +6,4 @@ POSTHOOK: query: CREATE TABLE dest1(a float)
POSTHOOK: type: CREATETABLE
POSTHOOK: Output: database:default
POSTHOOK: Output: default@dest1
-FAILED: NoMatchingMethodException No matching method for class org.apache.hadoop.hive.ql.udf.UDFToFloat with (array<double>). Possible choices: _FUNC_(bigint) _FUNC_(boolean) _FUNC_(decimal(38,18)) _FUNC_(double) _FUNC_(int) _FUNC_(smallint) _FUNC_(string) _FUNC_(timestamp) _FUNC_(tinyint) _FUNC_(void)
+FAILED: NoMatchingMethodException No matching method for class org.apache.hadoop.hive.ql.udf.UDFToFloat with (array<decimal(1,0)>). Possible choices: _FUNC_(bigint) _FUNC_(boolean) _FUNC_(decimal(38,18)) _FUNC_(double) _FUNC_(int) _FUNC_(smallint) _FUNC_(string) _FUNC_(timestamp) _FUNC_(tinyint) _FUNC_(void)
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientpositive/annotate_stats_select.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/annotate_stats_select.q.out b/ql/src/test/results/clientpositive/annotate_stats_select.q.out
index a03040a..03944fa 100644
--- a/ql/src/test/results/clientpositive/annotate_stats_select.q.out
+++ b/ql/src/test/results/clientpositive/annotate_stats_select.q.out
@@ -351,9 +351,9 @@ STAGE PLANS:
alias: alltypes_orc
Statistics: Num rows: 2 Data size: 1686 Basic stats: COMPLETE Column stats: COMPLETE
Select Operator
- expressions: 11.0 (type: double)
+ expressions: 11 (type: int)
outputColumnNames: _col0
- Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
+ Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
ListSink
PREHOOK: query: -- numRows: 2 rawDataSize: 178
@@ -949,12 +949,12 @@ STAGE PLANS:
Number of rows: 10
Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
Select Operator
- expressions: 11.0 (type: double)
+ expressions: 11 (type: int)
outputColumnNames: _col0
- Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
+ Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
File Output Operator
compressed: false
- Statistics: Num rows: 2 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
+ Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -1081,12 +1081,12 @@ STAGE PLANS:
Number of rows: 10
Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
Select Operator
- expressions: 'hello' (type: string), 11.0 (type: double)
+ expressions: 'hello' (type: string), 11 (type: int)
outputColumnNames: _col0, _col1
- Statistics: Num rows: 2 Data size: 194 Basic stats: COMPLETE Column stats: COMPLETE
+ Statistics: Num rows: 2 Data size: 186 Basic stats: COMPLETE Column stats: COMPLETE
File Output Operator
compressed: false
- Statistics: Num rows: 2 Data size: 194 Basic stats: COMPLETE Column stats: COMPLETE
+ Statistics: Num rows: 2 Data size: 186 Basic stats: COMPLETE Column stats: COMPLETE
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out b/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out
index dd12b02..7d345fc 100644
--- a/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out
+++ b/ql/src/test/results/clientpositive/ansi_sql_arithmetic.q.out
@@ -16,7 +16,7 @@ STAGE PLANS:
alias: src
Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: (CAST( UDFToInteger(key) AS decimal(10,0)) / CAST( UDFToInteger(key) AS decimal(10,0))) (type: decimal(21,11))
+ expressions: (CAST( UDFToInteger(key) AS decimal(10,0)) / CAST( UDFToInteger(key) AS decimal(10,0))) (type: decimal(28,18))
outputColumnNames: _col0
Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
Limit
@@ -44,7 +44,7 @@ POSTHOOK: query: select cast(key as int) / cast(key as int) from src limit 1
POSTHOOK: type: QUERY
POSTHOOK: Input: default@src
#### A masked pattern was here ####
-1.00000000000
+1.000000000000000000
PREHOOK: query: -- With ansi sql arithmetic disabled, int / int => double
explain select cast(key as int) / cast(key as int) from src limit 1
PREHOOK: type: QUERY
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientpositive/cast1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cast1.q.out b/ql/src/test/results/clientpositive/cast1.q.out
index d87c04c..1a246c0 100644
--- a/ql/src/test/results/clientpositive/cast1.q.out
+++ b/ql/src/test/results/clientpositive/cast1.q.out
@@ -106,9 +106,9 @@ POSTHOOK: type: QUERY
POSTHOOK: Input: default@src
POSTHOOK: Output: default@dest1
POSTHOOK: Lineage: dest1.c1 SIMPLE []
-POSTHOOK: Lineage: dest1.c2 SIMPLE []
-POSTHOOK: Lineage: dest1.c3 SIMPLE []
-POSTHOOK: Lineage: dest1.c4 SIMPLE []
+POSTHOOK: Lineage: dest1.c2 EXPRESSION []
+POSTHOOK: Lineage: dest1.c3 EXPRESSION []
+POSTHOOK: Lineage: dest1.c4 EXPRESSION []
POSTHOOK: Lineage: dest1.c5 SIMPLE []
POSTHOOK: Lineage: dest1.c6 SIMPLE []
POSTHOOK: Lineage: dest1.c7 SIMPLE []
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientpositive/decimal_6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_6.q.out b/ql/src/test/results/clientpositive/decimal_6.q.out
index 2c2c97a..8504f2b 100644
--- a/ql/src/test/results/clientpositive/decimal_6.q.out
+++ b/ql/src/test/results/clientpositive/decimal_6.q.out
@@ -144,5 +144,5 @@ PREHOOK: Input: default@decimal_6_3
POSTHOOK: query: desc DECIMAL_6_3
POSTHOOK: type: DESCTABLE
POSTHOOK: Input: default@decimal_6_3
-k double
+k decimal(11,5)
v int
http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientpositive/decimal_precision.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_precision.q.out b/ql/src/test/results/clientpositive/decimal_precision.q.out
index fa26248..23eda1c 100644
--- a/ql/src/test/results/clientpositive/decimal_precision.q.out
+++ b/ql/src/test/results/clientpositive/decimal_precision.q.out
@@ -242,37 +242,37 @@ NULL NULL NULL
NULL NULL NULL
NULL NULL NULL
NULL NULL NULL
-0.0000000000 0.0000000000 0.000000000000
-0.0000000000 0.0000000000 0.000000000000
-0.0000000000 0.0000000000 0.000000000000
-0.0000000000 0.0000000000 0.000000000000
-0.0000000000 0.0000000000 0.000000000000
-0.1234567890 0.2469135780 0.041152263000
-0.1234567890 0.2469135780 0.041152263000
-1.2345678901 2.4691357802 0.411522630033
-1.2345678901 2.4691357802 0.411522630033
-1.2345678901 2.4691357802 0.411522630033
-12.3456789012 24.6913578024 4.115226300400
-12.3456789012 24.6913578024 4.115226300400
-12.3456789012 24.6913578024 4.115226300400
-123.4567890123 246.9135780246 41.152263004100
-123.4567890123 246.9135780246 41.152263004100
-123.4567890123 246.9135780246 41.152263004100
-1234.5678901235 2469.1357802470 411.522630041167
-1234.5678901235 2469.1357802470 411.522630041167
-1234.5678901235 2469.1357802470 411.522630041167
-12345.6789012346 24691.3578024692 4115.226300411533
-12345.6789012346 24691.3578024692 4115.226300411533
-123456.7890123456 246913.5780246912 41152.263004115200
-123456.7890123457 246913.5780246914 41152.263004115233
-1234567.8901234560 2469135.7802469120 411522.630041152000
-1234567.8901234568 2469135.7802469136 411522.630041152267
-12345678.9012345600 24691357.8024691200 4115226.300411520000
-12345678.9012345679 24691357.8024691358 4115226.300411522633
-123456789.0123456000 246913578.0246912000 41152263.004115200000
-123456789.0123456789 246913578.0246913578 41152263.004115226300
-1234567890.1234560000 2469135780.2469120000 411522630.041152000000
-1234567890.1234567890 2469135780.2469135780 411522630.041152263000
+0.0000000000 0.0000000000 0.000000000000000000
+0.0000000000 0.0000000000 0.000000000000000000
+0.0000000000 0.0000000000 0.000000000000000000
+0.0000000000 0.0000000000 0.000000000000000000
+0.0000000000 0.0000000000 0.000000000000000000
+0.1234567890 0.2469135780 0.041152263000000000
+0.1234567890 0.2469135780 0.041152263000000000
+1.2345678901 2.4691357802 0.411522630033333333
+1.2345678901 2.4691357802 0.411522630033333333
+1.2345678901 2.4691357802 0.411522630033333333
+12.3456789012 24.6913578024 4.115226300400000000
+12.3456789012 24.6913578024 4.115226300400000000
+12.3456789012 24.6913578024 4.115226300400000000
+123.4567890123 246.9135780246 41.152263004100000000
+123.4567890123 246.9135780246 41.152263004100000000
+123.4567890123 246.9135780246 41.152263004100000000
+1234.5678901235 2469.1357802470 411.522630041166666667
+1234.5678901235 2469.1357802470 411.522630041166666667
+1234.5678901235 2469.1357802470 411.522630041166666667
+12345.6789012346 24691.3578024692 4115.226300411533333333
+12345.6789012346 24691.3578024692 4115.226300411533333333
+123456.7890123456 246913.5780246912 41152.263004115200000000
+123456.7890123457 246913.5780246914 41152.263004115233333333
+1234567.8901234560 2469135.7802469120 411522.630041152000000000
+1234567.8901234568 2469135.7802469136 411522.630041152266666667
+12345678.9012345600 24691357.8024691200 4115226.300411520000000000
+12345678.9012345679 24691357.8024691358 4115226.300411522633333333
+123456789.0123456000 246913578.0246912000 41152263.004115200000000000
+123456789.0123456789 246913578.0246913578 41152263.004115226300000000
+1234567890.1234560000 2469135780.2469120000 411522630.041152000000000000
+1234567890.1234567890 2469135780.2469135780 411522630.041152263000000000
PREHOOK: query: SELECT dec, dec / 9 FROM DECIMAL_PRECISION ORDER BY dec
PREHOOK: type: QUERY
PREHOOK: Input: default@decimal_precision
@@ -325,37 +325,37 @@ NULL NULL
NULL NULL
NULL NULL
NULL NULL
-0.0000000000 0.000000000000
-0.0000000000 0.000000000000
-0.0000000000 0.000000000000
-0.0000000000 0.000000000000
-0.0000000000 0.000000000000
-0.1234567890 0.013717421000
-0.1234567890 0.013717421000
-1.2345678901 0.137174210011
-1.2345678901 0.137174210011
-1.2345678901 0.137174210011
-12.3456789012 1.371742100133
-12.3456789012 1.371742100133
-12.3456789012 1.371742100133
-123.4567890123 13.717421001367
-123.4567890123 13.717421001367
-123.4567890123 13.717421001367
-1234.5678901235 137.174210013722
-1234.5678901235 137.174210013722
-1234.5678901235 137.174210013722
-12345.6789012346 1371.742100137178
-12345.6789012346 1371.742100137178
-123456.7890123456 13717.421001371733
-123456.7890123457 13717.421001371744
-1234567.8901234560 137174.210013717333
-1234567.8901234568 137174.210013717422
-12345678.9012345600 1371742.100137173333
-12345678.9012345679 1371742.100137174211
-123456789.0123456000 13717421.001371733333
-123456789.0123456789 13717421.001371742100
-1234567890.1234560000 137174210.013717333333
-1234567890.1234567890 137174210.013717421000
+0.0000000000 0.000000000000000000
+0.0000000000 0.000000000000000000
+0.0000000000 0.000000000000000000
+0.0000000000 0.000000000000000000
+0.0000000000 0.000000000000000000
+0.1234567890 0.013717421000000000
+0.1234567890 0.013717421000000000
+1.2345678901 0.137174210011111111
+1.2345678901 0.137174210011111111
+1.2345678901 0.137174210011111111
+12.3456789012 1.371742100133333333
+12.3456789012 1.371742100133333333
+12.3456789012 1.371742100133333333
+123.4567890123 13.717421001366666667
+123.4567890123 13.717421001366666667
+123.4567890123 13.717421001366666667
+1234.5678901235 137.174210013722222222
+1234.5678901235 137.174210013722222222
+1234.5678901235 137.174210013722222222
+12345.6789012346 1371.742100137177777778
+12345.6789012346 1371.742100137177777778
+123456.7890123456 13717.421001371733333333
+123456.7890123457 13717.421001371744444444
+1234567.8901234560 137174.210013717333333333
+1234567.8901234568 137174.210013717422222222
+12345678.9012345600 1371742.100137173333333333
+12345678.9012345679 1371742.100137174211111111
+123456789.0123456000 13717421.001371733333333333
+123456789.0123456789 13717421.001371742100000000
+1234567890.1234560000 137174210.013717333333333333
+1234567890.1234567890 137174210.013717421000000000
PREHOOK: query: SELECT dec, dec / 27 FROM DECIMAL_PRECISION ORDER BY dec
PREHOOK: type: QUERY
PREHOOK: Input: default@decimal_precision
@@ -408,37 +408,37 @@ NULL NULL
NULL NULL
NULL NULL
NULL NULL
-0.0000000000 0.0000000000000
-0.0000000000 0.0000000000000
-0.0000000000 0.0000000000000
-0.0000000000 0.0000000000000
-0.0000000000 0.0000000000000
-0.1234567890 0.0045724736667
-0.1234567890 0.0045724736667
-1.2345678901 0.0457247366704
-1.2345678901 0.0457247366704
-1.2345678901 0.0457247366704
-12.3456789012 0.4572473667111
-12.3456789012 0.4572473667111
-12.3456789012 0.4572473667111
-123.4567890123 4.5724736671222
-123.4567890123 4.5724736671222
-123.4567890123 4.5724736671222
-1234.5678901235 45.7247366712407
-1234.5678901235 45.7247366712407
-1234.5678901235 45.7247366712407
-12345.6789012346 457.2473667123926
-12345.6789012346 457.2473667123926
-123456.7890123456 4572.4736671239111
-123456.7890123457 4572.4736671239148
-1234567.8901234560 45724.7366712391111
-1234567.8901234568 45724.7366712391407
-12345678.9012345600 457247.3667123911111
-12345678.9012345679 457247.3667123914037
-123456789.0123456000 4572473.6671239111111
-123456789.0123456789 4572473.6671239140333
-1234567890.1234560000 45724736.6712391111111
-1234567890.1234567890 45724736.6712391403333
+0.0000000000 0.000000000000000000
+0.0000000000 0.000000000000000000
+0.0000000000 0.000000000000000000
+0.0000000000 0.000000000000000000
+0.0000000000 0.000000000000000000
+0.1234567890 0.004572473666666667
+0.1234567890 0.004572473666666667
+1.2345678901 0.045724736670370370
+1.2345678901 0.045724736670370370
+1.2345678901 0.045724736670370370
+12.3456789012 0.457247366711111111
+12.3456789012 0.457247366711111111
+12.3456789012 0.457247366711111111
+123.4567890123 4.572473667122222222
+123.4567890123 4.572473667122222222
+123.4567890123 4.572473667122222222
+1234.5678901235 45.724736671240740741
+1234.5678901235 45.724736671240740741
+1234.5678901235 45.724736671240740741
+12345.6789012346 457.247366712392592593
+12345.6789012346 457.247366712392592593
+123456.7890123456 4572.473667123911111111
+123456.7890123457 4572.473667123914814815
+1234567.8901234560 45724.736671239111111111
+1234567.8901234568 45724.736671239140740741
+12345678.9012345600 457247.366712391111111111
+12345678.9012345679 457247.366712391403703704
+123456789.0123456000 4572473.667123911111111111
+123456789.0123456789 4572473.667123914033333333
+1234567890.1234560000 45724736.671239111111111111
+1234567890.1234567890 45724736.671239140333333333
PREHOOK: query: SELECT dec, dec * dec FROM DECIMAL_PRECISION ORDER BY dec
PREHOOK: type: QUERY
PREHOOK: Input: default@decimal_precision