rtpsw commented on code in PR #35953:
URL: https://github.com/apache/arrow/pull/35953#discussion_r1237176571
##########
cpp/src/arrow/acero/plan_test.cc:
##########
@@ -767,6 +767,24 @@ TEST(ExecPlanExecution, DeclarationToReader) {
reader->Next());
}
+TEST(ExecPlanExecution, DeclarationToReaderWithEarlyClose) {
+ auto random_data = MakeRandomBatches(schema({field("a", int8())}),
/*num_batches=*/100);
+ auto plan = Declaration::Sequence(
+ {{"source", SourceNodeOptions(random_data.schema, random_data.gen(false,
false))}});
+ ASSERT_OK_AND_ASSIGN(std::unique_ptr<RecordBatchReader> reader,
+ DeclarationToReader(plan, /*use_threads=*/false));
+
+ // read only a few batches
+ for (size_t i = 0; i < 10; i++) {
+ ASSERT_OK(reader->Next());
+ }
+ // then close
+ EXPECT_RAISES_WITH_MESSAGE_THAT(Cancelled, HasSubstr("Plan was cancelled
early"),
+ reader->Close());
Review Comment:
I actually included the fix you requested, so please take a look. In any
case, I'm fine with whatever is decided.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]