younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL]
Accept "true", "yes", "1", "false", "no", "0", and unique prefixes as input and
trim input for the boolean data type.
URL: https://github.com/apache/spark/pull/25458#discussion_r318569316
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -819,19 +819,32 @@ class CastSuite extends SparkFunSuite with
ExpressionEvalHelper {
}
test("cast string to boolean") {
- checkCast("t", true)
+
checkCast("true", true)
+ checkCast("tru", true)
+ checkCast("tr", true)
+ checkCast("t", true)
checkCast("tRUe", true)
- checkCast("y", true)
+ checkCast(" tRue ", true)
+ checkCast(" tRu ", true)
checkCast("yes", true)
+ checkCast("ye", true)
+ checkCast("y", true)
checkCast("1", true)
+ checkCast("on", true)
- checkCast("f", false)
checkCast("false", false)
- checkCast("FAlsE", false)
- checkCast("n", false)
+ checkCast("fals", false)
+ checkCast("fal", false)
+ checkCast("fa", false)
+ checkCast("f", false)
+ checkCast(" fAlse ", false)
+ checkCast(" fAls ", false)
checkCast("no", false)
+ checkCast("n", false)
checkCast("0", false)
+ checkCast("off", false)
+ checkCast("of", false)
Review comment:
@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?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]