Prevent Constructing Decoder for Incompatible Types #1276
Labels
enhancement
Any new improvement worthy of a entry in the changelog
parquet
Changes to the parquet crate
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
It is possible to call
get_decoder
with anyT: DataType
and a correspondingEncoding
, even if thatEncoding
doesn't make sense for that type. For exampleThese will error, or in some case panic, if an attempt is made to use them but it would be better to return an error on construction.
Describe the solution you'd like
Attempting to use an incompatible encoding with a given type should return an error on construction.
Additional context
An additional challenge with the current setup is that it makes the implicit assumption that a Decoder must be able to be created for all
DataType
even if it doesn't make sense for most types. This makes for some rather confusing code, and prevents decoders from adding constraints that may be true for all valid types, but not all types in general, (e.g. num::FromPrimitive).The text was updated successfully, but these errors were encountered: