trait TypeApiOps extends Serializable
Client-side (spark-api) type operations for the Types Framework.
This trait consolidates all client-side operations that a data type must implement to be usable in the Spark SQL API layer. All methods are mandatory because a type cannot function correctly without string formatting (needed for CAST to STRING, EXPLAIN, SHOW) or encoding (needed for Dataset[T] operations).
This single-interface design was chosen over separate FormatTypeOps/EncodeTypeOps traits to make it clear what a new type must implement - there is one mandatory interface, and it contains everything required. Optional capabilities (e.g., proto, Arrow, JDBC) are defined as separate traits that can be mixed in incrementally.
RELATIONSHIP TO TypeOps:
- TypeOps (catalyst): Server-side operations - physical types, literals, conversions
- TypeApiOps (spark-api): Client-side operations - formatting, encoding
The split exists because sql/api cannot depend on sql/catalyst. For TimeType, TimeTypeOps (catalyst) extends TimeTypeApiOps (sql-api) to inherit both sets of operations.
- Source
- TypeApiOps.scala
- Since
4.2.0
- See also
TimeTypeApiOps for reference implementation
- Alphabetic
- By Inheritance
- TypeApiOps
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def dataType: DataType
The DataType this Ops instance handles.
- abstract def format(v: Any): String
Formats an internal value as a display string.
Formats an internal value as a display string.
Used by CAST to STRING, EXPLAIN output, SHOW commands.
- v
the internal value (e.g., Long nanoseconds for TimeType)
- returns
formatted string (e.g., "10:30:45.123456")
- abstract def getEncoder: AgnosticEncoder[_]
Returns the AgnosticEncoder for this type.
Returns the AgnosticEncoder for this type.
Used by RowEncoder for Dataset[T] operations.
- returns
AgnosticEncoder instance (e.g., LocalTimeEncoder for TimeType)
- abstract def toSQLValue(v: Any): String
Formats an internal value as a SQL literal string.
Formats an internal value as a SQL literal string.
- v
the internal value
- returns
SQL literal string (e.g., "TIME '10:30:00'")
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def formatUTF8(v: Any): UTF8String
Formats an internal value as a UTF8String.
Formats an internal value as a UTF8String.
Default implementation wraps format(). Override for performance if needed.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)