subhramit commented on code in PR #58225: URL: https://github.com/apache/spark/pull/58225#discussion_r3891497151
########## sql/core/src/test/scala/org/apache/spark/sql/errors/ErrorMessageParametersSuite.scala: ########## @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.errors + +import org.apache.spark.{SparkFunSuite, SparkRuntimeException} +import org.apache.spark.sql.catalyst.catalog.InvalidUDFClassException +import org.apache.spark.sql.execution.streaming.state.StateStoreColumnFamilyMismatch + +class ErrorMessageParametersSuite extends SparkFunSuite { + + test("SPARK-58945: invalid writer commit message reports detail") { + checkError( + exception = QueryExecutionErrors.invalidWriterCommitMessageError("zero") + .asInstanceOf[SparkRuntimeException], + condition = "INVALID_WRITER_COMMIT_MESSAGE", + parameters = Map("detail" -> "zero")) + } + + test("SPARK-58945: invalid UDF class error reports clazz") { + checkError( + exception = QueryCompilationErrors.invalidUDFClassError("example.InvalidFunction") + .asInstanceOf[InvalidUDFClassException], + condition = "_LEGACY_ERROR_TEMP_2450", + parameters = Map("clazz" -> "example.InvalidFunction")) + } + + test("SPARK-58945: state store mismatch reports schema details") { + checkError( + exception = new StateStoreColumnFamilyMismatch( Review Comment: I kept the fix, moved the coverage into a dedicated state-store suite, and updated the PR description to call that out >Two of the seven fixed paths are not demonstrated by an end-to-end repro today. stateStoreColumnFamilyMismatch currently has no callers, so that path is latent. It would have failed during message construction before this fix, so the factory is covered directly by a unit test. This PR only fixes its parameter mapping so the path is correct if the transformWithState side wires it up in follow-up work. ########## sql/core/src/test/scala/org/apache/spark/sql/errors/ErrorMessageParametersSuite.scala: ########## @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.errors + +import org.apache.spark.{SparkFunSuite, SparkRuntimeException} +import org.apache.spark.sql.catalyst.catalog.InvalidUDFClassException +import org.apache.spark.sql.execution.streaming.state.StateStoreColumnFamilyMismatch + +class ErrorMessageParametersSuite extends SparkFunSuite { + + test("SPARK-58945: invalid writer commit message reports detail") { + checkError( + exception = QueryExecutionErrors.invalidWriterCommitMessageError("zero") + .asInstanceOf[SparkRuntimeException], + condition = "INVALID_WRITER_COMMIT_MESSAGE", + parameters = Map("detail" -> "zero")) + } + + test("SPARK-58945: invalid UDF class error reports clazz") { + checkError( + exception = QueryCompilationErrors.invalidUDFClassError("example.InvalidFunction") + .asInstanceOf[InvalidUDFClassException], + condition = "_LEGACY_ERROR_TEMP_2450", + parameters = Map("clazz" -> "example.InvalidFunction")) + } + + test("SPARK-58945: state store mismatch reports schema details") { + checkError( + exception = new StateStoreColumnFamilyMismatch( Review Comment: I kept the fix, moved the coverage into a dedicated state-store suite, updated the PR description to call that out >Two of the seven fixed paths are not demonstrated by an end-to-end repro today. stateStoreColumnFamilyMismatch currently has no callers, so that path is latent. It would have failed during message construction before this fix, so the factory is covered directly by a unit test. This PR only fixes its parameter mapping so the path is correct if the transformWithState side wires it up in follow-up work. -- 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]
