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 - Arrow conversion (ArrowUtils) - Python interop (EvaluatePython) - Hive formatting (HiveResult) - Thrift type mapping (SparkExecuteStatementOperation)

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")
    • formatExternal

      public scala.Option<String> formatExternal(Object value)
      Description copied from interface: TypeApiOps
      Formats an external-type value for Hive output. Most types override this simple version. Types that need different formatting when nested should override the 2-param overload.
      Specified by:
      formatExternal in interface TypeApiOps
      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • 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)
    • makeFromJava

      public scala.Option<scala.Function1<Object,Object>> makeFromJava()
      Description copied from interface: TypeApiOps
      Creates a converter function for Python/Py4J interop.
      Specified by:
      makeFromJava in interface TypeApiOps
    • needConversionInPython

      public scala.Option<Object> needConversionInPython()
      Description copied from interface: TypeApiOps
      Returns true if values of this type need conversion when passed to/from Python.
      Specified by:
      needConversionInPython in interface TypeApiOps
    • t

      public TimeType t()
    • thriftTypeName

      public scala.Option<String> thriftTypeName()
      Description copied from interface: TypeApiOps
      Returns the Thrift TTypeId name for this type (e.g., "STRING_TYPE").
      Specified by:
      thriftTypeName in interface TypeApiOps
    • toArrowType

      public scala.Option<org.apache.arrow.vector.types.pojo.ArrowType> toArrowType(String timeZoneId)
      Description copied from interface: TypeApiOps
      Converts this DataType to its Arrow representation. Returns None if not supported.
      Specified by:
      toArrowType in interface TypeApiOps
    • 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'")