MCPcopy Create free account
hub / github.com/apache/arrow / ExportAsyncRecordBatchReader

Function ExportAsyncRecordBatchReader

cpp/src/arrow/c/bridge.cc:2837–2873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2835}
2836
2837Future<> ExportAsyncRecordBatchReader(
2838 std::shared_ptr<Schema> schema,
2839 AsyncGenerator<std::shared_ptr<RecordBatch>> generator,
2840 DeviceAllocationType device_type, struct ArrowAsyncDeviceStreamHandler* handler) {
2841 if (!schema) {
2842 handler->on_error(handler, EINVAL, "Schema is null", nullptr);
2843 handler->release(handler);
2844 return Future<>::MakeFinished(Status::Invalid("Schema is null"));
2845 }
2846
2847 struct ArrowSchema c_schema;
2848 SchemaExportGuard guard(&c_schema);
2849
2850 auto status = ExportSchema(*schema, &c_schema);
2851 if (!status.ok()) {
2852 handler->on_error(handler, EINVAL, status.message().c_str(), nullptr);
2853 handler->release(handler);
2854 return Future<>::MakeFinished(status);
2855 }
2856
2857 return VisitAsyncGenerator(generator, AsyncProducer{device_type, &c_schema, handler})
2858 .Then(
2859 [handler]() -> Status {
2860 int status = handler->on_next_task(handler, nullptr, nullptr);
2861 handler->release(handler);
2862 if (status != 0) {
2863 return Status::UnknownError("Received error from handler::on_next_task ",
2864 status);
2865 }
2866 return Status::OK();
2867 },
2868 [handler](const Status status) -> Status {
2869 handler->on_error(handler, EINVAL, status.message().c_str(), nullptr);
2870 handler->release(handler);
2871 return status;
2872 });
2873}
2874
2875} // namespace arrow

Callers 1

TEST_FFunction · 0.85

Calls 10

VisitAsyncGeneratorFunction · 0.85
UnknownErrorFunction · 0.85
on_errorMethod · 0.80
ThenMethod · 0.80
on_next_taskMethod · 0.80
ExportSchemaFunction · 0.70
InvalidFunction · 0.50
OKFunction · 0.50
releaseMethod · 0.45
okMethod · 0.45

Tested by 1

TEST_FFunction · 0.68