rok commented on code in PR #44215:
URL: https://github.com/apache/arrow/pull/44215#discussion_r1775501455
##########
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);
+Result<std::shared_ptr<DataType>> JsonExtensionType::Make(
+ const std::shared_ptr<DataType>& storage_type) {
+ if (storage_type->id() != Type::STRING && storage_type->id() !=
Type::STRING_VIEW &&
+ storage_type->id() != Type::LARGE_STRING) {
+ return Status::Invalid("Invalid storage type for JsonExtensionType: ",
+ storage_type->ToString());
+ }
return std::make_shared<JsonExtensionType>(storage_type);
}
+std::shared_ptr<DataType> json(std::shared_ptr<DataType> storage_type) {
+ return JsonExtensionType::Make(storage_type).ValueOrDie();
Review Comment:
Done.
--
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]