eldenmoon commented on PR #61539: URL: https://github.com/apache/doris/pull/61539#issuecomment-4294359587
Review complete ā 3 findings š“ be/src/core/column/column_variant.cpp:2864-2878 convert_subcolumns_to_doc_value() calls variant_util::get_sorted_subcolumns(subcolumns) inside the per-row loop, turning an O(S log S + NĀ·S) conversion into O(NĀ·S log S) with N transient allocations/sorts. Hoist the call into a local before the outer loop, matching the pattern already used in the sibling _insert_range_from_doc_mode scenario 3. This path runs during compaction/flush over potentially millions of rows, so the overhead is significant. š” fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:3688-3698 The PR adds two duplicate assignments to defaultVariantDocHashShardCount in initFuzzyModeVariables(): line 3691 redundantly re-rolls the same random value assigned on line 3688 (making line 3688 dead code), and line 3698 duplicates the zero-assignment on line 3697 verbatim. Both appear to be copy-paste/rebase artifacts ā functionally harmless but worth cleaning up before merge. š“ be/src/core/column/column_variant.cpp:1281-1286 Scenario 4 in _insert_range_from_doc_mode (and _insert_from_doc_mode) calls convert_subcolumns_to_doc_value() then recurses, but convert_subcolumns_to_doc_value() early-returns at the top when num_rows == 0 without collapsing subcolumns to root-only. If dst is in the state (num_rows == 0, subcolumns.size() > 1) ā which check_consistency() explicitly permits ā the post-convert state still has dst_has_subcolumns == true, so the recursive call re-enters scenario 4 and recurses until stack overflow. Fix: in the num_rows == 0 branch, collapse subcolumns down to a single root-only entry before returning (same tail that runs in the non-empty path), or guard the recursive call in scenario 4 so it cannot re-select the same branch. -- 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]
