yiguolei commented on code in PR #30906:
URL: https://github.com/apache/doris/pull/30906#discussion_r1480732162


##########
be/src/olap/tablet_schema.cpp:
##########
@@ -1382,4 +1386,13 @@ bool operator!=(const TabletSchema& a, const 
TabletSchema& b) {
     return !(a == b);
 }
 
+std::string TabletSchema::deterministic_string_serialize(const TabletSchemaPB& 
schema_pb) {
+    std::string output;
+    google::protobuf::io::StringOutputStream string_output_stream(&output);
+    google::protobuf::io::CodedOutputStream 
output_stream(&string_output_stream);
+    output_stream.SetSerializationDeterministic(true);

Review Comment:
   Are you sure the deterministic serialize will take affect on map value?
   void CodedOutputStream::SetSerializationDeterministic(
           bool value) 
   Indicate to the serializer whether the user wants derministic serialization.
   
   The default when this is not called comes from the global default, 
controlled by SetDefaultSerializationDeterministic.
   
   What deterministic serialization means is entirely up to the driver of the 
serialization process (i.e. the caller of methods like WriteVarint32). In the 
case of serializing a proto buffer message using one of the methods of 
[MessageLite](https://protobuf.dev/reference/cpp/api-docs/google.protobuf.io.coded_stream/google.protobuf.message_lite#MessageLite),
 this means that for a given binary equal messages will always be serialized to 
the same bytes. This implies:
   
   Repeated serialization of a message will return the same bytes.
   Different processes running the same binary (including on different
   machines) will serialize equal messages to the same bytes.
   
   Note that this is not canonical across languages. It is also unstable across 
different builds with intervening message definition changes, due to unknown 
fields. Users who need canonical serialization (e.g. persistent storage in a 
canonical form, fingerprinting) should define their own canonicalization 
specification and implement the serializer using reflection APIs rather than 
relying on this API.



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