Package org.apache.calcite.adapter.druid
Class ExtractOperatorConversion
- java.lang.Object
-
- org.apache.calcite.adapter.druid.ExtractOperatorConversion
-
- All Implemented Interfaces:
DruidSqlOperatorConverter
public class ExtractOperatorConversion extends java.lang.Object implements DruidSqlOperatorConverter
Time extract operator conversion for expressions like EXTRACT(timeUnit FROM arg) Unit can be SECOND, MINUTE, HOUR, DAY (day of month), DOW (day of week), DOY (day of year), WEEK (week of week year), MONTH (1 through 12), QUARTER (1 through 4), or YEAR
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<org.apache.calcite.avatica.util.TimeUnitRange,java.lang.String>
EXTRACT_UNIT_MAP
-
Constructor Summary
Constructors Constructor Description ExtractOperatorConversion()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlOperator
calciteOperator()
Returns the calcite SQL operator corresponding to Druid operator.java.lang.String
toDruidExpression(RexNode rexNode, RelDataType rowType, DruidQuery query)
Translate rexNode to valid Druid expression.
-
-
-
Method Detail
-
calciteOperator
public SqlOperator calciteOperator()
Description copied from interface:DruidSqlOperatorConverter
Returns the calcite SQL operator corresponding to Druid operator.- Specified by:
calciteOperator
in interfaceDruidSqlOperatorConverter
- Returns:
- operator
-
toDruidExpression
public java.lang.String toDruidExpression(RexNode rexNode, RelDataType rowType, DruidQuery query)
Description copied from interface:DruidSqlOperatorConverter
Translate rexNode to valid Druid expression.- Specified by:
toDruidExpression
in interfaceDruidSqlOperatorConverter
- Parameters:
rexNode
- rexNode to translate to Druid expressionrowType
- row type associated with rexNodequery
- druid query used to figure out configs/fields related like timeZone- Returns:
- valid Druid expression or null if it can not convert the rexNode
-
-