JingsongLi commented on PR #10297:
URL: https://github.com/apache/paimon/pull/10297#issuecomment-5935589817

   Additional **[P1] Compute routing from the default-normalized row** at 
`StoreSinkWriteImpl.java:157–159` (`1944e95879`).
   
   The new mapped path calls `write.getPartition(row)` and 
`write.getBucket(row)` on the raw input, then passes that bucket explicitly to 
`TableWriteImpl.writeAndReturn`. The latter applies column defaults at line 243 
before extracting the stored row, but keeps the already supplied bucket. The 
written value and the bucket can therefore disagree. `FixedBucketSink` supplies 
a non-null mapping for ordinary fixed-bucket tables too, so this regression 
occurs even when `bucket.per-partition-count-enabled` is absent/disabled.
   
   I reproduced this through actual Flink SQL:
   
   ```sql
   CREATE TABLE T (a INT, b INT) WITH (
     'bucket'='4', 'bucket-key'='b', 'bucket-function.type'='mod');
   CALL sys.alter_column_default_value('default.T', 'b', '5');
   INSERT INTO T (a) VALUES (1);
   SELECT * FROM T;             -- returns [1, 5]
   SELECT * FROM T WHERE b=5;   -- incorrectly returns no rows
   ```
   
   The null input routes to bucket 0, while the stored default `5` belongs to 
bucket 1. The filtered query prunes bucket 0 and silently misses the committed 
row. As a falsification control, restoring only the old 
`StoreSinkWriteImpl.write(row)` body makes the same INSERT and both queries 
pass; the rest of this PR remained in place. The original PR source was 
restored after the test.
   
   Resolve the partition, bucket and total count from the same 
default-normalized row used for storage, preferably inside the existing 
conversion path rather than duplicating default handling before it. Include a 
real fixed-bucket default-key INSERT/filter regression test; partition defaults 
also need to participate in count resolution after normalization.
   


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