assign granularity.all to SelectQuery by default (#5091)

This commit is contained in:
Chuanlei Ni 2017-11-22 09:10:19 +08:00 committed by Gian Merlino
parent 22c49b0d33
commit 368d03146b
2 changed files with 3 additions and 2 deletions

View File

@ -38,7 +38,7 @@ There are several main parts to a select query:
|filter|See [Filters](../querying/filters.html)|no|
|dimensions|A JSON list of dimensions to select; or see [DimensionSpec](../querying/dimensionspecs.html) for ways to extract dimensions. If left empty, all dimensions are returned.|no|
|metrics|A String array of metrics to select. If left empty, all metrics are returned.|no|
|granularity|Defines the granularity of the query. See [Granularities](../querying/granularities.html)|yes|
|granularity|Defines the granularity of the query. See [Granularities](../querying/granularities.html). Default is `Granularity.ALL`.|no|
|pagingSpec|A JSON object indicating offsets into different scanned segments. Query results will return a `pagingIdentifiers` value that can be reused in the next query for pagination.|yes|
|context|An additional JSON Object which can be used to specify certain flags.|no|

View File

@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.base.Preconditions;
import io.druid.java.util.common.granularity.Granularities;
import io.druid.java.util.common.granularity.Granularity;
import io.druid.query.BaseQuery;
import io.druid.query.DataSource;
@ -66,7 +67,7 @@ public class SelectQuery extends BaseQuery<Result<SelectResultValue>>
{
super(dataSource, querySegmentSpec, descending, context);
this.dimFilter = dimFilter;
this.granularity = granularity;
this.granularity = granularity == null ? Granularities.ALL : granularity;
this.dimensions = dimensions;
this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns);
this.metrics = metrics;