Skip to content

fix: use column collation in bloom filter hash to handle non-deterministic collations (#10263) - #10383

Open
waterWang wants to merge 1 commit into
timescale:mainfrom
waterWang:fix/bloom-collation
Open

fix: use column collation in bloom filter hash to handle non-deterministic collations (#10263)#10383
waterWang wants to merge 1 commit into
timescale:mainfrom
waterWang:fix/bloom-collation

Conversation

@waterWang

Copy link
Copy Markdown

What

Use the actual column collation in the bloom filter hash function instead of hardcoding C_COLLATION_OID.

Why

Fixes #10263.

The bloom filter hash function batch_metadata_builder_bloom1_calculate_hash hardcoded C_COLLATION_OID for all hash computations. When a column uses a non-deterministic collation (e.g. ICU case-insensitive und-u-ks-level2), collation-equivalent values like 'alice' and 'ALICE' produce different hashes, causing the bloom filter to falsely reject the batch during UPDATE/DELETE on compressed data.

How

  • Added collation_oids array to Bloom1HasherInternal
  • Pass column collation through bloom1_hasher_init and all callers
  • Use the actual column collation instead of C_COLLATION_OID in batch_metadata_builder_bloom1_calculate_hash
  • For scalar types and debug functions, continue using C_COLLATION_OID (no column context available, and these are non-critical paths)

Files changed

  • tsl/src/compression/batch_metadata_builder.h — function declarations
  • tsl/src/compression/batch_metadata_builder_bloom1.c — core fix + all internal callers
  • tsl/src/compression/compression.c — 2 callers
  • tsl/src/compression/compression_dml.c — 2 callers
  • tsl/src/compression/recompress.c — 1 caller

…istic collations (timescale#10263)

The bloom filter hash function batch_metadata_builder_bloom1_calculate_hash
hardcoded C_COLLATION_OID for all hash computations. When a column uses a
non-deterministic collation (e.g. ICU case-insensitive und-u-ks-level2),
collation-equivalent values like 'alice' and 'ALICE' produce different
hashes, causing the bloom filter to falsely reject the batch during
UPDATE/DELETE on compressed data.

Fix:
- Add collation_oids array to Bloom1HasherInternal
- Pass column collation through bloom1_hasher_init and all callers
- Use the actual column collation instead of C_COLLATION_OID in
  batch_metadata_builder_bloom1_calculate_hash
- For scalar types and debug functions, continue using C_COLLATION_OID
  (no column context available)
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

@antekresic, @natalya-aksman: please review this pull request.

Powered by pull-review

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.

[Bug]: Bloom filter ignores column collation during DML batch filtering

2 participants