-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fieldless unions broken on main #57
Comments
Here's one that fails with the given enums:
|
Thanks for the example! This was super helpful. The root cause for the error you see is, that you do not specify all possible values of the unions when you trace the fields. In principle this usage should be supported by raising errors for variants that are encountered during serialization, but were not seen during tracing. However, there are a couple of issues with the current
I will fix these issues, but have to think about, how to balance complexity and user friendliness :) In the mean time you can simply make sure that there are no "holes" in the unions you use during tracing by including all variants up the maximum variant you would like to use (the order in which the variants are encountered by serde-arrow does not matter): let infos = vec![
FileInfo {
filename: String::from("test"),
game_type: GameType::RegularSeason,
account_type: AccountType::Deduced,
file_index: 0
},
FileInfo {
filename: String::from("test"),
game_type: GameType::SpringTraining,
account_type: AccountType::PlayByPlay,
file_index: 0
},
];
let opts = TracingOptions::default().allow_null_fields(true);
let fields = serialize_into_fields(&infos, opts).unwrap(); |
Thanks - using a dummy struct like the one above, I was able to get it working for subsets of my serialization, but still got index errors on the real-world data. I think I am going to wait until this gets resolved to put more work into it on my end, but I am really looking forward to using it in my project; it'll be such a big help. Thanks for your help here and your work on the library in general! |
Thanks for the feedback and for reporting this issue! I pushed a new release 0.7.1 that fixes the issue. Note: you still need to make sure that all enum variants that will be seen by |
Original report:
The text was updated successfully, but these errors were encountered: