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-48169][SQL] Use lazy BadRecordException cause in all parsers and remove the old constructor, which was meant for the migration #46438

Closed
wants to merge 2 commits into from
Closed

[SPARK-48169][SQL] Use lazy BadRecordException cause in all parsers and remove the old constructor, which was meant for the migration #46438

wants to merge 2 commits into from

Conversation

vladimirg-db
Copy link
Contributor

@vladimirg-db vladimirg-db commented May 7, 2024

What changes were proposed in this pull request?

Use factory function for the exception cause in BadRecordException to avoid constructing heavy exceptions in the underlying parser. Now they are constructed on-demand in FailureSafeParser. A follow-up for #46400

Why are the changes needed?

  • Speed-up JacksonParser and StaxXmlParser, since they throw user-facing exceptions to FailureSafeParser
  • Refactoring - leave only one constructor in BadRecordException

Does this PR introduce any user-facing change?

No

How was this patch tested?

  • testOnly org.apache.spark.sql.catalyst.json.JacksonParserSuite
  • testOnly org.apache.spark.sql.catalyst.csv.UnivocityParserSuite

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

No

…onstructor, which was meant for the migration
@github-actions github-actions bot added the SQL label May 7, 2024
@vladimirg-db vladimirg-db marked this pull request as ready for review May 7, 2024 12:47
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM.

@dongjoon-hyun
Copy link
Member

Merged to master for Apache Spark 4.0.0-preview.

@vladimirg-db vladimirg-db deleted the vladimirg-db/use-lazy-exception-cause-in-all-bad-record-exception-invocations branch May 8, 2024 17:14
cloud-fan pushed a commit that referenced this pull request May 9, 2024
### What changes were proposed in this pull request?
Revert BadRecordException optimizations for UnivocityParser, StaxXmlParser and JacksonParser

### Why are the changes needed?
To reduce the blast radius - this will be implemented differently. There were two PRs by me recently:
- #46438
- #46400

which introduced optimizations to speed-up control flow between UnivocityParser, StaxXmlParser and JacksonParser. However, these changes are quite unstable and may break any calling code, which relies on exception cause type, for example. Also, there may be some Spark plugins/extensions using that exception for user-facing errors

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

### How was this patch tested?
N/A

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

Closes #46478 from vladimirg-db/vladimirg-db/revert-SPARK-48169-SPARK-48143.

Authored-by: Vladimir Golubev <vladimir.golubev@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
JacobZheng0927 pushed a commit to JacobZheng0927/spark that referenced this pull request May 11, 2024
…nd remove the old constructor, which was meant for the migration

### What changes were proposed in this pull request?
Use factory function for the exception cause in `BadRecordException` to avoid constructing heavy exceptions in the underlying parser. Now they are constructed on-demand in `FailureSafeParser`. A follow-up for apache#46400

### Why are the changes needed?
- Speed-up `JacksonParser` and `StaxXmlParser`, since they throw user-facing exceptions to `FailureSafeParser`
- Refactoring - leave only one constructor in `BadRecordException`

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

### How was this patch tested?
- `testOnly org.apache.spark.sql.catalyst.json.JacksonParserSuite`
- `testOnly org.apache.spark.sql.catalyst.csv.UnivocityParserSuite`

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

Closes apache#46438 from vladimirg-db/vladimirg-db/use-lazy-exception-cause-in-all-bad-record-exception-invocations.

Authored-by: Vladimir Golubev <vladimir.golubev@databricks.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
JacobZheng0927 pushed a commit to JacobZheng0927/spark that referenced this pull request May 11, 2024
### What changes were proposed in this pull request?
Revert BadRecordException optimizations for UnivocityParser, StaxXmlParser and JacksonParser

### Why are the changes needed?
To reduce the blast radius - this will be implemented differently. There were two PRs by me recently:
- apache#46438
- apache#46400

which introduced optimizations to speed-up control flow between UnivocityParser, StaxXmlParser and JacksonParser. However, these changes are quite unstable and may break any calling code, which relies on exception cause type, for example. Also, there may be some Spark plugins/extensions using that exception for user-facing errors

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

### How was this patch tested?
N/A

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

Closes apache#46478 from vladimirg-db/vladimirg-db/revert-SPARK-48169-SPARK-48143.

Authored-by: Vladimir Golubev <vladimir.golubev@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.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.

3 participants