hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcama...@apache.org
Subject hive git commit: HIVE-15274: DruidSelectQueryRecordReader uses wrong value for timestamp (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)
Date Wed, 23 Nov 2016 20:12:22 GMT
Repository: hive
Updated Branches:
  refs/heads/master ea920d6de -> 4d4cc1a16


HIVE-15274: DruidSelectQueryRecordReader uses wrong value for timestamp (Jesus Camacho Rodriguez,
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/4d4cc1a1
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/4d4cc1a1
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/4d4cc1a1

Branch: refs/heads/master
Commit: 4d4cc1a163b6fb4f6414d79b11cbc82efc5a109d
Parents: ea920d6
Author: Jesus Camacho Rodriguez <jcamacho@apache.org>
Authored: Wed Nov 23 20:12:12 2016 +0000
Committer: Jesus Camacho Rodriguez <jcamacho@apache.org>
Committed: Wed Nov 23 20:12:12 2016 +0000

----------------------------------------------------------------------
 .../druid/serde/DruidSelectQueryRecordReader.java    | 15 ++++++---------
 .../org/apache/hadoop/hive/druid/TestDruidSerDe.java | 12 ++++++------
 2 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/4d4cc1a1/druid-handler/src/java/org/apache/hadoop/hive/druid/serde/DruidSelectQueryRecordReader.java
----------------------------------------------------------------------
diff --git a/druid-handler/src/java/org/apache/hadoop/hive/druid/serde/DruidSelectQueryRecordReader.java
b/druid-handler/src/java/org/apache/hadoop/hive/druid/serde/DruidSelectQueryRecordReader.java
index 8b40d4d..c30ac56 100644
--- a/druid-handler/src/java/org/apache/hadoop/hive/druid/serde/DruidSelectQueryRecordReader.java
+++ b/druid-handler/src/java/org/apache/hadoop/hive/druid/serde/DruidSelectQueryRecordReader.java
@@ -76,11 +76,9 @@ public class DruidSelectQueryRecordReader
   public DruidWritable getCurrentValue() throws IOException, InterruptedException {
     // Create new value
     DruidWritable value = new DruidWritable();
-    value.getValue().put(DruidTable.DEFAULT_TIMESTAMP_COLUMN, current.getTimestamp().getMillis());
-    if (values.hasNext()) {
-      value.getValue().putAll(values.next().getEvent());
-      return value;
-    }
+    EventHolder e = values.next();
+    value.getValue().put(DruidTable.DEFAULT_TIMESTAMP_COLUMN, e.getTimestamp().getMillis());
+    value.getValue().putAll(e.getEvent());
     return value;
   }
 
@@ -89,10 +87,9 @@ public class DruidSelectQueryRecordReader
     if (nextKeyValue()) {
       // Update value
       value.getValue().clear();
-      value.getValue().put(DruidTable.DEFAULT_TIMESTAMP_COLUMN, current.getTimestamp().getMillis());
-      if (values.hasNext()) {
-        value.getValue().putAll(values.next().getEvent());
-      }
+      EventHolder e = values.next();
+      value.getValue().put(DruidTable.DEFAULT_TIMESTAMP_COLUMN, e.getTimestamp().getMillis());
+      value.getValue().putAll(e.getEvent());
       return true;
     }
     return false;

http://git-wip-us.apache.org/repos/asf/hive/blob/4d4cc1a1/druid-handler/src/test/org/apache/hadoop/hive/druid/TestDruidSerDe.java
----------------------------------------------------------------------
diff --git a/druid-handler/src/test/org/apache/hadoop/hive/druid/TestDruidSerDe.java b/druid-handler/src/test/org/apache/hadoop/hive/druid/TestDruidSerDe.java
index 9c5c65c..1343939 100644
--- a/druid-handler/src/test/org/apache/hadoop/hive/druid/TestDruidSerDe.java
+++ b/druid-handler/src/test/org/apache/hadoop/hive/druid/TestDruidSerDe.java
@@ -357,7 +357,7 @@ public class TestDruidSerDe {
           + "    \"segmentId\" : \"wikipedia_2012-12-29T00:00:00.000Z_2013-01-10T08:00:00.000Z_2013-01-10T08:13:47.830Z_v9\",
 "
           + "    \"offset\" : 2,  "
           + "    \"event\" : {   "
-          + "     \"timestamp\" : \"2013-01-01T00:00:00.000Z\",   "
+          + "     \"timestamp\" : \"2013-01-01T00:00:12.000Z\",   "
           + "     \"robot\" : \"0\",   "
           + "     \"namespace\" : \"article\",   "
           + "     \"anonymous\" : \"0\",   "
@@ -376,7 +376,7 @@ public class TestDruidSerDe {
           + "    \"segmentId\" : \"wikipedia_2012-12-29T00:00:00.000Z_2013-01-10T08:00:00.000Z_2013-01-10T08:13:47.830Z_v9\",
 "
           + "    \"offset\" : 3,  "
           + "    \"event\" : {   "
-          + "     \"timestamp\" : \"2013-01-01T00:00:00.000Z\",   "
+          + "     \"timestamp\" : \"2013-01-01T00:00:12.000Z\",   "
           + "     \"robot\" : \"0\",   "
           + "     \"namespace\" : \"article\",   "
           + "     \"anonymous\" : \"0\",   "
@@ -395,7 +395,7 @@ public class TestDruidSerDe {
           + "    \"segmentId\" : \"wikipedia_2012-12-29T00:00:00.000Z_2013-01-10T08:00:00.000Z_2013-01-10T08:13:47.830Z_v9\",
 "
           + "    \"offset\" : 4,  "
           + "    \"event\" : {   "
-          + "     \"timestamp\" : \"2013-01-01T00:00:00.000Z\",   "
+          + "     \"timestamp\" : \"2013-01-01T00:00:12.000Z\",   "
           + "     \"robot\" : \"0\",   "
           + "     \"namespace\" : \"article\",   "
           + "     \"anonymous\" : \"0\",   "
@@ -419,13 +419,13 @@ public class TestDruidSerDe {
     new Object[] { new TimestampWritable(new Timestamp(1356998400000L)), new Text("0"), new
Text("article"), new Text("0"), new Text("0"),
         new Text("112_U.S._580"), new Text("en"), new Text("1"), new Text("MZMcBride"),
         new FloatWritable(1.0F), new FloatWritable(70.0F), new FloatWritable(70.0F), new
FloatWritable(70.0F), new FloatWritable(0.0F) } ,
-    new Object[] { new TimestampWritable(new Timestamp(1356998400000L)), new Text("0"), new
Text("article"), new Text("0"), new Text("0"),
+    new Object[] { new TimestampWritable(new Timestamp(1356998412000L)), new Text("0"), new
Text("article"), new Text("0"), new Text("0"),
         new Text("113_U.S._243"), new Text("en"), new Text("1"), new Text("MZMcBride"),
         new FloatWritable(1.0F), new FloatWritable(77.0F), new FloatWritable(77.0F), new
FloatWritable(77.0F), new FloatWritable(0.0F) } ,
-    new Object[] { new TimestampWritable(new Timestamp(1356998400000L)), new Text("0"), new
Text("article"), new Text("0"), new Text("0"),
+    new Object[] { new TimestampWritable(new Timestamp(1356998412000L)), new Text("0"), new
Text("article"), new Text("0"), new Text("0"),
         new Text("113_U.S._73"), new Text("en"), new Text("1"), new Text("MZMcBride"),
         new FloatWritable(1.0F), new FloatWritable(70.0F), new FloatWritable(70.0F), new
FloatWritable(70.0F), new FloatWritable(0.0F) } ,
-    new Object[] { new TimestampWritable(new Timestamp(1356998400000L)), new Text("0"), new
Text("article"), new Text("0"), new Text("0"),
+    new Object[] { new TimestampWritable(new Timestamp(1356998412000L)), new Text("0"), new
Text("article"), new Text("0"), new Text("0"),
         new Text("113_U.S._756"), new Text("en"), new Text("1"), new Text("MZMcBride"),
         new FloatWritable(1.0F), new FloatWritable(68.0F), new FloatWritable(68.0F), new
FloatWritable(68.0F), new FloatWritable(0.0F) }
   };


Mime
View raw message