Reranko05 commented on code in PR #50937:
URL: https://github.com/apache/arrow/pull/50937#discussion_r3842345617
##########
cpp/src/arrow/integration/json_internal.cc:
##########
@@ -1039,24 +1038,28 @@ Result<std::shared_ptr<DataType>> GetTime(const
RjObject& json_type) {
return type;
}
-Result<std::shared_ptr<DataType>> GetDuration(const RjObject& json_type) {
+Result<std::shared_ptr<DataType>> GetDuration(const JsonObject& json_type) {
ARROW_ASSIGN_OR_RAISE(const TimeUnit::type unit,
GetMemberTimeUnit(json_type, "unit"));
return duration(unit);
}
-Result<std::shared_ptr<DataType>> GetTimestamp(const RjObject& json_type) {
+Result<std::shared_ptr<DataType>> GetTimestamp(const JsonObject& json_type) {
ARROW_ASSIGN_OR_RAISE(const TimeUnit::type unit,
GetMemberTimeUnit(json_type, "unit"));
- const auto& it_tz = json_type.FindMember("timezone");
- if (it_tz == json_type.MemberEnd()) {
+ auto timezone_result = json_type["timezone"];
+ if (timezone_result.error() == simdjson::NO_SUCH_FIELD) {
return timestamp(unit);
- } else {
- RETURN_NOT_STRING("timezone", it_tz, json_type);
- return timestamp(unit, it_tz->value.GetString());
}
+
+ ARROW_ASSIGN_OR_RAISE(auto timezone, internal::ResolveSimdjsonResult(
+ timezone_result, "Failed to get
JSON field"));
+ ARROW_ASSIGN_OR_RAISE(
+ auto timezone_string,
+ internal::ResolveSimdjsonResult(timezone.get_string(), "field was not a
string"));
+ return timestamp(unit, std::string(timezone_string));
Review Comment:
I checked this, but `timestamp()` currently takes a `const std::string&`, so
the conversion is required here.
--
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]