apache / apache/parquet-java

Make the order of encodings in column metadata deterministic

Ouverte
#3,215 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Type: enhancement
Langage dominant
Java
Étoiles
3.1k
Forks
1.6k
Merge moyen
3 j 12 h
PR mergées (30 j)
33

Description

### Describe the enhancement requested

**Background**
The list of encodings used for a column is stored in the column metadata in the Parquet file footer.

The elements in this list are enumeration constants (`org.apache.parquet.format.Encoding`), which are collected in a `HashSet` when the records and fields are written. Later, when the footer is written, the set of enum constants are converted to a temporary list using the HashSet’s iteration order.

Since `Enum::hashCode` delegates to `Object::hashCode` (or, in later JDK versions, to `System::identityHashCode`), the order of the enum constants in this list can vary between runs in different processes, and thus files with identical encodings can represent this list differently (the elements may appear in different order).

**Rationale for changing this behaviour**
Two processes running the same version of parquet-java and having identical writer configurations can still produce files that are different at the binary level for the exact same written data.

For redundancy reasons, it is not uncommon to write data to Parquet files on two different machines. To verify that the same data has been written on both machines, it is currently not sufficient to compare the files ate the binary level. Instead, the files must be decoded and their actual data must be compared to ensure they are equal.

If the files can be made identical at the binary level, this verification process would be simplified.

**Suggested change**
The list of encodings is created in `org.apache.parquet.format.converter.ParquetMetadataConverter::toFormatEncodings`. A simple solution is to sort this list before it is returned, i.e. always return the `Encoding` enum constants in ascending ordinal order.

### Component(s)

Core

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par org.apache.parquet.format.converter.ParquetMetadataConverter::toFormatEncodings et examinez comment le HashSet de valeurs Encoding devient la liste renvoyée. Le travail est terminé lorsque l’écriture de données équivalentes produit des métadonnées Encoding dans un ordre ordinal croissant déterministe, éliminant ainsi l’ordre dépendant du processus.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
data
Type d'issue
Fonctionnalité
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
58/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.