Skip to content

Conversation

@LuciferYang
Copy link
Contributor

@LuciferYang LuciferYang commented Nov 21, 2022

What changes were proposed in this pull request?

This pr overrides the checkInputDataTypes() method of ToBinary function to propagate error class to users for invalid format.

Why are the changes needed?

Migration onto error classes unifies Spark SQL error messages.

Does this PR introduce any user-facing change?

Yes. The PR changes user-facing error messages.

How was this patch tested?

Pass GitHub Actions

@LuciferYang LuciferYang changed the title [SPARK-41174][SQL] Propagate an error class to users for invalid format of to_binary() [SPARK-41174][CORE][SQL] Propagate an error class to users for invalid format of to_binary() Nov 21, 2022
@LuciferYang
Copy link
Contributor Author

cc @MaxGekk

@LuciferYang
Copy link
Contributor Author

@MaxGekk rebased

}
} else if (!f.foldable) {
DataTypeMismatch(
errorSubClass = "NON_FOLDABLE_INPUT",
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 write a test for the case, please. I just wonder how it could happen:

if (f.foldable && ...) {
...
  } else if (!f.foldable) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For !f.foldable branch?

Copy link
Member

Choose a reason for hiding this comment

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

Yep. Just to be sure we handle the non-foldable case correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

36e1bda add two new case

GenerateUnsafeProjection.generate(StringDecode(b, Literal("\"quote")) :: Nil)
}


Copy link
Member

Choose a reason for hiding this comment

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

it is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

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

LGTM except of a minor comment.

@MaxGekk
Copy link
Member

MaxGekk commented Nov 23, 2022

+1, LGTM. Merging to master.
Thank you, @LuciferYang and @srielau for review.

@MaxGekk MaxGekk closed this in c3f8c97 Nov 23, 2022
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 15, 2022
…d `format` of `to_binary()`

### What changes were proposed in this pull request?
This pr overrides the `checkInputDataTypes()` method of `ToBinary` function to propagate error class to users for invalid `format`.

### Why are the changes needed?
Migration onto error classes unifies Spark SQL error messages.

### Does this PR introduce _any_ user-facing change?
Yes. The PR changes user-facing error messages.

### How was this patch tested?
Pass GitHub Actions

Closes apache#38737 from LuciferYang/SPARK-41174.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
…d `format` of `to_binary()`

### What changes were proposed in this pull request?
This pr overrides the `checkInputDataTypes()` method of `ToBinary` function to propagate error class to users for invalid `format`.

### Why are the changes needed?
Migration onto error classes unifies Spark SQL error messages.

### Does this PR introduce _any_ user-facing change?
Yes. The PR changes user-facing error messages.

### How was this patch tested?
Pass GitHub Actions

Closes apache#38737 from LuciferYang/SPARK-41174.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants