Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Variant field names not being ordered correctly via UTF-8 byte order

Closed
#3,735 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java

Research direction

Start with VariantBuilder and Variant.getFieldByKey, then reproduce the issue using an object with a supplementary-plane field name and enough fields to trigger binary search. Verify that field ids follow UTF-8 byte order and that lookup succeeds for objects produced by both parquet-java and spec-compliant writers.

Written by the indexing model from the issue text.

Description

Type: bug
Describe the bug, including details regarding any error messages, version, and platform.

The Variant spec requires the field ids in an object's header to be sorted by the
UTF-8 byte order of the field names, so a reader can binary-search them.
VariantBuilder sorted the fields — and Variant.getFieldByKey binary-searched them —
using String.compareTo, which orders by UTF-16 code units, not UTF-8 bytes.

The two orderings are identical for all field names in the Basic Multilingual Plane, but
they diverge for names containing supplementary-plane characters (U+10000 and above):
String.compareTo orders a leading high surrogate (0xD800–0xDBFF) before code points in
U+E000..U+FFFF, whereas UTF-8 byte order (and the spec) orders them after. Consequences:

  • An object parquet-java builds with such keys has field ids sorted in an order that
    violates the spec.
  • A spec-compliant reader (e.g. the Apache Arrow C++/Rust/Go Variant readers) binary-searching
    that object can fail to find fields.
  • Conversely, parquet-java's own binary search fails to find a supplementary-plane key in an
    object produced by a spec-compliant writer.

The bug only surfaces when an object both contains a supplementary-plane key and is large
enough to take the binary-search path, so it has gone unnoticed.

Component(s)

Core

Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
6d 16h
Merged PRs (30d)
36

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/parquet-java

All issues in apache/parquet-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.