Skip to content

[C++][Parquet] How to read Decimal type in Stream Reader C++ API #34594

@tahsinreza

Description

@tahsinreza

Describe the usage question you have. Please include as many useful details as possible.

I'm trying to read the following field in a parquet file using the Stream Reader C++ API (I didn't create the parquet file):

Schema output:

optional fixed_len_byte_array(16) field_id=-1 processstarted_seconds (Decimal(precision=38, scale=18));
// code
optional<std::array<char, 16>> processstarted_seconds;
... 
stream_reader >> columns_obj.processstarted_seconds;
// code

When I run the above code, I get the following runtime error message:

what():  Column converted type mismatch.  Column 'processstarted_seconds' has converted type 'DECIMAL' not 'NONE'

The error is originating here: https://github.com/apache/arrow/blob/main/cpp/src/parquet/stream_reader.cc#L158

Note that I'm able to read the FIXED_LEN_BYTE_ARRAY type with parquet::ConvertedType::NONE. For example, the following works fine.
Schema output:

optional fixed_len_byte_array(4) field_id=-1 country_char[4];

I'm using Arrow-Parquet C++ v9.0.0.

Thanks for your help.

Component(s)

C++

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions