zhiqiang-hhhh commented on code in PR #52701: URL: https://github.com/apache/doris/pull/52701#discussion_r2225645859
########## be/src/olap/rowset/segment_v2/segment_iterator.cpp: ########## @@ -2594,7 +2778,63 @@ bool SegmentIterator::_can_opt_topn_reads() { return all_true; } -#include "common/compile_check_end.h" +// Before get next batch. make sure all virtual columns in block has type ColumnNothing. +void SegmentIterator::_init_virtual_columns(vectorized::Block* block) { + for (const auto& pair : _vir_cid_to_idx_in_block) { + auto& col_with_type_and_name = block->get_by_position(pair.second); + col_with_type_and_name.column = vectorized::ColumnNothing::create(0); + col_with_type_and_name.type = _opts.vir_col_idx_to_type[pair.second]; + } +} + +Status SegmentIterator::_materialization_of_virtual_column(vectorized::Block* block) { + size_t prev_block_columns = block->columns(); + for (const auto& cid_and_expr : _virtual_column_exprs) { + auto cid = cid_and_expr.first; + auto column_expr = cid_and_expr.second; + size_t idx_in_block = _vir_cid_to_idx_in_block[cid]; + if (block->columns() <= idx_in_block) { + LOG_ERROR("Block columns: {}, virtual column idx {}", block->columns(), idx_in_block); Review Comment: removed -- 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