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 StringapplyTimeExtract(String timeExpression, String druidUnit, TimeZone timeZone) static StringapplyTimestampCeil(String input, String granularity, String origin, TimeZone timeZone) static StringapplyTimestampFloor(String input, String granularity, String origin, TimeZone timeZone) static StringfromColumn(String columnName) static StringfunctionCall(String functionName, List<String> args) static StringnAryOperatorCall(String druidOperator, List<String> args) static Stringstatic StringnumberLiteral(@Nullable Number n) static StringstringLiteral(@Nullable String s) static @Nullable StringtoDruidExpression(RexNode rexNode, RelDataType inputRowType, DruidQuery druidRel) Translates a CalciteRexNodeto a Druid expression, if possible; returns null if not possible.toDruidExpressions(DruidQuery druidRel, RelDataType rowType, List<RexNode> rexNodes) Translate a list of CalciteRexNodeto Druid expressions.
-
Method Details
-
toDruidExpression
public static @Nullable String toDruidExpression(RexNode rexNode, RelDataType inputRowType, DruidQuery druidRel) Translates a CalciteRexNodeto 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 CalciteRexNodeto 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
-