Skip to content
Merged
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
22 changes: 22 additions & 0 deletions cpp/src/arrow/acero/fetch_node_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,28 @@ TEST(FetchNode, Basic) {
CheckFetch({0, 0});
}

TEST(FetchNode, RecordBatchReaderSource) {
constexpr random::SeedType kSeed = 42;
constexpr int kJitterMod = 4;
FetchNodeOptions options{20, 50};
RegisterTestNodes();
std::shared_ptr<Table> input = TestTable();
for (bool use_threads : {false, true}) {
SCOPED_TRACE(use_threads ? "threaded" : "serial");
auto reader = std::make_shared<TableBatchReader>(input);
Declaration plan = Declaration::Sequence(
{{"record_batch_reader_source", RecordBatchReaderSourceNodeOptions{reader}},
{"jitter", JitterNodeOptions(kSeed, kJitterMod)},
{"fetch", options}});
QueryOptions query_options;
query_options.use_threads = use_threads;
ASSERT_OK_AND_ASSIGN(std::shared_ptr<Table> actual,
DeclarationToTable(plan, query_options));
std::shared_ptr<Table> expected = input->Slice(options.offset, options.count);
AssertTablesEqual(*expected, *actual);
}
}

TEST(FetchNode, Invalid) {
CheckFetchInvalid({-1, 10}, "`offset` must be non-negative");
CheckFetchInvalid({10, -1}, "`count` must be non-negative");
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/acero/source_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ struct SchemaSourceNode : public SourceNode {
struct RecordBatchReaderSourceNode : public SourceNode {
RecordBatchReaderSourceNode(ExecPlan* plan, std::shared_ptr<Schema> schema,
arrow::AsyncGenerator<std::optional<ExecBatch>> generator)
: SourceNode(plan, schema, generator) {}
: SourceNode(plan, schema, generator, Ordering::Implicit()) {}

Comment thread
egolearner marked this conversation as resolved.
static Result<ExecNode*> Make(ExecPlan* plan, std::vector<ExecNode*> inputs,
const ExecNodeOptions& options) {
Expand Down
Loading