HappenLee commented on code in PR #33124: URL: https://github.com/apache/doris/pull/33124#discussion_r1554854111
########## be/src/vec/data_types/serde/data_type_jsonb_serde.cpp: ########## @@ -239,6 +239,35 @@ Status DataTypeJsonbSerDe::read_one_cell_from_json(IColumn& column, parser.getWriter().getOutput()->getSize()); return Status::OK(); } +Status DataTypeJsonbSerDe::write_column_to_pb(const IColumn& column, PValues& result, int start, + int end) const { + const auto& string_column = assert_cast<const ColumnString&>(column); + result.mutable_string_value()->Reserve(end - start); + auto* ptype = result.mutable_type(); + ptype->set_id(PGenericType::JSONB); + for (size_t row_num = start; row_num < end; ++row_num) { + const auto& string_ref = string_column.get_data_at(row_num); + if (string_ref.size > 0) { + std::string json_string = + JsonbToJson::jsonb_to_json_string(string_ref.data, string_ref.size); + result.add_string_value(json_string); + } else { + result.add_string_value(NULL_IN_CSV_FOR_ORDINARY_TYPE); + } + } + return Status::OK(); +} +Status DataTypeJsonbSerDe::read_column_from_pb(IColumn& column, const PValues& arg) const { + auto& column_string = assert_cast<ColumnString&>(column); + column_string.reserve(arg.string_value_size()); + for (int i = 0; i < arg.string_value_size(); ++i) { + JsonBinaryValue value; Review Comment: better out the for loop -- 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