[SPARK-52335][CONNET][SQL] Unify the 'invalid bucket count' error for both Connect and Classic #51039
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR unifies the error handling for invalid bucket count validation between Spark Connect and Classic Spark. The main changes are:
error-conditions.json
forINVALID_BUCKET_COUNT
to be more descriptive and consistent_LEGACY_ERROR_TEMP_1083
since its functionality is now merged intoINVALID_BUCKET_COUNT
InvalidCommandInput
class and its usage in Connect since we're now using the standardAnalysisException
withINVALID_BUCKET_COUNT
error conditionSparkConnectPlanner
to rely on the standard error handling pathSparkConnectProtoSuite
to verify the new unified error handlingThe key improvement is that both Connect and Classic now use the same error condition and message format for invalid bucket count errors, making the error handling more consistent across Spark's different interfaces. The error message now includes both the maximum allowed bucket count and the invalid value received, providing better guidance to users.
This change simplifies the error handling codebase by removing duplicate error definitions and standardizing on a single error condition for this validation case.
Why are the changes needed?
The changes are needed to:
The unified error message now clearly indicates both the requirement (bucket count > 0) and the upper limit (≤ bucketing.maxBuckets), making it more helpful for users to understand and fix the issue.
Does this PR introduce any user-facing change?
No
How was this patch tested?
build/sbt "connect/testOnly *SparkConnectProtoSuite"
Was this patch authored or co-authored using generative AI tooling?
No