anishshri-db commented on code in PR #47528:
URL: https://github.com/apache/spark/pull/47528#discussion_r1699117904
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/TransformWithStateExec.scala:
##########
@@ -396,8 +396,16 @@ case class TransformWithStateExec(
new Path(stateSchemaDir, s"${batchId}_${UUID.randomUUID().toString}")
val metadataPath = new Path(getStateInfo.checkpointLocation,
s"${getStateInfo.operatorId}")
val metadataReader = OperatorStateMetadataReader.createReader(
- metadataPath, hadoopConf, operatorStateMetadataVersion)
- val operatorStateMetadata = metadataReader.read()
+ metadataPath, hadoopConf, operatorStateMetadataVersion, batchId)
+ val operatorStateMetadata = try {
+ metadataReader.read()
+ } catch {
+ // If this is the first time we are running the query, there will be
no metadata
+ // and this error is expected. In this case, we return None.
+ case ex: Exception if batchId == 0 =>
Review Comment:
This was intentional. This is basically to guard against the case where we
are trying to replay batch 0 but it has the operator metadata already recorded.
In this case, we will be able to read that file.
--
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]