-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-27931][SQL] Accept "true", "yes", "1", "false", "no", "0", and unique prefixes as input and trim input for the boolean data type. #25458
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
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7d61642
[SPARK-27931][SQL] Accept 'on' and 'off' as input and trim input for …
933fe86
[SPARK-27931][SQL] Unique prefixes of strings are also accepted for t…
a5aec9f
Trim string whitespace so it should be true
9e9aac3
Generated spark golden files.
dacd46b
add a comment: "true", "yes", "1", "false", "no", "0", and unique pre…
abe9a84
[SPARK-27931][SQL] add a "FAlse" test case and remove the redundant s…
2ea551c
[SPARK-27931][SQL] add a negative test case for "o"
b787483
removed "[SPARK-27931] Trim the string when cast string type to boole…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[SPARK-27931][SQL] add a negative test case for "o"
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -846,6 +846,7 @@ class CastSuite extends SparkFunSuite with ExpressionEvalHelper { | |
| checkCast("off", false) | ||
| checkCast("of", false) | ||
|
|
||
| checkEvaluation(cast("o", BooleanType), null) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dongjoon-hyun |
||
| checkEvaluation(cast("abc", BooleanType), null) | ||
| checkEvaluation(cast("", BooleanType), null) | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@younggyuchun, just for doubly sure, did you double check the behaviours against PostgreSQL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HyukjinKwon Here it is:

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not documented: https://www.postgresql.org/docs/devel/datatype-boolean.html
Postgres may support
offor history reasons, I don't think we have to follow it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cloud-fan @dongjoon-hyun @HyukjinKwon
This build accepts several unique prefixes for the boolean data type. For example, tru, tr, ye, fals, fal, fa and of, which are not documented. Do we want to not to accept these prefixes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cloud-fan . It's a documented feature in that document. We had better support it.
cc @gatorsmile
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, @younggyuchun . Please add a negative test case.
ois not supported because it's not unique. It's a common prefix foronandoff.It should be
null.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems okay to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM