mapleFU commented on PR #37713:
URL: https://github.com/apache/arrow/pull/37713#issuecomment-1723718847
After some trying, we have `FileInterface`, and can make `FileInterface`
extended from `enable_shared_from_this`.
However, because of the derive is virtual, we need to change
`checked_pointer_cast` (which might use `std::static_pointer_cast`) to
`std::dynamic_pointer_cast`, like below:
```c++
// Default ReadMetadataAsync() implementation: simply issue the read on the
context's
// executor
Future<std::shared_ptr<const KeyValueMetadata>>
InputStream::ReadMetadataAsync(
const IOContext& ctx) {
std::shared_ptr<InputStream> self =
std::dynamic_pointer_cast<InputStream>(shared_from_this());
return DeferNotOk(internal::SubmitIO(ctx, [self] { return
self->ReadMetadata(); }));
}
```
Do you think this is ok? @pitrou
--
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]