Skip to content

Review use of panic in datafusion-proto crate - #3365

Merged
alamb merged 10 commits into
apache:masterfrom
comphead:proto-no-panic
Sep 8, 2022
Merged

alamb merged 10 commits into
apache:masterfrom
comphead:proto-no-panic

Conversation

@comphead

@comphead comphead commented Sep 5, 2022

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #3318.

Rationale for this change

Refactor to get rid of explicit panics

What changes are included in this PR?

Are there any user-facing changes?

@comphead comphead changed the title Proto no panic Review use of panic in datafusion-proto crate Sep 5, 2022
@codecov-commenter

codecov-commenter commented Sep 5, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #3365 (625fcf0) into master (4c948a3) will increase coverage by 0.00%.
The diff coverage is 51.16%.

@@           Coverage Diff            @@
##           master    #3365    +/-   ##
========================================
  Coverage   85.51%   85.51%            
========================================
  Files         294      296     +2     
  Lines       54120    54300   +180     
========================================
+ Hits        46279    46433   +154     
- Misses       7841     7867    +26     
Impacted Files Coverage Δ
datafusion/proto/src/bytes/mod.rs 82.75% <ø> (ø)
datafusion/proto/src/from_proto.rs 34.26% <ø> (ø)
datafusion/proto/src/logical_plan.rs 17.46% <0.00%> (-0.35%) ⬇️
datafusion/proto/src/to_proto.rs 48.25% <53.65%> (-0.64%) ⬇️
datafusion/expr/src/udaf.rs 37.50% <0.00%> (-12.50%) ⬇️
...ion/physical-expr/src/aggregate/approx_distinct.rs 50.00% <0.00%> (-9.53%) ⬇️
benchmarks/src/bin/tpch.rs 37.59% <0.00%> (-3.56%) ⬇️
datafusion/physical-expr/src/planner.rs 94.19% <0.00%> (-1.86%) ⬇️
datafusion/expr/src/logical_plan/display.rs 90.12% <0.00%> (-1.02%) ⬇️
datafusion/expr/src/binary_rule.rs 84.50% <0.00%> (-0.48%) ⬇️
... and 44 more

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

@alamb

alamb commented Sep 6, 2022

Copy link
Copy Markdown
Contributor

Looks like there is a CI error on this PR.

Comment thread datafusion/proto/src/logical_plan.rs Resolved
}),
DataType::Decimal256(_, _) => {
unimplemented!("The Decimal256 data type is not yet supported")
unimplemented!("Proto serialization error: The Decimal256 data type is not yet supported")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we used impl TryFrom instead of impl From, we could return errors here. This could be done as a separate Pr.

@comphead comphead Sep 8, 2022 •

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.

Created #3401

Comment thread datafusion/proto/src/to_proto.rs Resolved
@andygrove

Copy link
Copy Markdown
Member

Thanks @comphead. This is looking good. I left some comments.

@comphead
comphead marked this pull request as draft September 7, 2022 00:01
@comphead

comphead commented Sep 7, 2022

Copy link
Copy Markdown
Contributor Author

@andygrove @alamb I dont get why cargo check keeps failing.... even on master branch.

@alamb

alamb commented Sep 7, 2022

Copy link
Copy Markdown
Contributor

@andygrove @alamb I dont get why cargo check keeps failing.... even on master branch.

I think the reason that https://github.com/apache/arrow-datafusion/runs/8218776681?check_suite_focus=true is failing is that there is some issue in code that is not normally run via cargo test.

In this case, the command that is failing is:

cargo check --workspace --benches --features avro,jit,scheduler,json

Does that fail locally for you?

@comphead

comphead commented Sep 7, 2022

Copy link
Copy Markdown
Contributor Author

Thanks @alamb
cargo test works fine locally. but cargo check --workspace --benches --features json does not even switching to main branch. Like some local cache exists. I'll try to get the repo clean copy

@comphead
comphead marked this pull request as ready for review September 7, 2022 21:39
@comphead

comphead commented Sep 7, 2022

Copy link
Copy Markdown
Contributor Author

Sorry guys, I probably generated more commits than expected, the reason being is cargo check gives me not the same results as CI, even after cleaning the cache

@andygrove andygrove left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks @comphead

@andygrove

Copy link
Copy Markdown
Member

@avantgardnerio I know you fixed a json proto build issue recently. Could you take a look at this PR to make sure you are happy with it?

@avantgardnerio avantgardnerio left a comment

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.

I added a few minor nits, but overall I think this is a definite improvement - thank you for putting in this work!

Comment thread datafusion/proto/src/from_proto.rs Resolved
Comment thread datafusion/proto/src/logical_plan.rs Resolved
Comment thread datafusion/proto/build.rs

let out = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
let out = std::path::PathBuf::from(
std::env::var("OUT_DIR").expect("Cannot find OUT_DIR environment vairable"),

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.

expect seems semi-reasonable in tests or build.rs

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.

Imho expect here gives more user friendly message than .unwrap with very generic text

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.

expect is a definite improvement to unwrap in my opinion too

@comphead

comphead commented Sep 8, 2022

Copy link
Copy Markdown
Contributor Author

Thanks @avantgardnerio for the review, please find the fixed PR

@alamb alamb left a comment

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.

LGTM -- thanks @avantgardnerio and @comphead !

@alamb
alamb merged commit 1b40ffa into apache:master Sep 8, 2022
@ursabot

ursabot commented Sep 8, 2022

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = 4258751 and contender = 1b40ffa. 1b40ffa 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review use of panic in datafusion-proto crate

6 participants