jingz-db commented on code in PR #47528:
URL: https://github.com/apache/spark/pull/47528#discussion_r1699101756
##########
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:
Shall we move the `if batchId == 0` before `metadataReader.read` to avoid
unnecessary file read?
--
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]