eldenmoon commented on code in PR #49020: URL: https://github.com/apache/doris/pull/49020#discussion_r1992860438
########## be/src/vec/columns/column_object.cpp: ########## @@ -1902,8 +1902,22 @@ Status ColumnObject::extract_root(const PathInData& path, MutableColumnPtr& dst) void ColumnObject::insert_indices_from(const IColumn& src, const uint32_t* indices_begin, const uint32_t* indices_end) { - for (const auto* x = indices_begin; x != indices_end; ++x) { - ColumnObject::insert_from(src, *x); + // optimize when src and this column are scalar variant, since try_insert is inefficiency + const auto* src_v = check_and_get_column<ColumnObject>(src); + if (src_v != nullptr && src_v->is_scalar_variant() && is_scalar_variant() && + src_v->get_root_type()->equals(*get_root_type())) { + // do src/dst finalization if needed + finalize(); + const_cast<ColumnObject*>(src_v)->finalize(); Review Comment: need to make sure the const_cast is safe, otherwise leading to potential memory bug -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org