toParquetMetadata method in ParquetMetadataConverter does not set dictionary page offset bit
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.6k
- Merge moyen
- 3 j 12 h
- PR mergées (30 j)
- 33
Description
toParquetMetadata method converts org.apache.parquet.hadoop.metadata.ParquetMetadata to org.apache.parquet.format.FileMetaData but this does not set the dictionary page offset bit in FileMetaData.
When a FileMetaData object is serialized while writing to the footer and then deserialized, the dictionary offset is lost as the dictionary page offset bit was never set.
PARQUET-1850 tried to fix this but it did only a partial fix.
It sets setDictionary_page_offset only if getEncodingStats are present
```java
if (columnMetaData.getEncodingStats() != null
&& columnMetaData.getEncodingStats().hasDictionaryPages())
{ metaData.setDictionary_page_offset(columnMetaData.getDictionaryPageOffset()); }
```
However, it should setDictionary_page_offset even when getEncodingStats are not present but encodings are present.
It should use the implementation in ColumnChunkMetatdata below:
```java
public boolean hasDictionaryPage() {
EncodingStats stats = getEncodingStats();
if (stats != null) {
return stats.hasDictionaryPages() && stats.hasDictionaryEncodedPages();
}
Set encodings = getEncodings();
return (encodings.contains(PLAIN_DICTIONARY) || encodings.contains(RLE_DICTIONARY));
}
```
So new change in ParquetMetadataCOnvertor should be like:
```java
if (columnMetaData.hasDictionaryPage()) { metaData.setDictionary_page_offset(columnMetaData.getDictionaryPageOffset()); }
```
**Reporter**: [Abhishek Dixit](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=abhishekd0907)
#### PRs and other links:
- [GitHub Pull Request #1340](https://github.com/apache/parquet-mr/pull/1340)
**Note**: *This issue was originally created as [PARQUET-2464](https://issues.apache.org/jira/browse/PARQUET-2464). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez dans ParquetMetadataConverter.toParquetMetadata et comparez sa condition concernant les pages de dictionnaire avec ColumnChunkMetadata.hasDictionaryPage(), comme décrit dans l’issue. Vérifiez que la sérialisation et la désérialisation du footer préservent l’offset de la page de dictionnaire lorsque les statistiques d’encodage sont absentes mais que les encodages de dictionnaire sont présents ; consultez Pull Request #1340 pour voir le travail déjà réalisé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- data-engineering
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 25/100