Skip to content
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

[SPARK-38464][CORE] Use error classes in org.apache.spark.io #41277

Closed
wants to merge 3 commits into from

Conversation

bozhang2820
Copy link
Contributor

@bozhang2820 bozhang2820 commented May 23, 2023

What changes were proposed in this pull request?

This PR aims to change exceptions created in package org.apache.spark.io to use error class.

This PR also adds toConf and toConfVal in SparkCoreErrors.

Why are the changes needed?

This is to move exceptions created in package org.apache.spark.io to error class.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Updated existing tests.

@github-actions github-actions bot added the CORE label May 23, 2023
errorClass = "CODEC_NOT_AVAILABLE",
messageParameters = Map(
"codecName" -> codecName,
"configKey" -> configKey,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, wrap it by toSQLConf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. Should we move these to spark-core? Or have them duplicated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry. Let's define in core at leats quoteByDefault(), toConf, and toConfVal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

messageParameters = Map(
"codecName" -> codecName,
"configKey" -> configKey,
"configVal" -> FALLBACK_COMPRESSION_CODEC)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you wrap it by toSQLConfVal

core/src/main/resources/error/error-classes.json Outdated Show resolved Hide resolved
core/src/main/resources/error/error-classes.json Outdated Show resolved Hide resolved
codec.getOrElse(throw new SparkIllegalArgumentException(
errorClass = "CODEC_NOT_AVAILABLE",
messageParameters = Map(
"codecName" -> codecName,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, wrap it, for instance by toSQLValue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toSQLValue is defined in spark-sql, we cannot use it directly here in spark-core.

@MaxGekk
Copy link
Member

MaxGekk commented May 24, 2023

+1, LGTM. Merging to master.
Thank you, @bozhang2820.

@MaxGekk MaxGekk closed this in 76f82bd May 24, 2023
@bozhang2820 bozhang2820 deleted the spark-38464 branch May 24, 2023 11:31
czxm pushed a commit to czxm/spark that referenced this pull request Jun 12, 2023
### What changes were proposed in this pull request?
This PR aims to change exceptions created in package org.apache.spark.io to use error class.

This PR also adds `toConf` and `toConfVal` in `SparkCoreErrors`.

### Why are the changes needed?
This is to move exceptions created in package org.apache.spark.io to error class.

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

### How was this patch tested?
Updated existing tests.

Closes apache#41277 from bozhang2820/spark-38464.

Authored-by: Bo Zhang <bo.zhang@databricks.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
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.

2 participants