hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pras...@apache.org
Subject svn commit: r799148 - in /hadoop/hive/trunk: CHANGES.txt serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableSerDe.java
Date Thu, 30 Jul 2009 01:18:47 GMT
Author: prasadc
Date: Thu Jul 30 01:18:47 2009
New Revision: 799148

URL: http://svn.apache.org/viewvc?rev=799148&view=rev
Log:
HIVE-710. Fix serialization bug in BinarySortableSerDe for negative double
    and float numbers (Zheng Shao via pchakka)

Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
    hadoop/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableSerDe.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=799148&r1=799147&r2=799148&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Thu Jul 30 01:18:47 2009
@@ -103,7 +103,7 @@
 
     HIVE-656. Add a PMOD (POSITIVE MOD) function. (Scott Chen via zshao)
 
-    HIVE-698. Add create temporary function for generic UDAF. 
+    HIVE-698. Add create temporary function for generic UDAF.
     (Zheng Shao via namit)
 
     HIVE-607. Add udafs for variance and standard deviation
@@ -377,9 +377,9 @@
 
     HIVE-612. Problem in removing temp files in FileSinkOperator.jobClose
     (Zheng Shao via namit)
- 
+
     HIVE-608. No type conversion in GenericUDF
-    (Zheng Shao via namit)  
+    (Zheng Shao via namit)
 
     HIVE-616. Make hive work with symbolic linked sub directories
     (Zheng Shao via rmurthy)
@@ -431,7 +431,7 @@
     HIVE-620. bug in displaying function name when more than 1 function points to the same
class
     (Emil Ibrishimov via namit)
 
-    HIVE-670. dump output column names in explain 
+    HIVE-670. dump output column names in explain
     (Zheng Shao via namit)
 
     HIVE-673. Bug in handling of null partitions.
@@ -449,6 +449,9 @@
     HIVE-702. bug in drop temporary function
     (Min Zhou via namit)
 
+    HIVE-710. Fix serialization bug in BinarySortableSerDe for negative double
+    and float numbers (Zheng Shao via pchakka)
+
 Release 0.3.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java?rev=799148&r1=799147&r2=799148&view=diff
==============================================================================
--- hadoop/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
(original)
+++ hadoop/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
Thu Jul 30 01:18:47 2009
@@ -229,7 +229,7 @@
             }
             if ((v & (1<<31)) == 0) {
               // negative number, flip all bits
-              v = v ^ Integer.MAX_VALUE;
+              v = ~v;
             } else {
               // positive number, flip the first bit
               v = v ^ (1<<31);
@@ -245,7 +245,7 @@
             }
             if ((v & (1L<<63)) == 0) {
               // negative number, flip all bits
-              v = v ^ Long.MAX_VALUE;
+              v = ~v;
             } else {
               // positive number, flip the first bit
               v = v ^ (1L<<63);
@@ -470,7 +470,7 @@
             int v = Float.floatToIntBits(foi.get(o));
             if ((v & (1<<31)) != 0) {
               // negative number, flip all bits
-              v = v ^ Integer.MAX_VALUE;
+              v = ~v;
             } else {
               // positive number, flip the first bit
               v = v ^ (1<<31);
@@ -486,7 +486,7 @@
             long v = Double.doubleToLongBits(doi.get(o));
             if ((v & (1L<<63)) != 0) {
               // negative number, flip all bits
-              v = v ^ Long.MAX_VALUE;
+              v = ~v;
             } else {
               // positive number, flip the first bit
               v = v ^ (1L<<63);

Modified: hadoop/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableSerDe.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableSerDe.java?rev=799148&r1=799147&r2=799148&view=diff
==============================================================================
--- hadoop/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableSerDe.java
(original)
+++ hadoop/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/binarysortable/TestBinarySortableSerDe.java
Thu Jul 30 01:18:47 2009
@@ -151,8 +151,8 @@
         t.myShort = randField > 1 ? null : Short.valueOf((short)r.nextInt());
         t.myInt = randField > 2 ? null : Integer.valueOf(r.nextInt());
         t.myLong = randField > 3 ? null : Long.valueOf(r.nextLong());
-        t.myFloat = randField > 4 ? null : Float.valueOf(r.nextFloat());
-        t.myDouble = randField > 5 ? null : Double.valueOf(r.nextDouble());
+        t.myFloat = randField > 4 ? null : Float.valueOf(r.nextFloat() * 10 - 5);
+        t.myDouble = randField > 5 ? null : Double.valueOf(r.nextDouble() * 10 - 5);
         t.myString = randField > 6 ? null : getRandString(r);
         t.myStruct = randField > 7 ? null : new MyTestInnerStruct(r.nextInt(5)-2, r.nextInt(5)-2);
         t.myList = randField > 8 ? null: getRandIntegerArray(r);



Mime
View raw message