kou commented on code in PR #50874:
URL: https://github.com/apache/arrow/pull/50874#discussion_r3816785045
##########
cpp/src/arrow/extension/fixed_shape_tensor.cc:
##########
@@ -116,60 +115,190 @@ Result<std::shared_ptr<DataType>>
FixedShapeTensorType::Deserialize(
return Status::Invalid("Expected FixedSizeList storage type, got ",
storage_type->ToString());
}
+
auto fsl_type =
internal::checked_pointer_cast<FixedSizeListType>(storage_type);
auto value_type = fsl_type->value_type();
- rj::Document document;
- if (document.Parse(serialized_data.data(),
serialized_data.length()).HasParseError() ||
- !document.IsObject() || !document.HasMember("shape") ||
- !document["shape"].IsArray()) {
+
+ simdjson::padded_string padded_json(serialized_data);
+ simdjson::ondemand::parser parser;
+ simdjson::ondemand::document document;
+
+ auto error = parser.iterate(padded_json).get(document);
+ if (error != simdjson::SUCCESS) {
return Status::Invalid("Invalid serialized JSON data: ", serialized_data);
}
Review Comment:
Could you use `ResolveSimdjsonResult()` like we did in #50905?
##########
cpp/src/arrow/extension/tensor_extension_array_test.cc:
##########
@@ -223,15 +223,15 @@ TEST_F(TestFixedShapeTensorType,
MetadataSerializationRoundtrip) {
// Validate shape values must be integers. Error message should include the
// JSON type name of the offending value.
CheckDeserializationRaises(ext_type_, storage_type, R"({"shape":[3.5,4]})",
- "shape must contain integers, got Number");
+ "shape must contain integers, got number");
Review Comment:
I think that we can use "number" because it's just for error message.
--
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]