yujun777 opened a new issue, #65440:
URL: https://github.com/apache/doris/issues/65440

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/doris/issues) 
and found no similar issues.
   
   ### Version
   
   Reproduced on local Doris master-based checkout on 2026-07-10.
   
   ### What's Wrong?
   
   `ROW` binlog `MIN_DELTA` can crash BE when a historical-value query touches 
a complex `NOT NULL` column such as `BITMAP`.
   
   The root cause is that `MIN_DELTA` does not materialize separate schemas for 
update-before rows and update-after rows. Instead, it writes both row kinds 
through one unified output schema, which is the generated after/output value 
schema.
   
   That means the update-before value also has to be written into the after 
value slot. But before this fix, FE generated the after value column by copying 
the user column definition directly. For a user column like `b BITMAP NOT 
NULL`, the generated after/output slot stayed non-nullable, while the before 
value still came from the nullable `__DORIS_BEFORE_*` mirror column.
   
   When `MIN_DELTA` tried to materialize the before row into that unified 
after/output slot, BE could crash with:
   
   ```text
   F20260710 11:13:48.523105 ... status.h:472] Bad cast from 
type:doris::ColumnNullable to doris::ColumnComplexType<(doris::PrimitiveType)22>
   ```
   
   ### What You Expected?
   
   `MIN_DELTA` should not crash. The generated output schema should accept both 
before rows and after rows, including nullable before values for complex 
columns.
   
   ### How to Reproduce?
   
   Minimal table shape:
   
   ```sql
   CREATE TABLE changes_mow_bitmap (
       id BIGINT,
       b BITMAP NOT NULL
   ) ENGINE=OLAP
   UNIQUE KEY(id)
   DISTRIBUTED BY HASH(id) BUCKETS 1
   PROPERTIES (
       "replication_num" = "1",
       "enable_unique_key_merge_on_write" = "true",
       "light_schema_change" = "true",
       "binlog.enable" = "true",
       "binlog.format" = "ROW",
       "binlog.need_historical_value" = "true"
   );
   
   INSERT INTO changes_mow_bitmap VALUES (1, BITMAP_FROM_STRING('1,2'));
   SYNC;
   INSERT INTO changes_mow_bitmap VALUES (1, BITMAP_FROM_STRING('3,4'));
   SYNC;
   
   SELECT id, BITMAP_TO_STRING(b), __DORIS_BINLOG_OP__
   FROM changes_mow_bitmap@incr(
       'startTimestamp' = '2026-07-10 11:13:46',
       'endTimestamp' = '2026-07-10 11:13:48',
       'incrementType' = 'MIN_DELTA'
   )
   ORDER BY __DORIS_BINLOG_OP__;
   ```
   
   Existing regression reproduction:
   
   ```text
   regression-test/suites/row_binlog_p0/test_binlog_changes_syntax.groovy
   ```
   
   Repro validation:
   
   1. Apply the fix in PR #65438 and verify the regression passes.
   2. Temporarily revert the `Column.java` change from PR #65438.
   3. Rebuild FE and rerun:
      `./run-regression-test.sh --run -d row_binlog_p0 -s 
test_binlog_changes_syntax`
   4. BE crashes at `bitmap_min_delta` with the bad cast above.
   
   ### Anything Else?
   
   - Tracking list: #65265
   - Consolidated tracker: #65418
   - Fix PR: #65438
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to