Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/src/arrow/dataset/file_ipc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ Result<RecordBatchGenerator> IpcFileFormat::ScanBatchesAsync(
auto reopen_reader = [self, options,
source](std::shared_ptr<ipc::RecordBatchFileReader> reader)
-> Future<std::shared_ptr<ipc::RecordBatchFileReader>> {
ARROW_ASSIGN_OR_RAISE(auto options,
ARROW_ASSIGN_OR_RAISE(auto read_options,

@rok rok Oct 13, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit: good call.

GetReadOptions(*reader->schema(), *self, *options));
return OpenReader(source, options);
return OpenReader(source, read_options);
};
auto readahead_level = options->batch_readahead;
auto default_fragment_scan_options = this->default_fragment_scan_options;
Expand Down
25 changes: 20 additions & 5 deletions cpp/src/arrow/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,25 @@ class [[nodiscard]] Result : public util::EqualityComparable<Result<T>> {
}
};

#define ARROW_ASSIGN_OR_RAISE_IMPL(result_name, lhs, rexpr) \
auto&& result_name = (rexpr); \
ARROW_RETURN_IF_(!(result_name).ok(), (result_name).status(), ARROW_STRINGIFY(rexpr)); \
lhs = std::move(result_name).ValueUnsafe();
#if defined(__GNUC__) || defined(__clang__)
// For gcc and clang, we can avoid the intermediate `result_name`
// escaping the current scope by using a compiler extension.
// Otherwise, we fall back to an implementation where the intermediate
// declaration might consume additional stack space.
# define ARROW_ASSIGN_OR_RAISE_IMPL(result_name, lhs, rexpr) \
lhs = __extension__({ \
auto&& result_name = (rexpr); \
ARROW_RETURN_IF_(!(result_name).ok(), (result_name).status(), \
ARROW_STRINGIFY(rexpr)); \
std::move(result_name).ValueUnsafe(); \
})
#else
# define ARROW_ASSIGN_OR_RAISE_IMPL(result_name, lhs, rexpr) \
auto&& result_name = (rexpr); \
ARROW_RETURN_IF_(!(result_name).ok(), (result_name).status(), \
ARROW_STRINGIFY(rexpr)); \
lhs = std::move(result_name).ValueUnsafe();
#endif

#define ARROW_ASSIGN_OR_RAISE_NAME(x, y) ARROW_CONCAT(x, y)

Expand All @@ -482,7 +497,7 @@ class [[nodiscard]] Result : public util::EqualityComparable<Result<T>> {
/// ValueType value;
/// ARROW_ASSIGN_OR_RAISE(value, MaybeGetValue(arg));
///
/// WARNING: ARROW_ASSIGN_OR_RAISE expands into multiple statements;
/// WARNING: ARROW_ASSIGN_OR_RAISE may expand into multiple statements;
/// it cannot be used in a single statement (e.g. as the body of an if
/// statement without {})!
///
Expand Down
Loading