hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject [01/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)
Date Thu, 07 Jul 2016 19:49:46 GMT
Repository: hive
Updated Branches:
  refs/heads/master e1171c933 -> 1b5ee3d88


http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientpositive/vectorized_math_funcs.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vectorized_math_funcs.q.out b/ql/src/test/results/clientpositive/vectorized_math_funcs.q.out
index 3a57d92..7b7dedc 100644
--- a/ql/src/test/results/clientpositive/vectorized_math_funcs.q.out
+++ b/ql/src/test/results/clientpositive/vectorized_math_funcs.q.out
@@ -121,7 +121,7 @@ STAGE PLANS:
               predicate: (((cbigint % 500) = 0) and (sin(cfloat) >= -1.0)) (type: boolean)
               Statistics: Num rows: 2048 Data size: 440327 Basic stats: COMPLETE Column stats:
NONE
               Select Operator
-                expressions: cdouble (type: double), round(cdouble, 2) (type: double), floor(cdouble)
(type: bigint), ceil(cdouble) (type: bigint), rand() (type: double), rand(98007) (type: double),
exp(ln(cdouble)) (type: double), ln(cdouble) (type: double), ln(cfloat) (type: double), log10(cdouble)
(type: double), log2(cdouble) (type: double), log2((cdouble - 15601.0)) (type: double), log2(cfloat)
(type: double), log2(cbigint) (type: double), log2(cint) (type: double), log2(csmallint) (type:
double), log2(ctinyint) (type: double), log(2.0, cdouble) (type: double), power(log2(cdouble),
2.0) (type: double), power(log2(cdouble), 2.0) (type: double), sqrt(cdouble) (type: double),
sqrt(cbigint) (type: double), bin(cbigint) (type: string), hex(cdouble) (type: string), conv(cbigint,
10, 16) (type: string), abs(cdouble) (type: double), abs(ctinyint) (type: int), (cint pmod
3) (type: int), sin(cdouble) (type: double), asin(cdouble) (type: double), cos(cdouble) (type:
double), acos(cdouble)
  (type: double), atan(cdouble) (type: double), degrees(cdouble) (type: double), radians(cdouble)
(type: double), cdouble (type: double), cbigint (type: bigint), (- cdouble) (type: double),
sign(cdouble) (type: double), sign(cbigint) (type: double), cos(((- sin(log(cdouble))) + 3.14159))
(type: double)
+                expressions: cdouble (type: double), round(cdouble, 2) (type: double), floor(cdouble)
(type: bigint), ceil(cdouble) (type: bigint), rand() (type: double), rand(98007) (type: double),
exp(ln(cdouble)) (type: double), ln(cdouble) (type: double), ln(cfloat) (type: double), log10(cdouble)
(type: double), log2(cdouble) (type: double), log2((cdouble - 15601.0)) (type: double), log2(cfloat)
(type: double), log2(cbigint) (type: double), log2(cint) (type: double), log2(csmallint) (type:
double), log2(ctinyint) (type: double), log(2, cdouble) (type: double), power(log2(cdouble),
2) (type: double), power(log2(cdouble), 2) (type: double), sqrt(cdouble) (type: double), sqrt(cbigint)
(type: double), bin(cbigint) (type: string), hex(cdouble) (type: string), conv(cbigint, 10,
16) (type: string), abs(cdouble) (type: double), abs(ctinyint) (type: int), (cint pmod 3)
(type: int), sin(cdouble) (type: double), asin(cdouble) (type: double), cos(cdouble) (type:
double), acos(cdouble) (type
 : double), atan(cdouble) (type: double), degrees(cdouble) (type: double), radians(cdouble)
(type: double), cdouble (type: double), cbigint (type: bigint), (- cdouble) (type: double),
sign(cdouble) (type: double), sign(cbigint) (type: double), cos(((- sin(log(cdouble))) + 3.14159))
(type: double)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7,
_col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19,
_col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29, _col30, _col31,
_col32, _col33, _col34, _col35, _col36, _col37, _col38, _col39, _col40
                 Statistics: Num rows: 2048 Data size: 440327 Basic stats: COMPLETE Column
stats: NONE
                 File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/ql/src/test/results/clientpositive/view_cast.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/view_cast.q.out b/ql/src/test/results/clientpositive/view_cast.q.out
index 34444ae..b771b7f 100644
--- a/ql/src/test/results/clientpositive/view_cast.q.out
+++ b/ql/src/test/results/clientpositive/view_cast.q.out
@@ -99,11 +99,11 @@ POSTHOOK: Input: default@joined_aa_view_tw
 POSTHOOK: Input: default@mstab
 POSTHOOK: Input: default@mstab@dt=20130311
 #### A masked pattern was here ####
-1111	abc	fun	bar	NULL	2222	NULL	99999.0	99999.0
-1111	abc	fun	bar	NULL	2222	NULL	99999.0	99999.0
-2222	abc	fun	bar	NULL	4444	NULL	99999.0	99999.0
-2222	abc	fun	bar	NULL	4444	NULL	99999.0	99999.0
-3333	abc	fun	bar	NULL	6666	NULL	99999.0	10.0
-3333	abc	fun	bar	NULL	6666	NULL	99999.0	10.0
-3333	abc	fun	bar	NULL	6666	NULL	99999.0	10.0
-4444	abc	fun	bar	NULL	8888	NULL	99999.0	99999.0
+1111	abc	fun	bar	NULL	2222	NULL	99999	99999
+1111	abc	fun	bar	NULL	2222	NULL	99999	99999
+2222	abc	fun	bar	NULL	4444	NULL	99999	99999
+2222	abc	fun	bar	NULL	4444	NULL	99999	99999
+3333	abc	fun	bar	NULL	6666	NULL	99999	10
+3333	abc	fun	bar	NULL	6666	NULL	99999	10
+3333	abc	fun	bar	NULL	6666	NULL	99999	10
+4444	abc	fun	bar	NULL	8888	NULL	99999	99999

http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
b/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
index 6415bf8..51b529e 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
@@ -485,6 +485,7 @@ public final class PrimitiveObjectInspectorUtils {
       return ((TimestampObjectInspector) oi).getPrimitiveWritableObject(o)
           .getDouble();
     case DECIMAL:
+      // TODO: lossy conversion!
       return ((HiveDecimalObjectInspector) oi).getPrimitiveJavaObject(o).doubleValue();
     case DATE:  // unsupported conversion
     default:
@@ -653,7 +654,7 @@ public final class PrimitiveObjectInspectorUtils {
       break;
     case DECIMAL:
       result = ((HiveDecimalObjectInspector) oi)
-          .getPrimitiveJavaObject(o).intValue();
+          .getPrimitiveJavaObject(o).intValue();  // TODO: lossy conversion!
       break;
     case DATE:  // unsupported conversion
     default: {
@@ -717,7 +718,7 @@ public final class PrimitiveObjectInspectorUtils {
       break;
     case DECIMAL:
       result = ((HiveDecimalObjectInspector) oi)
-          .getPrimitiveJavaObject(o).longValue();
+          .getPrimitiveJavaObject(o).longValue();  // TODO: lossy conversion!
       break;
     case DATE:  // unsupported conversion
     default:

http://git-wip-us.apache.org/repos/asf/hive/blob/1b5ee3d8/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java
----------------------------------------------------------------------
diff --git a/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java b/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java
index 1c6be91..674400c 100644
--- a/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java
+++ b/storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimal.java
@@ -80,7 +80,6 @@ public class HiveDecimal implements Comparable<HiveDecimal> {
     } catch (NumberFormatException ex) {
       return null;
     }
-
     bd = normalize(bd, true);
     return bd == null ? null : new HiveDecimal(bd);
   }
@@ -161,6 +160,7 @@ public class HiveDecimal implements Comparable<HiveDecimal> {
     return bdPrecision;
   }
 
+  /** Note - this method will corrupt the value if it doesn't fit. */
   public int intValue() {
     return bd.intValue();
   }
@@ -169,10 +169,12 @@ public class HiveDecimal implements Comparable<HiveDecimal> {
     return bd.doubleValue();
   }
 
+  /** Note - this method will corrupt the value if it doesn't fit. */
   public long longValue() {
     return bd.longValue();
   }
 
+  /** Note - this method will corrupt the value if it doesn't fit. */
   public short shortValue() {
     return bd.shortValue();
   }
@@ -329,4 +331,8 @@ public class HiveDecimal implements Comparable<HiveDecimal> {
 
     return HiveDecimal.create(bd);
   }
+
+  public long longValueExact() {
+    return bd.longValueExact();
+  }
 }


Mime
View raw message