apache / arrow

Apache Arrow is a multi-language toolbox for accelerated data interchange and in-memory processing
https://arrow.apache.org/
Apache License 2.0
14.37k stars 3.49k forks source link

[C++][Parquet] Provide std::optional-based APIs for statistics #37065

Open pitrou opened 1 year ago

pitrou commented 1 year ago

Describe the enhancement requested

Currently, our Statistics classes use a cumbersome mix of HasXXX() and xxx() accessors. It would be nice to instead use the more idiomatic C++17 std::optional.

This transition is made more cumbersome by EncodedStatistics, which directly exposes those attributes instead of providing accessors.

Component(s)

C++

pitrou commented 1 year ago

@felipecrv I don't know if a nice migration can be found for this.

felipecrv commented 1 year ago

@felipecrv I don't know if a nice migration can be found for this.

We could deprecate accessors like null_count and add a NullCount that returns an optional. Even with the optional-returning functions, I think it's good to still have the HasXXX() functions.