diff --git druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java index 7ac52c6..e539dab 100644 --- druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java +++ druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java @@ -219,9 +219,14 @@ private static String createSelectStarQuery(String dataSource) throws IOExceptio 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"); }