Class TimeFloorOperatorConversion

java.lang.Object
org.apache.druid.sql.calcite.expression.builtin.TimeFloorOperatorConversion
All Implemented Interfaces:
SqlOperatorConversion

public class TimeFloorOperatorConversion extends Object implements SqlOperatorConversion
  • Field Details

    • SQL_FUNCTION_NAME

      public static final String 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: SqlOperatorConversion
      Returns the SQL operator corresponding to this function. Should be a singleton.
      Specified by:
      calciteOperator in interface SqlOperatorConversion
      Returns:
      operator
    • toDruidExpression

      @Nullable public DruidExpression toDruidExpression(PlannerContext plannerContext, RowSignature rowSignature, org.apache.calcite.rex.RexNode rexNode)
      Description copied from interface: SqlOperatorConversion
      Translate a Calcite RexNode to a Druid expression.
      Specified by:
      toDruidExpression in interface SqlOperatorConversion
      Parameters:
      plannerContext - SQL planner context
      rowSignature - signature of the rows to be extracted from
      rexNode - expression meant to be applied on top of the rows
      Returns:
      Druid expression, or null if translation is not possible
      See Also: