Skip to content

[flink] Fix batch query on empty datalake-enabled table to return 0 rows instead of failing#3208

Open
matrixsparse wants to merge 2 commits intoapache:mainfrom
matrixsparse:feature/issue-3207-empty-lake-batch-query
Open

[flink] Fix batch query on empty datalake-enabled table to return 0 rows instead of failing#3208
matrixsparse wants to merge 2 commits intoapache:mainfrom
matrixsparse:feature/issue-3207-empty-lake-batch-query

Conversation

@matrixsparse
Copy link
Copy Markdown
Contributor

Summary

  • When a datalake-enabled table is empty (no lake snapshot), batch query via Flink SQL
    throws UnsupportedOperationException. This PR makes it return empty result
    (0 rows) instead, consistent with Spark connector behavior.

Root Cause

In FlinkSourceEnumerator.startInBatchMode(), generateHybridLakeFlussSplits()
returns null when no lake snapshot exists. The stream mode code in the same
commit (7937996) correctly falls back to initNonPartitionedSplits(), but the
batch mode path was left to throw an exception.

Change

  • FlinkSourceEnumerator.java: Return Collections.emptyList() instead of
    throwing UnsupportedOperationException when splits is null.

Verification

  • Ran mvnw test -pl fluss-flink/fluss-flink-common -Dtest="FlinkSourceEnumerator*"
  • All existing tests pass

Fixes #3207

Copy link
Copy Markdown
Contributor

@binary-signal binary-signal left a comment

Choose a reason for hiding this comment

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

LGMT +1

@matrixsparse
Copy link
Copy Markdown
Contributor Author

Thanks for the review!

@binary-signal
Copy link
Copy Markdown
Contributor

@fresh-borzoni @luoyuxia PTAL

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] Batch query on empty datalake-enabled table should return 0 rows instead of failing with UnsupportedOperationException

2 participants