Skip to content

[flink] Gate single-row lookup pushdown on partition liveness - #3442

Merged
fresh-borzoni merged 2 commits into
apache:mainfrom
fresh-borzoni:flink-lookup-lake-partition-gate
Jun 20, 2026
Merged

[flink] Gate single-row lookup pushdown on partition liveness#3442
fresh-borzoni merged 2 commits into
apache:mainfrom
fresh-borzoni:flink-lookup-lake-partition-gate

Conversation

@fresh-borzoni

@fresh-borzoni fresh-borzoni commented Jun 6, 2026

Copy link
Copy Markdown
Member

closes #3443

A full-PK point query on a lake-enabled partitioned table returns empty when the partition was expired from Fluss but still lives in the lake and the lookup pushdown skips the union scan.
Gate the lookup on partition liveness, fall back to the scan otherwise.

@fresh-borzoni

Copy link
Copy Markdown
Member Author

@luoyuxia @loserwang1024 PTAL 🙏

@fresh-borzoni
fresh-borzoni force-pushed the flink-lookup-lake-partition-gate branch from 924cd13 to 4f71fdc Compare June 6, 2026 13:03
@luoyuxia
luoyuxia requested a review from Copilot June 20, 2026 03:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Flink lookup pushdown correctness for lake-enabled, partitioned primary-key tables by preventing single-row KV lookups from being used when the target partition no longer exists in Fluss (but still exists in the lake), ensuring the planner falls back to the union scan path in that case.

Changes:

  • Gate full-PK single-row lookup pushdown on Fluss partition liveness for lake-enabled partitioned tables.
  • Add a utility to check partition existence via Fluss Admin metadata.
  • Add an IT case that reproduces the “expired-in-Fluss but present-in-lake” point-query scenario and verifies correct results.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
fluss-lake/fluss-lake-paimon/src/test/java/org/apache/fluss/lake/paimon/flink/FlinkUnionReadPrimaryKeyTableITCase.java Adds an integration test ensuring point lookups on expired partitions still read from the lake.
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/utils/PushdownUtils.java Adds partitionExists(...) helper to check partition liveness via Admin.
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/source/FlinkTableSource.java Uses partition liveness to decide whether the single-row lookup pushdown is safe.
fluss-client/src/main/java/org/apache/fluss/client/table/getter/PartitionGetter.java Exposes getResolvedPartitionSpec(...) to reuse partition spec resolution logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@luoyuxia luoyuxia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fresh-borzoni Thanks for the pr. lgtm overall. Only one minor comment
Also, https://cwiki.apache.org/confluence/display/FLUSS/FIP-28%3A+Improve+historical+Partition+Support+for+Fluss+Datalake-Enabled+Tables
will make lookup expire partition from paimon possible. Could you please left a todo when FIP28 is finished, we can then fall into the normal path to lookup instead of full scan?

@luoyuxia luoyuxia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fresh-borzoni Thanks LGTM! But seems ci fails

@fresh-borzoni

fresh-borzoni commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

@luoyuxia Thank you, looking into CI

update: fixed the issue, will wait until green

@fresh-borzoni
fresh-borzoni force-pushed the flink-lookup-lake-partition-gate branch from 84fecf8 to f12b6cb Compare June 20, 2026 13:42
@fresh-borzoni
fresh-borzoni force-pushed the flink-lookup-lake-partition-gate branch from f12b6cb to 6b7781f Compare June 20, 2026 13:56
@fresh-borzoni
fresh-borzoni merged commit 162897d into apache:main Jun 20, 2026
7 checks passed
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.

[flink] Single-row lookup pushdown returns empty for lake-only (expired) partitions

3 participants