You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2016/12/21 17:59:58 UTC
hive git commit: HIVE-15331: Decimal multiplication with high
precision/scale often returns NULL (Jason Dere, reviewed by Sergey Shelukhin)
Repository: hive
Updated Branches:
refs/heads/master 66f13472e -> 99a951823
HIVE-15331: Decimal multiplication with high precision/scale often returns NULL (Jason Dere, reviewed by Sergey Shelukhin)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/99a95182
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/99a95182
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/99a95182
Branch: refs/heads/master
Commit: 99a951823cf24be8dc97427a5d27342fb7983648
Parents: 66f1347
Author: Jason Dere <jd...@hortonworks.com>
Authored: Wed Dec 21 09:59:12 2016 -0800
Committer: Jason Dere <jd...@hortonworks.com>
Committed: Wed Dec 21 09:59:12 2016 -0800
----------------------------------------------------------------------
.../ql/udf/generic/GenericUDFBaseNumeric.java | 29 +++
.../hive/ql/udf/generic/GenericUDFOPDivide.java | 21 +--
.../hive/ql/udf/generic/GenericUDFOPMod.java | 8 +-
.../ql/udf/generic/GenericUDFOPMultiply.java | 10 +-
.../udf/generic/GenericUDFOPNumericMinus.java | 8 +-
.../ql/udf/generic/GenericUDFOPNumericPlus.java | 8 +-
.../ql/udf/generic/TestGenericUDFOPDivide.java | 8 +-
.../udf/generic/TestGenericUDFOPMultiply.java | 6 +
.../clientpositive/decimal_precision.q.out | 62 +++----
.../results/clientpositive/decimal_udf.q.out | 186 +++++++++----------
.../llap/vector_decimal_expressions.q.out | 26 +--
.../llap/vector_decimal_precision.q.out | 62 +++----
.../llap/vector_decimal_udf.q.out | 186 +++++++++----------
.../vector_decimal_expressions.q.out | 26 +--
.../vector_decimal_precision.q.out | 62 +++----
15 files changed, 377 insertions(+), 331 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseNumeric.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseNumeric.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseNumeric.java
index ef6ef11..1734328 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseNumeric.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseNumeric.java
@@ -288,6 +288,35 @@ public abstract class GenericUDFBaseNumeric extends GenericUDFBaseBinary {
protected abstract DecimalTypeInfo deriveResultDecimalTypeInfo(int prec1, int scale1, int prec2, int scale2);
+ public static final int MINIMUM_ADJUSTED_SCALE = 6;
+
+ /**
+ * Create DecimalTypeInfo from input precision/scale, adjusting if necessary to fit max precision
+ * @param precision precision value before adjustment
+ * @param scale scale value before adjustment
+ * @return
+ */
+ protected DecimalTypeInfo adjustPrecScale(int precision, int scale) {
+ // Assumptions:
+ // precision >= scale
+ // scale >= 0
+
+ if (precision <= HiveDecimal.MAX_PRECISION) {
+ // Adjustment only needed when we exceed max precision
+ return new DecimalTypeInfo(precision, scale);
+ }
+
+ // Precision/scale exceed maximum precision. Result must be adjusted to HiveDecimal.MAX_PRECISION.
+ // See https://blogs.msdn.microsoft.com/sqlprogrammability/2006/03/29/multiplication-and-division-with-numerics/
+ int intDigits = precision - scale;
+ // If original scale less than 6, use original scale value; otherwise preserve at least 6 fractional digits
+ int minScaleValue = Math.min(scale, MINIMUM_ADJUSTED_SCALE);
+ int adjustedScale = HiveDecimal.MAX_PRECISION - intDigits;
+ adjustedScale = Math.max(adjustedScale, minScaleValue);
+
+ return new DecimalTypeInfo(HiveDecimal.MAX_PRECISION, adjustedScale);
+ }
+
public void copyToNewInstance(Object newInstance) throws UDFArgumentException {
super.copyToNewInstance(newInstance);
GenericUDFBaseNumeric other = (GenericUDFBaseNumeric) newInstance;
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/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..225a529 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,21 +110,16 @@ public class GenericUDFOPDivide extends GenericUDFBaseNumeric {
return decimalWritable;
}
- /**
- * 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.
- */
@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 diff = intDig + decDig - HiveDecimal.MAX_SCALE;
- if (diff > 0) {
- decDig -= diff/2 + 1; // Slight negative bias.
- intDig = HiveDecimal.MAX_SCALE - decDig;
- }
- return TypeInfoFactory.getDecimalTypeInfo(intDig + decDig, decDig);
+ // From https://msdn.microsoft.com/en-us/library/ms190476.aspx
+ // e1 / e2
+ // Precision: p1 - s1 + s2 + max(6, s1 + p2 + 1)
+ // Scale: max(6, s1 + p2 + 1)
+ int intDig = prec1 - scale1 + scale2;
+ int scale = Math.max(6, scale1 + prec2 + 1);
+ int prec = intDig + scale;
+ return adjustPrecScale(prec, scale);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMod.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMod.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMod.java
index 9d283bd..6d3e82e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMod.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMod.java
@@ -119,9 +119,13 @@ public class GenericUDFOPMod extends GenericUDFBaseNumeric {
@Override
protected DecimalTypeInfo deriveResultDecimalTypeInfo(int prec1, int scale1, int prec2, int scale2) {
+ // From https://msdn.microsoft.com/en-us/library/ms190476.aspx
+ // e1 % e2
+ // Precision: min(p1-s1, p2 -s2) + max( s1,s2 )
+ // Scale: max(s1, s2)
+ int prec = Math.min(prec1 - scale1, prec2 - scale2) + Math.max(scale1, scale2);
int scale = Math.max(scale1, scale2);
- int prec = Math.min(HiveDecimal.MAX_PRECISION, Math.min(prec1 - scale1, prec2 - scale2) + scale);
- return TypeInfoFactory.getDecimalTypeInfo(prec, scale);
+ return adjustPrecScale(prec, scale);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMultiply.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMultiply.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMultiply.java
index 7dc1f83..47a11f3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMultiply.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMultiply.java
@@ -98,9 +98,13 @@ public class GenericUDFOPMultiply extends GenericUDFBaseNumeric {
@Override
protected DecimalTypeInfo deriveResultDecimalTypeInfo(int prec1, int scale1, int prec2, int scale2) {
- int scale = Math.min(HiveDecimal.MAX_SCALE, scale1 + scale2 );
- int prec = Math.min(HiveDecimal.MAX_PRECISION, prec1 + prec2 + 1);
- return TypeInfoFactory.getDecimalTypeInfo(prec, scale);
+ // From https://msdn.microsoft.com/en-us/library/ms190476.aspx
+ // e1 * e2
+ // Precision: p1 + p2 + 1
+ // Scale: s1 + s2
+ int scale = scale1 + scale2;
+ int prec = prec1 + prec2 + 1;
+ return adjustPrecScale(prec, scale);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericMinus.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericMinus.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericMinus.java
index a31cf78..28f7907 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericMinus.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericMinus.java
@@ -88,10 +88,14 @@ public class GenericUDFOPNumericMinus extends GenericUDFBaseNumeric {
@Override
protected DecimalTypeInfo deriveResultDecimalTypeInfo(int prec1, int scale1, int prec2, int scale2) {
+ // From https://msdn.microsoft.com/en-us/library/ms190476.aspx
+ // e1 + e2
+ // Precision: max(s1, s2) + max(p1-s1, p2-s2) + 1
+ // Scale: max(s1, s2)
int intPart = Math.max(prec1 - scale1, prec2 - scale2);
int scale = Math.max(scale1, scale2);
- int prec = Math.min(intPart + scale + 1, HiveDecimal.MAX_PRECISION);
- return TypeInfoFactory.getDecimalTypeInfo(prec, scale);
+ int prec = intPart + scale + 1;
+ return adjustPrecScale(prec, scale);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericPlus.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericPlus.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericPlus.java
index b055776..b2b76f0 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericPlus.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericPlus.java
@@ -99,10 +99,14 @@ public class GenericUDFOPNumericPlus extends GenericUDFBaseNumeric {
@Override
protected DecimalTypeInfo deriveResultDecimalTypeInfo(int prec1, int scale1, int prec2, int scale2) {
+ // From https://msdn.microsoft.com/en-us/library/ms190476.aspx
+ // e1 + e2
+ // Precision: max(s1, s2) + max(p1-s1, p2-s2) + 1
+ // Scale: max(s1, s2)
int intPart = Math.max(prec1 - scale1, prec2 - scale2);
int scale = Math.max(scale1, scale2);
- int prec = Math.min(intPart + scale + 1, HiveDecimal.MAX_PRECISION);
- return TypeInfoFactory.getDecimalTypeInfo(prec, scale);
+ int prec = intPart + scale + 1;
+ return adjustPrecScale(prec, scale);
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/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..523a1a4 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
@@ -227,15 +227,15 @@ public class TestGenericUDFOPDivide extends AbstractTestGenericUDFOPNumeric {
@Test
public void testDecimalDivisionResultType() throws HiveException {
testDecimalDivisionResultType(5, 2, 3, 2, 11, 6);
- testDecimalDivisionResultType(38, 18, 38, 18, 38, 18);
- testDecimalDivisionResultType(38, 18, 20, 0, 38, 27);
+ testDecimalDivisionResultType(38, 18, 38, 18, 38, 6);
+ testDecimalDivisionResultType(38, 18, 20, 0, 38, 18);
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(38, 38, 38, 38, 38, 18);
- testDecimalDivisionResultType(38, 0, 38, 0, 38, 18);
+ testDecimalDivisionResultType(38, 38, 38, 38, 38, 6);
+ testDecimalDivisionResultType(38, 0, 38, 0, 38, 6);
}
private void testDecimalDivisionResultType(int prec1, int scale1, int prec2, int scale2, int prec3, int scale3)
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
index e342a76..9b02538 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMultiply.java
@@ -243,5 +243,11 @@ public class TestGenericUDFOPMultiply extends AbstractTestGenericUDFOPNumeric {
verifyReturnType(new GenericUDFOPMultiply(), "double", "decimal(10,2)", "double");
verifyReturnType(new GenericUDFOPMultiply(), "decimal(10,2)", "decimal(10,2)", "decimal(21,4)");
+
+ verifyReturnType(new GenericUDFOPMultiply(), "decimal(38,18)", "decimal(38,18)", "decimal(38,6)");
+ verifyReturnType(new GenericUDFOPMultiply(), "decimal(38,38)", "decimal(38,38)", "decimal(38,37)");
+ verifyReturnType(new GenericUDFOPMultiply(), "decimal(38,0)", "decimal(38,0)", "decimal(38,0)");
+ verifyReturnType(new GenericUDFOPMultiply(), "decimal(38,38)", "decimal(38,0)", "decimal(38,6)");
+ verifyReturnType(new GenericUDFOPMultiply(), "decimal(20,2)", "decimal(20,0)", "decimal(38,2)");
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/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 9fbc8f5..5203a51 100644
--- a/ql/src/test/results/clientpositive/decimal_precision.q.out
+++ b/ql/src/test/results/clientpositive/decimal_precision.q.out
@@ -491,37 +491,37 @@ NULL NULL
NULL NULL
NULL NULL
NULL NULL
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.1234567890 0.01524157875019052100
-0.1234567890 0.01524157875019052100
-1.2345678901 1.52415787526596567801
-1.2345678901 1.52415787526596567801
-1.2345678901 1.52415787526596567801
-12.3456789012 152.41578753153483936144
-12.3456789012 152.41578753153483936144
-12.3456789012 152.41578753153483936144
-123.4567890123 15241.57875322755800955129
-123.4567890123 15241.57875322755800955129
-123.4567890123 15241.57875322755800955129
-1234.5678901235 1524157.87532399036884525225
-1234.5678901235 1524157.87532399036884525225
-1234.5678901235 1524157.87532399036884525225
-12345.6789012346 152415787.53238916034140423716
-12345.6789012346 152415787.53238916034140423716
-123456.7890123456 15241578753.23881726870921383936
-123456.7890123457 15241578753.23884196006701630849
-1234567.8901234560 1524157875323.88172687092138393600
-1234567.8901234568 1524157875323.88370217954558146624
-12345678.9012345600 152415787532388.17268709213839360000
-12345678.9012345679 152415787532388.36774881877789971041
-123456789.0123456000 15241578753238817.26870921383936000000
-123456789.0123456789 15241578753238836.75019051998750190521
-1234567890.1234560000 NULL
-1234567890.1234567890 NULL
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.1234567890 0.01524157875019052
+0.1234567890 0.01524157875019052
+1.2345678901 1.52415787526596568
+1.2345678901 1.52415787526596568
+1.2345678901 1.52415787526596568
+12.3456789012 152.41578753153483936
+12.3456789012 152.41578753153483936
+12.3456789012 152.41578753153483936
+123.4567890123 15241.57875322755800955
+123.4567890123 15241.57875322755800955
+123.4567890123 15241.57875322755800955
+1234.5678901235 1524157.87532399036884525
+1234.5678901235 1524157.87532399036884525
+1234.5678901235 1524157.87532399036884525
+12345.6789012346 152415787.53238916034140424
+12345.6789012346 152415787.53238916034140424
+123456.7890123456 15241578753.23881726870921384
+123456.7890123457 15241578753.23884196006701631
+1234567.8901234560 1524157875323.88172687092138394
+1234567.8901234568 1524157875323.88370217954558147
+12345678.9012345600 152415787532388.17268709213839360
+12345678.9012345679 152415787532388.36774881877789971
+123456789.0123456000 15241578753238817.26870921383936000
+123456789.0123456789 15241578753238836.75019051998750191
+1234567890.1234560000 1524157875323881726.87092138393600000
+1234567890.1234567890 1524157875323883675.01905199875019052
PREHOOK: query: EXPLAIN SELECT avg(dec), sum(dec) FROM DECIMAL_PRECISION
PREHOOK: type: QUERY
POSTHOOK: query: EXPLAIN SELECT avg(dec), sum(dec) FROM DECIMAL_PRECISION
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/test/results/clientpositive/decimal_udf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_udf.q.out b/ql/src/test/results/clientpositive/decimal_udf.q.out
index c0baab8..6e0d37e 100644
--- a/ql/src/test/results/clientpositive/decimal_udf.q.out
+++ b/ql/src/test/results/clientpositive/decimal_udf.q.out
@@ -582,7 +582,7 @@ STAGE PLANS:
alias: decimal_udf
Statistics: Num rows: 3 Data size: 359 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: (key * key) (type: decimal(38,20))
+ expressions: (key * key) (type: decimal(38,17))
outputColumnNames: _col0
Statistics: Num rows: 3 Data size: 359 Basic stats: COMPLETE Column stats: NONE
ListSink
@@ -595,44 +595,44 @@ POSTHOOK: query: SELECT key * key FROM DECIMAL_UDF
POSTHOOK: type: QUERY
POSTHOOK: Input: default@decimal_udf
#### A masked pattern was here ####
-19360000.00000000000000000000
-NULL
-0.00000000000000000000
-0.00000000000000000000
-10000.00000000000000000000
-100.00000000000000000000
-1.00000000000000000000
-0.01000000000000000000
-0.00010000000000000000
-40000.00000000000000000000
-400.00000000000000000000
-4.00000000000000000000
-0.00000000000000000000
-0.04000000000000000000
-0.00040000000000000000
-0.09000000000000000000
-0.10890000000000000000
-0.11088900000000000000
-0.09000000000000000000
-0.10890000000000000000
-0.11088900000000000000
-1.00000000000000000000
-4.00000000000000000000
-9.85960000000000000000
-1.25440000000000000000
-1.25440000000000000000
-1.25888400000000000000
-1.25440000000000000000
-1.25888400000000000000
-15376.00000000000000000000
-15675.04000000000000000000
-1576255.14010000000000000000
-9.85960000000000000000
-9.85960000000000000000
-9.85960000000000000000
-1.00000000000000000000
-NULL
+19360000.00000000000000000
NULL
+0.00000000000000000
+0.00000000000000000
+10000.00000000000000000
+100.00000000000000000
+1.00000000000000000
+0.01000000000000000
+0.00010000000000000
+40000.00000000000000000
+400.00000000000000000
+4.00000000000000000
+0.00000000000000000
+0.04000000000000000
+0.00040000000000000
+0.09000000000000000
+0.10890000000000000
+0.11088900000000000
+0.09000000000000000
+0.10890000000000000
+0.11088900000000000
+1.00000000000000000
+4.00000000000000000
+9.85960000000000000
+1.25440000000000000
+1.25440000000000000
+1.25888400000000000
+1.25440000000000000
+1.25888400000000000
+15376.00000000000000000
+15675.04000000000000000
+1576255.14010000000000000
+9.85960000000000000
+9.85960000000000000
+9.85960000000000000
+1.00000000000000000
+1524157875323883675.01905199875019052
+1524157875323883652.79682997652796840
PREHOOK: query: EXPLAIN SELECT key, value FROM DECIMAL_UDF where key * value > 0
PREHOOK: type: QUERY
POSTHOOK: query: EXPLAIN SELECT key, value FROM DECIMAL_UDF where key * value > 0
@@ -976,7 +976,7 @@ STAGE PLANS:
predicate: (key <> 0) (type: boolean)
Statistics: Num rows: 3 Data size: 359 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: (key / key) (type: decimal(38,24))
+ expressions: (key / key) (type: decimal(38,18))
outputColumnNames: _col0
Statistics: Num rows: 3 Data size: 359 Basic stats: COMPLETE Column stats: NONE
ListSink
@@ -989,40 +989,40 @@ POSTHOOK: query: SELECT key / key FROM DECIMAL_UDF WHERE key is not null and key
POSTHOOK: type: QUERY
POSTHOOK: Input: default@decimal_udf
#### A masked pattern was here ####
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
PREHOOK: query: EXPLAIN SELECT key / value FROM DECIMAL_UDF WHERE value is not null and value <> 0
PREHOOK: type: QUERY
POSTHOOK: query: EXPLAIN SELECT key / value FROM DECIMAL_UDF WHERE value is not null and value <> 0
@@ -1313,7 +1313,7 @@ STAGE PLANS:
outputColumnNames: _col0, _col1, _col2, _col3
Statistics: Num rows: 1 Data size: 119 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: _col0 (type: int), (_col1 / CAST( _col2 AS decimal(19,0))) (type: decimal(38,23)), _col3 (type: decimal(24,14)), _col1 (type: decimal(30,10))
+ expressions: _col0 (type: int), (_col1 / CAST( _col2 AS decimal(19,0))) (type: decimal(38,18)), _col3 (type: decimal(24,14)), _col1 (type: decimal(30,10))
outputColumnNames: _col0, _col1, _col2, _col3
Statistics: Num rows: 1 Data size: 119 Basic stats: COMPLETE Column stats: NONE
File Output Operator
@@ -1331,10 +1331,10 @@ STAGE PLANS:
key expressions: _col0 (type: int)
sort order: +
Statistics: Num rows: 1 Data size: 119 Basic stats: COMPLETE Column stats: NONE
- value expressions: _col1 (type: decimal(38,23)), _col2 (type: decimal(24,14)), _col3 (type: decimal(30,10))
+ value expressions: _col1 (type: decimal(38,18)), _col2 (type: decimal(24,14)), _col3 (type: decimal(30,10))
Reduce Operator Tree:
Select Operator
- expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: decimal(38,23)), VALUE._col1 (type: decimal(24,14)), VALUE._col2 (type: decimal(30,10))
+ expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: decimal(38,18)), VALUE._col1 (type: decimal(24,14)), VALUE._col2 (type: decimal(30,10))
outputColumnNames: _col0, _col1, _col2, _col3
Statistics: Num rows: 1 Data size: 119 Basic stats: COMPLETE Column stats: NONE
File Output Operator
@@ -1359,23 +1359,23 @@ POSTHOOK: query: SELECT value, sum(key) / count(key), avg(key), sum(key) FROM DE
POSTHOOK: type: QUERY
POSTHOOK: Input: default@decimal_udf
#### A masked pattern was here ####
--1234567890 -1234567890.12345678900000000000000 -1234567890.12345678900000 -1234567890.1234567890
--1255 -1255.49000000000000000000000 -1255.49000000000000 -1255.4900000000
--11 -1.12200000000000000000000 -1.12200000000000 -1.1220000000
--1 -1.12000000000000000000000 -1.12000000000000 -2.2400000000
-0 0.02538461538461538461538 0.02538461538462 0.3300000000
-1 1.04840000000000000000000 1.04840000000000 5.2420000000
-2 2.00000000000000000000000 2.00000000000000 4.0000000000
-3 3.14000000000000000000000 3.14000000000000 9.4200000000
-4 3.14000000000000000000000 3.14000000000000 3.1400000000
-10 10.00000000000000000000000 10.00000000000000 10.0000000000
-20 20.00000000000000000000000 20.00000000000000 20.0000000000
-100 100.00000000000000000000000 100.00000000000000 100.0000000000
-124 124.00000000000000000000000 124.00000000000000 124.0000000000
-125 125.20000000000000000000000 125.20000000000000 125.2000000000
-200 200.00000000000000000000000 200.00000000000000 200.0000000000
-4400 -4400.00000000000000000000000 -4400.00000000000000 -4400.0000000000
-1234567890 1234567890.12345678000000000000000 1234567890.12345678000000 1234567890.1234567800
+-1234567890 -1234567890.123456789000000000 -1234567890.12345678900000 -1234567890.1234567890
+-1255 -1255.490000000000000000 -1255.49000000000000 -1255.4900000000
+-11 -1.122000000000000000 -1.12200000000000 -1.1220000000
+-1 -1.120000000000000000 -1.12000000000000 -2.2400000000
+0 0.025384615384615385 0.02538461538462 0.3300000000
+1 1.048400000000000000 1.04840000000000 5.2420000000
+2 2.000000000000000000 2.00000000000000 4.0000000000
+3 3.140000000000000000 3.14000000000000 9.4200000000
+4 3.140000000000000000 3.14000000000000 3.1400000000
+10 10.000000000000000000 10.00000000000000 10.0000000000
+20 20.000000000000000000 20.00000000000000 20.0000000000
+100 100.000000000000000000 100.00000000000000 100.0000000000
+124 124.000000000000000000 124.00000000000000 124.0000000000
+125 125.200000000000000000 125.20000000000000 125.2000000000
+200 200.000000000000000000 200.00000000000000 200.0000000000
+4400 -4400.000000000000000000 -4400.00000000000000 -4400.0000000000
+1234567890 1234567890.123456780000000000 1234567890.12345678000000 1234567890.1234567800
PREHOOK: query: -- negative
EXPLAIN SELECT -key FROM DECIMAL_UDF
PREHOOK: type: QUERY
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/test/results/clientpositive/llap/vector_decimal_expressions.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_decimal_expressions.q.out b/ql/src/test/results/clientpositive/llap/vector_decimal_expressions.q.out
index bce4b12..cf264e8 100644
--- a/ql/src/test/results/clientpositive/llap/vector_decimal_expressions.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_decimal_expressions.q.out
@@ -44,11 +44,11 @@ STAGE PLANS:
predicate: ((cdecimal1 > 0) and (cdecimal1 < 12345.5678) and (cdecimal2 <> 0) and (cdecimal2 > 1000) and cdouble is not null) (type: boolean)
Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: (cdecimal1 + cdecimal2) (type: decimal(25,14)), (cdecimal1 - (2 * cdecimal2)) (type: decimal(26,14)), ((cdecimal1 + 2.34) / cdecimal2) (type: decimal(38,23)), (cdecimal1 * (cdecimal2 / 3.4)) (type: decimal(38,27)), (cdecimal1 % 10) (type: decimal(12,10)), UDFToInteger(cdecimal1) (type: int), UDFToShort(cdecimal2) (type: smallint), UDFToByte(cdecimal2) (type: tinyint), UDFToLong(cdecimal1) (type: bigint), UDFToBoolean(cdecimal1) (type: boolean), UDFToDouble(cdecimal2) (type: double), UDFToFloat(cdecimal1) (type: float), UDFToString(cdecimal2) (type: string), CAST( cdecimal1 AS TIMESTAMP) (type: timestamp)
+ expressions: (cdecimal1 + cdecimal2) (type: decimal(25,14)), (cdecimal1 - (2 * cdecimal2)) (type: decimal(26,14)), ((cdecimal1 + 2.34) / cdecimal2) (type: decimal(38,13)), (cdecimal1 * (cdecimal2 / 3.4)) (type: decimal(38,17)), (cdecimal1 % 10) (type: decimal(12,10)), UDFToInteger(cdecimal1) (type: int), UDFToShort(cdecimal2) (type: smallint), UDFToByte(cdecimal2) (type: tinyint), UDFToLong(cdecimal1) (type: bigint), UDFToBoolean(cdecimal1) (type: boolean), UDFToDouble(cdecimal2) (type: double), UDFToFloat(cdecimal1) (type: float), UDFToString(cdecimal2) (type: string), CAST( cdecimal1 AS TIMESTAMP) (type: timestamp)
outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
Reduce Output Operator
- key expressions: _col0 (type: decimal(25,14)), _col1 (type: decimal(26,14)), _col2 (type: decimal(38,23)), _col3 (type: decimal(38,27)), _col4 (type: decimal(12,10)), _col5 (type: int), _col6 (type: smallint), _col7 (type: tinyint), _col8 (type: bigint), _col9 (type: boolean), _col10 (type: double), _col11 (type: float), _col12 (type: string), _col13 (type: timestamp)
+ key expressions: _col0 (type: decimal(25,14)), _col1 (type: decimal(26,14)), _col2 (type: decimal(38,13)), _col3 (type: decimal(38,17)), _col4 (type: decimal(12,10)), _col5 (type: int), _col6 (type: smallint), _col7 (type: tinyint), _col8 (type: bigint), _col9 (type: boolean), _col10 (type: double), _col11 (type: float), _col12 (type: string), _col13 (type: timestamp)
sort order: ++++++++++++++
Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
TopN Hash Memory Usage: 0.1
@@ -58,7 +58,7 @@ STAGE PLANS:
Execution mode: vectorized, llap
Reduce Operator Tree:
Select Operator
- expressions: KEY.reducesinkkey0 (type: decimal(25,14)), KEY.reducesinkkey1 (type: decimal(26,14)), KEY.reducesinkkey2 (type: decimal(38,23)), KEY.reducesinkkey3 (type: decimal(38,27)), KEY.reducesinkkey4 (type: decimal(12,10)), KEY.reducesinkkey5 (type: int), KEY.reducesinkkey6 (type: smallint), KEY.reducesinkkey7 (type: tinyint), KEY.reducesinkkey8 (type: bigint), KEY.reducesinkkey9 (type: boolean), KEY.reducesinkkey10 (type: double), KEY.reducesinkkey11 (type: float), KEY.reducesinkkey12 (type: string), KEY.reducesinkkey13 (type: timestamp)
+ expressions: KEY.reducesinkkey0 (type: decimal(25,14)), KEY.reducesinkkey1 (type: decimal(26,14)), KEY.reducesinkkey2 (type: decimal(38,13)), KEY.reducesinkkey3 (type: decimal(38,17)), KEY.reducesinkkey4 (type: decimal(12,10)), KEY.reducesinkkey5 (type: int), KEY.reducesinkkey6 (type: smallint), KEY.reducesinkkey7 (type: tinyint), KEY.reducesinkkey8 (type: bigint), KEY.reducesinkkey9 (type: boolean), KEY.reducesinkkey10 (type: double), KEY.reducesinkkey11 (type: float), KEY.reducesinkkey12 (type: string), KEY.reducesinkkey13 (type: timestamp)
outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
Limit
@@ -90,13 +90,13 @@ LIMIT 10
POSTHOOK: type: QUERY
POSTHOOK: Input: default@decimal_test
#### A masked pattern was here ####
-1836.44199584197700 -1166.02723492725400 0.83726978148337131458955 245972.558108102558044693817536566 5.6189189189 835 1000 -24 835 true 1000.823076923077 835.6189 1000.823076923077 1969-12-31 16:13:55.618918918
-1856.13222453224620 -1178.52931392929240 0.83724497870140374273038 251275.443243249687478989925889984 4.5783783784 844 1011 -13 844 true 1011.5538461538462 844.57837 1011.5538461538462 1969-12-31 16:14:04.578378378
-1858.75758835761550 -1180.19625779623100 0.83724171136694298221079 251986.767567575648615190046228140 5.7729729730 845 1012 -12 845 true 1012.9846153846155 845.77295 1012.9846153846155 1969-12-31 16:14:05.772972973
-1862.69563409566930 -1182.69667359663860 0.83723682763446158861586 253055.639189199696672864219396582 7.5648648649 847 1015 -9 847 true 1015.1307692307693 847.5649 1015.1307692307693 1969-12-31 16:14:07.564864864
-1883.69854469852330 -1196.03222453224660 0.83721112592864992485015 258794.493243236771165588048182512 7.1216216216 857 1026 2 857 true 1026.5769230769233 857.12164 1026.5769230769233 1969-12-31 16:14:17.121621621
-1886.32390852389240 -1197.69916839918480 0.83720795345819015087813 259516.374324319444568156352818442 8.3162162162 858 1028 4 858 true 1028.0076923076924 858.3162 1028.0076923076924 1969-12-31 16:14:18.316216216
-1887.63659043657700 -1198.53264033265400 0.83720637053221313673364 259877.691891887822598337517182035 8.9135135135 858 1028 4 858 true 1028.723076923077 858.9135 1028.723076923077 1969-12-31 16:14:18.913513513
-1895.51268191268460 -1203.53347193346920 0.83719691901713431682002 262050.875675676492928354428763593 2.4972972973 862 1033 9 862 true 1033.0153846153846 862.4973 1033.0153846153846 1969-12-31 16:14:22.497297297
-1909.95218295221550 -1212.70166320163100 0.83717979369462356311054 266058.547297307255740143215728140 9.0675675676 869 1040 16 869 true 1040.8846153846155 869.06757 1040.8846153846155 1969-12-31 16:14:29.067567567
-1913.89022869026920 -1215.20207900203840 0.83717516799957965211367 267156.827027039455923922058456280 0.8594594595 870 1043 19 870 true 1043.0307692307692 870.85944 1043.0307692307692 1969-12-31 16:14:30.859459459
+1836.44199584197700 -1166.02723492725400 0.8372697814834 245972.55810810255804469 5.6189189189 835 1000 -24 835 true 1000.823076923077 835.6189 1000.823076923077 1969-12-31 16:13:55.618918918
+1856.13222453224620 -1178.52931392929240 0.8372449787014 251275.44324324968747899 4.5783783784 844 1011 -13 844 true 1011.5538461538462 844.57837 1011.5538461538462 1969-12-31 16:14:04.578378378
+1858.75758835761550 -1180.19625779623100 0.8372417113669 251986.76756757564861519 5.7729729730 845 1012 -12 845 true 1012.9846153846155 845.77295 1012.9846153846155 1969-12-31 16:14:05.772972973
+1862.69563409566930 -1182.69667359663860 0.8372368276345 253055.63918919969667286 7.5648648649 847 1015 -9 847 true 1015.1307692307693 847.5649 1015.1307692307693 1969-12-31 16:14:07.564864864
+1883.69854469852330 -1196.03222453224660 0.8372111259286 258794.49324323677116559 7.1216216216 857 1026 2 857 true 1026.5769230769233 857.12164 1026.5769230769233 1969-12-31 16:14:17.121621621
+1886.32390852389240 -1197.69916839918480 0.8372079534582 259516.37432431944456816 8.3162162162 858 1028 4 858 true 1028.0076923076924 858.3162 1028.0076923076924 1969-12-31 16:14:18.316216216
+1887.63659043657700 -1198.53264033265400 0.8372063705322 259877.69189188782259834 8.9135135135 858 1028 4 858 true 1028.723076923077 858.9135 1028.723076923077 1969-12-31 16:14:18.913513513
+1895.51268191268460 -1203.53347193346920 0.8371969190171 262050.87567567649292835 2.4972972973 862 1033 9 862 true 1033.0153846153846 862.4973 1033.0153846153846 1969-12-31 16:14:22.497297297
+1909.95218295221550 -1212.70166320163100 0.8371797936946 266058.54729730725574014 9.0675675676 869 1040 16 869 true 1040.8846153846155 869.06757 1040.8846153846155 1969-12-31 16:14:29.067567567
+1913.89022869026920 -1215.20207900203840 0.8371751679996 267156.82702703945592392 0.8594594595 870 1043 19 870 true 1043.0307692307692 870.85944 1043.0307692307692 1969-12-31 16:14:30.859459459
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/test/results/clientpositive/llap/vector_decimal_precision.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_decimal_precision.q.out b/ql/src/test/results/clientpositive/llap/vector_decimal_precision.q.out
index 3c932e2..8ccc8cf 100644
--- a/ql/src/test/results/clientpositive/llap/vector_decimal_precision.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_decimal_precision.q.out
@@ -514,37 +514,37 @@ NULL NULL
NULL NULL
NULL NULL
NULL NULL
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.1234567890 0.01524157875019052100
-0.1234567890 0.01524157875019052100
-1.2345678901 1.52415787526596567801
-1.2345678901 1.52415787526596567801
-1.2345678901 1.52415787526596567801
-12.3456789012 152.41578753153483936144
-12.3456789012 152.41578753153483936144
-12.3456789012 152.41578753153483936144
-123.4567890123 15241.57875322755800955129
-123.4567890123 15241.57875322755800955129
-123.4567890123 15241.57875322755800955129
-1234.5678901235 1524157.87532399036884525225
-1234.5678901235 1524157.87532399036884525225
-1234.5678901235 1524157.87532399036884525225
-12345.6789012346 152415787.53238916034140423716
-12345.6789012346 152415787.53238916034140423716
-123456.7890123456 15241578753.23881726870921383936
-123456.7890123457 15241578753.23884196006701630849
-1234567.8901234560 1524157875323.88172687092138393600
-1234567.8901234568 1524157875323.88370217954558146624
-12345678.9012345600 152415787532388.17268709213839360000
-12345678.9012345679 152415787532388.36774881877789971041
-123456789.0123456000 15241578753238817.26870921383936000000
-123456789.0123456789 15241578753238836.75019051998750190521
-1234567890.1234560000 NULL
-1234567890.1234567890 NULL
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.1234567890 0.01524157875019052
+0.1234567890 0.01524157875019052
+1.2345678901 1.52415787526596568
+1.2345678901 1.52415787526596568
+1.2345678901 1.52415787526596568
+12.3456789012 152.41578753153483936
+12.3456789012 152.41578753153483936
+12.3456789012 152.41578753153483936
+123.4567890123 15241.57875322755800955
+123.4567890123 15241.57875322755800955
+123.4567890123 15241.57875322755800955
+1234.5678901235 1524157.87532399036884525
+1234.5678901235 1524157.87532399036884525
+1234.5678901235 1524157.87532399036884525
+12345.6789012346 152415787.53238916034140424
+12345.6789012346 152415787.53238916034140424
+123456.7890123456 15241578753.23881726870921384
+123456.7890123457 15241578753.23884196006701631
+1234567.8901234560 1524157875323.88172687092138394
+1234567.8901234568 1524157875323.88370217954558147
+12345678.9012345600 152415787532388.17268709213839360
+12345678.9012345679 152415787532388.36774881877789971
+123456789.0123456000 15241578753238817.26870921383936000
+123456789.0123456789 15241578753238836.75019051998750191
+1234567890.1234560000 1524157875323881726.87092138393600000
+1234567890.1234567890 1524157875323883675.01905199875019052
PREHOOK: query: EXPLAIN SELECT avg(dec), sum(dec) FROM DECIMAL_PRECISION
PREHOOK: type: QUERY
POSTHOOK: query: EXPLAIN SELECT avg(dec), sum(dec) FROM DECIMAL_PRECISION
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out b/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out
index 0813854..87fde0e 100644
--- a/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_decimal_udf.q.out
@@ -745,7 +745,7 @@ STAGE PLANS:
alias: decimal_udf
Statistics: Num rows: 38 Data size: 4296 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: (key * key) (type: decimal(38,20))
+ expressions: (key * key) (type: decimal(38,17))
outputColumnNames: _col0
Statistics: Num rows: 38 Data size: 4296 Basic stats: COMPLETE Column stats: NONE
File Output Operator
@@ -772,44 +772,44 @@ POSTHOOK: query: SELECT key * key FROM DECIMAL_UDF
POSTHOOK: type: QUERY
POSTHOOK: Input: default@decimal_udf
#### A masked pattern was here ####
-19360000.00000000000000000000
-NULL
-0.00000000000000000000
-0.00000000000000000000
-10000.00000000000000000000
-100.00000000000000000000
-1.00000000000000000000
-0.01000000000000000000
-0.00010000000000000000
-40000.00000000000000000000
-400.00000000000000000000
-4.00000000000000000000
-0.00000000000000000000
-0.04000000000000000000
-0.00040000000000000000
-0.09000000000000000000
-0.10890000000000000000
-0.11088900000000000000
-0.09000000000000000000
-0.10890000000000000000
-0.11088900000000000000
-1.00000000000000000000
-4.00000000000000000000
-9.85960000000000000000
-1.25440000000000000000
-1.25440000000000000000
-1.25888400000000000000
-1.25440000000000000000
-1.25888400000000000000
-15376.00000000000000000000
-15675.04000000000000000000
-1576255.14010000000000000000
-9.85960000000000000000
-9.85960000000000000000
-9.85960000000000000000
-1.00000000000000000000
-NULL
+19360000.00000000000000000
NULL
+0.00000000000000000
+0.00000000000000000
+10000.00000000000000000
+100.00000000000000000
+1.00000000000000000
+0.01000000000000000
+0.00010000000000000
+40000.00000000000000000
+400.00000000000000000
+4.00000000000000000
+0.00000000000000000
+0.04000000000000000
+0.00040000000000000
+0.09000000000000000
+0.10890000000000000
+0.11088900000000000
+0.09000000000000000
+0.10890000000000000
+0.11088900000000000
+1.00000000000000000
+4.00000000000000000
+9.85960000000000000
+1.25440000000000000
+1.25440000000000000
+1.25888400000000000
+1.25440000000000000
+1.25888400000000000
+15376.00000000000000000
+15675.04000000000000000
+1576255.14010000000000000
+9.85960000000000000
+9.85960000000000000
+9.85960000000000000
+1.00000000000000000
+1524157875323883675.01905199875019052
+1524157875323883652.79682997652796840
PREHOOK: query: EXPLAIN SELECT key, value FROM DECIMAL_UDF where key * value > 0
PREHOOK: type: QUERY
POSTHOOK: query: EXPLAIN SELECT key, value FROM DECIMAL_UDF where key * value > 0
@@ -1258,7 +1258,7 @@ STAGE PLANS:
predicate: (key <> 0) (type: boolean)
Statistics: Num rows: 38 Data size: 4296 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: (key / key) (type: decimal(38,24))
+ expressions: (key / key) (type: decimal(38,18))
outputColumnNames: _col0
Statistics: Num rows: 38 Data size: 4296 Basic stats: COMPLETE Column stats: NONE
File Output Operator
@@ -1285,40 +1285,40 @@ POSTHOOK: query: SELECT key / key FROM DECIMAL_UDF WHERE key is not null and key
POSTHOOK: type: QUERY
POSTHOOK: Input: default@decimal_udf
#### A masked pattern was here ####
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
-1.000000000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
+1.000000000000000000
PREHOOK: query: EXPLAIN SELECT key / value FROM DECIMAL_UDF WHERE value is not null and value <> 0
PREHOOK: type: QUERY
POSTHOOK: query: EXPLAIN SELECT key / value FROM DECIMAL_UDF WHERE value is not null and value <> 0
@@ -1687,19 +1687,19 @@ STAGE PLANS:
outputColumnNames: _col0, _col1, _col2, _col3
Statistics: Num rows: 19 Data size: 2148 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: _col0 (type: int), (_col1 / CAST( _col2 AS decimal(19,0))) (type: decimal(38,23)), _col3 (type: decimal(24,14)), _col1 (type: decimal(30,10))
+ expressions: _col0 (type: int), (_col1 / CAST( _col2 AS decimal(19,0))) (type: decimal(38,18)), _col3 (type: decimal(24,14)), _col1 (type: decimal(30,10))
outputColumnNames: _col0, _col1, _col2, _col3
Statistics: Num rows: 19 Data size: 2148 Basic stats: COMPLETE Column stats: NONE
Reduce Output Operator
key expressions: _col0 (type: int)
sort order: +
Statistics: Num rows: 19 Data size: 2148 Basic stats: COMPLETE Column stats: NONE
- value expressions: _col1 (type: decimal(38,23)), _col2 (type: decimal(24,14)), _col3 (type: decimal(30,10))
+ value expressions: _col1 (type: decimal(38,18)), _col2 (type: decimal(24,14)), _col3 (type: decimal(30,10))
Reducer 3
Execution mode: vectorized, llap
Reduce Operator Tree:
Select Operator
- expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: decimal(38,23)), VALUE._col1 (type: decimal(24,14)), VALUE._col2 (type: decimal(30,10))
+ expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: decimal(38,18)), VALUE._col1 (type: decimal(24,14)), VALUE._col2 (type: decimal(30,10))
outputColumnNames: _col0, _col1, _col2, _col3
Statistics: Num rows: 19 Data size: 2148 Basic stats: COMPLETE Column stats: NONE
File Output Operator
@@ -1724,23 +1724,23 @@ POSTHOOK: query: SELECT value, sum(key) / count(key), avg(key), sum(key) FROM DE
POSTHOOK: type: QUERY
POSTHOOK: Input: default@decimal_udf
#### A masked pattern was here ####
--1234567890 -1234567890.12345678900000000000000 -1234567890.12345678900000 -1234567890.1234567890
--1255 -1255.49000000000000000000000 -1255.49000000000000 -1255.4900000000
--11 -1.12200000000000000000000 -1.12200000000000 -1.1220000000
--1 -1.12000000000000000000000 -1.12000000000000 -2.2400000000
-0 0.02538461538461538461538 0.02538461538462 0.3300000000
-1 1.04840000000000000000000 1.04840000000000 5.2420000000
-2 2.00000000000000000000000 2.00000000000000 4.0000000000
-3 3.14000000000000000000000 3.14000000000000 9.4200000000
-4 3.14000000000000000000000 3.14000000000000 3.1400000000
-10 10.00000000000000000000000 10.00000000000000 10.0000000000
-20 20.00000000000000000000000 20.00000000000000 20.0000000000
-100 100.00000000000000000000000 100.00000000000000 100.0000000000
-124 124.00000000000000000000000 124.00000000000000 124.0000000000
-125 125.20000000000000000000000 125.20000000000000 125.2000000000
-200 200.00000000000000000000000 200.00000000000000 200.0000000000
-4400 -4400.00000000000000000000000 -4400.00000000000000 -4400.0000000000
-1234567890 1234567890.12345678000000000000000 1234567890.12345678000000 1234567890.1234567800
+-1234567890 -1234567890.123456789000000000 -1234567890.12345678900000 -1234567890.1234567890
+-1255 -1255.490000000000000000 -1255.49000000000000 -1255.4900000000
+-11 -1.122000000000000000 -1.12200000000000 -1.1220000000
+-1 -1.120000000000000000 -1.12000000000000 -2.2400000000
+0 0.025384615384615385 0.02538461538462 0.3300000000
+1 1.048400000000000000 1.04840000000000 5.2420000000
+2 2.000000000000000000 2.00000000000000 4.0000000000
+3 3.140000000000000000 3.14000000000000 9.4200000000
+4 3.140000000000000000 3.14000000000000 3.1400000000
+10 10.000000000000000000 10.00000000000000 10.0000000000
+20 20.000000000000000000 20.00000000000000 20.0000000000
+100 100.000000000000000000 100.00000000000000 100.0000000000
+124 124.000000000000000000 124.00000000000000 124.0000000000
+125 125.200000000000000000 125.20000000000000 125.2000000000
+200 200.000000000000000000 200.00000000000000 200.0000000000
+4400 -4400.000000000000000000 -4400.00000000000000 -4400.0000000000
+1234567890 1234567890.123456780000000000 1234567890.12345678000000 1234567890.1234567800
PREHOOK: query: -- negative
EXPLAIN SELECT -key FROM DECIMAL_UDF
PREHOOK: type: QUERY
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out b/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
index db160e1..895116d 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_expressions.q.out
@@ -38,18 +38,18 @@ STAGE PLANS:
predicate: ((cdecimal1 > 0) and (cdecimal1 < 12345.5678) and (cdecimal2 <> 0) and (cdecimal2 > 1000) and cdouble is not null) (type: boolean)
Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
Select Operator
- expressions: (cdecimal1 + cdecimal2) (type: decimal(25,14)), (cdecimal1 - (2 * cdecimal2)) (type: decimal(26,14)), ((cdecimal1 + 2.34) / cdecimal2) (type: decimal(38,23)), (cdecimal1 * (cdecimal2 / 3.4)) (type: decimal(38,27)), (cdecimal1 % 10) (type: decimal(12,10)), UDFToInteger(cdecimal1) (type: int), UDFToShort(cdecimal2) (type: smallint), UDFToByte(cdecimal2) (type: tinyint), UDFToLong(cdecimal1) (type: bigint), UDFToBoolean(cdecimal1) (type: boolean), UDFToDouble(cdecimal2) (type: double), UDFToFloat(cdecimal1) (type: float), UDFToString(cdecimal2) (type: string), CAST( cdecimal1 AS TIMESTAMP) (type: timestamp)
+ expressions: (cdecimal1 + cdecimal2) (type: decimal(25,14)), (cdecimal1 - (2 * cdecimal2)) (type: decimal(26,14)), ((cdecimal1 + 2.34) / cdecimal2) (type: decimal(38,13)), (cdecimal1 * (cdecimal2 / 3.4)) (type: decimal(38,17)), (cdecimal1 % 10) (type: decimal(12,10)), UDFToInteger(cdecimal1) (type: int), UDFToShort(cdecimal2) (type: smallint), UDFToByte(cdecimal2) (type: tinyint), UDFToLong(cdecimal1) (type: bigint), UDFToBoolean(cdecimal1) (type: boolean), UDFToDouble(cdecimal2) (type: double), UDFToFloat(cdecimal1) (type: float), UDFToString(cdecimal2) (type: string), CAST( cdecimal1 AS TIMESTAMP) (type: timestamp)
outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
Reduce Output Operator
- key expressions: _col0 (type: decimal(25,14)), _col1 (type: decimal(26,14)), _col2 (type: decimal(38,23)), _col3 (type: decimal(38,27)), _col4 (type: decimal(12,10)), _col5 (type: int), _col6 (type: smallint), _col7 (type: tinyint), _col8 (type: bigint), _col9 (type: boolean), _col10 (type: double), _col11 (type: float), _col12 (type: string), _col13 (type: timestamp)
+ key expressions: _col0 (type: decimal(25,14)), _col1 (type: decimal(26,14)), _col2 (type: decimal(38,13)), _col3 (type: decimal(38,17)), _col4 (type: decimal(12,10)), _col5 (type: int), _col6 (type: smallint), _col7 (type: tinyint), _col8 (type: bigint), _col9 (type: boolean), _col10 (type: double), _col11 (type: float), _col12 (type: string), _col13 (type: timestamp)
sort order: ++++++++++++++
Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
TopN Hash Memory Usage: 0.1
Execution mode: vectorized
Reduce Operator Tree:
Select Operator
- expressions: KEY.reducesinkkey0 (type: decimal(25,14)), KEY.reducesinkkey1 (type: decimal(26,14)), KEY.reducesinkkey2 (type: decimal(38,23)), KEY.reducesinkkey3 (type: decimal(38,27)), KEY.reducesinkkey4 (type: decimal(12,10)), KEY.reducesinkkey5 (type: int), KEY.reducesinkkey6 (type: smallint), KEY.reducesinkkey7 (type: tinyint), KEY.reducesinkkey8 (type: bigint), KEY.reducesinkkey9 (type: boolean), KEY.reducesinkkey10 (type: double), KEY.reducesinkkey11 (type: float), KEY.reducesinkkey12 (type: string), KEY.reducesinkkey13 (type: timestamp)
+ expressions: KEY.reducesinkkey0 (type: decimal(25,14)), KEY.reducesinkkey1 (type: decimal(26,14)), KEY.reducesinkkey2 (type: decimal(38,13)), KEY.reducesinkkey3 (type: decimal(38,17)), KEY.reducesinkkey4 (type: decimal(12,10)), KEY.reducesinkkey5 (type: int), KEY.reducesinkkey6 (type: smallint), KEY.reducesinkkey7 (type: tinyint), KEY.reducesinkkey8 (type: bigint), KEY.reducesinkkey9 (type: boolean), KEY.reducesinkkey10 (type: double), KEY.reducesinkkey11 (type: float), KEY.reducesinkkey12 (type: string), KEY.reducesinkkey13 (type: timestamp)
outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
Statistics: Num rows: 455 Data size: 78809 Basic stats: COMPLETE Column stats: NONE
Limit
@@ -81,13 +81,13 @@ LIMIT 10
POSTHOOK: type: QUERY
POSTHOOK: Input: default@decimal_test
#### A masked pattern was here ####
-1836.44199584197700 -1166.02723492725400 0.83726978148337131458955 245972.558108102558044693817536566 5.6189189189 835 1000 -24 835 true 1000.823076923077 835.6189 1000.823076923077 1969-12-31 16:13:55.618918918
-1856.13222453224620 -1178.52931392929240 0.83724497870140374273038 251275.443243249687478989925889984 4.5783783784 844 1011 -13 844 true 1011.5538461538462 844.57837 1011.5538461538462 1969-12-31 16:14:04.578378378
-1858.75758835761550 -1180.19625779623100 0.83724171136694298221079 251986.767567575648615190046228140 5.7729729730 845 1012 -12 845 true 1012.9846153846155 845.77295 1012.9846153846155 1969-12-31 16:14:05.772972973
-1862.69563409566930 -1182.69667359663860 0.83723682763446158861586 253055.639189199696672864219396582 7.5648648649 847 1015 -9 847 true 1015.1307692307693 847.5649 1015.1307692307693 1969-12-31 16:14:07.564864864
-1883.69854469852330 -1196.03222453224660 0.83721112592864992485015 258794.493243236771165588048182512 7.1216216216 857 1026 2 857 true 1026.5769230769233 857.12164 1026.5769230769233 1969-12-31 16:14:17.121621621
-1886.32390852389240 -1197.69916839918480 0.83720795345819015087813 259516.374324319444568156352818442 8.3162162162 858 1028 4 858 true 1028.0076923076924 858.3162 1028.0076923076924 1969-12-31 16:14:18.316216216
-1887.63659043657700 -1198.53264033265400 0.83720637053221313673364 259877.691891887822598337517182035 8.9135135135 858 1028 4 858 true 1028.723076923077 858.9135 1028.723076923077 1969-12-31 16:14:18.913513513
-1895.51268191268460 -1203.53347193346920 0.83719691901713431682002 262050.875675676492928354428763593 2.4972972973 862 1033 9 862 true 1033.0153846153846 862.4973 1033.0153846153846 1969-12-31 16:14:22.497297297
-1909.95218295221550 -1212.70166320163100 0.83717979369462356311054 266058.547297307255740143215728140 9.0675675676 869 1040 16 869 true 1040.8846153846155 869.06757 1040.8846153846155 1969-12-31 16:14:29.067567567
-1913.89022869026920 -1215.20207900203840 0.83717516799957965211367 267156.827027039455923922058456280 0.8594594595 870 1043 19 870 true 1043.0307692307692 870.85944 1043.0307692307692 1969-12-31 16:14:30.859459459
+1836.44199584197700 -1166.02723492725400 0.8372697814834 245972.55810810255804469 5.6189189189 835 1000 -24 835 true 1000.823076923077 835.6189 1000.823076923077 1969-12-31 16:13:55.618918918
+1856.13222453224620 -1178.52931392929240 0.8372449787014 251275.44324324968747899 4.5783783784 844 1011 -13 844 true 1011.5538461538462 844.57837 1011.5538461538462 1969-12-31 16:14:04.578378378
+1858.75758835761550 -1180.19625779623100 0.8372417113669 251986.76756757564861519 5.7729729730 845 1012 -12 845 true 1012.9846153846155 845.77295 1012.9846153846155 1969-12-31 16:14:05.772972973
+1862.69563409566930 -1182.69667359663860 0.8372368276345 253055.63918919969667286 7.5648648649 847 1015 -9 847 true 1015.1307692307693 847.5649 1015.1307692307693 1969-12-31 16:14:07.564864864
+1883.69854469852330 -1196.03222453224660 0.8372111259286 258794.49324323677116559 7.1216216216 857 1026 2 857 true 1026.5769230769233 857.12164 1026.5769230769233 1969-12-31 16:14:17.121621621
+1886.32390852389240 -1197.69916839918480 0.8372079534582 259516.37432431944456816 8.3162162162 858 1028 4 858 true 1028.0076923076924 858.3162 1028.0076923076924 1969-12-31 16:14:18.316216216
+1887.63659043657700 -1198.53264033265400 0.8372063705322 259877.69189188782259834 8.9135135135 858 1028 4 858 true 1028.723076923077 858.9135 1028.723076923077 1969-12-31 16:14:18.913513513
+1895.51268191268460 -1203.53347193346920 0.8371969190171 262050.87567567649292835 2.4972972973 862 1033 9 862 true 1033.0153846153846 862.4973 1033.0153846153846 1969-12-31 16:14:22.497297297
+1909.95218295221550 -1212.70166320163100 0.8371797936946 266058.54729730725574014 9.0675675676 869 1040 16 869 true 1040.8846153846155 869.06757 1040.8846153846155 1969-12-31 16:14:29.067567567
+1913.89022869026920 -1215.20207900203840 0.8371751679996 267156.82702703945592392 0.8594594595 870 1043 19 870 true 1043.0307692307692 870.85944 1043.0307692307692 1969-12-31 16:14:30.859459459
http://git-wip-us.apache.org/repos/asf/hive/blob/99a95182/ql/src/test/results/clientpositive/vector_decimal_precision.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_decimal_precision.q.out b/ql/src/test/results/clientpositive/vector_decimal_precision.q.out
index ca14c44..94b9657 100644
--- a/ql/src/test/results/clientpositive/vector_decimal_precision.q.out
+++ b/ql/src/test/results/clientpositive/vector_decimal_precision.q.out
@@ -514,37 +514,37 @@ NULL NULL
NULL NULL
NULL NULL
NULL NULL
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.0000000000 0.00000000000000000000
-0.1234567890 0.01524157875019052100
-0.1234567890 0.01524157875019052100
-1.2345678901 1.52415787526596567801
-1.2345678901 1.52415787526596567801
-1.2345678901 1.52415787526596567801
-12.3456789012 152.41578753153483936144
-12.3456789012 152.41578753153483936144
-12.3456789012 152.41578753153483936144
-123.4567890123 15241.57875322755800955129
-123.4567890123 15241.57875322755800955129
-123.4567890123 15241.57875322755800955129
-1234.5678901235 1524157.87532399036884525225
-1234.5678901235 1524157.87532399036884525225
-1234.5678901235 1524157.87532399036884525225
-12345.6789012346 152415787.53238916034140423716
-12345.6789012346 152415787.53238916034140423716
-123456.7890123456 15241578753.23881726870921383936
-123456.7890123457 15241578753.23884196006701630849
-1234567.8901234560 1524157875323.88172687092138393600
-1234567.8901234568 1524157875323.88370217954558146624
-12345678.9012345600 152415787532388.17268709213839360000
-12345678.9012345679 152415787532388.36774881877789971041
-123456789.0123456000 15241578753238817.26870921383936000000
-123456789.0123456789 15241578753238836.75019051998750190521
-1234567890.1234560000 NULL
-1234567890.1234567890 NULL
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.0000000000 0.00000000000000000
+0.1234567890 0.01524157875019052
+0.1234567890 0.01524157875019052
+1.2345678901 1.52415787526596568
+1.2345678901 1.52415787526596568
+1.2345678901 1.52415787526596568
+12.3456789012 152.41578753153483936
+12.3456789012 152.41578753153483936
+12.3456789012 152.41578753153483936
+123.4567890123 15241.57875322755800955
+123.4567890123 15241.57875322755800955
+123.4567890123 15241.57875322755800955
+1234.5678901235 1524157.87532399036884525
+1234.5678901235 1524157.87532399036884525
+1234.5678901235 1524157.87532399036884525
+12345.6789012346 152415787.53238916034140424
+12345.6789012346 152415787.53238916034140424
+123456.7890123456 15241578753.23881726870921384
+123456.7890123457 15241578753.23884196006701631
+1234567.8901234560 1524157875323.88172687092138394
+1234567.8901234568 1524157875323.88370217954558147
+12345678.9012345600 152415787532388.17268709213839360
+12345678.9012345679 152415787532388.36774881877789971
+123456789.0123456000 15241578753238817.26870921383936000
+123456789.0123456789 15241578753238836.75019051998750191
+1234567890.1234560000 1524157875323881726.87092138393600000
+1234567890.1234567890 1524157875323883675.01905199875019052
PREHOOK: query: EXPLAIN SELECT avg(dec), sum(dec) FROM DECIMAL_PRECISION
PREHOOK: type: QUERY
POSTHOOK: query: EXPLAIN SELECT avg(dec), sum(dec) FROM DECIMAL_PRECISION