HappenLee commented on code in PR #33124:
URL: https://github.com/apache/doris/pull/33124#discussion_r1554887335


##########
be/src/vec/data_types/serde/data_type_struct_serde.cpp:
##########
@@ -413,5 +413,32 @@ Status DataTypeStructSerDe::write_column_to_orc(const 
std::string& timezone, con
     return Status::OK();
 }
 
+Status DataTypeStructSerDe::write_column_to_pb(const IColumn& column, PValues& 
result, int start,
+                                               int end) const {
+    const auto& struct_col = assert_cast<const ColumnStruct&>(column);
+    auto* ptype = result.mutable_type();
+    ptype->set_id(PGenericType::STRUCT);
+    auto tuple_size = struct_col.tuple_size();
+    PValues* child_elements[tuple_size];
+    for (int i = 0; i < tuple_size; ++i) {
+        child_elements[i] = result.add_child_element();
+    }
+    for (int i = 0; i < tuple_size; ++i) {
+        
RETURN_IF_ERROR(elemSerDeSPtrs[i]->write_column_to_pb(struct_col.get_column(i),
+                                                              
*child_elements[i], start, end));
+    }
+    return Status::OK();
+}
+
+Status DataTypeStructSerDe::read_column_from_pb(IColumn& column, const 
PValues& arg) const {
+    auto& struct_column = assert_cast<ColumnStruct&>(column);
+    DCHECK_EQ(struct_column.tuple_size(), arg.child_element_size());
+    for (size_t i = 0; i < struct_column.tuple_size(); ++i) {
+        
RETURN_IF_ERROR(elemSerDeSPtrs[i]->read_column_from_pb(struct_column.get_column(i),

Review Comment:
   change to `elem_serde_ptrs`



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

Reply via email to