apache / apache/parquet-java

Refactor the Statistics classes to match the specialized pattern used throughout parquet

Open
#1,450 0 comments 0 reactions 0 assignees View on GitHub
Component: Java Component: Parquet Priority: Minor Type: enhancement
Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
3d 12h
Merged PRs (30d)
33

Description

Because Parquet tries very hard to avoid autoboxing, most of the core classes are specialized for each primitive by having a method for each type, eg:

```Java
void writeInt(int x);
void writeLong(long x);
void writeDouble(double x);
```

and so on.

However, the statistics classes take the other approach of having an InstStatistics class, a LongStatistics class, a DoubleStatistics class and so on. I think it's worth going for consistency and picking a pattern and sticking to it. Seems like the first pattern I mentioned is currently the more common one.

We may want to take this one step further and define an interface that these all conform to, eg:
```Java
public interface ParquetTypeVisitor {
void visitInt(int x);
void visitLong(long x);
void visitDouble(double x);
}
```

**Reporter**: [Alex Levenson](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=alexlevenson) / @isnotinvain

**Note**: *This issue was originally created as [PARQUET-32](https://issues.apache.org/jira/browse/PARQUET-32). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.