Visitar URL original
GH-3826: Preserve component paths for Bloom filters by costas-db · Pull Request #3827 · apache/parquet-java · GitHub
Skip to content

GH-3826: Preserve component paths for Bloom filters - #3827

Open
costas-db wants to merge 2 commits into
apache:masterfrom
costas-db:gh-3826-column-path-bloom-repro
Open

costas-db wants to merge 2 commits into
apache:masterfrom
costas-db:gh-3826-column-path-bloom-repro

Conversation

@costas-db

@costas-db costas-db commented Sep 28, 2026 •

Copy link
Copy Markdown

Rationale for this change

Parquet column paths are component-based, but Bloom filters were stored under dot-string keys. A top-level field named a.b (["a.b"]) therefore collided with nested field a.b (["a", "b"]), allowing one column’s Bloom filter to overwrite the other.

What changes are included in this PR?

  • Keys internal Bloom-filter maps by ColumnPath rather than flattened strings.
  • Preserves the existing addBloomFilter(String, …) API and adds addBloomFilterForPath(ColumnPath, …) for structured callers.
  • Keeps component paths intact when copying Bloom filters through ParquetRewriter.
  • Adds a direct regression plus a readable expected-output JSON fixture.

Are these changes tested?

Before the fix, the focused reproduction reports:

"topLevelContainsOwnBloomValues" : false
"nestedContainsOwnBloomValues" : true

After the fix, both the direct and expected-output tests pass.

Also verified:

  • Full TestParquetWriter
  • TestParquetFileWriter
  • ParquetRewriterTest
  • spotless:check
  • apache-rat:check

Are there any user-facing changes?

No on-disk format change. The existing string-based API remains compatible; this adds a component-based API for callers that already have a ColumnPath.

Closes #3826.

@costas-db costas-db changed the title GH-3826: Add reproduction for Bloom filter path collisions GH-3826: Preserve component paths for Bloom filters Sep 28, 2026
@costas-db
costas-db marked this pull request as ready for review September 28, 2026 07:27
@divjotarora

Copy link
Copy Markdown
Contributor

@wgtmac Can you take a look at this? Seems important if it's a real issue. @costas-db found some similar issues in other parts of the code as well (#3830, #3831, #3833)

@wgtmac wgtmac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This overall looks good to me. Thanks @costas-db and @divjotarora. I've left some minor comments.

BTW, do you plan to land #3830 / #3831 together with this one, so schemas with dots in names are safe end to end?

* @param bloomFilter the bloom filter of column values
*/
public void addBloomFilter(String column, BloomFilter bloomFilter) {
addBloomFilterForPath(ColumnPath.fromDotString(column), bloomFilter);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fromDotString splits on dots. A caller who passes a name that contains a dot (for example the top-level a.b column this PR fixes) now builds a path that does not match the column, so their Bloom filter is dropped without any error or log. The javadoc above still says "the column name".

Perhaps we need to deprecate this method and add a comment to point callers at addBloomFilterForPath?

containsAllBloomValues(bloomFilters.get(ColumnPath.get("a.b")), "top-"),
containsAllBloomValues(bloomFilters.get(ColumnPath.get("a", "b")), "nested-"));

try (InputStream input = TestParquetWriter.class.getResourceAsStream("/bloom-filter-path-collision.json")) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The expected file repeats the values built two lines above, so there are two copies of the same expectations. Let's remove this resource file to make it easier to maintain.

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.

Bloom filters collide for distinct column paths with the same dot string

3 participants