-
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
Changes from 1 commit
7d61642
933fe86
a5aec9f
9e9aac3
dacd46b
abe9a84
2ea551c
b787483
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,12 +65,15 @@ object StringUtils extends Logging { | |
| "(?s)" + out.result() // (?s) enables dotall mode, causing "." to match new lines | ||
| } | ||
|
|
||
| private[this] val trueStrings = Set("t", "true", "y", "yes", "1").map(UTF8String.fromString) | ||
| private[this] val falseStrings = Set("f", "false", "n", "no", "0").map(UTF8String.fromString) | ||
| private[this] val trueStrings = | ||
| Set("t", "true", "y", "yes", "1", "on").map(UTF8String.fromString) | ||
|
|
||
| private[this] val falseStrings = | ||
| Set("f", "false", "n", "no", "0", "off").map(UTF8String.fromString) | ||
|
||
|
|
||
| // scalastyle:off caselocale | ||
| def isTrueString(s: UTF8String): Boolean = trueStrings.contains(s.toLowerCase) | ||
| def isFalseString(s: UTF8String): Boolean = falseStrings.contains(s.toLowerCase) | ||
| def isTrueString(s: UTF8String): Boolean = trueStrings.contains(s.toLowerCase.trim()) | ||
| def isFalseString(s: UTF8String): Boolean = falseStrings.contains(s.toLowerCase.trim()) | ||
| // scalastyle:on caselocale | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.