Package org.apache.spark.sql.types.ops
Class TimeTypeApiOps
Object
org.apache.spark.sql.types.ops.TimeTypeApiOps
- All Implemented Interfaces:
Serializable,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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondataType()The DataType this Ops instance handles.Formats an internal value as a display string.scala.Option<String>formatExternal(Object value) Formats an external-type value for Hive output.org.apache.spark.sql.catalyst.encoders.AgnosticEncoder<?>Returns the AgnosticEncoder for this type.Creates a converter function for Python/Py4J interop.scala.Option<Object>Returns true if values of this type need conversion when passed to/from Python.t()scala.Option<String>Returns the Thrift TTypeId name for this type (e.g., "STRING_TYPE").scala.Option<org.apache.arrow.vector.types.pojo.ArrowType>toArrowType(String timeZoneId) Converts this DataType to its Arrow representation.toSQLValue(Object v) Formats an internal value as a SQL literal string.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.spark.sql.types.ops.TypeApiOps
formatExternal, formatUTF8, nullSafeConvert
-
Constructor Details
-
TimeTypeApiOps
-
-
Method Details
-
dataType
Description copied from interface:TypeApiOpsThe DataType this Ops instance handles.- Specified by:
dataTypein interfaceTypeApiOps
-
format
Description copied from interface:TypeApiOpsFormats an internal value as a display string.Used by CAST to STRING, EXPLAIN output, SHOW commands.
- Specified by:
formatin interfaceTypeApiOps- Parameters:
v- the internal value (e.g., Long nanoseconds for TimeType)- Returns:
- formatted string (e.g., "10:30:45.123456")
-
formatExternal
Description copied from interface:TypeApiOpsFormats 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:
formatExternalin interfaceTypeApiOps- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
getEncoder
public org.apache.spark.sql.catalyst.encoders.AgnosticEncoder<?> getEncoder()Description copied from interface:TypeApiOpsReturns the AgnosticEncoder for this type.Used by RowEncoder for Dataset[T] operations.
- Specified by:
getEncoderin interfaceTypeApiOps- Returns:
- AgnosticEncoder instance (e.g., LocalTimeEncoder for TimeType)
-
makeFromJava
Description copied from interface:TypeApiOpsCreates a converter function for Python/Py4J interop.- Specified by:
makeFromJavain interfaceTypeApiOps
-
needConversionInPython
Description copied from interface:TypeApiOpsReturns true if values of this type need conversion when passed to/from Python.- Specified by:
needConversionInPythonin interfaceTypeApiOps
-
t
-
thriftTypeName
Description copied from interface:TypeApiOpsReturns the Thrift TTypeId name for this type (e.g., "STRING_TYPE").- Specified by:
thriftTypeNamein interfaceTypeApiOps
-
toArrowType
Description copied from interface:TypeApiOpsConverts this DataType to its Arrow representation. Returns None if not supported.- Specified by:
toArrowTypein interfaceTypeApiOps
-
toSQLValue
Description copied from interface:TypeApiOpsFormats an internal value as a SQL literal string.- Specified by:
toSQLValuein interfaceTypeApiOps- Parameters:
v- the internal value- Returns:
- SQL literal string (e.g., "TIME '10:30:00'")
-