wgtmac commented on code in PR #44215:
URL: https://github.com/apache/arrow/pull/44215#discussion_r1776206695


##########
cpp/src/arrow/extension/json.cc:
##########
@@ -51,11 +47,18 @@ std::shared_ptr<Array> JsonExtensionType::MakeArray(
   return std::make_shared<ExtensionArray>(data);
 }
 
-std::shared_ptr<DataType> json(const std::shared_ptr<DataType> storage_type) {
-  ARROW_CHECK(storage_type->id() != Type::STRING ||
-              storage_type->id() != Type::STRING_VIEW ||
-              storage_type->id() != Type::LARGE_STRING);
-  return std::make_shared<JsonExtensionType>(storage_type);
+Result<std::shared_ptr<DataType>> JsonExtensionType::Make(
+    std::shared_ptr<DataType> storage_type) {
+  if (storage_type->id() != Type::STRING && storage_type->id() != 
Type::STRING_VIEW &&

Review Comment:
   Should we add the following static function to `JsonExtensionType` to remove 
repeated code here and in cpp/src/parquet/arrow/schema.cc below?
   
   ```
   static bool IsSupportedStorageType(Type::type type_id) {
     return type_id == Type::STRING || type_id == Type::STRING_VIEW || type_id 
== Type::LARGE_STRING;
   }
   ```



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