Mryange opened a new pull request, #70421: URL: https://github.com/apache/doris/pull/70421
### Background During tablet block validation, complex columns can be referenced by multiple output slots. Validation may truncate or normalize a column in place when adapting it to a destination type. ### What problem does this PR solve? Issue Number: None Related PR: None PR Type: Bugfix Problem Summary: When the same MAP column is inserted into two destination columns, validation of a narrower destination type can mutate the shared input column. The later destination column then observes the truncated values. The fix propagates copy-on-write ownership through the actual column slots and refreshes nullable/real-column views after replacement, while keeping mutation targeted to paths that modify data. ### Details - **Frequency:** Occurs when one input complex column is reused for multiple output columns and an earlier destination type requires truncation or normalization. - **Root cause:** Validation received immutable column pointers and used `const_cast` to mutate nested Decimal, ARRAY, MAP, and STRUCT columns, so shared column trees were modified in place. - **Why existing tests missed it:** Existing coverage validated individual complex-column conversions but did not reuse one MAP expression across destinations with different nested string widths. - **Fix:** Pass owner `ColumnPtr` references through recursive validation, use `IColumn::mutate` only before mutating paths, and refresh cached views after ownership replacement. - **Other paths and branches:** The change is isolated to tablet block validation and applies to nested complex columns; no FE or schema changes are required. ### Testing - `sh build.sh --be -j48` on the validation checkout completed successfully. - Manual SQL reproduction on the rebuilt BE confirmed the narrow MAP output is truncated while the second full-width MAP retains its original values. - Generated and reran `./run-regression-test.sh --run -f regression-test/suites/datatype_p0/map/test_map_insert_shared_column.groovy -forceGenOut`; the suite passed. - A second run without `-forceGenOut` passed with the generated baseline. - A fresh latest-master BE build was attempted but could not complete because the third-party download for `libxml2-v2.9.10.tar.gz` returned an empty file; the patch itself was compiled successfully in the validation checkout. ### Notes for Reviewers The runtime validation used an already built FE with query port 9230 and the rebuilt BE. The FE and BE binaries therefore report different build revisions during that check. ### Release note Prevent shared complex input columns from being unexpectedly truncated during INSERT type conversion. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Ready ### AI Disclosure - Tool: Codex - Generated: Production code, regression test, generated output, and this description - Human review: Reviewed the source diff, generated baseline, build/test output, and task file scope -- 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]
