pedrumj2 opened a new pull request, #60709: URL: https://github.com/apache/spark/pull/60709
### What changes were proposed in this pull request? [`FileSourceCharVarcharTestSuite`](https://github.com/apache/spark/blob/642e11ce14be2e1423799cb0581ce6a26a068a86/sql/core/src/test/scala/org/apache/spark/sql/CharVarcharTestSuite.scala#L4126) now runs every char/varchar length check through [`assertLengthCheckFailure`](https://github.com/apache/spark/blob/642e11ce14be2e1423799cb0581ce6a26a068a86/sql/core/src/test/scala/org/apache/spark/sql/CharVarcharTestSuite.scala#L83-L93), which also accepts the expected limit. The write-side check in that suite now also asserts that the error is [`EXCEED_LIMIT_LENGTH`](https://github.com/apache/spark/blob/642e11ce14be2e1423799cb0581ce6a26a068a86/common/utils/src/main/resources/error/error-conditions.json#L2817) with limit 5. ### Why are the changes needed? [`assertLengthCheckFailure`](https://github.com/apache/spark/blob/642e11ce14be2e1423799cb0581ce6a26a068a86/sql/core/src/test/scala/org/apache/spark/sql/CharVarcharTestSuite.scala#L83-L93) only accepted a limit of 5. The read-side checks in [`FileSourceCharVarcharTestSuite`](https://github.com/apache/spark/blob/642e11ce14be2e1423799cb0581ce6a26a068a86/sql/core/src/test/scala/org/apache/spark/sql/CharVarcharTestSuite.scala#L4126) expect a limit of 2 or 3, so they had to repeat the helper's assertion inline. The write-side check in the same suite never checked the error condition of the exception it caught. With every check going through the helper, a project that runs this suite on another execution engine can override the helper instead of copying the tests, as discussed in [apache/gluten#13647](https://github.com/apache/gluten/issues/13647#issuecomment-6978920048). ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? #### Local run ``` build/sbt -Phive "sql/testOnly org.apache.spark.sql.FileSourceCharVarcharTestSuite org.apache.spark.sql.DSV2CharVarcharTestSuite" "hive/testOnly org.apache.spark.sql.hive.HiveCharVarcharTestSuite" ``` ``` [info] FileSourceCharVarcharTestSuite: ... [info] - SPARK-60243: read-side overflow on pre-existing CHAR/VARCHAR partitions (270 milliseconds) ... [info] - SPARK-58801: standardSemantics scan pads CHAR and errors on oversize (500 milliseconds) ... [info] - SPARK-58794: EXTERNAL TABLE CHAR/VARCHAR pad, assignment, and oversize (443 milliseconds) ... [info] Run completed in 1 minute, 4 seconds. [info] Total number of tests run: 140 [info] Suites: completed 2, aborted 0 [info] Tests: succeeded 140, failed 0, canceled 1, ignored 0, pending 0 [info] All tests passed. ... [info] HiveCharVarcharTestSuite: ... [info] Run completed in 1 minute, 10 seconds. [info] Total number of tests run: 65 [info] Suites: completed 1, aborted 0 [info] Tests: succeeded 65, failed 0, canceled 0, ignored 0, pending 0 [info] All tests passed. ``` #### Automated tests No tests were added. The changed checks are existing tests, and CI runs their suites. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Co-authored with Claude Code (claude-opus-5-5) -- 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]
