zeruibao commented on code in PR #54298:
URL: https://github.com/apache/spark/pull/54298#discussion_r2829552347


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/HDFSBackedStateStoreProvider.scala:
##########
@@ -1369,7 +1369,7 @@ class HDFSBackedStateStoreChangeDataReader(
         keyArray
       }
       keyRow.pointTo(originalKeyBytes, originalKeyBytes.length)
-      (recordType, keyRow, null, currentChangelogVersion - 1)
+      (recordType, keyRow, null, currentChangelogVersion - 1, null)

Review Comment:
   In the internal tuple: endKey is the last element (_5)
   In the output schema: end_key is second to last (before partition_id)
   We do conversion here
   ```
     private def unifyStateChangeDataRow(
         row: (RecordType, UnsafeRow, UnsafeRow, Long, UnsafeRow)): InternalRow 
= {
       val result = new GenericInternalRow(6)
       result.update(0, row._4)
       result.update(1, UTF8String.fromString(getRecordTypeAsString(row._1)))
       result.update(2, row._2)
       result.update(3, row._3)
       result.update(4, row._5)
       result.update(5, partition.partition)
       result
     }
   ```



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/HDFSBackedStateStoreProvider.scala:
##########
@@ -1387,7 +1387,7 @@ class HDFSBackedStateStoreChangeDataReader(
       // Prior to Spark 2.3 mistakenly append 4 bytes to the value row in
       // `RowBasedKeyValueBatch`, which gets persisted into the checkpoint data
       valueRow.pointTo(originalValueBytes, (originalValueBytes.length / 8) * 8)
-      (recordType, keyRow, valueRow, currentChangelogVersion - 1)
+      (recordType, keyRow, valueRow, currentChangelogVersion - 1, null)

Review Comment:
   ditto



-- 
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]

Reply via email to