lvyanquan commented on PR #4562:
URL: https://github.com/apache/flink-cdc/pull/4562#issuecomment-5876533632

   Fixed the partitioned-table e2e failure.
   
   **Root cause:** `MaxComputeUtils.createPartitionIfAbsent` always calls 
`Table.createPartition(spec, true)`, which issues `ALTER TABLE 
<project>.<table> ADD IF NOT EXISTS PARTITION (...)`. The MaxCompute emulator 
(v0.0.7) only rewrites CREATE TABLE / ADD|DROP|RENAME COLUMN / DROP TABLE 
statements and passes other statements straight to its sqlite backend, so the 
ALTER fails with `no such table: MOCKED_MC.TABLE1` and the job gets stuck 
restarting.
   
   **Fix:** check `hasPartition` first and skip creation when the partition 
exists. On real MaxCompute this is a pure idempotency improvement (the 
`ifNotExists` flag still guards concurrent creation between check and create); 
on the emulator `hasPartition` returns true, so the unsupported ALTER is never 
issued. Verified locally that the full write path (create partitioned table -> 
createPartitionIfAbsent -> upsert session with partition spec -> 
write/flush/commit -> query back 3 rows across 2 partitions) works against the 
emulator via the new `MaxComputeUtilsPartitionTest`.
   
   Also made `EmulatorTestBase` create a fresh container per test class (a 
stopped GenericContainer cannot be restarted) and set the tunnel endpoint, 
which the upsert-session path needs.


-- 
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]

Reply via email to