[GitHub] spark pull request #18854: [SPARK-21629][SQL][WIP] Fix Or nullability
GitHub user goldmedal opened a pull request: https://github.com/apache/spark/pull/18854 [SPARK-21629][SQL][WIP] Fix Or nullability ## What changes were proposed in this pull request? Override nullable of Or Expression to make sure nullable behavior is correct. ## How was this patch tested? I'll add test case later cc @viirya You can merge this pull request into a Git repository by running: $ git pull https://github.com/goldmedal/spark master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/18854.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #18854 commit be711d003f2831c1ab4b69fc2a119aefbba08743 Author: goldmedal Date: 2017-08-05T14:44:04Z Fix Or nullability --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #18854: [SPARK-21629][SQL][WIP] Fix Or nullability
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/18854#discussion_r131526168 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala --- @@ -396,6 +396,8 @@ case class Or(left: Expression, right: Expression) extends BinaryOperator with P override def sqlOperator: String = "OR" + override def nullable: Boolean = left.nullable && right.nullable --- End diff -- Based on the semantics of ANSI SQL, the current solution is right. ```SQL NULL OR True => True NULL OR False => NULL NULL OR NULL => NULL ``` If you also agree on it, could you close it? Thanks! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #18854: [SPARK-21629][SQL][WIP] Fix Or nullability
Github user hvanhovell commented on a diff in the pull request: https://github.com/apache/spark/pull/18854#discussion_r131530967 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala --- @@ -396,6 +396,8 @@ case class Or(left: Expression, right: Expression) extends BinaryOperator with P override def sqlOperator: String = "OR" + override def nullable: Boolean = left.nullable && right.nullable --- End diff -- Yeah that is fair point. I misread the code when I was going over it. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #18854: [SPARK-21629][SQL][WIP] Fix Or nullability
Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/18854#discussion_r131531690 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala --- @@ -396,6 +396,8 @@ case class Or(left: Expression, right: Expression) extends BinaryOperator with P override def sqlOperator: String = "OR" + override def nullable: Boolean = left.nullable && right.nullable --- End diff -- Oh, right. Yeah, I agree. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #18854: [SPARK-21629][SQL][WIP] Fix Or nullability
Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/18854#discussion_r131531879 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala --- @@ -396,6 +396,8 @@ case class Or(left: Expression, right: Expression) extends BinaryOperator with P override def sqlOperator: String = "OR" + override def nullable: Boolean = left.nullable && right.nullable --- End diff -- Actually the current `def nullable: Boolean = left.nullable || right.nullable` for `Or` is not very accurate too. At least when any of left/right is true, its `nullable` should be false. Although we can't know if any of left/right is true under most of cases, but if they are foldable, then we can know that. @gatorsmile @hvanhovell What do you think? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #18854: [SPARK-21629][SQL][WIP] Fix Or nullability
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/18854#discussion_r131532024 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala --- @@ -396,6 +396,8 @@ case class Or(left: Expression, right: Expression) extends BinaryOperator with P override def sqlOperator: String = "OR" + override def nullable: Boolean = left.nullable && right.nullable --- End diff -- uh... I did not read the original JIRA. For foldable expressions, we will eventually evaluate them in the Optimizer. Maybe, here, we do not need to introduce the extra complexity. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #18854: [SPARK-21629][SQL][WIP] Fix Or nullability
Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/18854#discussion_r131532208 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala --- @@ -396,6 +396,8 @@ case class Or(left: Expression, right: Expression) extends BinaryOperator with P override def sqlOperator: String = "OR" + override def nullable: Boolean = left.nullable && right.nullable --- End diff -- Yeah, I forgot it. `BooleanSimplification` will do this. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #18854: [SPARK-21629][SQL][WIP] Fix Or nullability
Github user goldmedal closed the pull request at: https://github.com/apache/spark/pull/18854 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org