chmp / serde_arrow

Convert sequences of Rust objects to Arrow tables
MIT License
60 stars 17 forks source link

Surface error more clearly for `push_validity` #202

Open kszlim opened 1 month ago

kszlim commented 1 month ago

When this function panics, it's not clear exactly what is being pushed that violates its invariants. Ideally you'd see what arrow field is failing and what the data looks like.

chmp commented 1 month ago

Thanks a lot for the report! The error messages are definitely something to improve.

If you have a concrete example, it would be quite helpful, so I can directly include it in the test suite.

kszlim commented 1 month ago

I worked around the issue I encountered by mapping my schema directly, but basically the issue is that if tracing determines the schema incorrectly, there's not really a good way to determine what about the inferred schema clashes with your data that you're trying to push. You can either encounter this issue or one of the panics on the SimpleSerializer for unimplemented methods.

chmp commented 2 weeks ago

My current plan is to include the relevant fields (and potentially other metadata) in the error message, e.g.,

Cannot push null for non-nullable array (field: "$.nested.field")

Would this have helped?

kszlim commented 1 week ago

Yeah something like that would help immensely