Skip to content

Commit

Permalink
[SPARK-51177][PYTHON][CONNECT] Add InvalidCommandInput to Spark Con…
Browse files Browse the repository at this point in the history
…nect Python client

### What changes were proposed in this pull request?

This PR proposes to add `InvalidCommandInput` to Spark Connect Python client.

### Why are the changes needed?

To keep the consistency with Spark Connect Scala client. We should capture the `SparkConnectGrpcException` more generally across all clients.

### Does this PR introduce _any_ user-facing change?

No API changes, but the user-facing error message would keep consistency with Spark Connect Scala client.

### How was this patch tested?

The existing CI should pass

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #49916 from itholic/invalid_command_input.

Authored-by: Haejoon Lee <[email protected]>
Signed-off-by: Haejoon Lee <[email protected]>
  • Loading branch information
itholic committed Feb 14, 2025
1 parent 78b1754 commit 2e0c02e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/pyspark/errors/exceptions/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ class InvalidPlanInput(SparkConnectGrpcException):
"""


class InvalidCommandInput(SparkConnectGrpcException):
"""
Error thrown when a connect command is not valid.
"""


# Update EXCEPTION_CLASS_MAPPING here when adding a new exception
EXCEPTION_CLASS_MAPPING = {
"org.apache.spark.sql.catalyst.parser.ParseException": ParseException,
Expand All @@ -319,6 +325,7 @@ class InvalidPlanInput(SparkConnectGrpcException):
"org.apache.spark.SparkNoSuchElementException": SparkNoSuchElementException,
"org.apache.spark.SparkException": SparkException,
"org.apache.spark.sql.connect.common.InvalidPlanInput": InvalidPlanInput,
"org.apache.spark.sql.connect.common.InvalidCommandInput": InvalidCommandInput,
}


Expand Down

0 comments on commit 2e0c02e

Please sign in to comment.