You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@arrow.apache.org by Sebastian Fischmeister <sf...@uwaterloo.ca> on 2020/03/18 21:49:44 UTC

Access to parquet elements in Row via Rust API

Hi,

I'm trying to write a simple Rust program that accesses a parquet file, looks for some values, and prints them.

I took the example from [1] and can pick up individual column values in each row by directly addressing them (e.g., record.get_long(147)) ). However, there are two problems with that:

1) It's unclear whether 147 is really the column I want to read.
2) If there's a change in the provided parquet file, all the absolute numbers may change.

I was hoping that there's a way to address an element through a hashmap as in record.get("foo"). Does the Rust API currently support this?

Thanks,
  Sebastian

[1] https://docs.rs/parquet/0.16.0/parquet/file/index.html

Re: Access to parquet elements in Row via Rust API

Posted by Daniel Nugent <nu...@gmail.com>.
I believe the Rust API is still nascent. But you can get that by looking through the Metadata. It’s a bit nastily nested though. The type descent path is File > ParquetMetaData > RowGroupMetaData > ColumnChunkMetaData > ColumnDescriptor > &str

You are currently required to track the mappings between index and column name yourself.

-Dan Nugent
On Mar 18, 2020, 17:49 -0400, Sebastian Fischmeister <sf...@uwaterloo.ca>, wrote:
> Hi,
>
> I'm trying to write a simple Rust program that accesses a parquet file, looks for some values, and prints them.
>
> I took the example from [1] and can pick up individual column values in each row by directly addressing them (e.g., record.get_long(147)) ). However, there are two problems with that:
>
> 1) It's unclear whether 147 is really the column I want to read.
> 2) If there's a change in the provided parquet file, all the absolute numbers may change.
>
> I was hoping that there's a way to address an element through a hashmap as in record.get("foo"). Does the Rust API currently support this?
>
> Thanks,
> Sebastian
>
> [1] https://docs.rs/parquet/0.16.0/parquet/file/index.html