yiguolei commented on code in PR #52676:
URL: https://github.com/apache/doris/pull/52676#discussion_r2182074845
##########
be/src/vec/data_types/serde/data_type_variant_serde.cpp:
##########
@@ -210,27 +210,50 @@ Status DataTypeVariantSerDe::write_column_to_orc(const
std::string& timezone, co
std::vector<StringRef>&
buffer_list) const {
const auto* var = check_and_get_column<ColumnVariant>(column);
orc::StringVectorBatch* cur_batch =
dynamic_cast<orc::StringVectorBatch*>(orc_col_batch);
-
- INIT_MEMORY_FOR_ORC_WRITER()
-
+ // First pass: calculate total memory needed and collect serialized values
+ std::vector<std::string> serialized_values;
+ std::vector<size_t> valid_row_indices;
+ size_t total_size = 0;
for (size_t row_id = start; row_id < end; row_id++) {
if (cur_batch->notNull[row_id] == 1) {
- auto serialized_value = std::make_unique<std::string>();
- if (!var->serialize_one_row_to_string(row_id,
serialized_value.get())) {
+ // avoid move the string data, use emplace_back to construct in
place
+ serialized_values.emplace_back();
+ if (!var->serialize_one_row_to_string(row_id,
&serialized_values.back())) {
throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Failed to
serialize variant {}",
var->dump_structure());
Review Comment:
这里为啥是throw exception,不是返回error status?
--
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]