Class TimeTypeApiOps

Object
org.apache.spark.sql.types.ops.TimeTypeApiOps
All Implemented Interfaces:
Serializable, TypeApiOps

public class TimeTypeApiOps extends Object implements TypeApiOps
Client-side (spark-api) operations for TimeType.

This class implements all TypeApiOps methods for the TIME data type: - String formatting: uses FractionTimeFormatter for consistent output - Row encoding: uses LocalTimeEncoder for java.time.LocalTime

RELATIONSHIP TO TimeTypeOps: TimeTypeOps (in catalyst package) extends this class to inherit client-side operations while adding server-side operations (physical type, literals, etc.).

param: t The TimeType with precision information

Since:
4.2.0
See Also:
  • Constructor Details

    • TimeTypeApiOps

      public TimeTypeApiOps(TimeType t)
  • Method Details

    • dataType

      public DataType dataType()
      Description copied from interface: TypeApiOps
      The DataType this Ops instance handles.
      Specified by:
      dataType in interface TypeApiOps
    • format

      public String format(Object v)
      Description copied from interface: TypeApiOps
      Formats an internal value as a display string.

      Used by CAST to STRING, EXPLAIN output, SHOW commands.

      Specified by:
      format in interface TypeApiOps
      Parameters:
      v - the internal value (e.g., Long nanoseconds for TimeType)
      Returns:
      formatted string (e.g., "10:30:45.123456")
    • getEncoder

      public org.apache.spark.sql.catalyst.encoders.AgnosticEncoder<?> getEncoder()
      Description copied from interface: TypeApiOps
      Returns the AgnosticEncoder for this type.

      Used by RowEncoder for Dataset[T] operations.

      Specified by:
      getEncoder in interface TypeApiOps
      Returns:
      AgnosticEncoder instance (e.g., LocalTimeEncoder for TimeType)
    • t

      public TimeType t()
    • toSQLValue

      public String toSQLValue(Object v)
      Description copied from interface: TypeApiOps
      Formats an internal value as a SQL literal string.

      Specified by:
      toSQLValue in interface TypeApiOps
      Parameters:
      v - the internal value
      Returns:
      SQL literal string (e.g., "TIME '10:30:00'")