bkietz commented on a change in pull request #10863:
URL: https://github.com/apache/arrow/pull/10863#discussion_r687026063
##########
File path: cpp/src/arrow/compute/exec/sink_node.cc
##########
@@ -19,14 +19,17 @@
#include "arrow/compute/exec/exec_plan.h"
#include <mutex>
+#include <unordered_map>
Review comment:
```suggestion
```
##########
File path: cpp/src/arrow/compute/exec/plan_test.cc
##########
@@ -541,6 +612,45 @@ TEST(ExecPlanExecution,
SourceFilterProjectGroupedSumFilter) {
}
}
+TEST(ExecPlanExecution, SourceFilterProjectGroupedSumOrderBy) {
+ for (bool parallel : {false, true}) {
+ SCOPED_TRACE(parallel ? "parallel/merged" : "serial");
+
+ int batch_multiplicity = parallel ? 100 : 1;
+ auto input = MakeGroupableBatches(/*multiplicity=*/batch_multiplicity);
+
+ ASSERT_OK_AND_ASSIGN(auto plan, ExecPlan::Make());
+ AsyncGenerator<util::optional<ExecBatch>> sink_gen;
+
+ SortOptions options({SortKey("str", SortOrder::Descending)});
+ ASSERT_OK(
+ Declaration::Sequence(
+ {
+ {"source",
+ SourceNodeOptions{input.schema, input.gen(parallel,
/*slow=*/false)}},
+ {"filter",
+ FilterNodeOptions{greater_equal(field_ref("i32"),
literal(0))}},
+ {"project", ProjectNodeOptions{{
+ field_ref("str"),
+ call("multiply", {field_ref("i32"),
literal(2)}),
+ }}},
+ {"aggregate",
AggregateNodeOptions{/*aggregates=*/{{"hash_sum", nullptr}},
+ /*targets=*/{"multiply(i32,
2)"},
+
/*names=*/{"sum(multiply(i32, 2))"},
+ /*keys=*/{"str"}}},
+ {"filter",
FilterNodeOptions{greater(field_ref("sum(multiply(i32, 2))"),
+ literal(10 *
batch_multiplicity))}},
+ {"order_by_sink", OrderBySinkNodeOptions{options, &sink_gen}},
+ })
+ .AddToPlan(plan.get()));
+
+ ASSERT_THAT(StartAndCollect(plan.get(), sink_gen),
+
Finishes(ResultWith(::testing::ElementsAreArray({ExecBatchFromJSON(
Review comment:
```suggestion
Finishes(ResultWith(ElementsAreArray({ExecBatchFromJSON(
```
--
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]