yingcai-cy commented on code in PR #75:
URL: https://github.com/apache/iceberg-cpp/pull/75#discussion_r2044335637


##########
src/iceberg/statistics_file.cc:
##########
@@ -23,29 +23,26 @@
 
 namespace iceberg {
 
-bool BlobMetadata::Equals(const BlobMetadata& other) const {
-  return type == other.type && source_snapshot_id == other.source_snapshot_id 
&&
-         source_snapshot_sequence_number == 
other.source_snapshot_sequence_number &&
-         fields == other.fields && properties == other.properties;
-}
-
-std::string BlobMetadata::ToString() const {
+std::string ToString(const BlobMetadata& blob_metadata) {
   std::string repr = "BlobMetadata[";
   std::format_to(std::back_inserter(repr),
-                 
"type='{}',sourceSnapshotId={},sourceSnapshotSequenceNumber={},", type,
-                 source_snapshot_id, source_snapshot_sequence_number);
+                 
"type='{}',sourceSnapshotId={},sourceSnapshotSequenceNumber={},",
+                 blob_metadata.type, blob_metadata.source_snapshot_id,
+                 blob_metadata.source_snapshot_sequence_number);
   std::format_to(std::back_inserter(repr), "fields=[");
-  for (auto iter = fields.cbegin(); iter != fields.cend(); ++iter) {
-    if (iter != fields.cbegin()) {
+  for (auto iter = blob_metadata.fields.cbegin(); iter != 
blob_metadata.fields.cend();

Review Comment:
   how about:
   ```suggestion
     if (!blob_metadata.fields.empty()) {
       std::format_to(std::back_inserter(repr), "{}", 
blob_metadata.fields.front());
     for (auto iter = std::next(blob_metadata.fields.cbegin()); iter != 
blob_metadata.fields.cend(); ++iter) {
       std::format_to(std::back_inserter(repr), ",{}", *iter);
     }
     }
   ```
   Remove the if/else in the for loop or we should wrap a helper function.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to