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

Review use of panic in datafusion-proto crate #3365

Merged
merged 10 commits into from
Sep 8, 2022

Conversation

comphead
Copy link
Contributor

@comphead comphead commented Sep 5, 2022

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
Copy link

codecov-commenter commented Sep 5, 2022

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
Copy link
Contributor

alamb commented Sep 6, 2022

Looks like there is a CI error on this PR.

@@ -224,10 +224,12 @@ impl From<&DataType> for protobuf::arrow_type::ArrowTypeEnum {
fractional: *fractional as u64,
}),
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
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.

Copy link
Contributor Author

@comphead comphead Sep 8, 2022

Choose a reason for hiding this comment

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

Created #3401

@andygrove
Copy link
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
Copy link
Contributor Author

comphead commented Sep 7, 2022

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

@alamb
Copy link
Contributor

alamb commented Sep 7, 2022

@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
Copy link
Contributor Author

comphead commented Sep 7, 2022

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
Copy link
Contributor Author

comphead commented Sep 7, 2022

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

Copy link
Member

@andygrove andygrove 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 @comphead

@andygrove
Copy link
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?

Copy link
Contributor

@avantgardnerio avantgardnerio left a comment

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!

@@ -32,7 +32,9 @@ fn main() -> Result<(), String> {
fn build() -> Result<(), String> {
use std::io::Write;

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
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
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
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
Copy link
Contributor Author

comphead commented Sep 8, 2022

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

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.

LGTM -- thanks @avantgardnerio and @comphead !

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

ursabot commented Sep 8, 2022

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