-
Notifications
You must be signed in to change notification settings - Fork 860
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
feat: impl display for DataType::List
#7051
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, although it will need to wait for the next breaking release as it is a breaking change
DataType::List(Arc::new(Field::new_list_field(DataType::UInt64, false))); | ||
let list_data_type_string = list_data_type.to_string(); | ||
let expected_string = "List(UInt64)"; | ||
assert_eq!(list_data_type_string, expected_string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could get a test of a nested list as well
Thanks @tustvold , I have made the changes as you suggested. Could you please help review it again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've taken another look, but just to set expectations this won't be merged until main opens up for the next breaking release in a months time
@@ -458,7 +458,16 @@ pub enum UnionMode { | |||
|
|||
impl fmt::Display for DataType { | |||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |||
write!(f, "{self:?}") | |||
match self { | |||
DataType::List(field) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to print the field name here if it isn't the default of item
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right -- so if field.name() != "item"
perhaps it could look like
List(Int8;N, field='foo')
Likewise, if there is metadata I think it should also be displayed like
List(Int8;N, field='foo', metadata)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which issue does this PR close?
Closes #7048
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?