taepper commented on code in PR #50653:
URL: https://github.com/apache/arrow/pull/50653#discussion_r3664065370
##########
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;
Review Comment:
I see. Was able to replace with `static_assert(false,..)` inline. Not sure
why this produced an error for me before. Might had missed a `constexpr` in one
of the elif branches and thought this indirection was necessary
--
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]