Skip to content

Simplify null division.#3625

Merged
alamb merged 2 commits intoapache:masterfrom
HaoYang670:3624_fix_divide_null_simplification
Sep 30, 2022
Merged

Simplify null division.#3625
alamb merged 2 commits intoapache:masterfrom
HaoYang670:3624_fix_divide_null_simplification

Conversation

@HaoYang670
Copy link
Copy Markdown
Contributor

Signed-off-by: remzi 13716567376yh@gmail.com

Which issue does this PR close?

Closes #3624.

Rationale for this change

What changes are included in this PR?

Simplify A / null and null / A to null.
Add tests.

Are there any user-facing changes?

Signed-off-by: remzi <13716567376yh@gmail.com>
@github-actions github-actions Bot added the optimizer Optimizer rules label Sep 27, 2022
@HaoYang670 HaoYang670 changed the title Fix the simplification of division null. Fix the simplification of null division. Sep 27, 2022
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #3625 (d39703e) into master (ea3dbb6) will decrease coverage by 0.08%.
The diff coverage is 58.33%.

@@            Coverage Diff             @@
##           master    #3625      +/-   ##
==========================================
- Coverage   86.07%   85.99%   -0.09%     
==========================================
  Files         300      300              
  Lines       56337    56457     +120     
==========================================
+ Hits        48494    48552      +58     
- Misses       7843     7905      +62     
Impacted Files Coverage Δ
datafusion/optimizer/src/simplify_expressions.rs 82.56% <58.33%> (-0.12%) ⬇️
datafusion/physical-expr/src/regex_expressions.rs 64.38% <0.00%> (-18.66%) ⬇️
datafusion/expr/src/window_frame.rs 92.43% <0.00%> (-0.85%) ⬇️
datafusion/physical-expr/src/functions.rs 92.66% <0.00%> (-0.10%) ⬇️
datafusion/common/src/scalar.rs 85.31% <0.00%> (+0.06%) ⬆️
datafusion/expr/src/logical_plan/plan.rs 77.42% <0.00%> (+0.16%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@alamb alamb changed the title Fix the simplification of null division. Simplify null division. Sep 28, 2022
Copy link
Copy Markdown
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.

Thanks @HaoYang670 -- I think the comments may be mixed up but otherwise 👍

op: Divide,
right,
} if left == right && is_null(&left) => *left,
} if is_null(&right) => *right,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't this checking for A / null (not null / A as the comments suggest)?
(as in I think the comments are backwards)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for catching this, I will update.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: remzi <13716567376yh@gmail.com>
@alamb alamb merged commit 6d2b417 into apache:master Sep 30, 2022
@ursabot
Copy link
Copy Markdown

ursabot commented Sep 30, 2022

Benchmark runs are scheduled for baseline = a1b2112 and contender = 6d2b417. 6d2b417 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

optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The expression col(a) / null is not optimized.

4 participants