[FLINK-39718][pipeline][paimon] Paimon pipeline sink fails with distributed source when target table does not exist#4406
Open
ThorneANN wants to merge 1 commit into
Conversation
Member
|
@ThorneANN nice job. btw, I think your commit message needs to be formatted, for example, [FLINK-xxx] [module] yyy |
Contributor
Author
|
@lvyanquan Hi,can u help me review this pr. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using a distributed pipeline source (e.g., Kafka, any source where isParallelMetadataSource() = true) with a Paimon sink, the job fails with TableNotExistException if the
target table does not already exist in the catalog.
Root cause: In the distributed pipeline topology, DistributedPrePartitionOperator runs before SchemaOperator. When it receives a CreateTableEvent, it immediately calls
PaimonHashFunctionProvider.getHashFunction(), which constructs a PaimonHashFunction. The PaimonHashFunction constructor called catalog.getTable() to determine whether the table is
append-only — but the table hasn't been created yet because MetadataApplier hasn't run.
This does not affect MySQL-CDC pipelines because the regular topology routes events through SchemaOperator first, so the table always exists by the time
RegularPrePartitionOperator creates the hash function.
Fix
PaimonHashFunction queried the catalog for exactly one reason: to distinguish append-only tables (no primary key) from primary-key tables. This information is already available in
the CDC Schema object passed to getHashFunction() via schema.primaryKeys().
Changes:
from the CDC Schema (column types, partition keys, primary keys) to initialize RowAssignerChannelComputer. No catalog access at any stage.