-
Notifications
You must be signed in to change notification settings - Fork 21
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
feature request: have a TracingOption to represent enums as flattened structs instead of unions #221
Comments
As an example, imagine we had the following rust enum
I think given the option, we could map that to an equivalent flattened struct like the following in terms of the Arrow Field:
The field names are to prevent field name collisions.
Represented as arrow Fields, instead of this:
We would auto-convert to this:
When disabling the first type, I can now write parquet files just fine. If we can do this for the user automatically I think it could be quite useful. |
Initial draft MR #222 |
Hi Chris,
I wanted to propose/discuss a new feature, where Rust enums are flattened into a struct (or map?) with a wide schema, where the non-selected variants would have None/Null fields and then deserialized with some intelligent logic checking the fields for each variant.
This would be a workaround/crutch for the fact that Unions are not supported in parquet (and support doesn't appear to be coming any time soon), but ideally generic enough to be useful for anyone if they wish, and it seems like the feature would do well to live in this crate.
For the interface, I would hope it would be a simple option set in
TracingOptions
, e.g.TracingOptions::new().flatten_enums_into_structs(true)
.I would like to try to help implement this if you agree with the feature but don't think you'll have time to work on it yourself, although obviously you would implement this much faster than I would. I notice in your branch activity you appear to be actively working on version 0.12 of the crate, where maybe you are thinking about this already? Or possibly want to delay a feature like this until the next version? Either way, would love to discuss possibilities. Please let me know your thoughts.
Thanks,
Raj
The text was updated successfully, but these errors were encountered: