feat: Support reading Parquet ENUM logical type as String#7805
Open
leochen4891 wants to merge 4 commits intodeephaven:mainfrom
Open
feat: Support reading Parquet ENUM logical type as String#7805leochen4891 wants to merge 4 commits intodeephaven:mainfrom
leochen4891 wants to merge 4 commits intodeephaven:mainfrom
Conversation
…deephaven#7723) ENUM-annotated BINARY columns in parquet files produced by external tools are currently rejected. This test captures the existing behavior where enum statistics are not materialized as strings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…7723) Parquet ENUM is physically identical to STRING (UTF-8 encoded BINARY). Files produced by external tools (e.g. Spark) may use this annotation. - ParquetSchemaReader: map EnumLogicalTypeAnnotation to String.class - ParquetColumnLocation: add visitor delegating to ToStringPage - MinMaxFromStatistics: accept EnumLogicalTypeAnnotation for min/max - Update test to verify enum statistics are now materialized Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ring Writes a Parquet file with a BINARY+ENUM column using Deephaven's own ParquetFileWriter, then reads it back and verifies the column is materialized as String with correct values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
No docs changes detected for 84ea207 |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for Parquet ENUM logical type by treating it like STRING across Deephaven’s Parquet read pipeline, enabling successful reads and statistics pushdown for externally-produced Parquet files.
Changes:
- Map
EnumLogicalTypeAnnotationtoStringduring schema-to-Java type resolution. - Decode
ENUM-annotatedBINARYcolumns using the existing string page decoder. - Enable min/max statistics extraction (pushdown) for
ENUMlogical type and add unit + end-to-end tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
extensions/parquet/table/src/main/java/io/deephaven/parquet/table/ParquetSchemaReader.java |
Maps Parquet ENUM logical type to String in schema interpretation. |
extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java |
Adds ENUM logical type visitor to decode values via ToStringPage. |
extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/MinMaxFromStatistics.java |
Allows string min/max extraction for ENUM logical type to support pushdown. |
extensions/parquet/table/src/test/java/io/deephaven/parquet/table/location/MinMaxFromStatisticsTest.java |
Adds unit test asserting min/max materialization for ENUM-annotated stats. |
extensions/parquet/table/src/test/java/io/deephaven/parquet/table/ParquetTableReadWriteTest.java |
Adds end-to-end test writing a BINARY+ENUM column and reading it back as String. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
extensions/parquet/table/src/main/java/io/deephaven/parquet/table/ParquetSchemaReader.java
Show resolved
Hide resolved
...nsions/parquet/table/src/test/java/io/deephaven/parquet/table/ParquetTableReadWriteTest.java
Outdated
Show resolved
Hide resolved
- Extract visitStringLike() helper in ParquetSchemaReader so STRING and ENUM visitors share identical SpecialType resolution logic. This ensures any future Deephaven SpecialType metadata on ENUM columns is handled consistently with STRING columns. - Wrap ParquetFileWriter in try-with-resources in the test so the file is always finalised even if an exception is thrown mid-write. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7723
Background
Parquet's
ENUMlogical type is physically identical toSTRING: both annotate aBINARYcolumn with UTF-8 encoded bytes. The only difference is the label. External tools such as Spark and PyArrow useENUMto indicate a column holds a finite set of string values, but the wire format is the same.Deephaven's read pipeline has three stages where logical type is dispatched. All three previously had no handling for
EnumLogicalTypeAnnotation, causing ENUM-annotated columns from externally produced files to fail on read.Changes
Stage 1 — Schema to Java type (
ParquetSchemaReader)Before:
visit(EnumLogicalTypeAnnotation)set an error string and returnedOptional.empty(), so the column was unresolvable.After: Returns
Optional.of(String.class), the same result asvisit(StringLogicalTypeAnnotation).Stage 2 — Column data to chunk (
ParquetColumnLocation)Before: No
visit(EnumLogicalTypeAnnotation)override existed, so the visitor returnedOptional.empty()and the read failed at runtime.After: A new override delegates to
ToStringPage.create(...), the same decoder used forSTRINGcolumns.Stage 3 — Pushdown statistics (
MinMaxFromStatistics)Before:
getMinMaxForStringsonly acceptedStringLogicalTypeAnnotation, so ENUM columns returnedfalseand forced a full scan on every filter.After: The condition adds
|| instanceof EnumLogicalTypeAnnotation, enabling min/max pushdown for ENUM columns.Tests
MinMaxFromStatisticsTest.enumLogicalStatisticsAreMaterialised— unit test verifying ENUM statistics are extracted as strings.ParquetTableReadWriteTest.testReadEnumLogicalTypeAsString— end-to-end test that writes a Parquet file with aBINARY+ENUMcolumn and reads it back, verifying the column materializes asStringwith correct values.