Skip to content

[SPARK-51817][SPARK-49578][CONNECT] Re-introduce ansiConfig fields in messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW #50604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented Apr 16, 2025

What changes were proposed in this pull request?

In Spark Connect, we guarantee that older clients are compatible with newer
versions of the Spark Connect service.

A previous change - e28c33b - broke this compatibility by removing the
"ansiConfig" field in the message parameters for two error codes -
"CAST_OVERFLOW" and "CAST_INVALID_INPUT".

The Spark Connect client includes GrpcExceptionConverter.scala[1] to
convert error codes from the server to produce SQL compliant error codes
on the client. The SQL compliant error codes and corresponding error
messages are included in the error-conditions.json file. Older clients do not
include the change (e28c33b) to this file and still include the ansiConfig
parameter. Later versions of the Spark Connect service don't return this
parameter resulting in an internal error[2] that the correct error condition
could not be formulated.

This change reverts the changes on the server to continue producing the
"ansiConfig" field so older clients can still correctly reformulate the error class.

[1]:


[2]:
case i: IllegalArgumentException => throw SparkException.internalError(

Why are the changes needed?

Explained above.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Manual tests.

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

No.

@github-actions github-actions bot added the SQL label Apr 16, 2025
@nija-at nija-at changed the title [CONNECT][SPARK-51817][SPARK-49578] Re-introduce ansiConfig fields in messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW [WIP][CONNECT][SPARK-51817][SPARK-49578] Re-introduce ansiConfig fields in messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW Apr 16, 2025
@nija-at nija-at changed the title [WIP][CONNECT][SPARK-51817][SPARK-49578] Re-introduce ansiConfig fields in messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW [CONNECT][SPARK-51817][SPARK-49578] Re-introduce ansiConfig fields in messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW Apr 22, 2025
@HyukjinKwon HyukjinKwon changed the title [CONNECT][SPARK-51817][SPARK-49578] Re-introduce ansiConfig fields in messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW [SPARK-51817][SPARK-49578][CONNECT] Re-introduce ansiConfig fields in messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW Apr 23, 2025
@cloud-fan
Copy link
Contributor

there are still test failures in

org.apache.spark.sql.errors.QueryExecutionErrorsSuite
org.apache.spark.sql.execution.command.v2.AlterTableAddPartitionSuite
org.apache.spark.sql.scripting.SqlScriptingInterpreterSuite
org.apache.spark.sql.connector.ProcedureSuite
org.apache.spark.sql.errors.QueryExecutionAnsiErrorsSuite

@nija-at
Copy link
Contributor Author

nija-at commented Apr 25, 2025

@cloud-fan thanks. I've fixed these now. Waiting for CI to confirm.

@HyukjinKwon
Copy link
Member

Merged to master and branch-4.0.

HyukjinKwon pushed a commit that referenced this pull request Apr 27, 2025
… messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW

In Spark Connect, we guarantee that older clients are compatible with newer
versions of the Spark Connect service.

A previous change - e28c33b - broke this compatibility by removing the
"ansiConfig" field in the message parameters for two error codes -
"CAST_OVERFLOW" and "CAST_INVALID_INPUT".

The Spark Connect client includes GrpcExceptionConverter.scala\[1] to
convert error codes from the server to produce SQL compliant error codes
on the client. The SQL compliant error codes and corresponding error
messages are included in the error-conditions.json file. Older clients do not
include the change (e28c33b) to this file and still include the `ansiConfig`
parameter. Later versions of the Spark Connect service don't return this
parameter resulting in an internal error\[2] that the correct error condition
could not be formulated.

This change reverts the changes on the server to continue producing the
"ansiConfig" field so older clients can still correctly reformulate the error class.

\[1]: https://github.com/apache/spark/blob/2ba156096e83adf7b0b2f5c38453d6fd37d95ded/sql/connect/common/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala#L184
\[2]: https://github.com/apache/spark/blob/2ba156096e83adf7b0b2f5c38453d6fd37d95ded/common/utils/src/main/scala/org/apache/spark/ErrorClassesJSONReader.scala#L58

Explained above.

No.

Manual tests.

No.

Closes #50604 from nija-at/cast-invalid-input.

Authored-by: Niranjan Jayakar <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
(cherry picked from commit 528fe20)
Signed-off-by: Hyukjin Kwon <[email protected]>
LuciferYang added a commit that referenced this pull request Apr 28, 2025
…at4.sql` and `postgreSQL/int8.sql` for Java 21

### What changes were proposed in this pull request?
This pr aims to Re-generate golden files of `postgreSQL/float4.sql` and `postgreSQL/int8.sql` for Java 21. #50604 forgot to generate them.

### Why are the changes needed?
Restore Java 21 daily test:
- master: https://github.com/apache/spark/actions/runs/14699959163/job/41247643789
- branch-4.0: https://github.com/apache/spark/actions/runs/14700610338/job/41249373892

![image](https://github.com/user-attachments/assets/4bfe3b14-d5a8-4428-928b-8a2e94287bb0)

![image](https://github.com/user-attachments/assets/ab725b03-2da6-4460-8cc7-759806965fbd)

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

### How was this patch tested?
- Pass Github Actions
- locally test with Java 21

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

Closes #50740 from LuciferYang/SPARK-51817-FOLLOWUP.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
LuciferYang added a commit that referenced this pull request Apr 28, 2025
…at4.sql` and `postgreSQL/int8.sql` for Java 21

### What changes were proposed in this pull request?
This pr aims to Re-generate golden files of `postgreSQL/float4.sql` and `postgreSQL/int8.sql` for Java 21. #50604 forgot to generate them.

### Why are the changes needed?
Restore Java 21 daily test:
- master: https://github.com/apache/spark/actions/runs/14699959163/job/41247643789
- branch-4.0: https://github.com/apache/spark/actions/runs/14700610338/job/41249373892

![image](https://github.com/user-attachments/assets/4bfe3b14-d5a8-4428-928b-8a2e94287bb0)

![image](https://github.com/user-attachments/assets/ab725b03-2da6-4460-8cc7-759806965fbd)

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

### How was this patch tested?
- Pass Github Actions
- locally test with Java 21

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

Closes #50740 from LuciferYang/SPARK-51817-FOLLOWUP.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
(cherry picked from commit 6c37ee4)
Signed-off-by: yangjie01 <[email protected]>
Kimahriman pushed a commit to Kimahriman/spark that referenced this pull request May 13, 2025
… messageParameters of CAST_INVALID_INPUT and CAST_OVERFLOW

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

In Spark Connect, we guarantee that older clients are compatible with newer
versions of the Spark Connect service.

A previous change - e28c33b - broke this compatibility by removing the
"ansiConfig" field in the message parameters for two error codes -
"CAST_OVERFLOW" and "CAST_INVALID_INPUT".

The Spark Connect client includes GrpcExceptionConverter.scala\[1] to
convert error codes from the server to produce SQL compliant error codes
on the client. The SQL compliant error codes and corresponding error
messages are included in the error-conditions.json file. Older clients do not
include the change (e28c33b) to this file and still include the `ansiConfig`
parameter. Later versions of the Spark Connect service don't return this
parameter resulting in an internal error\[2] that the correct error condition
could not be formulated.

This change reverts the changes on the server to continue producing the
"ansiConfig" field so older clients can still correctly reformulate the error class.

\[1]: https://github.com/apache/spark/blob/2ba156096e83adf7b0b2f5c38453d6fd37d95ded/sql/connect/common/src/main/scala/org/apache/spark/sql/connect/client/GrpcExceptionConverter.scala#L184
\[2]: https://github.com/apache/spark/blob/2ba156096e83adf7b0b2f5c38453d6fd37d95ded/common/utils/src/main/scala/org/apache/spark/ErrorClassesJSONReader.scala#L58

### Why are the changes needed?

Explained above.

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

No.

### How was this patch tested?

Manual tests.

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

No.

Closes apache#50604 from nija-at/cast-invalid-input.

Authored-by: Niranjan Jayakar <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
Kimahriman pushed a commit to Kimahriman/spark that referenced this pull request May 13, 2025
…at4.sql` and `postgreSQL/int8.sql` for Java 21

### What changes were proposed in this pull request?
This pr aims to Re-generate golden files of `postgreSQL/float4.sql` and `postgreSQL/int8.sql` for Java 21. apache#50604 forgot to generate them.

### Why are the changes needed?
Restore Java 21 daily test:
- master: https://github.com/apache/spark/actions/runs/14699959163/job/41247643789
- branch-4.0: https://github.com/apache/spark/actions/runs/14700610338/job/41249373892

![image](https://github.com/user-attachments/assets/4bfe3b14-d5a8-4428-928b-8a2e94287bb0)

![image](https://github.com/user-attachments/assets/ab725b03-2da6-4460-8cc7-759806965fbd)

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

### How was this patch tested?
- Pass Github Actions
- locally test with Java 21

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

Closes apache#50740 from LuciferYang/SPARK-51817-FOLLOWUP.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants