public class Expressions extends Object
Modifier and Type | Method and Description |
---|---|
static org.apache.calcite.rex.RexNode |
fromFieldAccess(RowSignature rowSignature,
org.apache.calcite.rel.core.Project project,
int fieldNumber)
Translate a field access, possibly through a projection, to an underlying Druid dataSource.
|
static DimFilter |
toFilter(PlannerContext plannerContext,
RowSignature rowSignature,
org.apache.calcite.rex.RexNode expression)
Translates "condition" to a Druid filter, or returns null if we cannot translate the condition.
|
static String |
toMathExpression(List<String> rowOrder,
org.apache.calcite.rex.RexNode expression)
Translate a row-expression to a Druid math expression.
|
static long |
toMillisLiteral(org.apache.calcite.rex.RexNode literal,
org.joda.time.DateTimeZone timeZone)
Translates "literal" (a TIMESTAMP or DATE literal) to milliseconds since the epoch using the provided
session time zone.
|
static PostAggregator |
toPostAggregator(String name,
List<String> rowOrder,
List<PostAggregatorFactory> finalizingPostAggregatorFactories,
org.apache.calcite.rex.RexNode expression)
Translate a Calcite row-expression to a Druid PostAggregator.
|
static RowExtraction |
toRowExtraction(PlannerContext plannerContext,
List<String> rowOrder,
org.apache.calcite.rex.RexNode expression)
Translate a Calcite row-expression to a Druid row extraction.
|
public static org.apache.calcite.rex.RexNode fromFieldAccess(RowSignature rowSignature, org.apache.calcite.rel.core.Project project, int fieldNumber)
rowSignature
- row signature of underlying Druid dataSourceproject
- projection, or nullfieldNumber
- number of the field to accesspublic static RowExtraction toRowExtraction(PlannerContext plannerContext, List<String> rowOrder, org.apache.calcite.rex.RexNode expression)
plannerContext
- SQL planner contextrowOrder
- order of fields in the Druid rows to be extracted fromexpression
- expression meant to be applied on top of the rowspublic static PostAggregator toPostAggregator(String name, List<String> rowOrder, List<PostAggregatorFactory> finalizingPostAggregatorFactories, org.apache.calcite.rex.RexNode expression)
toRowExtraction(PlannerContext, List, RexNode)
.name
- name of the PostAggregatorrowOrder
- order of fields in the Druid rows to be extracted fromfinalizingPostAggregatorFactories
- post-aggregators that should be used for specific entries in rowOrder.
May be empty, and individual values may be null. Missing or null values
will lead to creation of FieldAccessPostAggregator
.expression
- expression meant to be applied on top of the rowspublic static String toMathExpression(List<String> rowOrder, org.apache.calcite.rex.RexNode expression)
toRowExtraction(PlannerContext, List, RexNode)
.rowOrder
- order of fields in the Druid rows to be extracted fromexpression
- expression meant to be applied on top of the rowspublic static long toMillisLiteral(org.apache.calcite.rex.RexNode literal, org.joda.time.DateTimeZone timeZone)
literal
- TIMESTAMP or DATE literaltimeZone
- session time zonepublic static DimFilter toFilter(PlannerContext plannerContext, RowSignature rowSignature, org.apache.calcite.rex.RexNode expression)
plannerContext
- planner contextrowSignature
- row signature of the dataSource to be filteredexpression
- Calcite row expressionCopyright © 2011–2017. All rights reserved.