sunchao / parquet-rs

Apache Parquet implementation in Rust
Apache License 2.0
149 stars 20 forks source link

Add "To Thrift" conversion to basic types and enums #122

Closed sadikovi closed 6 years ago

sadikovi commented 6 years ago

This PR adds conversion from parquet::XYZ to XYZ. This is needed when writing the enums into as part of parquet format structs. This allows to do the following:

let metadata = parquet::ColumnMetaData {
  type_: column_descr.physical_type().into(),
  ...
}

Basically implements From<XYZ> for parquet::XYZ for physical type, logical type, page type, compression, encoding, and repetition. I did not add column order, because it needs to be converted differently, since there is no direct one-to-one mapping with format definition.

Added unit tests, and made some small changes, like tp into value to be consistent in methods for non-type enum names, like Encoding or Compression.

sadikovi commented 6 years ago

I am slowly working on write path, and this is one of the helper PRs with relatively small changes.

sunchao commented 6 years ago

Interestingly cargo doc --no-deps generates lots of warnings, and cargo coveralls is failing again (which I think is expected since our travis cargo is not set up properly).

sunchao commented 6 years ago

Merged. Thanks @sadikovi !

sadikovi commented 6 years ago

@sunchao Thanks!