private static String withQueryId(String druidQuery, String queryId) throws IOException {
    Query<?> queryWithId = DruidStorageHandlerUtils.JSON_MAPPER.readValue(druidQuery, BaseQuery.class).withId(queryId);
    return DruidStorageHandlerUtils.JSON_MAPPER.writeValueAsString(queryWithId);
  }
Druid query based input format.

Given a query and the Druid broker address, it will send it, and retrieve
and parse the results.
druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidQueryBasedInputFormat.java