| 68 | } |
| 69 | |
| 70 | arrow::Result<std::shared_ptr<arrow::DataType>> RExtensionType::Deserialize( |
| 71 | std::shared_ptr<arrow::DataType> storage_type, |
| 72 | const std::string& serialized_data) const { |
| 73 | std::unique_ptr<RExtensionType> cloned = Clone(); |
| 74 | cloned->storage_type_ = storage_type; |
| 75 | cloned->extension_metadata_ = serialized_data; |
| 76 | |
| 77 | // We could create an ephemeral R6 instance here, which will call the R6 instance's |
| 78 | // deserialize_instance() method, possibly erroring when the metadata is |
| 79 | // invalid or the deserialized values are invalid. The complexity of setting up |
| 80 | // an event loop from wherever this *might* be called is high and hard to |
| 81 | // predict. As a compromise, just create the instance when it is safe to |
| 82 | // do so. |
| 83 | if (MainRThread::GetInstance().IsMainThread()) { |
| 84 | r6_instance(); |
| 85 | } |
| 86 | |
| 87 | return std::shared_ptr<RExtensionType>(cloned.release()); |
| 88 | } |
| 89 | |
| 90 | std::string RExtensionType::ToString() const { return ToString(false); } |
| 91 |
no test coverage detected