Class IntervalOperation

All Implemented Interfaces:
HasSQL, Typed

public class IntervalOperation extends Operation2
A mathematical operation with intervals.
  • Field Details

    • INTERVAL_YEAR_DIGITS

      private static final int INTERVAL_YEAR_DIGITS
      Number of digits enough to hold INTERVAL '999999999999999999' YEAR / INTERVAL '1' MONTH.
      See Also:
    • INTERVAL_DAY_DIGITS

      private static final int INTERVAL_DAY_DIGITS
      Number of digits enough to hold INTERVAL '999999999999999999' DAY / INTERVAL '0.000000001' SECOND.
      See Also:
    • INTERVAL_DIVIDE_INTERVAL_YEAR_TYPE

      private static final TypeInfo INTERVAL_DIVIDE_INTERVAL_YEAR_TYPE
    • INTERVAL_DIVIDE_INTERVAL_DAY_TYPE

      private static final TypeInfo INTERVAL_DIVIDE_INTERVAL_DAY_TYPE
    • opType

      private final IntervalOperation.IntervalOpType opType
    • forcedType

      private TypeInfo forcedType
  • Constructor Details

  • Method Details

    • nanosFromValue

      private static BigInteger nanosFromValue(SessionLocal session, Value v)
    • needParentheses

      public boolean needParentheses()
      Description copied from class: Expression
      Returns whether this expressions needs to be wrapped in parentheses when it is used as an argument of other expressions.
      Overrides:
      needParentheses in class Expression
      Returns:
      true if it is
    • getUnenclosedSQL

      public StringBuilder getUnenclosedSQL(StringBuilder builder, int sqlFlags)
      Description copied from class: Expression
      Get the SQL statement of this expression. This may not always be the original SQL statement, especially after optimization. Enclosing '(' and ')' are never appended.
      Specified by:
      getUnenclosedSQL in class Expression
      Parameters:
      builder - string builder
      sqlFlags - formatting flags
      Returns:
      the specified string builder
    • getInnerSQL2

      private void getInnerSQL2(StringBuilder builder, int sqlFlags)
    • getForcedTypeSQL

      static StringBuilder getForcedTypeSQL(StringBuilder builder, TypeInfo forcedType)
    • getOperationToken

      private char getOperationToken()
    • getValue

      public Value getValue(SessionLocal session)
      Description copied from class: Expression
      Return the resulting value for the current row.
      Specified by:
      getValue in class Expression
      Parameters:
      session - the session
      Returns:
      the result
    • getDateTimeWithInterval

      private Value getDateTimeWithInterval(SessionLocal session, Value l, Value r, int lType, int rType)
    • getTimeWithInterval

      private long getTimeWithInterval(Value r, long nanos)
    • optimize

      public Expression optimize(SessionLocal session)
      Description copied from class: Expression
      Try to optimize the expression.
      Specified by:
      optimize in class Expression
      Parameters:
      session - the session
      Returns:
      the optimized expression