Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ExprRewriter in pre_cast_lit_in_comparison #3260

Merged
merged 2 commits into from
Aug 25, 2022

Conversation

andygrove
Copy link
Member

Which issue does this PR close?

Closes #3259

Rationale for this change

This change makes the optimizer support nested expressions, including aliased expressions.

What changes are included in this PR?

Use ExprRewriter.

Are there any user-facing changes?

More optimizations!

@andygrove andygrove requested a review from liukun4515 August 25, 2022 14:17
@liukun4515
Copy link
Contributor

nice pr.
I am ready to do this refactor using the trait ExprRewriter, you got ahead.

Copy link
Contributor

@liukun4515 liukun4515 left a comment

Choose a reason for hiding this comment

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

LGTM thanks @andygrove

@@ -318,6 +317,20 @@ mod tests {
assert_eq!(optimize_test(expr_lt, &schema), expected);
}

#[test]
fn nested() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this test require this pr to pass?
I think the original logic can handle this case

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this is just an additional test to make sure that this PR did not cause any regressions.

@codecov-commenter
Copy link

Codecov Report

Merging #3260 (01fac56) into master (92110dd) will increase coverage by 0.00%.
The diff coverage is 86.53%.

❗ Current head 01fac56 differs from pull request most recent head 6e0f926. Consider uploading reports for the commit 6e0f926 to get more accurate results

@@           Coverage Diff           @@
##           master    #3260   +/-   ##
=======================================
  Coverage   85.89%   85.89%           
=======================================
  Files         294      294           
  Lines       53373    53391   +18     
=======================================
+ Hits        45845    45861   +16     
- Misses       7528     7530    +2     
Impacted Files Coverage Δ
...fusion/optimizer/src/pre_cast_lit_in_comparison.rs 85.60% <86.53%> (+2.27%) ⬆️
datafusion/expr/src/logical_plan/plan.rs 78.55% <0.00%> (-0.18%) ⬇️
datafusion/common/src/scalar.rs 84.58% <0.00%> (-0.07%) ⬇️

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

@andygrove
Copy link
Member Author

Thanks for the review @liukun4515

@andygrove andygrove merged commit 5ee52d0 into apache:master Aug 25, 2022
@andygrove andygrove deleted the pre-cast-lit-recursion branch August 25, 2022 17:24
@ursabot
Copy link

ursabot commented Aug 25, 2022

Benchmark runs are scheduled for baseline = 92110dd and contender = 5ee52d0. 5ee52d0 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.

PreCastLitInComparisonExpressions should use ExprRewriter and supported nested expressions
4 participants