Class TimeFloorOperatorConversion
java.lang.Object
org.apache.druid.sql.calcite.expression.builtin.TimeFloorOperatorConversion
- All Implemented Interfaces:
SqlOperatorConversion
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.calcite.sql.SqlFunctionstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DruidExpressionapplyTimestampFloor(DruidExpression input, PeriodGranularity granularity, PlannerContext plannerContext) Function that floors a DruidExpression to a particular granularity.org.apache.calcite.sql.SqlOperatorReturns the SQL operator corresponding to this function.toDruidExpression(PlannerContext plannerContext, RowSignature rowSignature, org.apache.calcite.rex.RexNode rexNode) Translate a CalciteRexNodeto a Druid expression.static List<DruidExpression>toTimestampFloorOrCeilArgs(PlannerContext plannerContext, RowSignature rowSignature, List<org.apache.calcite.rex.RexNode> operands) Function that converts SQL TIME_FLOOR or TIME_CEIL args to Druid expression "timestamp_floor" or "timestamp_ceil" args.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.sql.calcite.expression.SqlOperatorConversion
toDruidExpressionWithPostAggOperands, toDruidFilter, toPostAggregator
-
Field Details
-
SQL_FUNCTION_NAME
- See Also:
-
SQL_FUNCTION
public static final org.apache.calcite.sql.SqlFunction SQL_FUNCTION
-
-
Constructor Details
-
TimeFloorOperatorConversion
public TimeFloorOperatorConversion()
-
-
Method Details
-
applyTimestampFloor
public static DruidExpression applyTimestampFloor(DruidExpression input, PeriodGranularity granularity, PlannerContext plannerContext) Function that floors a DruidExpression to a particular granularity. Not actually used by the TimeFloorOperatorConversion, but I'm not sure where else to put this. It makes some sense in this file, since it's responsible for generating "timestamp_floor" calls. -
toTimestampFloorOrCeilArgs
@Nullable public static List<DruidExpression> toTimestampFloorOrCeilArgs(PlannerContext plannerContext, RowSignature rowSignature, List<org.apache.calcite.rex.RexNode> operands) Function that converts SQL TIME_FLOOR or TIME_CEIL args to Druid expression "timestamp_floor" or "timestamp_ceil" args. The main reason this function is necessary is because the handling of origin and timezone must take into account the SQL context timezone. It also helps with handling SQL FLOOR and CEIL, by offering handling of TimeUnitRange args. -
calciteOperator
public org.apache.calcite.sql.SqlOperator calciteOperator()Description copied from interface:SqlOperatorConversionReturns the SQL operator corresponding to this function. Should be a singleton.- Specified by:
calciteOperatorin interfaceSqlOperatorConversion- Returns:
- operator
-
toDruidExpression
@Nullable public DruidExpression toDruidExpression(PlannerContext plannerContext, RowSignature rowSignature, org.apache.calcite.rex.RexNode rexNode) Description copied from interface:SqlOperatorConversionTranslate a CalciteRexNodeto a Druid expression.- Specified by:
toDruidExpressionin interfaceSqlOperatorConversion- Parameters:
plannerContext- SQL planner contextrowSignature- signature of the rows to be extracted fromrexNode- expression meant to be applied on top of the rows- Returns:
- Druid expression, or null if translation is not possible
- See Also:
-