You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2017/01/19 00:46:10 UTC

[2/2] hive git commit: HIVE-15633: Hive/Druid integration: Exception when time filter is not in datasource range (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)

HIVE-15633: Hive/Druid integration: Exception when time filter is not in datasource range (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/8cdef2bc
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/8cdef2bc
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/8cdef2bc

Branch: refs/heads/master
Commit: 8cdef2bc8693950004eb47ee8d4f24b74137e1d7
Parents: 3ca3e4e
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Thu Jan 19 00:46:20 2017 +0000
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Thu Jan 19 00:46:20 2017 +0000

----------------------------------------------------------------------
 .../hadoop/hive/druid/io/DruidQueryBasedInputFormat.java      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/8cdef2bc/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java
----------------------------------------------------------------------
diff --git a/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java b/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java
index 7ac52c6..e539dab 100644
--- a/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java
+++ b/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java
@@ -219,9 +219,14 @@ public class DruidQueryBasedInputFormat extends InputFormat<NullWritable, DruidW
       response.close();
       throw new IOException(org.apache.hadoop.util.StringUtils.stringifyException(e));
     }
-    if (metadataList == null || metadataList.isEmpty()) {
+    if (metadataList == null) {
       throw new IOException("Connected to Druid but could not retrieve datasource information");
     }
+    if (metadataList.isEmpty()) {
+      // There are no rows for that time range, we can submit query as it is
+      return new HiveDruidSplit[] { new HiveDruidSplit(
+              address, DruidStorageHandlerUtils.JSON_MAPPER.writeValueAsString(query), dummyPath) };
+    }
     if (metadataList.size() != 1) {
       throw new IOException("Information about segments should have been merged");
     }