Skip to content

Support parsing and display pretty for StructType #7469

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

Merged
merged 2 commits into from
May 9, 2025

Conversation

goldmedal
Copy link
Contributor

Which issue does this PR close?

  • No corresponding issue

Rationale for this change

I implemented the datatype_parse for the struct type. I follow the DuckDB SQL style to parse a struct type.
The format is

Struct(<field_name> <data_type>, ..)

I also implemented the Display for the struct type. The display result is reversible.

What changes are included in this PR?

  • datatype_parse for StructType
  • Display for StructType
  • The required tests.

Are there any user-facing changes?

Now, we can parse a text as a struct type.

@github-actions github-actions bot added the arrow Changes to the arrow crate label May 5, 2025
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.

Thank you @goldmedal -- this is really nice and very well tested 👍

@@ -754,11 +834,13 @@ mod test {
("Decimal256(-3, 5)", "Error converting -3 into u8 for Decimal256: out of range integral type conversion attempted"),
("Decimal128(3, 500)", "Error converting 500 into i8 for Decimal128: out of range integral type conversion attempted"),
("Decimal256(3, 500)", "Error converting 500 into i8 for Decimal256: out of range integral type conversion attempted"),

("Struct(f1, Int64)", "Error finding next type, got unexpected ','"),
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@alamb alamb changed the title Support to parse and display pretty for StructType Support parsing and display pretty for StructType May 9, 2025
@alamb alamb merged commit 84646ac into apache:main May 9, 2025
27 checks passed
@alamb
Copy link
Contributor

alamb commented May 9, 2025

Thank you @goldmedal

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.

2 participants