This is an automated email from the ASF dual-hosted git repository.
uros-b pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.x by this push:
new 2cc70259c071 [SPARK-43940][SQL] Test the error class:
BATCH_METADATA_NOT_FOUND
2cc70259c071 is described below
commit 2cc70259c0713cdbe4d5ad2b7b27305dc95e821c
Author: Deepak Jain (DJ) <[email protected]>
AuthorDate: Sun Aug 30 23:48:18 2026 +0000
[SPARK-43940][SQL] Test the error class: BATCH_METADATA_NOT_FOUND
### Summary
Adds coverage for the missing batch metadata error path.
### Change
`HDFSMetadataLog.applyFnToBatchByStream` now has a focused test that checks
`BATCH_METADATA_NOT_FOUND`, the missing batch file parameter, and SQLSTATE
`42K03`.
### Tests
`JAVA_HOME=/opt/homebrew/opt/openjdk17
PATH="/opt/homebrew/opt/openjdk17/bin:$PATH" ./build/sbt "sql/testOnly
org.apache.spark.sql.errors.QueryExecutionErrorsSuite -- -z SPARK-43940"`
Fixes SPARK-43940
**JIRA assignee for credit:** deepujain
Closes #57926 from deepujain/SPARK-43940-cannot-find-batch-test.
Authored-by: Deepak Jain (DJ) <[email protected]>
Signed-off-by: Uros Bojanic <[email protected]>
(cherry picked from commit f54433a5c38c1d91633385a8f948d75fdf36dd46)
Signed-off-by: Uros Bojanic <[email protected]>
---
.../spark/sql/errors/QueryExecutionErrorsSuite.scala | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala
index 7eccce3fe049..e9d9baaff583 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala
@@ -48,7 +48,9 @@ import
org.apache.spark.sql.execution.datasources.jdbc.connection.ConnectionProv
import org.apache.spark.sql.execution.datasources.orc.OrcTest
import org.apache.spark.sql.execution.datasources.parquet.ParquetTest
import org.apache.spark.sql.execution.datasources.v2.jdbc.JDBCTableCatalog
-import
org.apache.spark.sql.execution.streaming.checkpointing.FileSystemBasedCheckpointFileManager
+import org.apache.spark.sql.execution.streaming.checkpointing.{
+ FileSystemBasedCheckpointFileManager,
+ HDFSMetadataLog}
import org.apache.spark.sql.execution.vectorized.{
ColumnVectorUtils,
ConstantColumnVector,
@@ -997,6 +999,22 @@ class QueryExecutionErrorsSuite
}
}
+ test("SPARK-43940: BATCH_METADATA_NOT_FOUND") {
+ withTempDir { dir =>
+ val metadataLog = new HDFSMetadataLog[String](spark, dir.getAbsolutePath)
+ val e = intercept[SparkFileNotFoundException] {
+ metadataLog.applyFnToBatchByStream(0L) { _ => () }
+ }
+
+ val batchMetadataFile = new Path(dir.getAbsolutePath, "0").toString
+ checkError(
+ exception = e,
+ condition = "BATCH_METADATA_NOT_FOUND",
+ parameters = Map("batchMetadataFile" -> batchMetadataFile),
+ sqlState = "42K03")
+ }
+ }
+
test("UNSUPPORTED_FEATURE.MULTI_ACTION_ALTER: The target JDBC server hosting
table " +
"does not support ALTER TABLE with multiple actions.") {
withTempDir { tempDir =>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]