mirror of
https://github.com/apache/druid.git
synced 2025-02-25 04:16:07 +00:00
Set default query granularity for null value (#3965)
This commit is contained in:
parent
f21641f0dc
commit
ebd100cbb0
@ -175,7 +175,8 @@ handle all formatting decisions on their own, without using the ParseSpec.
|
||||
|
||||
## GranularitySpec
|
||||
|
||||
The default granularity spec is `uniform`.
|
||||
The default granularity spec is `uniform`, and can be changed by setting the `type` field.
|
||||
Currently, `uniform` and `arbitrary` types are supported.
|
||||
|
||||
### Uniform Granularity Spec
|
||||
|
||||
@ -183,7 +184,6 @@ This spec is used to generated segments with uniform intervals.
|
||||
|
||||
| Field | Type | Description | Required |
|
||||
|-------|------|-------------|----------|
|
||||
| type | string | The type of granularity spec. | no (default == 'uniform') |
|
||||
| segmentGranularity | string | The granularity to create segments at. | no (default == 'DAY') |
|
||||
| queryGranularity | string | The minimum granularity to be able to query results at and the granularity of the data inside the segment. E.g. a value of "minute" will mean that data is aggregated at minutely granularity. That is, if there are collisions in the tuple (minute(timestamp), dimensions), then it will aggregate values together using the aggregators instead of storing individual rows. | no (default == 'NONE') |
|
||||
| rollup | boolean | rollup or not | no (default == true) |
|
||||
@ -196,7 +196,6 @@ This spec is used to generate segments with arbitrary intervals (it tries to cre
|
||||
|
||||
| Field | Type | Description | Required |
|
||||
|-------|------|-------------|----------|
|
||||
| type | string | The type of granularity spec. | no (default == 'uniform') |
|
||||
| queryGranularity | string | The minimum granularity to be able to query results at and the granularity of the data inside the segment. E.g. a value of "minute" will mean that data is aggregated at minutely granularity. That is, if there are collisions in the tuple (minute(timestamp), dimensions), then it will aggregate values together using the aggregators instead of storing individual rows. | no (default == 'NONE') |
|
||||
| rollup | boolean | rollup or not | no (default == true) |
|
||||
| intervals | string | A list of intervals for the raw data being ingested. Ignored for real-time ingestion. | yes for batch, no for real-time |
|
||||
|
@ -27,12 +27,11 @@ import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.PeekingIterator;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import io.druid.common.utils.JodaUtils;
|
||||
import io.druid.granularity.QueryGranularities;
|
||||
import io.druid.granularity.QueryGranularity;
|
||||
import io.druid.java.util.common.Granularity;
|
||||
import io.druid.java.util.common.guava.Comparators;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.Interval;
|
||||
@ -57,7 +56,7 @@ public class ArbitraryGranularitySpec implements GranularitySpec
|
||||
|
||||
)
|
||||
{
|
||||
this.queryGranularity = queryGranularity;
|
||||
this.queryGranularity = queryGranularity == null ? QueryGranularities.NONE : queryGranularity;
|
||||
this.rollup = rollup == null ? Boolean.TRUE : rollup;
|
||||
this.intervals = Sets.newTreeSet(Comparators.intervalsByStartThenEnd());
|
||||
this.timezone = timezone;
|
||||
|
@ -40,6 +40,21 @@ public class ArbitraryGranularityTest
|
||||
{
|
||||
private static final ObjectMapper jsonMapper = new DefaultObjectMapper();
|
||||
|
||||
@Test
|
||||
public void testDefaultQueryGranularity()
|
||||
{
|
||||
final GranularitySpec spec = new ArbitraryGranularitySpec(
|
||||
null,
|
||||
Lists.newArrayList(
|
||||
new Interval("2012-01-08T00Z/2012-01-11T00Z"),
|
||||
new Interval("2012-02-01T00Z/2012-03-01T00Z"),
|
||||
new Interval("2012-01-07T00Z/2012-01-08T00Z"),
|
||||
new Interval("2012-01-03T00Z/2012-01-04T00Z"),
|
||||
new Interval("2012-01-01T00Z/2012-01-03T00Z")
|
||||
));
|
||||
Assert.assertNotNull(spec.getQueryGranularity());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user