Skip to content

Conversation

@Ted-Jiang
Copy link
Member

Signed-off-by: yangjiang yangjiang@ebay.com

Which issue does this PR close?

Closes #4241.

Rationale for this change

in spark:

spark-sql> select null or true;
true
Time taken: 0.65 seconds, Fetched 1 row(s)
spark-sql> select null or false;
NULL
Time taken: 0.076 seconds, Fetched 1 row(s)

in pg:

postgres=# select true or NULL test;
 test
------
 t
(1 row)

postgres=# select false or NULL test;
 test
------

(1 row)

After this change in datafusion

❯ select NULL or false;
+------------------------+
| NULL OR Boolean(false) |
+------------------------+
|                        |
+------------------------+
1 row in set. Query took 0.067 seconds.
❯ select NULL or true;
+-----------------------+
| NULL OR Boolean(true) |
+-----------------------+
| true                  |
+-----------------------+
1 row in set. Query took 0.003 seconds.

Also test with AND

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

Signed-off-by: yangjiang <yangjiang@ebay.com>
@github-actions github-actions bot added the logical-expr Logical plan and expressions label Nov 16, 2022
@Ted-Jiang Ted-Jiang requested a review from alamb November 16, 2022 13:26
Signed-off-by: yangjiang <yangjiang@ebay.com>
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Ted-Jiang

// logical binary boolean operators can only be evaluated in bools
// logical binary boolean operators can only be evaluated in bools or nulls
(DataType::Boolean, DataType::Boolean) => Some(DataType::Boolean),
(DataType::Null, DataType::Null) => Some(DataType::Null),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alamb alamb merged commit b935cff into apache:master Nov 16, 2022
@ursabot
Copy link

ursabot commented Nov 16, 2022

Benchmark runs are scheduled for baseline = 905935c and contender = b935cff. b935cff is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-expr Logical plan and expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support binary boolean operators with nulls

5 participants