You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/10/01 09:16:01 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #8309: ARROW-7372: [C++] Allow creating dictionary array from simple JSON

pitrou commented on a change in pull request #8309:
URL: https://github.com/apache/arrow/pull/8309#discussion_r498099713



##########
File path: cpp/src/arrow/ipc/json_simple.cc
##########
@@ -50,13 +51,35 @@ namespace json {
 using ::arrow::internal::checked_cast;
 using ::arrow::internal::checked_pointer_cast;
 
-static constexpr auto kParseFlags = rj::kParseFullPrecisionFlag | rj::kParseNanAndInfFlag;
+namespace {
 
-static Status JSONTypeError(const char* expected_type, rj::Type json_type) {
+constexpr auto kParseFlags = rj::kParseFullPrecisionFlag | rj::kParseNanAndInfFlag;
+
+Status JSONTypeError(const char* expected_type, rj::Type json_type) {
   return Status::Invalid("Expected ", expected_type, " or null, got JSON type ",
                          json_type);
 }
 
+template <typename Type>
+struct RegularBuilderTraits {
+  using BuilderType = typename TypeTraits<Type>::BuilderType;
+
+  static const std::shared_ptr<DataType>& value_type(
+      const std::shared_ptr<DataType>& type) {
+    return type;
+  }
+};
+
+template <typename Type>
+struct DictionaryBuilderTraits {
+  using BuilderType = DictionaryBuilder<Type>;
+
+  static const std::shared_ptr<DataType>& value_type(
+      const std::shared_ptr<DataType>& type) {
+    return checked_cast<const DictionaryType&>(*type).value_type();
+  }
+};
+

Review comment:
       Ah, right, thank you.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org