Class ToTimestamp

java.lang.Object
dev.frostlake.functions.BuiltInFunction
dev.frostlake.functions.scalar.conversion.ToTimestamp

public class ToTimestamp extends BuiltInFunction
TO_TIMESTAMP / TO_TIMESTAMP_LTZ / TO_TIMESTAMP_TZ. They share one conversion but NOT one declared type: live reports each under the flavour its own name asks for, so the name decides — and the value is held the way that flavour holds it (see TimestampFlavourConversion).
  • Constructor Details

    • ToTimestamp

      public ToTimestamp(String name)
  • Method Details

    • getReturnType

      public DataType getReturnType()
      The BARE spelling is re-resolved on every call, because the session's TIMESTAMP_TYPE_MAPPING can change between statements and the registry builds each function ONCE at startup — a type decided in the constructor would be frozen at whatever the mapping was before any session existed. The flavoured spellings carry their answer in their own name and never move.
      Overrides:
      getReturnType in class BuiltInFunction
    • evaluate

      public Object evaluate(List<Object> args)
      Description copied from class: BuiltInFunction
      Computes the function's result over its already-evaluated argument values. A SQL NULL argument arrives as Java null, and returning null makes the SQL result NULL.
      Specified by:
      evaluate in class BuiltInFunction
      Parameters:
      args - the argument values, in call order
      Returns:
      the function's value for these arguments, or null for SQL NULL
    • getMinArgCount

      public int getMinArgCount()
      Description copied from class: BuiltInFunction
      The fewest arguments a call to this function may pass; fewer is an argument-count error.
      Specified by:
      getMinArgCount in class BuiltInFunction
      Returns:
      the minimum accepted argument count
    • getMaxArgCount

      public int getMaxArgCount()
      Description copied from class: BuiltInFunction
      The most arguments a call to this function may pass; Integer.MAX_VALUE marks a variadic function (see BuiltInFunction.isVariadic()).
      Specified by:
      getMaxArgCount in class BuiltInFunction
      Returns:
      the maximum accepted argument count