public class TemplateDruidQuery extends Object implements DruidAggregationQuery<TemplateDruidQuery>
Constructor and Description |
---|
TemplateDruidQuery(Collection<Aggregation> aggregations,
Collection<PostAggregation> postAggregations)
Template Query constructor for a non nested template query.
|
TemplateDruidQuery(Collection<Aggregation> aggregations,
Collection<PostAggregation> postAggregations,
TemplateDruidQuery nestedQuery)
Template Query constructor for a nested template query.
|
TemplateDruidQuery(Collection<Aggregation> aggregations,
Collection<PostAggregation> postAggregations,
TemplateDruidQuery nestedQuery,
ZonelessTimeGrain timeGrain)
Template Query constructor for a nested template query with a bound time grain.
|
TemplateDruidQuery(Collection<Aggregation> aggregations,
Collection<PostAggregation> postAggregations,
ZonelessTimeGrain timeGrain)
Template Query constructor for a non nested template query with a bound time grain.
|
Modifier and Type | Method and Description |
---|---|
int |
depth()
Returns the depth of the query nesting.
|
boolean |
equals(Object o) |
Set<Aggregation> |
getAggregations()
Returns the aggregations of the query.
|
QueryContext |
getContext()
Returns the context of the query.
|
DataSource |
getDataSource()
Returns the data source of the query.
|
Collection<Dimension> |
getDimensions()
Returns the dimensions of the query if any.
|
Filter |
getFilter()
Returns the filter object of the query.
|
Granularity |
getGranularity()
Returns the time grain (granularity) of the query.
|
TemplateDruidQuery |
getInnermostQuery()
If this structure is part of a query stack, return the lowest element.
|
Optional<TemplateDruidQuery> |
getInnerQuery()
If this query is nestable, and has a nested query return it.
|
List<org.joda.time.Interval> |
getIntervals()
Returns the intervals of the query.
|
MetricField |
getMetricField(String name)
Get the field by name.
|
Set<PostAggregation> |
getPostAggregations()
Returns the post-aggregations of the query.
|
QueryType |
getQueryType()
Returns the type of the query.
|
ZonelessTimeGrain |
getTimeGrain() |
int |
hashCode() |
boolean |
isNested()
Checks if the template druid query is nested.
|
boolean |
isTimeGrainValid()
Check if outer TimeGrain is compatible with inner TimeGrain.
|
TemplateDruidQuery |
merge(TemplateDruidQuery sibling)
Merges two template queries into one.
|
TemplateDruidQuery |
nest()
Transforms a N-pass query into a (N+1)-pass query.
|
String |
toString() |
TemplateDruidQuery |
withAggregations(Collection<Aggregation> newAggregations)
Makes a copy of the template query and any sub query(s), changing aggregations.
|
TemplateDruidQuery |
withAllIntervals(Collection<org.joda.time.Interval> intervals)
Returns a copy of this query with the specified intervals set in this and all inner queries.
|
TemplateDruidQuery |
withContext(QueryContext context)
Returns a copy of this query with the specified context.
|
TemplateDruidQuery |
withDataSource(DataSource dataSource)
Returns a copy of this query with the specified data source.
|
TemplateDruidQuery |
withFilter(Filter filter)
Returns a copy of this query with the specified filter.
|
TemplateDruidQuery |
withGranularity(Granularity granularity)
With granularity is partially implemented because TemplateDruidQuery supports only ZonelessTimeGrains.
|
TemplateDruidQuery |
withGranularity(ZonelessTimeGrain newTimeGrain)
Makes a copy of the template query and any sub query(s), changing time grain on the outermost level only.
|
TemplateDruidQuery |
withInnermostDataSource(DataSource dataSource)
Returns a copy of this query with the specified data source on the innermost query.
|
TemplateDruidQuery |
withInnerQuery(TemplateDruidQuery newNestedQuery)
Makes a copy of the template query, changing nested query.
|
TemplateDruidQuery |
withIntervals(Collection<org.joda.time.Interval> intervals)
Returns a copy of this query with the specified intervals.
|
TemplateDruidQuery |
withPostAggregations(Collection<PostAggregation> newPostAggregations)
Makes a copy of the template query and any sub query(s), changing post-aggregations.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
buildSchemaColumns, getDependentFieldNames, getMetricDimensions
public TemplateDruidQuery(Collection<Aggregation> aggregations, Collection<PostAggregation> postAggregations)
aggregations
- aggregations for this query templatepostAggregations
- post aggregations for this query templatepublic TemplateDruidQuery(Collection<Aggregation> aggregations, Collection<PostAggregation> postAggregations, ZonelessTimeGrain timeGrain)
aggregations
- aggregations for this query templatepostAggregations
- post aggregations for this query templatetimeGrain
- The time grain constraintpublic TemplateDruidQuery(Collection<Aggregation> aggregations, Collection<PostAggregation> postAggregations, TemplateDruidQuery nestedQuery)
aggregations
- aggregations for this query templatepostAggregations
- post aggregations for this template querynestedQuery
- A query which this query uses as a data sourcepublic TemplateDruidQuery(Collection<Aggregation> aggregations, Collection<PostAggregation> postAggregations, TemplateDruidQuery nestedQuery, ZonelessTimeGrain timeGrain)
aggregations
- aggregations for this query templatepostAggregations
- post aggregations for this query templatenestedQuery
- A query which this query uses as a data sourcetimeGrain
- The time grain constraint on the query if anypublic TemplateDruidQuery nest()
public boolean isTimeGrainValid()
public TemplateDruidQuery merge(TemplateDruidQuery sibling)
sibling
- the query to merge.public QueryType getQueryType()
DruidQuery
getQueryType
in interface DruidQuery<TemplateDruidQuery>
public DataSource getDataSource()
DruidQuery
getDataSource
in interface DruidQuery<TemplateDruidQuery>
public QueryContext getContext()
DruidQuery
getContext
in interface DruidQuery<TemplateDruidQuery>
public Granularity getGranularity()
DruidFactQuery
getGranularity
in interface DruidFactQuery<TemplateDruidQuery>
public Filter getFilter()
DruidFactQuery
getFilter
in interface DruidFactQuery<TemplateDruidQuery>
public List<org.joda.time.Interval> getIntervals()
DruidFactQuery
getIntervals
in interface DruidFactQuery<TemplateDruidQuery>
public Collection<Dimension> getDimensions()
DruidAggregationQuery
getDimensions
in interface DruidAggregationQuery<TemplateDruidQuery>
public Set<Aggregation> getAggregations()
DruidAggregationQuery
getAggregations
in interface DruidAggregationQuery<TemplateDruidQuery>
public Set<PostAggregation> getPostAggregations()
DruidAggregationQuery
getPostAggregations
in interface DruidAggregationQuery<TemplateDruidQuery>
public ZonelessTimeGrain getTimeGrain()
public Optional<TemplateDruidQuery> getInnerQuery()
DruidQuery
getInnerQuery
in interface DruidAggregationQuery<TemplateDruidQuery>
getInnerQuery
in interface DruidFactQuery<TemplateDruidQuery>
getInnerQuery
in interface DruidQuery<TemplateDruidQuery>
public TemplateDruidQuery getInnermostQuery()
DruidQuery
getInnermostQuery
in interface DruidAggregationQuery<TemplateDruidQuery>
getInnermostQuery
in interface DruidFactQuery<TemplateDruidQuery>
getInnermostQuery
in interface DruidQuery<TemplateDruidQuery>
public boolean isNested()
public int depth()
public MetricField getMetricField(String name)
name
- Name of the field to retrieveIllegalArgumentException
- if there is no MetricField with the given namepublic TemplateDruidQuery withAggregations(Collection<Aggregation> newAggregations)
Everything is a shallow copy.
withAggregations
in interface DruidAggregationQuery<TemplateDruidQuery>
newAggregations
- The Aggregations to replace in the copypublic TemplateDruidQuery withPostAggregations(Collection<PostAggregation> newPostAggregations)
Everything is a shallow copy.
withPostAggregations
in interface DruidAggregationQuery<TemplateDruidQuery>
newPostAggregations
- The PostAggregations to replace with in the copypublic TemplateDruidQuery withInnerQuery(TemplateDruidQuery newNestedQuery)
Everything is a shallow copy.
newNestedQuery
- The nestedQuery to replace in the copypublic TemplateDruidQuery withGranularity(ZonelessTimeGrain newTimeGrain)
Everything is a shallow copy.
newTimeGrain
- The TimeGrain to replace with in the copypublic TemplateDruidQuery withDataSource(DataSource dataSource)
DruidQuery
withDataSource
in interface DruidQuery<TemplateDruidQuery>
dataSource
- the new data sourcepublic TemplateDruidQuery withInnermostDataSource(DataSource dataSource)
DruidQuery
withInnermostDataSource
in interface DruidQuery<TemplateDruidQuery>
dataSource
- the new data sourcepublic TemplateDruidQuery withGranularity(Granularity granularity)
withGranularity
in interface DruidFactQuery<TemplateDruidQuery>
granularity
- a zoneless time grainUnsupportedOperationException
- if the granularity is not a ZonelessTimeGrainpublic TemplateDruidQuery withFilter(Filter filter)
DruidFactQuery
withFilter
in interface DruidFactQuery<TemplateDruidQuery>
filter
- the new filterpublic TemplateDruidQuery withIntervals(Collection<org.joda.time.Interval> intervals)
DruidFactQuery
withIntervals
in interface DruidFactQuery<TemplateDruidQuery>
intervals
- the new intervalspublic TemplateDruidQuery withAllIntervals(Collection<org.joda.time.Interval> intervals)
DruidFactQuery
All nested queries are copies of themselves with the specified intervals set.
withAllIntervals
in interface DruidFactQuery<TemplateDruidQuery>
intervals
- the new intervalspublic TemplateDruidQuery withContext(QueryContext context)
DruidQuery
withContext
in interface DruidQuery<TemplateDruidQuery>
context
- the new contextCopyright © 2016–2018 Yahoo! Inc.. All rights reserved.