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

Cleanup parquet type builders #4706

Merged
merged 2 commits into from
Aug 17, 2023

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Aug 16, 2023

Which issue does this PR close?

Closes #.

Rationale for this change

Noticed whilst investigating #4702

What changes are included in this PR?

Are there any user-facing changes?

The apis for some of setters of PrimitiveTypeBuilder have changed

@github-actions github-actions bot added the parquet Changes to the parquet crate label Aug 16, 2023
pub fn with_fields(mut self, fields: &mut Vec<TypePtr>) -> Self {
self.fields.append(fields);
self
pub fn with_fields(self, fields: Vec<TypePtr>) -> Self {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accepting &mut Vec<TypePtr> made for a very unusual interface, changing to accept Vec<TypePtr> is much "normal"

pub fn with_id(mut self, id: i32) -> Self {
self.id = Some(id);
self
pub fn with_id(self, id: Option<i32>) -> Self {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes with_id consistent with the other APIs such as with_logical_type and with_converted_type (where ConvertedType has implicit nullability as a result of ConvertedType::NONE`). It also reflects the fact this setting is most often optional

@tustvold tustvold added the api-change Changes to the arrow API label Aug 16, 2023
@tustvold tustvold merged commit 44b644d into apache:master Aug 17, 2023
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.

👌 I think this is a nice improvement

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

Successfully merging this pull request may close these issues.

3 participants