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

Preserve list element name #2840

Closed
wants to merge 5 commits into from

Conversation

comphead
Copy link
Contributor

@comphead comphead commented Jul 6, 2022

Which issue does this PR close?

Closes #2450 .

Rationale for this change

What changes are included in this PR?

Preserve list element name

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate physical-expr Physical Expressions sql SQL Planner labels Jul 6, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #2840 (34bbf11) into master (00a1731) will decrease coverage by 0.01%.
The diff coverage is 88.55%.

❗ Current head 34bbf11 differs from pull request most recent head 29243c4. Consider uploading reports for the commit 29243c4 to get more accurate results

@@            Coverage Diff             @@
##           master    #2840      +/-   ##
==========================================
- Coverage   85.19%   85.18%   -0.02%     
==========================================
  Files         275      275              
  Lines       48764    48756       -8     
==========================================
- Hits        41546    41534      -12     
- Misses       7218     7222       +4     
Impacted Files Coverage Δ
datafusion/sql/src/planner.rs 81.48% <50.00%> (ø)
datafusion/proto/src/to_proto.rs 53.88% <65.85%> (-2.59%) ⬇️
datafusion/proto/src/from_proto.rs 33.87% <66.66%> (-0.77%) ⬇️
.../physical-expr/src/aggregate/array_agg_distinct.rs 80.18% <93.75%> (ø)
datafusion/common/src/scalar.rs 75.74% <100.00%> (-0.04%) ⬇️
datafusion/core/src/scalar.rs 99.61% <100.00%> (+<0.01%) ⬆️
...atafusion/physical-expr/src/aggregate/array_agg.rs 95.87% <100.00%> (-0.05%) ⬇️
...sion/physical-expr/src/aggregate/count_distinct.rs 94.73% <100.00%> (+0.01%) ⬆️
...fusion/physical-expr/src/aggregate/sum_distinct.rs 92.72% <100.00%> (+0.06%) ⬆️
datafusion/physical-expr/src/aggregate/tdigest.rs 91.30% <100.00%> (+0.05%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00a1731...29243c4. Read the comment docs.

@@ -656,21 +658,22 @@ impl TryFrom<&protobuf::ScalarListValue> for ScalarValue {
fn try_from(
scalar_list_value: &protobuf::ScalarListValue,
) -> Result<Self, Self::Error> {
use protobuf::{scalar_type::Datatype, PrimitiveScalarType};
if 2 > 1 {
Copy link
Contributor Author

@comphead comphead Jul 6, 2022

Choose a reason for hiding this comment

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

@tustvold im not sure why all tests are ok, looks like this piece of code not used. The CI build has Ballista tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is because the tests don't have coverage of DataType::List

This is a good experiment (add in a panic) but we probably need to remove this prior to merging this PR

Copy link
Contributor Author

@comphead comphead Jul 11, 2022

Choose a reason for hiding this comment

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

Right,I added this to check if this code part is used. We have roundtrips tests for lists and nested lists in round_trip_scalar_values which passed. I'm wondering if ballista tests are in CI? Otherwise this code looks useless and can be dropped

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the ballista CI checks only run in the ballista repo 🤔

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.

Thank you @comphead; This looks good to me except for:

  1. the issue in protobuf encoding/decoding (and the if 2 > 1 assert)
  2. The change to the parquet-testing submodule pin

I am sorry for the delay in reviewing

ScalarValue::List(value, Box::new(data_type))
ScalarValue::List(
value,
Box::new(Field::new("item", nested_type.data_type().clone(), true)),
Copy link
Contributor

Choose a reason for hiding this comment

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

this is effectively going to lose the original field name (which isn't attached to the array) in this particular codepath, which is a similar problem to what I observed in #2874

However, this PR certainly seems better than the current state of master which loses the field name through all paths

@@ -656,21 +658,22 @@ impl TryFrom<&protobuf::ScalarListValue> for ScalarValue {
fn try_from(
scalar_list_value: &protobuf::ScalarListValue,
) -> Result<Self, Self::Error> {
use protobuf::{scalar_type::Datatype, PrimitiveScalarType};
if 2 > 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is because the tests don't have coverage of DataType::List

This is a good experiment (add in a panic) but we probably need to remove this prior to merging this PR

@alamb alamb marked this pull request as draft July 11, 2022 18:49
@alamb
Copy link
Contributor

alamb commented Jul 11, 2022

Marking as a draft while we work out feedback; Please mark ready for review when it is ready again 🙏

@comphead comphead closed this Jul 13, 2022
@comphead comphead deleted the scalar_list_elname_merged branch September 8, 2022 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate physical-expr Physical Expressions sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preserve Element Name in ScalarValue::List
3 participants