Skip to content

[core] Do not drop partitions when the system-table partition filter cannot be parsed - #10207

Open
LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:m/core-015-buckets-parse
Open

LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:m/core-015-buckets-parse

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Purpose

System tables (t$buckets, t$files, t$fileindexes, t$filekeyranges) render the partition as a single string column and parse a pushed-down equality or IN literal back into a partition spec before pushing it into the snapshot reader. A partition value that contains the ", " separator does not round-trip this format: parsePartitionSpec sees a token count that differs from the number of partition keys and returns null. In that case the Equal branch returned false, which the callers translate into an empty result, so a query filtering for that exact partition silently returned zero rows. The IN branch had the same flaw per literal: it dropped only the unparseable literals from the pushed filter, so their partitions silently vanished from the results.

This treats an unparseable spec the way the range branch already does: skip the partition pushdown and read all partitions, letting the engine re-apply the predicate. For Equal it skips the pushdown when the spec is null; for IN it skips the whole pushdown as soon as any literal fails to parse.

Tests

BucketsTableTest.testBucketsTableWithUnparseablePartitionFilterIsConservative pins that an unparseable equality filter degrades to reading all partitions instead of returning empty.

BucketsTableTest.testBucketsTableWithPartiallyUnparseableInFilterIsConservative pins that a single unparseable IN literal disables the whole pushdown rather than dropping only that literal's partition.

FilesTableTest.testReadWithNotFullPartitionKey is updated from the old empty-result expectation to the conservative all-partitions expectation.

API and Format

No.

Documentation

No.

System tables like t$buckets render the partition as a single string
column and parse the pushed-down equality literal back into a partition
spec. A partition value that contains the ", " separator (or braces)
does not round-trip this format: the parse saw a token count different
from the partition key count and the equality branch reported "no
partition matches", so a query filtering for that very partition
silently returned zero rows from t$buckets, t$files, t$fileindexes and
t$filekeyranges. The IN branch had the same flaw per literal: it
dropped only the unparseable literals from the pushed filter, silently
vanishing their partitions from the results.

Treat an unparseable spec like the range branch already does: skip the
partition pushdown and read all partitions, letting the engine re-apply
the predicate — for equality always, and for IN as soon as any literal
fails to parse. The existing test that encoded the old empty-result
behavior for a partial key filter is updated to the conservative
expectation.

Assisted-by: GLM-5.3
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.

1 participant