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

Function ExportAsyncRecordBatchReader

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

Source from the content-addressed store, hash-verified

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