Skip to content

Commit

Permalink
suggestions and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroshade committed Oct 22, 2024
1 parent 53eca31 commit 9239737
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 8 additions & 2 deletions cpp/src/arrow/c/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,19 @@ Result<std::shared_ptr<ChunkedArray>> 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:
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/c/bridge_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
1 change: 0 additions & 1 deletion cpp/src/arrow/record_batch.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#pragma once

#include <chrono>
#include <cstdint>
#include <memory>
#include <string>
Expand Down

0 comments on commit 9239737

Please sign in to comment.