Open xrl opened 5 years ago
What do you mean by upcast? Those are completely different structs. Could you elaborate on this comment?
typed_writer.close().unwrap(); // doesn't stop row_group_writer from complaining a column is still open
Unfortunately, row group writer only works with column writer, not column writer impl. Closing the latter would not be seen by the former, because there is no way to close column writer impl. We can add a method to close column writer impl, or, as an alternative, we can mark get_typed_column_writer
private - it is safer to use pattern match.
Those are good points. I vote for turning get_typed_column_writer
private.
Also, the comment for get_typed_column_writer
is from the docs for the function:
/// Gets a typed column writer for the specific type `T`, by "up-casting" `col_writer` of
/// non-generic type to a generic column writer type `ColumnWriterImpl`.
///
/// NOTE: the caller MUST guarantee that the actual enum value for `col_writer` matches
/// the type `T`. Otherwise, disastrous consequence could happen.
If your code needs to have that method, we can keep it public and fix the code around it. The easiest would be making it private with it's counterpart in column reader.
I was trying to implement
ColumnWriter
variant-agnostic code for #197 and I could not close the column withRowGroupWriter
. Looks like once you "upcast" the ColumnWriter -> ColumnWriterImpl you can't close it, so perhaps theget_typed_column_writer
is only useful for tests?Here's a snippet of the failing code: