'Builds an ingest query for an HDFS TSV load.
:param datasource: target datasource in druid
:param columns: list of all columns in the TSV, in the right order'

def construct_ingest_query(self, datasource, static_path, ts_dim, columns, metric_spec, intervals, num_shards, target_partition_size, query_granularity='NONE', segment_granularity='DAY', hadoop_dependency_coordinates=None):

    if (target_partition_size == (-1)):
        if (num_shards == (-1)):
            target_partition_size = DEFAULT_TARGET_PARTITION_SIZE
    else:
        num_shards = (-1)
    metric_names = [m['fieldName'] for m in metric_spec if (m['type'] != 'count')]
    dimensions = [c for c in columns if ((c not in metric_names) and (c != ts_dim))]
    ingest_query_dict = {'type': 'index_hadoop', 'spec': {'dataSchema': {'metricsSpec': metric_spec, 'granularitySpec': {'queryGranularity': query_granularity, 'intervals': intervals, 'type': 'uniform', 'segmentGranularity': segment_granularity}, 'parser': {'type': 'string', 'parseSpec': {'columns': columns, 'dimensionsSpec': {'dimensionExclusions': [], 'dimensions': dimensions, 'spatialDimensions': []}, 'timestampSpec': {'column': ts_dim, 'format': 'auto'}, 'format': 'tsv'}}, 'dataSource': datasource}, 'tuningConfig': {'type': 'hadoop', 'jobProperties': {'mapreduce.job.user.classpath.first': 'false', 'mapreduce.map.output.compress': 'false', 'mapreduce.output.fileoutputformat.compress': 'false'}, 'partitionsSpec': {'type': 'hashed', 'targetPartitionSize': target_partition_size, 'numShards': num_shards}}, 'ioConfig': {'inputSpec': {'paths': static_path, 'type': 'static'}, 'type': 'hadoop'}}}
    if hadoop_dependency_coordinates:
        ingest_query_dict['hadoopDependencyCoordinates'] = hadoop_dependency_coordinates
    return json.dumps(ingest_query_dict, indent=4)
