Skip to content

GH-3043: Ignore V1 level encodings for omitted streams - #3867

Open
skyon0522-ai wants to merge 1 commit into
apache:masterfrom
skyon0522-ai:codex/v1-zero-level-streams
Open

skyon0522-ai wants to merge 1 commit into
apache:masterfrom
skyon0522-ai:codex/v1-zero-level-streams

Conversation

@skyon0522-ai

Copy link
Copy Markdown

Closes #3043.

Rationale for this change

The attached nanoparquet file uses PLAIN in the V1 repetition/definition
encoding fields for flat required columns. Neither level stream is present.
readPageV1 nevertheless selects a reader from each header encoding, which
can consume value bytes or fail at ValuesReader.readInteger before the
first record is returned. The format specification
specifies that these zero-maximum level streams are omitted.

What changes are included in this PR?

Select the existing ZeroIntegerValuesReader independently when the
corresponding maximum level is zero. Keep the existing encoding dispatch
for nonzero levels. The regression uses the upstream V1 writer to generate
two pages, replaces only unused level-encoding fields, and checks exact
values and levels for required, optional and repeated columns.

Are these changes tested?

Validation on Linux (Ubuntu 24.04, Java 17.0.20.1, Maven 3.9.11):

  • The new parameterized cases produced four errors on unchanged production
    code. The two controls and seven existing cases passed. All 13 passed
    with the fix.
  • The full parquet-column reactor test run passed all 1,094 tests.
  • A separate 92-test Hadoop run passed, including reading all 32 rows of
    the issue attachment through both reader APIs and a generated control.
  • Spotless checks for the two changed files, normal RAT checks across
    eight reactor modules, and git diff --check passed.

The entire root reactor, native Windows and macOS were not tested.

Are there any user-facing changes?

Files such as the issue attachment become readable when a V1 header uses
PLAIN for an omitted level stream.

OpenAI Codex assisted with the implementation and tests.

Use the existing zero reader when a column's maximum repetition or
definition level is zero. Such a column has no corresponding encoded
level stream, so its unused header encoding must not select a physical
value reader or consume value bytes.

Preserve encoding dispatch for nonzero levels and add synthetic V1
regressions for required, optional and repeated columns across two pages.

Generated-by: OpenAI Codex
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.

Cannot read parquet file that was generated from nanoparquet

1 participant