eldenmoon commented on PR #65561:
URL: https://github.com/apache/doris/pull/65561#issuecomment-5032166252

   ColumnVariantV2 过度设计点:
   1. 状态回滚保留了大量 replacement
   例如 insert_range_from、insert_indices_from 都会:
   clone typed
   ensure_encoded
   写入 replacement
   _adopt_state_from
   既然不考虑失败回滚,可以直接:
   ensure_encoded();
   继续 encoded 写入;
   这能删除多处分支、整列 clone 和部分 _adopt_state_from() 使用。
   
   
   2. typed 状态的删除操作不必要地整列复制
   pop_back 使用 clone_resized();resize() 缩小时也间接复制整列。
   已经要求 _typed exclusive,可以直接调用 _typed->pop_back()。clear() 同理可直接清空,无须 
clone_empty()。
   TypedEncodingStats 是测试逻辑侵入生产接口
   TypedEncodingStats 只被单测使用;非 BE_TEST 构建甚至不会统计,但 ensure_encoded() 仍返回它。
   建议删除:
   TypedEncodingStats
   TypedFallbackKind
   count_fallback
   ensure_encoded() 返回值
   单测直接验证最终 Variant primitive 类型即可。
   
   3. ReadView 的懒校验缓存偏复杂
   column_variant_v2_read_view.cpp 每次创建 view 都分配 _validated_metadata,而非法字节在 
insert_encoded_rows() 时被接收,直到读取才报错。
   更简单且语义更一致的是:在反序列化或插入边界一次性校验,ReadView 只负责无状态访问。整个 ReadView 不一定要删除,但懒校验 cache 
可以删除。
   
   4. _meta_index 需要性能证据
   MetaDictIndex 使用“metadata hash → std::map → candidate vector”,同时带来构建、失效、COW 
detach 和内存估算逻辑。
   metadata 通常很少时,直接线性比较可能更简单、更快。建议没有 benchmark 证明必要时先删除
   
   5. 插入路径存在重复扫描和临时数组
   insert_encoded_rows:583 对 meta_ids 检查两遍,还构造整行 appended_ids;共享 metadata 的 
range copy 也先复制 ID 到临时 vector,再复制进目标列。这些主要也是为了“先准备、后发布”的事务式设计,可以随回滚语义一起简化。


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