zhjwpku commented on code in PR #791:
URL: https://github.com/apache/iceberg-cpp/pull/791#discussion_r3490509548


##########
src/iceberg/json_serde.cc:
##########
@@ -808,12 +822,54 @@ Result<std::unique_ptr<Snapshot>> SnapshotFromJson(const 
nlohmann::json& json) {
     }
   }
 
+  auto parse_summary_int64 =
+      [&summary](const std::string& key) -> Result<std::optional<int64_t>> {
+    auto it = summary.find(key);
+    if (it == summary.end()) {
+      return std::nullopt;
+    }
+    ICEBERG_ASSIGN_OR_RAISE(auto value, 
StringUtils::ParseNumber<int64_t>(it->second));
+    return value;
+  };
+
+  ICEBERG_ASSIGN_OR_RAISE(auto first_row_id,
+                          GetJsonValueOptional<int64_t>(json, kFirstRowId));
+  if (!first_row_id.has_value()) {
+    ICEBERG_ASSIGN_OR_RAISE(first_row_id,
+                            
parse_summary_int64(SnapshotSummaryFields::kFirstRowId));
+  }
+
+  ICEBERG_ASSIGN_OR_RAISE(auto added_rows,
+                          GetJsonValueOptional<int64_t>(json, kAddedRows));
+  if (!added_rows.has_value()) {
+    ICEBERG_ASSIGN_OR_RAISE(added_rows,
+                            
parse_summary_int64(SnapshotSummaryFields::kAddedRows));
+  }
+
+  summary.erase(SnapshotSummaryFields::kFirstRowId);

Review Comment:
   I think these two fields are dedicated to v3, see 
https://iceberg.apache.org/spec/#snapshots



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

Reply via email to