Skip to content

Fix generate_unions_case for Rust case - #1677

Merged
viirya merged 2 commits into
apache:masterfrom
viirya:fix_generate_unions_case_rust
May 10, 2022
Merged

Fix generate_unions_case for Rust case#1677
viirya merged 2 commits into
apache:masterfrom
viirya:fix_generate_unions_case_rust

Conversation

@viirya

@viirya viirya commented May 9, 2022

Copy link
Copy Markdown
Member

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

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
))
}
}
Some(s) if s == "union" => {

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

}

#[test]
fn parse_union_from_json() {

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

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

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

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.

is it cool to have a field without a name 🤔

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

viirya commented May 10, 2022

Copy link
Copy Markdown
Member Author

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