Packages

c

org.apache.spark.sql.execution.streaming.state

RangeKeyScanStateEncoder

class RangeKeyScanStateEncoder extends RocksDBKeyStateEncoder with Logging

RocksDB Key Encoder for UnsafeRow that supports range scan for fixed size fields

To encode a row for range scan, we first project the orderingOrdinals from the oridinal UnsafeRow into another UnsafeRow; we then rewrite that new UnsafeRow's fields in BIG_ENDIAN to allow for scanning keys in sorted order using the byte-wise comparison method that RocksDB uses.

Then, for the rest of the fields, we project those into another UnsafeRow. We then effectively join these two UnsafeRows together, and finally take those bytes to get the resulting row.

We cannot support variable sized fields in the range scan because the UnsafeRow format stores variable sized fields as offset and length pointers to the actual values, thereby changing the required ordering.

Note that we also support "null" values being passed for these fixed size fields. We prepend a single byte to indicate whether the column value is null or not. We cannot change the nullability on the UnsafeRow itself as the expected ordering would change if non-first columns are marked as null. If the first col is null, those entries will appear last in the iterator. If non-first columns are null, ordering based on the previous columns will still be honored. For rows with null column values, ordering for subsequent columns will also be maintained within those set of rows. We use the same byte to also encode whether the value is negative or not. For negative float/double values, we flip all the bits to ensure the right lexicographical ordering. For the rationale around this, please check the link here: https://en.wikipedia.org/wiki/IEEE_754#Design_rationale

Linear Supertypes
Logging, RocksDBKeyStateEncoder, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RangeKeyScanStateEncoder
  2. Logging
  3. RocksDBKeyStateEncoder
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new RangeKeyScanStateEncoder(dataEncoder: RocksDBDataEncoder, keySchema: StructType, orderingOrdinals: Seq[Int], useColumnFamilies: Boolean = false)

    dataEncoder

    - the encoder that handles the actual encoding/decoding of data

    keySchema

    - schema of the key to be encoded

    orderingOrdinals

    - the ordinals for which the range scan is constructed

    useColumnFamilies

    - if column family is enabled for this encoder

Type Members

  1. implicit class LogStringContext extends AnyRef
    Definition Classes
    Logging

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. def decodeKey(keyBytes: Array[Byte]): UnsafeRow
  7. def encodeKey(row: UnsafeRow): Array[Byte]
  8. def encodePrefixKey(prefixKey: UnsafeRow): Array[Byte]
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  13. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  14. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  17. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  18. def logDebug(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  19. def logDebug(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  20. def logDebug(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  21. def logDebug(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  22. def logError(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  23. def logError(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  24. def logError(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  25. def logError(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  26. def logInfo(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. def logInfo(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  28. def logInfo(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  29. def logInfo(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  30. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  31. def logTrace(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  32. def logTrace(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  33. def logTrace(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  34. def logTrace(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  35. def logWarning(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  36. def logWarning(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  37. def logWarning(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  38. def logWarning(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  39. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  40. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  41. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  42. def supportPrefixKeyScan: Boolean
  43. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  44. def toString(): String
    Definition Classes
    AnyRef → Any
  45. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  46. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  47. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  48. def withLogContext(context: Map[String, String])(body: => Unit): Unit
    Attributes
    protected
    Definition Classes
    Logging

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from Logging

Inherited from RocksDBKeyStateEncoder

Inherited from AnyRef

Inherited from Any

Ungrouped