From 923973728b7e18c93a180c2d80a712880b8a5437 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Mon, 21 Oct 2024 22:27:56 -0400 Subject: [PATCH] suggestions and lint --- cpp/src/arrow/c/bridge.h | 10 ++++++++-- cpp/src/arrow/c/bridge_test.cc | 8 ++++---- cpp/src/arrow/record_batch.h | 1 - 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cpp/src/arrow/c/bridge.h b/cpp/src/arrow/c/bridge.h index 813e13e79d64c..0fdd6e664e256 100644 --- a/cpp/src/arrow/c/bridge.h +++ b/cpp/src/arrow/c/bridge.h @@ -412,13 +412,19 @@ Result> ImportDeviceChunkedArray( /// /// @{ +/// \brief AsyncErrorDetail is a StatusDetail that contains an error code and message +/// from an asynchronous operation. class AsyncErrorDetail : public StatusDetail { public: AsyncErrorDetail(int code, std::string message, std::string metadata) : code_(code), message_(std::move(message)), metadata_(std::move(metadata)) {} const char* type_id() const override { return "AsyncErrorDetail"; } + // ToString just returns the error message that was returned with the error std::string ToString() const override { return message_; } + // code is an errno-compatible error code int code() const { return code_; } + // returns any metadata that was returned with the error, likely in a + // key-value format similar to ArrowSchema metadata const std::string& ErrorMetadata() const { return metadata_; } private: @@ -443,8 +449,8 @@ class Executor; /// The ArrowAsyncDeviceStreamHandler struct is intended to have its callbacks populated /// and then be passed to a producer to call the appropriate callbacks when data is ready. /// This inverts the traditional flow of control, and so we construct a corresponding -/// AsyncRecordBatchGenerator to provide an interface for the consumer to retrieve data as it -/// is pushed to the handler. +/// AsyncRecordBatchGenerator to provide an interface for the consumer to retrieve data as +/// it is pushed to the handler. /// /// \param[in,out] handler C struct to be populated /// \param[in] executor the executor to use for waiting and populating record batches diff --git a/cpp/src/arrow/c/bridge_test.cc b/cpp/src/arrow/c/bridge_test.cc index 06a82baf8920d..8128de26fcc7a 100644 --- a/cpp/src/arrow/c/bridge_test.cc +++ b/cpp/src/arrow/c/bridge_test.cc @@ -5367,13 +5367,13 @@ TEST_F(TestAsyncDeviceArrayStreamRoundTrip, Simple) { device->device_type(), &handler); })); - ASSERT_OK_AND_ASSIGN(auto generator, fut_gen.result()); + ASSERT_FINISHES_OK_AND_ASSIGN(auto generator, fut_gen); ASSERT_NO_FATAL_FAILURE(AssertSchemaEqual(*orig_schema, *generator.schema)); auto collect_fut = CollectAsyncGenerator(generator.generator); - ASSERT_OK_AND_ASSIGN(auto results, collect_fut.result()); - ASSERT_OK(fut.status()); - ASSERT_OK(fut_gen.status()); + ASSERT_FINISHES_OK_AND_ASSIGN(auto results, collect_fut); + ASSERT_FINISHES_OK(fut); + ASSERT_FINISHES_OK(fut_gen); ASSERT_EQ(results.size(), 2); AssertBatchesEqual(*results[0].batch, *batches[0]); diff --git a/cpp/src/arrow/record_batch.h b/cpp/src/arrow/record_batch.h index b8d443e811f47..855f8d4368096 100644 --- a/cpp/src/arrow/record_batch.h +++ b/cpp/src/arrow/record_batch.h @@ -17,7 +17,6 @@ #pragma once -#include #include #include #include