Class DruidQuery
- java.lang.Object
-
- org.apache.calcite.rel.AbstractRelNode
-
- org.apache.calcite.adapter.druid.DruidQuery
-
- All Implemented Interfaces:
java.lang.Cloneable
,BindableRel
,InterpretableRel
,RelOptNode
,RelNode
,ArrayBindable
,Bindable<java.lang.Object[]>
,Typed
public class DruidQuery extends AbstractRelNode implements BindableRel
Relational expression representing a scan of a Druid data set.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DruidQuery.DruidQueryNode
Interpreter node that executes a Druid query and sends the results to aSink
.private static class
DruidQuery.JsonAggregation
Aggregation element of a Druid "groupBy" or "topN" query.private static class
DruidQuery.JsonCardinalityAggregation
Aggregation element that calls the "cardinality" function.private static class
DruidQuery.JsonCollation
Collation element of a Druid "groupBy" query.private static class
DruidQuery.JsonExpressionPostAgg
Druid Json Expression post aggregate.private static class
DruidQuery.JsonFilteredAggregation
Aggregation element that contains a filterprivate static class
DruidQuery.JsonLimit
Collation element of a Druid "groupBy" query.protected static class
DruidQuery.JsonPostAggregation
Post-Aggregator Post aggregator abstract writerstatic class
DruidQuery.QuerySpec
Druid query specification.private static class
DruidQuery.ScanQuery
Druid Scan Query Body-
Nested classes/interfaces inherited from interface org.apache.calcite.interpreter.InterpretableRel
InterpretableRel.InterpreterImplementor
-
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<SqlOperator,DruidSqlOperatorConverter>
converterOperatorMap
This operator map provides DruidSqlOperatorConverter instance to convert a Calcite RexNode to Druid Expression when possible.private static int
DAYS_IN_TEN_YEARS
static java.util.List<DruidSqlOperatorConverter>
DEFAULT_OPERATORS_LIST
Provides a standard list of supported Calcite operators that can be converted to Druid Expressions.protected static java.lang.String
DRUID_QUERY_FETCH
(package private) DruidTable
druidTable
private static java.lang.String
EXTRACT_COLUMN_NAME_PREFIX
private static java.lang.String
FLOOR_COLUMN_NAME_PREFIX
(package private) com.google.common.collect.ImmutableList<org.joda.time.Interval>
intervals
protected DruidQuery.QuerySpec
querySpec
(package private) com.google.common.collect.ImmutableList<RelNode>
rels
(package private) RelOptTable
table
private static java.util.regex.Pattern
VALID_SIG
-
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DruidQuery(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, java.util.List<org.joda.time.Interval> intervals, java.util.List<RelNode> rels, java.util.Map<SqlOperator,DruidSqlOperatorConverter> converterOperatorMap)
Creates a DruidQuery.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Enumerable<java.lang.Object[]>
bind(DataContext dataContext)
Executes this statement and returns an enumerable which will yield rows.protected static java.util.List<DruidQuery.JsonAggregation>
computeDruidJsonAgg(java.util.List<AggregateCall> aggCalls, java.util.List<java.lang.String> aggNames, Project project, DruidQuery druidQuery)
Translates aggregate calls to DruidDruidQuery.JsonAggregation
s when possible.private static DruidJsonFilter
computeFilter(Filter filterRel, DruidQuery druidQuery)
Translates Filter rel to Druid Filter Json object if possible.protected static Pair<java.util.List<java.lang.String>,java.util.List<VirtualColumn>>
computeProjectAsScan(Project projectRel, RelDataType inputRowType, DruidQuery druidQuery)
Translates list of projects to Druid Column names and Virtual Columns if any We can not usePair.zip(Object[], Object[])
, since size can be differentprotected static Pair<java.util.List<DimensionSpec>,java.util.List<VirtualColumn>>
computeProjectGroupSet(Project projectNode, ImmutableBitSet groupSet, RelDataType inputRowType, DruidQuery druidQuery)
Computes the project group set.RelOptCost
computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
Returns the cost of this plan (not including children).private DruidQuery.JsonLimit
computeSort(java.lang.Integer fetch, java.util.List<java.lang.Integer> collationIndexes, java.util.List<RelFieldCollation.Direction> collationDirections, ImmutableBitSet numericCollationIndexes, java.util.List<java.lang.String> queryOutputFieldNames)
RelNode
copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
Creates a copy of this relational expression, perhaps changing traits and inputs.static DruidQuery
create(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, java.util.List<RelNode> rels)
Creates a DruidQuery.static DruidQuery
create(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, java.util.List<RelNode> rels, java.util.Map<SqlOperator,DruidSqlOperatorConverter> converterOperatorMap)
Creates a DruidQuery.private static DruidQuery
create(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, java.util.List<org.joda.time.Interval> intervals, java.util.List<RelNode> rels, java.util.Map<SqlOperator,DruidSqlOperatorConverter> converterOperatorMap)
Creates a DruidQuery.protected DruidQuery.QuerySpec
deriveQuerySpec()
RelDataType
deriveRowType()
RelWriter
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.static DruidQuery
extendQuery(DruidQuery query, java.util.List<org.joda.time.Interval> intervals)
Extends a DruidQuery.static DruidQuery
extendQuery(DruidQuery query, RelNode r)
Extends a DruidQuery.protected static java.lang.String
extractColumnName(RexNode rexNode, RelDataType rowType, DruidQuery query)
static java.lang.String
format(java.lang.String message, java.lang.Object... formatArgs)
Equivalent of String.format(Locale.ENGLISH, message, formatArgs).protected CalciteConnectionConfig
getConnectionConfig()
DruidTable
getDruidTable()
java.lang.Class<java.lang.Object[]>
getElementType()
Gets the type of the element(s) that are returned in this collection.private double
getIntervalCostMultiplier()
private static DruidQuery.JsonAggregation
getJsonAggregation(java.lang.String name, AggregateCall aggCall, RexNode filterNode, java.lang.String fieldName, java.lang.String aggExpression, DruidQuery druidQuery)
protected java.util.Map<SqlOperator,DruidSqlOperatorConverter>
getOperatorConversionMap()
protected DruidQuery.QuerySpec
getQuery(RelDataType rowType, Filter filter, Project project, ImmutableBitSet groupSet, java.util.List<AggregateCall> aggCalls, java.util.List<java.lang.String> aggNames, java.util.List<java.lang.Integer> collationIndexes, java.util.List<RelFieldCollation.Direction> collationDirections, ImmutableBitSet numericCollationIndexes, java.lang.Integer fetch, Project postProject, Filter havingFilter)
DruidQuery.QuerySpec
getQuerySpec()
java.lang.String
getQueryString()
QueryType
getQueryType()
private double
getQueryTypeCostMultiplier()
RelOptTable
getTable()
If this relational expression represents an access to a table, returns that table, otherwise returns null.TableScan
getTableScan()
protected int
getTimestampFieldIndex()
RelNode
getTopNode()
Node
implement(InterpretableRel.InterpreterImplementor implementor)
Creates an interpreter node to implement this relational expression.boolean
isValid(Litmus litmus, RelNode.Context context)
Returns whether this relational expression is valid.private static boolean
isValidLeafCast(RexNode rexNode)
(package private) static boolean
isValidSignature(java.lang.String signature)
Returns whether a signature represents an sequence of relational operators that can be translated into a valid Druid query.(package private) static java.lang.String
metadataQuery(java.lang.String dataSourceName, java.util.List<org.joda.time.Interval> intervals)
Generates a JSON string to query metadata about a data source.private java.lang.String
planAsGroupBy(java.util.List<DimensionSpec> groupByKeyDims, DruidJsonFilter jsonFilter, java.util.List<VirtualColumn> virtualColumnList, java.util.List<DruidQuery.JsonAggregation> aggregations, java.util.List<DruidQuery.JsonExpressionPostAgg> postAggregations, DruidQuery.JsonLimit limit, DruidJsonFilter havingFilter)
private java.lang.String
planAsTimeSeries(java.util.List<DimensionSpec> groupByKeyDims, DruidJsonFilter jsonFilter, java.util.List<VirtualColumn> virtualColumnList, java.util.List<DruidQuery.JsonAggregation> aggregations, java.util.List<DruidQuery.JsonExpressionPostAgg> postAggregations, DruidQuery.JsonLimit limit, DruidJsonFilter havingFilter)
private java.lang.String
planAsTopN(java.util.List<DimensionSpec> groupByKeyDims, DruidJsonFilter jsonFilter, java.util.List<VirtualColumn> virtualColumnList, java.util.List<DruidQuery.JsonAggregation> aggregations, java.util.List<DruidQuery.JsonExpressionPostAgg> postAggregations, DruidQuery.JsonLimit limit, DruidJsonFilter havingFilter)
void
register(RelOptPlanner planner)
Registers any special rules specific to this kind of relational expression.(package private) java.lang.String
signature()
Returns a string describing the operations inside this query.protected static Pair<java.lang.String,ExtractionFunction>
toDruidColumn(RexNode rexNode, RelDataType rowType, DruidQuery druidQuery)
protected static void
writeArray(com.fasterxml.jackson.core.JsonGenerator generator, java.util.List<?> elements)
protected static void
writeField(com.fasterxml.jackson.core.JsonGenerator generator, java.lang.String fieldName, java.lang.Object o)
protected static void
writeFieldIf(com.fasterxml.jackson.core.JsonGenerator generator, java.lang.String fieldName, java.lang.Object o)
protected static void
writeObject(com.fasterxml.jackson.core.JsonGenerator generator, java.lang.Object o)
-
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, accept, childrenAccept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, estimateRowCount, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getInputs, getQuery, getRelTypeName, getRows, getRowType, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, metadata, onRegister, recomputeDigest, replaceInput, sole, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.rel.RelNode
accept, accept, childrenAccept, collectVariablesSet, collectVariablesUsed, computeSelfCost, estimateRowCount, explain, getChildExps, getCollationList, getConvention, getCorrelVariable, getExpectedInputRowType, getInput, getInputs, getQuery, getRelTypeName, getRows, getRowType, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, metadata, onRegister, recomputeDigest, replaceInput
-
Methods inherited from interface org.apache.calcite.plan.RelOptNode
getCluster, getDescription, getDigest, getId, getTraitSet
-
-
-
-
Field Detail
-
DEFAULT_OPERATORS_LIST
public static final java.util.List<DruidSqlOperatorConverter> DEFAULT_OPERATORS_LIST
Provides a standard list of supported Calcite operators that can be converted to Druid Expressions. This can be used as is or re-adapted based on underline engine operator syntax.
-
querySpec
protected DruidQuery.QuerySpec querySpec
-
table
final RelOptTable table
-
druidTable
final DruidTable druidTable
-
intervals
final com.google.common.collect.ImmutableList<org.joda.time.Interval> intervals
-
rels
final com.google.common.collect.ImmutableList<RelNode> rels
-
converterOperatorMap
final java.util.Map<SqlOperator,DruidSqlOperatorConverter> converterOperatorMap
This operator map provides DruidSqlOperatorConverter instance to convert a Calcite RexNode to Druid Expression when possible.
-
VALID_SIG
private static final java.util.regex.Pattern VALID_SIG
-
EXTRACT_COLUMN_NAME_PREFIX
private static final java.lang.String EXTRACT_COLUMN_NAME_PREFIX
- See Also:
- Constant Field Values
-
FLOOR_COLUMN_NAME_PREFIX
private static final java.lang.String FLOOR_COLUMN_NAME_PREFIX
- See Also:
- Constant Field Values
-
DRUID_QUERY_FETCH
protected static final java.lang.String DRUID_QUERY_FETCH
- See Also:
- Constant Field Values
-
DAYS_IN_TEN_YEARS
private static final int DAYS_IN_TEN_YEARS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DruidQuery
protected DruidQuery(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, java.util.List<org.joda.time.Interval> intervals, java.util.List<RelNode> rels, java.util.Map<SqlOperator,DruidSqlOperatorConverter> converterOperatorMap)
Creates a DruidQuery.- Parameters:
cluster
- ClustertraitSet
- Traitstable
- TabledruidTable
- Druid tableintervals
- Intervals for the queryrels
- Internal relational expressionsconverterOperatorMap
- mapping of Calcite Sql Operator to Druid Expression API.
-
-
Method Detail
-
isValidSignature
static boolean isValidSignature(java.lang.String signature)
Returns whether a signature represents an sequence of relational operators that can be translated into a valid Druid query.
-
create
public static DruidQuery create(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, java.util.List<RelNode> rels)
Creates a DruidQuery.
-
create
public static DruidQuery create(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, java.util.List<RelNode> rels, java.util.Map<SqlOperator,DruidSqlOperatorConverter> converterOperatorMap)
Creates a DruidQuery.
-
create
private static DruidQuery create(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, java.util.List<org.joda.time.Interval> intervals, java.util.List<RelNode> rels, java.util.Map<SqlOperator,DruidSqlOperatorConverter> converterOperatorMap)
Creates a DruidQuery.
-
extendQuery
public static DruidQuery extendQuery(DruidQuery query, RelNode r)
Extends a DruidQuery.
-
extendQuery
public static DruidQuery extendQuery(DruidQuery query, java.util.List<org.joda.time.Interval> intervals)
Extends a DruidQuery.
-
toDruidColumn
protected static Pair<java.lang.String,ExtractionFunction> toDruidColumn(RexNode rexNode, RelDataType rowType, DruidQuery druidQuery)
- Parameters:
rexNode
- leaf Input Ref to Druid ColumnrowType
- row typedruidQuery
- druid query- Returns:
Pair
of Column name and Extraction Function on the top of the input ref orof(null, null)
when can not translate to valid Druid column
-
isValidLeafCast
private static boolean isValidLeafCast(RexNode rexNode)
- Parameters:
rexNode
- rexNode- Returns:
- true if the operand is an inputRef and it is a valid Druid Cast operation
-
extractColumnName
@Nullable protected static java.lang.String extractColumnName(RexNode rexNode, RelDataType rowType, DruidQuery query)
- Parameters:
rexNode
- Druid input ref noderowType
- rowTypequery
- Druid Query- Returns:
- Druid column name or null when not possible to translate.
-
format
public static java.lang.String format(java.lang.String message, java.lang.Object... formatArgs)
Equivalent of String.format(Locale.ENGLISH, message, formatArgs).
-
signature
java.lang.String signature()
Returns a string describing the operations inside this query.For example, "sfpahol" means
TableScan
(s) followed byFilter
(f) followed byProject
(p) followed byAggregate
(a) followed byFilter
(h) followed byProject
(o) followed bySort
(l).- See Also:
isValidSignature(String)
-
isValid
public boolean isValid(Litmus litmus, RelNode.Context context)
Description copied from interface:RelNode
Returns whether this relational expression is valid.If assertions are enabled, this method is typically called with
litmus
=THROW
, as follows:assert rel.isValid(Litmus.THROW)
This signals that the method can throw an
AssertionError
if it is not valid.- Specified by:
isValid
in interfaceRelNode
- Overrides:
isValid
in classAbstractRelNode
- Parameters:
litmus
- What to do if invalidcontext
- Context for validity checking- Returns:
- Whether relational expression is valid
-
getOperatorConversionMap
protected java.util.Map<SqlOperator,DruidSqlOperatorConverter> getOperatorConversionMap()
-
copy
public RelNode copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
Description copied from interface:RelNode
Creates a copy of this relational expression, perhaps changing traits and inputs.Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
- Specified by:
copy
in interfaceRelNode
- Overrides:
copy
in classAbstractRelNode
- Parameters:
traitSet
- Trait setinputs
- Inputs- Returns:
- Copy of this relational expression, substituting traits and inputs
-
deriveRowType
public RelDataType deriveRowType()
- Overrides:
deriveRowType
in classAbstractRelNode
-
getTableScan
public TableScan getTableScan()
-
getTopNode
public RelNode getTopNode()
-
getTable
public RelOptTable getTable()
Description copied from interface:RelNode
If this relational expression represents an access to a table, returns that table, otherwise returns null.- Specified by:
getTable
in interfaceRelNode
- Overrides:
getTable
in classAbstractRelNode
- Returns:
- If this relational expression represents an access to a table, returns that table, otherwise returns null
-
getDruidTable
public DruidTable getDruidTable()
-
explainTerms
public RelWriter explainTerms(RelWriter pw)
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriterImpl.input(String, RelNode)
andRelWriterImpl.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classAbstractRelNode
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
computeSelfCost
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
Description copied from interface:RelNode
Returns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getNonCumulativeCost(org.apache.calcite.rel.RelNode)
, which gives plugins a chance to override the rel's default ideas about cost.- Specified by:
computeSelfCost
in interfaceRelNode
- Overrides:
computeSelfCost
in classAbstractRelNode
- Parameters:
planner
- Planner for cost calculationmq
- Metadata query- Returns:
- Cost of this plan (not including children)
-
getIntervalCostMultiplier
private double getIntervalCostMultiplier()
-
getQueryTypeCostMultiplier
private double getQueryTypeCostMultiplier()
-
register
public void register(RelOptPlanner planner)
Description copied from interface:RelNode
Registers any special rules specific to this kind of relational expression.The planner calls this method this first time that it sees a relational expression of this class. The derived class should call
RelOptPlanner.addRule(org.apache.calcite.plan.RelOptRule)
for each rule, and then callsuper.register
.- Specified by:
register
in interfaceRelNode
- Overrides:
register
in classAbstractRelNode
- Parameters:
planner
- Planner to be used to register additional relational expressions
-
getElementType
public java.lang.Class<java.lang.Object[]> getElementType()
Description copied from interface:Typed
Gets the type of the element(s) that are returned in this collection.- Specified by:
getElementType
in interfaceArrayBindable
- Specified by:
getElementType
in interfaceTyped
-
bind
public Enumerable<java.lang.Object[]> bind(DataContext dataContext)
Description copied from interface:Bindable
Executes this statement and returns an enumerable which will yield rows. Theenvironment
parameter provides the values in the root of the environment (usually schemas).
-
implement
public Node implement(InterpretableRel.InterpreterImplementor implementor)
Description copied from interface:InterpretableRel
Creates an interpreter node to implement this relational expression.- Specified by:
implement
in interfaceInterpretableRel
-
getQuerySpec
public DruidQuery.QuerySpec getQuerySpec()
-
deriveQuerySpec
protected DruidQuery.QuerySpec deriveQuerySpec()
-
getQueryType
public QueryType getQueryType()
-
getQueryString
public java.lang.String getQueryString()
-
getConnectionConfig
protected CalciteConnectionConfig getConnectionConfig()
-
computeFilter
@Nullable private static DruidJsonFilter computeFilter(@Nullable Filter filterRel, DruidQuery druidQuery)
Translates Filter rel to Druid Filter Json object if possible. Currently Filter rel input has to be Druid Table scan- Parameters:
filterRel
- input filter reldruidQuery
- Druid query- Returns:
- DruidJson Filter or null if can not translate one of filters
-
computeProjectAsScan
@Nullable protected static Pair<java.util.List<java.lang.String>,java.util.List<VirtualColumn>> computeProjectAsScan(@Nullable Project projectRel, RelDataType inputRowType, DruidQuery druidQuery)
Translates list of projects to Druid Column names and Virtual Columns if any We can not usePair.zip(Object[], Object[])
, since size can be different- Parameters:
projectRel
- Project ReldruidQuery
- Druid query- Returns:
- Pair of list of Druid Columns and Expression Virtual Columns or null when can not translate one of the projects.
-
computeProjectGroupSet
@Nullable protected static Pair<java.util.List<DimensionSpec>,java.util.List<VirtualColumn>> computeProjectGroupSet(@Nullable Project projectNode, ImmutableBitSet groupSet, RelDataType inputRowType, DruidQuery druidQuery)
Computes the project group set.- Parameters:
projectNode
- Project under the Aggregates if anygroupSet
- Ids of grouping keys as they are listed inprojects
listinputRowType
- Input row type under the projectdruidQuery
- Druid Query- Returns:
- A list of
DimensionSpec
containing the group by dimensions, and a list ofVirtualColumn
containing Druid virtual column projections; or null, if translation is not possible. Note that the size of lists can be different.
-
computeDruidJsonAgg
@Nullable protected static java.util.List<DruidQuery.JsonAggregation> computeDruidJsonAgg(java.util.List<AggregateCall> aggCalls, java.util.List<java.lang.String> aggNames, @Nullable Project project, DruidQuery druidQuery)
Translates aggregate calls to DruidDruidQuery.JsonAggregation
s when possible.- Parameters:
aggCalls
- List of AggregateCalls to translateaggNames
- List of aggregate namesproject
- Input project under the aggregate calls, or null if we haveTableScan
immediately under theAggregate
druidQuery
- Druid Query Rel- Returns:
- List of valid Druid
DruidQuery.JsonAggregation
s, or null if any of the aggregates is not supported
-
getQuery
protected DruidQuery.QuerySpec getQuery(RelDataType rowType, Filter filter, Project project, ImmutableBitSet groupSet, java.util.List<AggregateCall> aggCalls, java.util.List<java.lang.String> aggNames, java.util.List<java.lang.Integer> collationIndexes, java.util.List<RelFieldCollation.Direction> collationDirections, ImmutableBitSet numericCollationIndexes, java.lang.Integer fetch, Project postProject, Filter havingFilter)
-
computeSort
private DruidQuery.JsonLimit computeSort(@Nullable java.lang.Integer fetch, java.util.List<java.lang.Integer> collationIndexes, java.util.List<RelFieldCollation.Direction> collationDirections, ImmutableBitSet numericCollationIndexes, java.util.List<java.lang.String> queryOutputFieldNames)
- Parameters:
fetch
- limit to fetchcollationIndexes
- index of fields as listed in query row outputcollationDirections
- direction of sortnumericCollationIndexes
- flag of to determine sort comparatorqueryOutputFieldNames
- query output fields- Returns:
- always an non null Json Limit object
-
planAsTimeSeries
@Nullable private java.lang.String planAsTimeSeries(java.util.List<DimensionSpec> groupByKeyDims, DruidJsonFilter jsonFilter, java.util.List<VirtualColumn> virtualColumnList, java.util.List<DruidQuery.JsonAggregation> aggregations, java.util.List<DruidQuery.JsonExpressionPostAgg> postAggregations, DruidQuery.JsonLimit limit, DruidJsonFilter havingFilter)
-
planAsTopN
@Nullable private java.lang.String planAsTopN(java.util.List<DimensionSpec> groupByKeyDims, DruidJsonFilter jsonFilter, java.util.List<VirtualColumn> virtualColumnList, java.util.List<DruidQuery.JsonAggregation> aggregations, java.util.List<DruidQuery.JsonExpressionPostAgg> postAggregations, DruidQuery.JsonLimit limit, DruidJsonFilter havingFilter)
-
planAsGroupBy
@Nullable private java.lang.String planAsGroupBy(java.util.List<DimensionSpec> groupByKeyDims, DruidJsonFilter jsonFilter, java.util.List<VirtualColumn> virtualColumnList, java.util.List<DruidQuery.JsonAggregation> aggregations, java.util.List<DruidQuery.JsonExpressionPostAgg> postAggregations, DruidQuery.JsonLimit limit, DruidJsonFilter havingFilter)
-
getJsonAggregation
@Nullable private static DruidQuery.JsonAggregation getJsonAggregation(java.lang.String name, AggregateCall aggCall, RexNode filterNode, java.lang.String fieldName, java.lang.String aggExpression, DruidQuery druidQuery)
-
writeField
protected static void writeField(com.fasterxml.jackson.core.JsonGenerator generator, java.lang.String fieldName, java.lang.Object o) throws java.io.IOException
- Throws:
java.io.IOException
-
writeFieldIf
protected static void writeFieldIf(com.fasterxml.jackson.core.JsonGenerator generator, java.lang.String fieldName, java.lang.Object o) throws java.io.IOException
- Throws:
java.io.IOException
-
writeArray
protected static void writeArray(com.fasterxml.jackson.core.JsonGenerator generator, java.util.List<?> elements) throws java.io.IOException
- Throws:
java.io.IOException
-
writeObject
protected static void writeObject(com.fasterxml.jackson.core.JsonGenerator generator, java.lang.Object o) throws java.io.IOException
- Throws:
java.io.IOException
-
metadataQuery
static java.lang.String metadataQuery(java.lang.String dataSourceName, java.util.List<org.joda.time.Interval> intervals)
Generates a JSON string to query metadata about a data source.
-
getTimestampFieldIndex
protected int getTimestampFieldIndex()
- Returns:
- index of the timestamp ref or -1 if not present
-
-