zifeif2 opened a new pull request, #59219: URL: https://github.com/apache/spark/pull/59219
### What changes were proposed in this pull request? This pull request classifies invalid Kafka batch offsets with the structured error condition `KAFKA_INVALID_BATCH_OFFSET` and SQLSTATE `22023`. It uses the existing `KafkaIllegalArgumentException` for invalid global, topic-level, and partition-level starting and ending offsets. The existing human-readable messages are preserved. The existing Kafka relation tests now verify the error condition, SQLSTATE, message parameters, and message compatibility for all six variants. ### Why are the changes needed? Kafka batch queries currently throw plain `IllegalArgumentException` for `startingOffsets=latest`, `endingOffsets=earliest`, and their topic-level and partition-level equivalents. Those exceptions do not provide a stable Spark error condition or SQLSTATE for programmatic handling. See [SPARK-59965](https://issues.apache.org/jira/browse/SPARK-59965). ### Does this PR introduce _any_ user-facing change? Yes. These invalid configurations now expose `KAFKA_INVALID_BATCH_OFFSET.GLOBAL` or `KAFKA_INVALID_BATCH_OFFSET.TOPIC_OR_PARTITION` with SQLSTATE `22023`. The existing human-readable messages are unchanged. ### How was this patch tested? - Extended `KafkaRelationSuite` with structured-error assertions for global, topic-level, and partition-level starting and ending offsets. - Validated the error-condition JSON and ran `git diff --check` locally. - The fork's [Build workflow](https://github.com/zifeif2/spark/actions/runs/37076981451) is running against this commit. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex I certify that this contribution is my original work and license it to the Apache Software Foundation under the project's open source license. -- 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]
