evindj commented on code in PR #553:
URL: https://github.com/apache/iceberg-cpp/pull/553#discussion_r2765097879
##########
src/iceberg/expression/json_serde.cc:
##########
@@ -123,6 +129,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()) [[unlikely]] {
+ 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] = kTransform;
+ json[kTransform] = transform.transform()->ToString();
+ json[kTerm] = std::string(mutable_transform.reference()->name());
Review Comment:
I donl think like 146 is ok, after some research, I think what is happening
here is the following: MSVC is having hard times deciding what overload for
operators to use between
nlohmann::json::operator== (from nlohmann_json library)
std::operator==<char, std::char_traits<char>> for string_view (from MSVC's
STL)
a similar confusion is happening for constructors. I can push a another diff
to confirm, I will push another version to confirm
--
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]