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

Update signature for Expr.name so that schema is no longer required #3336

Merged
merged 3 commits into from
Sep 2, 2022

Conversation

andygrove
Copy link
Member

@andygrove andygrove commented Sep 1, 2022

Which issue does this PR close?

Part of #3330

Rationale for this change

The schema argument to Expr.name was not used and not needed.

What changes are included in this PR?

  • Remove schema argument from Expr.name
  • Remove some code duplication between Display and Debug traits

Are there any user-facing changes?

Yes, API change.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@andygrove andygrove added the api change Changes the API exposed to users of the crate label Sep 1, 2022
@github-actions github-actions bot added logical-expr Logical plan and expressions optimizer Optimizer rules labels Sep 1, 2022
use datafusion_common::{Result, ScalarValue};

#[test]
fn format_case_when() -> Result<()> {
Copy link
Member Author

Choose a reason for hiding this comment

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

I added this test just to demonstrate the difference between Expr Display, Debug, and name(). I plan on adding more tests in future PRs to cover other expressions.

@codecov-commenter
Copy link

Codecov Report

Merging #3336 (425996d) into master (3d37016) will increase coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3336      +/-   ##
==========================================
+ Coverage   85.74%   85.82%   +0.08%     
==========================================
  Files         294      294              
  Lines       53770    53745      -25     
==========================================
+ Hits        46104    46127      +23     
+ Misses       7666     7618      -48     
Impacted Files Coverage Δ
datafusion/core/tests/sql/timestamp.rs 99.65% <ø> (-0.01%) ⬇️
datafusion/expr/src/expr.rs 87.50% <100.00%> (+9.52%) ⬆️
datafusion/expr/src/expr_schema.rs 63.58% <100.00%> (ø)
datafusion/expr/src/logical_plan/builder.rs 90.35% <100.00%> (ø)
datafusion/expr/src/utils.rs 90.74% <100.00%> (ø)
...tafusion/optimizer/src/common_subexpr_eliminate.rs 94.24% <100.00%> (+1.38%) ⬆️
datafusion/optimizer/src/filter_push_down.rs 98.36% <100.00%> (ø)
datafusion/optimizer/src/projection_push_down.rs 98.06% <100.00%> (ø)
datafusion/optimizer/src/simplify_expressions.rs 83.52% <100.00%> (ø)
...fusion/optimizer/src/single_distinct_to_groupby.rs 98.22% <100.00%> (ø)
... and 7 more

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

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.

Looks like a great improvement to me. Thanks @andygrove

use datafusion_common::{Result, ScalarValue};

#[test]
fn format_case_when() -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

_ => {
// we should not be trying to create a name for the expression
// based on the input schema but this is the current behavior
// see https://github.com/apache/arrow-datafusion/issues/2456
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like #2456 could be closed too, perhaps

@ursabot
Copy link

ursabot commented Sep 2, 2022

Benchmark runs are scheduled for baseline = 3956fc2 and contender = dadd2dc. dadd2dc 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

@andygrove andygrove deleted the expr-name-no-schema branch September 2, 2022 12:52
kmitchener pushed a commit to kmitchener/arrow-datafusion that referenced this pull request Sep 4, 2022
…pache#3336)

* Update signature for Expr.name so that schema is no longer required

* remove some duplicate code

* clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate logical-expr Logical plan and expressions optimizer Optimizer rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants