@Override public org.apache.hadoop.mapred.RecordReader<NullWritable, DruidWritable> getRecordReader(
      org.apache.hadoop.mapred.InputSplit split,
      JobConf job,
      Reporter reporter) throws IOException {
    // We need to provide a different record reader for every type of Druid query.
    // The reason is that Druid results format is different for each type.
    final DruidQueryRecordReader<?> reader;
    // By default, we use druid scan query as fallback.
    final String druidQueryType = job.get(Constants.DRUID_QUERY_TYPE, Query.SCAN);
    reader = getDruidQueryReader(druidQueryType);
    reader.initialize((HiveDruidSplit) split, job);
    if (Utilities.getIsVectorized(job)) {
      //noinspection unchecked
      return (org.apache.hadoop.mapred.RecordReader) new DruidVectorizedWrapper(reader, job);
    }
    return reader;
  }
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