Skip to content

PARQUET-1850: Fix dictionaryPageOffset flag setting in toParquetMetadata method - #789

Closed
srinivasst wants to merge 2 commits into
apache:masterfrom
srinivasst:ParquetConverterFix
Closed

PARQUET-1850: Fix dictionaryPageOffset flag setting in toParquetMetadata method#789
srinivasst wants to merge 2 commits into
apache:masterfrom
srinivasst:ParquetConverterFix

Conversation

@srinivasst

Copy link
Copy Markdown
Contributor

Issue

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.

Fix

The flag is set to true when a dictionary page is used for encoding.

Tests

A ParquetMetadata object is created with PLAIN_DICTIONARY encoding and dictionaryPageOffset is set to a non zero value.

The ParquetMetadata object is converted to FileMetaData using toParquetMetadata method.
The FileMetaData object is then serialized and deserialized to FileMetaData and converted back to ParquetMetadata using fromParquetMetadata method.

The new ParquetMetadata should have the same dictionaryPageOffset as the original ParquetMetadata object.

@srinivasst

Copy link
Copy Markdown
Contributor Author

@julienledem @rdblue @belugabehr please review this PR

@srinivasst

Copy link
Copy Markdown
Contributor Author

@shangxinli @nandorKollar please review this PR

@surnaik surnaik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@asfgit asfgit closed this in 0acade0 Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants