zhjwpku commented on code in PR #553:
URL: https://github.com/apache/iceberg-cpp/pull/553#discussion_r2757482708
##########
src/iceberg/expression/json_serde.cc:
##########
@@ -123,6 +130,41 @@ nlohmann::json ToJson(Expression::Operation op) {
return json;
}
+nlohmann::json ToJson(const NamedReference& ref) { return
std::string(ref.name()); }
+
+Result<std::shared_ptr<NamedReference>> NamedReferenceFromJson(
+ const nlohmann::json& json) {
+ if (!json.is_string()) {
+ return JsonParseError("Expected string for named reference");
+ }
+ ICEBERG_ASSIGN_OR_RAISE(auto ref,
NamedReference::Make(json.get<std::string>()));
+ return std::shared_ptr<NamedReference>(std::move(ref));
+}
+
+nlohmann::json ToJson(const UnboundTransform& transform) {
+ auto& mutable_transform = const_cast<UnboundTransform&>(transform);
+ nlohmann::json json;
+ json[kType] = std::string(kTransform);
Review Comment:
Oh, I'm not entirely sure, but I noticed a similar usage here:
https://github.com/apache/iceberg-cpp/blob/main/src/iceberg/json_serde.cc#L1295
--
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]