taepper commented on code in PR #50653:
URL: https://github.com/apache/arrow/pull/50653#discussion_r3664184399


##########
cpp/src/arrow/json/from_string.cc:
##########
@@ -62,32 +64,85 @@ using ::arrow::internal::checked_pointer_cast;
 
 namespace {
 
-constexpr auto kParseFlags = rj::kParseFullPrecisionFlag | 
rj::kParseNanAndInfFlag;
-
-const char* JsonTypeName(rj::Type json_type) {
-  switch (json_type) {
-    case rapidjson::kNullType:
-      return "null";
-    case rapidjson::kFalseType:
-      return "false";
-    case rapidjson::kTrueType:
-      return "true";
-    case rapidjson::kObjectType:
-      return "object";
-    case rapidjson::kArrayType:
+const char* JsonTypeName(sj::json_type type) {
+  switch (type) {
+    case sj::json_type::array:
       return "array";
-    case rapidjson::kStringType:
-      return "string";
-    case rapidjson::kNumberType:
+    case sj::json_type::object:
+      return "object";
+    case sj::json_type::number:
       return "number";
+    case sj::json_type::string:
+      return "string";
+    case sj::json_type::boolean:
+      return "boolean";
+    case sj::json_type::null:
+      return "null";
     default:
       return "unknown";
   }
 }
 
-Status JSONTypeError(const char* expected_type, rj::Type json_type) {
-  return Status::Invalid("Expected ", expected_type, " or null, got JSON type 
",
-                         JsonTypeName(json_type));
+template <typename>
+inline constexpr bool kAlwaysFalse = false;
+
+template <typename SimdjsonClass>
+const char* JsonTypeName() {
+  constexpr bool isNumber = std::is_same_v<SimdjsonClass, int64_t> ||
+                            std::is_same_v<SimdjsonClass, uint64_t> ||
+                            std::is_same_v<SimdjsonClass, double>;
+  if constexpr (isNumber) {
+    return "number";
+  } else if constexpr (std::is_same_v<SimdjsonClass, sj::array>) {
+    return "array";
+  } else if constexpr (std::is_same_v<SimdjsonClass, sj::object>) {
+    return "object";
+  } else if constexpr (std::is_same_v<SimdjsonClass, std::string_view>) {
+    return "string";
+  } else if constexpr (std::is_same_v<SimdjsonClass, bool>) {
+    return "boolean";
+  } else if constexpr (std::is_same_v<SimdjsonClass, std::monostate>) {

Review Comment:
   Yes, I replaced it with a custom empty class



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

Reply via email to