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

Fix generate_unions_case for Rust case #1677

Merged
merged 2 commits into from
May 10, 2022

Conversation

viirya
Copy link
Member

@viirya viirya commented May 9, 2022

Which issue does this PR close?

Closes #1676.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label May 9, 2022
@viirya viirya force-pushed the fix_generate_unions_case_rust branch from 4896e43 to 2883adc Compare May 9, 2022 06:22
@codecov-commenter
Copy link

Codecov Report

Merging #1677 (2883adc) into master (03ab9a3) will decrease coverage by 0.09%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1677      +/-   ##
==========================================
- Coverage   83.10%   83.01%   -0.10%     
==========================================
  Files         193      193              
  Lines       55881    55940      +59     
==========================================
- Hits        46439    46436       -3     
- Misses       9442     9504      +62     
Impacted Files Coverage Δ
arrow/src/datatypes/datatype.rs 60.36% <0.00%> (-6.04%) ⬇️
arrow/src/datatypes/field.rs 54.21% <0.00%> (-2.23%) ⬇️
arrow/src/util/integration_util.rs 68.53% <ø> (ø)
integration-testing/src/lib.rs 0.00% <0.00%> (ø)
arrow/src/array/transform/mod.rs 86.57% <0.00%> (-0.12%) ⬇️
arrow/src/array/array_binary.rs 93.30% <0.00%> (ø)
arrow/src/array/array_string.rs 97.73% <0.00%> (ø)
arrow/src/array/array_list.rs 96.16% <0.00%> (+0.37%) ⬆️

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 03ab9a3...2883adc. Read the comment docs.

@viirya viirya force-pushed the fix_generate_unions_case_rust branch from 2883adc to 4372037 Compare May 9, 2022 07:04
@@ -499,6 +499,52 @@ impl DataType {
))
}
}
Some(s) if s == "union" => {
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't parse union type from json before.

@@ -392,6 +392,70 @@ mod tests {
assert_eq!(expected, dt);
}

#[test]
fn parse_union_from_json() {
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 will work on union to json in another PR later.

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 @viirya

let default_fields = type_ids
.iter()
.map(|t| {
Field::new("", DataType::Boolean, true).with_metadata(
Copy link
Contributor

Choose a reason for hiding this comment

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

is it cool to have a field without a name 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

This is only a placeholder, as above other nested types (list, map, etc) do. The actual fields will replace them (Field::from).

Copy link
Member Author

Choose a reason for hiding this comment

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

This is because, type (union, map, list, etc) is defined in "type" of the Json map, fields are defined in "children" of the map. We parse "type" to get the nested type and parse "children" to get actual fields after that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation

@viirya viirya merged commit 19f0ada into apache:master May 10, 2022
@viirya
Copy link
Member Author

viirya commented May 10, 2022

Merged, thanks @alamb !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix generate_unions_case integration test
3 participants