public class DruidQuery extends AbstractRelNode implements BindableRel
| Modifier and Type | Class and Description |
|---|---|
private static class |
DruidQuery.DruidQueryNode
Interpreter node that executes a Druid query and sends the results to a
Sink. |
private static interface |
DruidQuery.Json
Object that knows how to write itself to a
JsonGenerator. |
private static class |
DruidQuery.JsonAggregation
Aggregation element of a Druid "groupBy" or "topN" query.
|
private static class |
DruidQuery.JsonBound
Bound filter.
|
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.JsonCompositeFilter
Filter that combines other filters using a boolean operator.
|
private static class |
DruidQuery.JsonFilter
Filter element of a Druid "groupBy" or "topN" query.
|
private static class |
DruidQuery.JsonLimit
Collation element of a Druid "groupBy" query.
|
private static class |
DruidQuery.JsonSelector
Equality filter.
|
static class |
DruidQuery.QuerySpec
Druid query specification.
|
private static class |
DruidQuery.Translator
Translates scalar expressions to Druid field references.
|
InterpretableRel.InterpreterImplementor| Modifier and Type | Field and Description |
|---|---|
protected static String |
DRUID_QUERY_FETCH |
(package private) DruidTable |
druidTable |
(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 Pattern |
VALID_SIG |
digest, id, rowType, traitSet| Modifier | Constructor and Description |
|---|---|
protected |
DruidQuery(RelOptCluster cluster,
RelTraitSet traitSet,
RelOptTable table,
DruidTable druidTable,
List<org.joda.time.Interval> intervals,
List<RelNode> rels)
Creates a DruidQuery.
|
| Modifier and Type | Method and Description |
|---|---|
private boolean |
areValidFilters(List<RexNode> es) |
Enumerable<Object[]> |
bind(DataContext dataContext) |
RelOptCost |
computeSelfCost(RelOptPlanner planner,
RelMetadataQuery mq) |
RelNode |
copy(RelTraitSet traitSet,
List<RelNode> inputs) |
private static DruidQuery |
create(RelOptCluster cluster,
RelTraitSet traitSet,
RelOptTable table,
DruidTable druidTable,
List<org.joda.time.Interval> intervals,
List<RelNode> rels)
Creates a DruidQuery.
|
static DruidQuery |
create(RelOptCluster cluster,
RelTraitSet traitSet,
RelOptTable table,
DruidTable druidTable,
List<RelNode> rels)
Creates a DruidQuery.
|
protected DruidQuery.QuerySpec |
deriveQuerySpec() |
RelDataType |
deriveRowType() |
RelWriter |
explainTerms(RelWriter pw) |
static DruidQuery |
extendQuery(DruidQuery query,
List<org.joda.time.Interval> intervals)
Extends a DruidQuery.
|
static DruidQuery |
extendQuery(DruidQuery query,
RelNode r)
Extends a DruidQuery.
|
DruidTable |
getDruidTable() |
Class<Object[]> |
getElementType() |
protected DruidQuery.JsonAggregation |
getJsonAggregation(List<String> fieldNames,
String name,
AggregateCall aggCall) |
protected DruidQuery.QuerySpec |
getQuery(RelDataType rowType,
RexNode filter,
List<RexNode> projects,
ImmutableBitSet groupSet,
List<AggregateCall> aggCalls,
List<String> aggNames,
List<Integer> collationIndexes,
List<RelFieldCollation.Direction> collationDirections,
Integer fetch) |
DruidQuery.QuerySpec |
getQuerySpec() |
String |
getQueryString() |
QueryType |
getQueryType() |
RelOptTable |
getTable() |
TableScan |
getTableScan() |
RelNode |
getTopNode() |
Node |
implement(InterpretableRel.InterpreterImplementor implementor) |
boolean |
isValid(Litmus litmus) |
(package private) boolean |
isValidFilter(RexNode e) |
(package private) static boolean |
isValidSignature(String signature)
Returns whether a signature represents an sequence of relational operators
that can be translated into a valid Druid query.
|
(package private) static String |
metadataQuery(String dataSourceName,
List<org.joda.time.Interval> intervals)
Generates a JSON string to query metadata about a data source.
|
void |
register(RelOptPlanner planner) |
(package private) String |
signature()
Returns a string describing the operations inside this query.
|
protected static void |
writeArray(com.fasterxml.jackson.core.JsonGenerator generator,
List<?> elements) |
protected static void |
writeField(com.fasterxml.jackson.core.JsonGenerator generator,
String fieldName,
Object o) |
protected static void |
writeFieldIf(com.fasterxml.jackson.core.JsonGenerator generator,
String fieldName,
Object o) |
protected static void |
writeObject(com.fasterxml.jackson.core.JsonGenerator generator,
Object o) |
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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaccept, 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, replaceInputgetCluster, getDescription, getDigest, getId, getTraitSetprotected DruidQuery.QuerySpec querySpec
final RelOptTable table
final DruidTable druidTable
final com.google.common.collect.ImmutableList<org.joda.time.Interval> intervals
final com.google.common.collect.ImmutableList<RelNode> rels
private static final Pattern VALID_SIG
protected static final String DRUID_QUERY_FETCH
protected DruidQuery(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, List<org.joda.time.Interval> intervals, List<RelNode> rels)
cluster - ClustertraitSet - Traitstable - TabledruidTable - Druid tableintervals - Intervals for the queryrels - Internal relational expressionsString signature()
For example, "sfpal" means TableScan (s)
followed by Filter (f)
followed by Project (p)
followed by Aggregate (a)
followed by Sort (l).
isValidSignature(String)public boolean isValid(Litmus litmus)
isValid in interface RelNodeisValid in class AbstractRelNodeboolean isValidFilter(RexNode e)
static boolean isValidSignature(String signature)
public static DruidQuery create(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, List<RelNode> rels)
private static DruidQuery create(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, DruidTable druidTable, List<org.joda.time.Interval> intervals, List<RelNode> rels)
public static DruidQuery extendQuery(DruidQuery query, RelNode r)
public static DruidQuery extendQuery(DruidQuery query, List<org.joda.time.Interval> intervals)
public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs)
copy in interface RelNodecopy in class AbstractRelNodepublic RelDataType deriveRowType()
deriveRowType in class AbstractRelNodepublic TableScan getTableScan()
public RelNode getTopNode()
public RelOptTable getTable()
getTable in interface RelNodegetTable in class AbstractRelNodepublic DruidTable getDruidTable()
public RelWriter explainTerms(RelWriter pw)
explainTerms in class AbstractRelNodepublic RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
computeSelfCost in interface RelNodecomputeSelfCost in class AbstractRelNodepublic void register(RelOptPlanner planner)
register in interface RelNoderegister in class AbstractRelNodepublic Class<Object[]> getElementType()
getElementType in interface ArrayBindablegetElementType in interface Typedpublic Enumerable<Object[]> bind(DataContext dataContext)
public Node implement(InterpretableRel.InterpreterImplementor implementor)
implement in interface InterpretableRelpublic DruidQuery.QuerySpec getQuerySpec()
protected DruidQuery.QuerySpec deriveQuerySpec()
public QueryType getQueryType()
public String getQueryString()
protected DruidQuery.QuerySpec getQuery(RelDataType rowType, RexNode filter, List<RexNode> projects, ImmutableBitSet groupSet, List<AggregateCall> aggCalls, List<String> aggNames, List<Integer> collationIndexes, List<RelFieldCollation.Direction> collationDirections, Integer fetch)
protected DruidQuery.JsonAggregation getJsonAggregation(List<String> fieldNames, String name, AggregateCall aggCall)
protected static void writeField(com.fasterxml.jackson.core.JsonGenerator generator,
String fieldName,
Object o)
throws IOException
IOExceptionprotected static void writeFieldIf(com.fasterxml.jackson.core.JsonGenerator generator,
String fieldName,
Object o)
throws IOException
IOExceptionprotected static void writeArray(com.fasterxml.jackson.core.JsonGenerator generator,
List<?> elements)
throws IOException
IOExceptionprotected static void writeObject(com.fasterxml.jackson.core.JsonGenerator generator,
Object o)
throws IOException
IOExceptionCopyright © 2012–2016 The Apache Software Foundation. All rights reserved.