cambyzju commented on a change in pull request #8217: URL: https://github.com/apache/incubator-doris/pull/8217#discussion_r813649079
########## File path: be/src/olap/row_block2.cpp ########## @@ -328,6 +348,222 @@ Status RowBlockV2::_copy_data_to_column(int cid, doris::vectorized::MutableColum return Status::OK(); } +Status RowBlockV2::_append_data_to_column(const ColumnVectorBatch* batch, uint16_t off, uint16_t len, doris::vectorized::MutableColumnPtr& origin_column) { + constexpr auto MAX_SIZE_OF_VEC_STRING = 1024l * 1024; + + auto* column = origin_column.get(); + uint16_t selected_size = len; + bool nullable_mark_array[selected_size]; + + bool column_nullable = origin_column->is_nullable(); + bool origin_nullable = batch->is_nullable(); + if (column_nullable) { + auto nullable_column = assert_cast<vectorized::ColumnNullable*>(origin_column.get()); + auto& null_map = nullable_column->get_null_map_data(); + column = nullable_column->get_nested_column_ptr().get(); + + if (origin_nullable) { + for (uint16_t i = 0; i < selected_size; ++i) { + uint16_t row_idx = i + off; + null_map.push_back(batch->is_null_at(row_idx)); + nullable_mark_array[i] = null_map.back(); + } + } else { + null_map.resize_fill(null_map.size() + selected_size, 0); + memset(nullable_mark_array, false, selected_size * sizeof(bool)); + } + } else { + memset(nullable_mark_array, false, selected_size * sizeof(bool)); + } + + auto insert_data_directly = [&nullable_mark_array](auto& batch, auto& column, auto& off, auto& len) { + for (uint16_t j = 0; j < len; ++j) { + if (!nullable_mark_array[j]) { + uint16_t row_idx = j + off; + column->insert_data( + reinterpret_cast<const char*>(batch->cell_ptr(row_idx)), 0); + } else { + column->insert_default(); + } + } + }; + + switch (batch->type_info()->type()) { + case OLAP_FIELD_TYPE_OBJECT: { + auto column_bitmap = assert_cast<vectorized::ColumnBitmap*>(column); + for (uint16_t j = 0; j < selected_size; ++j) { + column_bitmap->insert_default(); + if (!nullable_mark_array[j]) { + uint16_t row_idx = j + off; + auto slice = reinterpret_cast<const Slice*>(batch->cell_ptr(row_idx)); + + BitmapValue* pvalue = &column_bitmap->get_element(column_bitmap->size() - 1); + + if (slice->size != 0) { + BitmapValue value; + value.deserialize(slice->data); + *pvalue = std::move(value); + } else { + *pvalue = std::move(*reinterpret_cast<BitmapValue*>(slice->data)); + } + } + } + break; + } + case OLAP_FIELD_TYPE_HLL: Review comment: done -- 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