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

Add Field::new_list_field and improve DataType::new_list docs #4627

Merged
merged 7 commits into from
Dec 27, 2023

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Aug 2, 2023

Which issue does this PR close?

Re #4544

Rationale for this change

As described on #4561 (comment) the API for creating List fields is somewhat confusing and hiding details of doing so may make it more so.

What changes are included in this PR?

  1. Add Field::new_list_item Field::new_list_field
  2. improve DataType::new_list docs

Are there any user-facing changes?

Yes a new API for constructing Fields and better docs

@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 2, 2023
Comment on lines 142 to 143
/// Field::new("item", DataType::Int32, true),
/// Field::new_list_item(DataType::Int32, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

It does occur to me that this is now longer 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But it is more explict / discoverable

Maybe Field::new_list_field? or Field::new_list?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel strongly, I personally don't see the issue with "item" but we're going to have to agree to disagree there 😅

Copy link
Member

Choose a reason for hiding this comment

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

I guess new_list_field? As this is to create a field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea -- done in 76b1e70

Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

Not sure about new_list_item, docs on DataType::new_list look good

@alamb
Copy link
Contributor Author

alamb commented Aug 2, 2023

I'll give this PR a few more days to see if anyone else has thoughts / comments

arrow-schema/src/datatype.rs Outdated Show resolved Hide resolved
arrow-schema/src/datatype.rs Outdated Show resolved Hide resolved
alamb and others added 4 commits August 3, 2023 10:30
Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>
Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>
@tustvold
Copy link
Contributor

How should we proceed with this one?

@alamb
Copy link
Contributor Author

alamb commented Dec 27, 2023

I will polish it up and get it merged

@alamb alamb changed the title Add Field::new_list_item and improve DataType::new_list docs Add Field::new_list_field and improve DataType::new_list docs Dec 27, 2023
@alamb alamb merged commit 3cd6da0 into apache:master Dec 27, 2023
25 checks passed
@alamb
Copy link
Contributor Author

alamb commented Mar 4, 2024

FYI here is a bug in DataFusion related to not following the conventions apache/datafusion#9441 (and hence another reason in my mind that this API has value)

@alamb alamb deleted the alamb/new_list_and_docs branch March 4, 2024 12:20
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.

3 participants