Mryange opened a new pull request, #70658: URL: https://github.com/apache/doris/pull/70658
### Background Doris columns use copy-on-write ownership. Unchanged columns and subcolumns can be shared through immutable owners, with later writes detaching shared data. ### What problem does this PR solve? Issue Number: None Related PR: #70606 (independent optimization of other copy sites; no dependency) PR Type: Performance Problem Summary: Several expression and Parquet Variant paths copy column data that is immediately stored without modification. Share selected IF arguments, unchanged array offsets and null maps, and constant values instead. Preserve the existing clone contracts and retain copying where resizing or modifying data requires it. ### Details - **Why it was slow:** Whole-column IF branches copied the selected payload, array_map copied offsets even when they were later discarded, and constant evaluation copied physical values merely to change the logical row count. - **Optimization:** Reuse immutable owners for IF results, one-dimensional array_flatten, array_map offsets, and Parquet Variant null maps. Create new ColumnConst wrappers sharing their physical values. Move insert_param to its source file to keep the constant-column dependency out of the public header. - **Results:** Removes these eager copy operations by source inspection. No benchmark was run; no measured speedup is claimed. - **Applicability and cost:** Applies to the listed paths when their data is unchanged. Hidden NULL payload still rebuilds array_map offsets, multidimensional array_flatten still composes offsets, and later writes retain normal COW detachment. ### Testing - Linux ASAN BE build: `sh build.sh --be -j48` passed. - clang-format 16, `build-support/check-build-hygiene.sh`, and `git diff --check` passed. - No unit tests were added or run. Regression tests and performance benchmarks were not run. ### Release note Reduce intermediate column copying in conditional expressions, array functions, constant evaluation, and Parquet Variant conversion without changing query results. ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Partially verified: ASAN BE build and source checks passed; runtime tests and benchmarks were not run. ### AI Disclosure - Tool: Codex (GPT-6) - Generated: Code changes and PR description. - Human review: The author reviewed and approved the patch before submission. -- 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]
