Select fileds rathert * to read snapshot data in case schema changes.#4273
Open
loserwang1024 wants to merge 1 commit intoapache:masterfrom
Open
Select fileds rathert * to read snapshot data in case schema changes.#4273loserwang1024 wants to merge 1 commit intoapache:masterfrom
loserwang1024 wants to merge 1 commit intoapache:masterfrom
Conversation
ffce44c to
0d86de2
Compare
0d86de2 to
032ffbc
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Postgres snapshot split scanning to select an explicit column list (instead of *) so snapshot reads are more robust when the underlying table schema changes (FLINK-39071).
Changes:
- Extend
PostgresQueryUtils.buildSplitScanQueryto optionally accept a column projection list. - Update
PostgresScanFetchTaskto build and pass a quoted column list from the DebeziumTableschema for snapshot queries. - Simplify the internal query builder path by removing unused split-query branching/limit handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.../utils/PostgresQueryUtils.java |
Adds a column-projection overload for split scan queries and simplifies select query construction. |
.../fetch/PostgresScanFetchTask.java |
Builds an explicit quoted column list from the schema and uses it for snapshot split SELECT statements. |
Comments suppressed due to low confidence (1)
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-postgres-cdc/src/main/java/org/apache/flink/cdc/connectors/postgres/source/utils/PostgresQueryUtils.java:321
buildSelectWithRowLimitsno longer applies any LIMIT clause (thelimitparameter and logic were removed), so the method name is now misleading and the remainingbuildSelectWithBoundaryRowLimits/get*Projectionhelpers appear to be unused. Consider either renaming this method to reflect its current behavior and removing the now-dead boundary/PK projection helpers, or reintroducing a limit parameter if limiting is still required elsewhere.
private static String buildSelectWithRowLimits(
TableId tableId,
String projection,
Optional<String> condition,
Optional<String> orderBy) {
final StringBuilder sql = new StringBuilder("SELECT ");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...c/main/java/org/apache/flink/cdc/connectors/postgres/source/fetch/PostgresScanFetchTask.java
Show resolved
Hide resolved
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.
Fix https://issues.apache.org/jira/browse/FLINK-39071