ericm-db commented on code in PR #48401:
URL: https://github.com/apache/spark/pull/48401#discussion_r1828318950
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDBStateEncoder.scala:
##########
@@ -661,19 +704,31 @@ class RangeKeyScanStateEncoder(
class NoPrefixKeyStateEncoder(
keySchema: StructType,
useColumnFamilies: Boolean = false,
- virtualColFamilyId: Option[Short] = None)
- extends RocksDBKeyStateEncoderBase(useColumnFamilies, virtualColFamilyId) {
+ virtualColFamilyId: Option[Short] = None,
+ avroEnc: Option[AvroEncoderSpec] = None)
+ extends RocksDBKeyStateEncoderBase(useColumnFamilies, virtualColFamilyId)
with Logging {
import RocksDBStateEncoder._
// Reusable objects
private val keyRow = new UnsafeRow(keySchema.size)
+ private val keyAvroType = SchemaConverters.toAvroType(keySchema)
override def encodeKey(row: UnsafeRow): Array[Byte] = {
if (!useColumnFamilies) {
encodeUnsafeRow(row)
} else {
- val bytesToEncode = row.getBytes
+ // If avroEnc is defined, we know that we need to use Avro to
+ // encode this UnsafeRow to Avro bytes
+ val bytesToEncode = if (avroEnc.isDefined) {
Review Comment:
introduce boolean for this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]