cloud-fan 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_r318389066
 
 

 ##########
 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:
   This is not documented: 
https://www.postgresql.org/docs/devel/datatype-boolean.html
   
   Postgres may support `of` for history reasons, I don't think we have to 
follow it.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to