[GitHub] [spark] younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] Accept 'on' and 'off' as input and trim input for the boolean data type.

2019-08-23 Thread GitBox
younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] 
Accept 'on' and 'off' as input and trim input for the boolean data type.
URL: https://github.com/apache/spark/pull/25458#discussion_r317167296
 
 

 ##
 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:
   @HyukjinKwon Here it is:
   
![image](https://user-images.githubusercontent.com/1910477/63601427-62cd5900-c593-11e9-93bc-9a93c8a187d3.png)
   


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



[GitHub] [spark] younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] Accept 'on' and 'off' as input and trim input for the boolean data type.

2019-08-16 Thread GitBox
younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] 
Accept 'on' and 'off' as input and trim input for the boolean data type.
URL: https://github.com/apache/spark/pull/25458#discussion_r314820823
 
 

 ##
 File path: sql/core/src/test/resources/sql-tests/inputs/pgSQL/boolean.sql
 ##
 @@ -23,7 +23,7 @@ SELECT false AS `false`;
 SELECT boolean('t') AS true;
 
 -- [SPARK-27931] Trim the string when cast string type to boolean type
-SELECT boolean('   f   ') AS `false`;
+SELECT boolean('   f   ') AS `true`;
 
 Review comment:
   Let me dig into this.


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



[GitHub] [spark] younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] Accept 'on' and 'off' as input and trim input for the boolean data type.

2019-08-16 Thread GitBox
younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] 
Accept 'on' and 'off' as input and trim input for the boolean data type.
URL: https://github.com/apache/spark/pull/25458#discussion_r314716565
 
 

 ##
 File path: sql/core/src/test/resources/sql-tests/inputs/pgSQL/boolean.sql
 ##
 @@ -23,7 +23,7 @@ SELECT false AS `false`;
 SELECT boolean('t') AS true;
 
 -- [SPARK-27931] Trim the string when cast string type to boolean type
-SELECT boolean('   f   ') AS `false`;
+SELECT boolean('   f   ') AS `true`;
 
 Review comment:
   @wangyum I think it should be 'true'. Is it correct?


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



[GitHub] [spark] younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] Accept 'on' and 'off' as input and trim input for the boolean data type.

2019-08-14 Thread GitBox
younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] 
Accept 'on' and 'off' as input and trim input for the boolean data type.
URL: https://github.com/apache/spark/pull/25458#discussion_r314179583
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
 ##
 @@ -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)
 
 Review comment:
   Ah okay. Let me add that too. Thank you


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



[GitHub] [spark] younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] Accept 'on' and 'off' as input and trim input for the boolean data type.

2019-08-14 Thread GitBox
younggyuchun commented on a change in pull request #25458: [SPARK-27931][SQL] 
Accept 'on' and 'off' as input and trim input for the boolean data type.
URL: https://github.com/apache/spark/pull/25458#discussion_r314174879
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
 ##
 @@ -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)
 
 Review comment:
   Yes I guess so. Do you know other common string representattion used in 
other databases?


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