Package org.apache.calcite.adapter.druid
Class DruidExpressions
java.lang.Object
org.apache.calcite.adapter.druid.DruidExpressions
Expression utility class to transform Calcite expressions to Druid expressions when possible.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
applyTimeExtract
(String timeExpression, String druidUnit, TimeZone timeZone) static String
applyTimestampCeil
(String input, String granularity, String origin, TimeZone timeZone) static String
applyTimestampFloor
(String input, String granularity, String origin, TimeZone timeZone) static String
fromColumn
(String columnName) static String
functionCall
(String functionName, List<String> args) static String
nAryOperatorCall
(String druidOperator, List<String> args) static String
static String
numberLiteral
(@Nullable Number n) static String
stringLiteral
(@Nullable String s) static @Nullable String
toDruidExpression
(RexNode rexNode, RelDataType inputRowType, DruidQuery druidRel) Translates a CalciteRexNode
to a Druid expression, if possible; returns null if not possible.toDruidExpressions
(DruidQuery druidRel, RelDataType rowType, List<RexNode> rexNodes) Translate a list of CalciteRexNode
to Druid expressions.
-
Method Details
-
toDruidExpression
public static @Nullable String toDruidExpression(RexNode rexNode, RelDataType inputRowType, DruidQuery druidRel) Translates a CalciteRexNode
to a Druid expression, if possible; returns null if not possible.- Parameters:
rexNode
- RexNode to convert to a Druid ExpressioninputRowType
- Input row type of the rexNode to translatedruidRel
- Druid query- Returns:
- Druid Expression, or null when can not convert the RexNode
-
fromColumn
-
nullLiteral
-
numberLiteral
-
stringLiteral
-
functionCall
-
nAryOperatorCall
-
toDruidExpressions
public static @Nullable List<String> toDruidExpressions(DruidQuery druidRel, RelDataType rowType, List<RexNode> rexNodes) Translate a list of CalciteRexNode
to Druid expressions.- Parameters:
rexNodes
- list of Calcite expressions meant to be applied on top of the rows- Returns:
- list of Druid expressions in the same order as rexNodes, or null if not possible. If a non-null list is returned, all elements will be non-null.
-
applyTimestampFloor
-
applyTimestampCeil
-
applyTimeExtract
-