shrirangmhalgi commented on code in PR #56319:
URL: https://github.com/apache/spark/pull/56319#discussion_r3532392531


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/state/StateDataSourceReadSuite.scala:
##########
@@ -329,6 +329,42 @@ class StateDataSourceNegativeTestSuite extends 
StateDataSourceTestBase {
         matchPVals = true)
     }
   }
+
+  test("SPARK-57225: statestore data source does not support write") {
+    withTempDir { tempDir =>
+      runLargeDataStreamingAggregationQuery(tempDir.getAbsolutePath)
+
+      val df = spark.read.format("statestore")
+        .option(StateSourceOptions.PATH, tempDir.getAbsolutePath)
+        .load()
+
+      val ex = intercept[StateDataSourceWriteUnsupported] {
+        df.write.format("statestore")
+          .option(StateSourceOptions.PATH, tempDir.getAbsolutePath)
+          .save()
+      }
+      checkError(ex, "STDS_WRITE_UNSUPPORTED", Some("0A000"),
+        Map("sourceName" -> "statestore"))
+    }
+  }
+
+  test("SPARK-57225: state-metadata data source does not support write") {
+    withTempDir { tempDir =>
+      runLargeDataStreamingAggregationQuery(tempDir.getAbsolutePath)
+
+      val df = spark.read.format("state-metadata")
+        .option(StateSourceOptions.PATH, tempDir.getAbsolutePath)
+        .load()
+
+      val ex = intercept[StateDataSourceWriteUnsupported] {
+        df.write.format("state-metadata")
+          .option(StateSourceOptions.PATH, tempDir.getAbsolutePath)
+          .save()
+      }
+      checkError(ex, "STDS_WRITE_UNSUPPORTED", Some("0A000"),
+        Map("sourceName" -> "state-metadata"))
+    }
+  }
 }

Review Comment:
   Thanks uros-b for the review and apologies for late reply. Fixed in the 
latest push. Added negative tests for the no-path case:
   
   - `statestore` without path throws 
`StateDataSourceUnspecifiedRequiredOption` first (path validation fires before 
`createRelation`), confirming your observation
   - `state-metadata` without path still throws `STDS_WRITE_UNSUPPORTED` 
directly (reaches `createRelation`)
   
   Also removed the FQN qualifiers and added proper imports per your other 
comment.



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