pitrou commented on code in PR #14486:
URL: https://github.com/apache/arrow/pull/14486#discussion_r1003415982


##########
cpp/src/arrow/ipc/json_simple.cc:
##########
@@ -63,10 +63,11 @@ using ::arrow::internal::checked_pointer_cast;
 namespace {
 
 constexpr auto kParseFlags = rj::kParseFullPrecisionFlag | 
rj::kParseNanAndInfFlag;
-
+constexpr std::array<const char*, 7> kJsonTypeNames{"null",  "false",  "true", 
 "object",
+                                                    "array", "string", 
"number"};

Review Comment:
   1. Let's keep it simple and make it a `std::vector`? (we don't care whether 
it can be made `constexpr` or not)
   2. Is this robust against potential changes in enumeration order? Perhaps it 
would be better to instead make it a helper function:
   ```c++
   const char* JSONTypeName(rj::Type json_type) {
     switch (json_type) {
       case rj::kNullType: return "null";
       // etc.
     }
   }
   ```



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