niumy0701 opened a new pull request, #13406:
URL: https://github.com/apache/seatunnel/pull/13406
### Purpose of this pull request
Fixes #13405.
A PostgreSQL partitioned table parent is stored in `pg_class` with `relkind
= 'p'`, but the
approximate row count lookup used by the dynamic shard splitter only matched
`relkind = 'r'`.
For a partitioned parent the lookup returned no row and the job failed
during split generation
with `No result returned after running query [...]`. This was reported from
a 2.3.13 production
job (Flink 1.20, `table_list` mode with table-level `query` and
`partition_column`; the top-level
`query`/`partition_column` options are empty there, so the dynamic splitter
is always used).
Changes:
- `PostgresDialect#approximateRowCntStatement` now uses `relkind IN ('r',
'p')` so the
partitioned parent's `reltuples` entry is found (one-line lookup change
plus a comment).
- Unit test in `PostgresDialectTest` asserts the generated SQL and the
returned count.
- New E2E case `testPartitionedTableSource` in `JdbcPostgresIT` creates a
range-partitioned
table (parent PK + two partitions), runs a full batch read through the
table mode (dynamic
splitter path) and asserts the sink rows match the source.
### Does this PR introduce any user-facing change?
Yes: reading a PostgreSQL partitioned table with the JDBC source no longer
fails during split
generation. Previously failing configurations now work.
### How was this patch tested?
- Unit test:
`PostgresDialectTest#testApproximateRowCntStatementCoversPartitionedTables`
- E2E: `JdbcPostgresIT#testPartitionedTableSource` (runs in CI with the
PostgreSQL container)
- Local Maven could not resolve the SNAPSHOT modules in this environment, so
the execution
evidence comes from the fork Build / CI on this branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]