| 601 | } |
| 602 | |
| 603 | std::shared_ptr<acero::ExecPlan> PlanFromAggregateCase( |
| 604 | const AggregateTestCase& test_case, std::shared_ptr<Table>* output_table, |
| 605 | bool with_keys) { |
| 606 | static ExecContext ctx_for_ordered; |
| 607 | std::shared_ptr<Table> input_table = GetInputTableForAggregateCase(test_case); |
| 608 | std::vector<int> key_idxs = {}; |
| 609 | if (with_keys) { |
| 610 | key_idxs = {0}; |
| 611 | } |
| 612 | EXPECT_OK_AND_ASSIGN( |
| 613 | std::shared_ptr<Buffer> substrait, |
| 614 | internal::CreateScanAggSubstrait( |
| 615 | test_case.function_id, input_table, key_idxs, |
| 616 | /*arg_idxs=*/test_case.nullary ? std::vector<int>{} : std::vector<int>{1}, |
| 617 | *test_case.output_type)); |
| 618 | std::shared_ptr<acero::SinkNodeConsumer> consumer = |
| 619 | std::make_shared<acero::TableSinkNodeConsumer>(output_table, default_memory_pool()); |
| 620 | |
| 621 | // Mock table provider that ignores the table name and returns input_table |
| 622 | NamedTableProvider table_provider = [input_table](const std::vector<std::string>&, |
| 623 | const Schema&) { |
| 624 | std::shared_ptr<acero::ExecNodeOptions> options = |
| 625 | std::make_shared<acero::TableSourceNodeOptions>(input_table); |
| 626 | return acero::Declaration("table_source", {}, options, "mock_source"); |
| 627 | }; |
| 628 | |
| 629 | ConversionOptions conversion_options; |
| 630 | conversion_options.named_table_provider = std::move(table_provider); |
| 631 | |
| 632 | EXPECT_OK_AND_ASSIGN( |
| 633 | auto declarations, |
| 634 | DeserializePlans( |
| 635 | *substrait, [consumer = std::move(consumer)] { return std::move(consumer); }, |
| 636 | default_extension_id_registry(), /*ext_set_out=*/nullptr, conversion_options)); |
| 637 | std::shared_ptr<acero::ExecPlan> plan; |
| 638 | if (test_case.ordered) { |
no test coverage detected