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

Function ExportAsyncRecordBatchReader

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

Source from the content-addressed store, hash-verified

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