hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1550555 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/io/orc/SerializationUtils.java test/org/apache/hadoop/hive/ql/io/orc/TestNewIntegerEncoding.java
Date Thu, 12 Dec 2013 22:30:53 GMT
Author: hashutosh
Date: Thu Dec 12 22:30:52 2013
New Revision: 1550555

URL: http://svn.apache.org/r1550555
Log:
HIVE-5994 : ORC RLEv2 encodes wrongly for large negative BIGINTs  (64 bits ) (Prasanth J via
Owen Omalley)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/SerializationUtils.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestNewIntegerEncoding.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/SerializationUtils.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/SerializationUtils.java?rev=1550555&r1=1550554&r2=1550555&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/SerializationUtils.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/SerializationUtils.java Thu Dec
12 22:30:52 2013
@@ -200,7 +200,7 @@ final class SerializationUtils {
    */
   static int findClosestNumBits(long value) {
     int count = 0;
-    while (value > 0) {
+    while (value != 0) {
       count++;
       value = value >>> 1;
     }

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestNewIntegerEncoding.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestNewIntegerEncoding.java?rev=1550555&r1=1550554&r2=1550555&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestNewIntegerEncoding.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestNewIntegerEncoding.java Thu
Dec 12 22:30:52 2013
@@ -949,6 +949,38 @@ public class TestNewIntegerEncoding {
   }
 
   @Test
+  public void testDirectLargeNegatives() throws Exception {
+    ObjectInspector inspector;
+    synchronized (TestOrcFile.class) {
+      inspector = ObjectInspectorFactory.getReflectionObjectInspector(Long.class,
+          ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
+    }
+
+    Writer writer = OrcFile.createWriter(testFilePath,
+        OrcFile.writerOptions(conf).inspector(inspector).stripeSize(100000).bufferSize(10000));
+
+    writer.addRow(-7486502418706614742L);
+    writer.addRow(0L);
+    writer.addRow(1L);
+    writer.addRow(1L);
+    writer.addRow(-5535739865598783616L);
+    writer.close();
+
+    Reader reader = OrcFile.createReader(fs, testFilePath);
+    RecordReader rows = reader.rows(null);
+    Object row = rows.next(null);
+    assertEquals(-7486502418706614742L, ((LongWritable) row).get());
+    row = rows.next(row);
+    assertEquals(0L, ((LongWritable) row).get());
+    row = rows.next(row);
+    assertEquals(1L, ((LongWritable) row).get());
+    row = rows.next(row);
+    assertEquals(1L, ((LongWritable) row).get());
+    row = rows.next(row);
+    assertEquals(-5535739865598783616L, ((LongWritable) row).get());
+  }
+
+  @Test
   public void testSeek() throws Exception {
     ObjectInspector inspector;
     synchronized (TestOrcFile.class) {



Mime
View raw message