MCPcopy Create free account
hub / github.com/apache/arrow / CheckGroupedAggregateCase

Function CheckGroupedAggregateCase

cpp/src/arrow/engine/substrait/function_test.cc:663–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661}
662
663void CheckGroupedAggregateCase(const AggregateTestCase& test_case) {
664 ARROW_SCOPED_TRACE("function = ", test_case.function_id.ToString());
665 std::shared_ptr<Table> output_table;
666 std::shared_ptr<acero::ExecPlan> plan =
667 PlanFromAggregateCase(test_case, &output_table, /*with_keys=*/true);
668
669 plan->StartProducing();
670 ASSERT_FINISHES_OK(plan->finished());
671
672 // The aggregate node's output is unpredictable so we sort by the key column
673 ASSERT_OK_AND_ASSIGN(
674 std::shared_ptr<Array> sort_indices,
675 compute::SortIndices(output_table, compute::SortOptions({compute::SortKey(
676 0, compute::SortOrder::Ascending)})));
677 ASSERT_OK_AND_ASSIGN(Datum sorted_table_datum,
678 compute::Take(output_table, sort_indices));
679 output_table = sorted_table_datum.table();
680 ASSERT_OK_AND_ASSIGN(output_table,
681 output_table->SelectColumns({output_table->num_columns() - 1}));
682
683 std::shared_ptr<Table> expected_output =
684 GetOutputTableForAggregateCase(test_case.output_type, test_case.group_outputs);
685
686 AssertTablesEqual(*expected_output, *output_table, /*same_chunk_layout=*/false);
687}
688
689void CheckAggregateCases(const std::vector<AggregateTestCase>& test_cases) {
690 for (const AggregateTestCase& test_case : test_cases) {

Callers 1

CheckAggregateCasesFunction · 0.85

Calls 12

PlanFromAggregateCaseFunction · 0.85
SortIndicesFunction · 0.85
AssertTablesEqualFunction · 0.85
finishedMethod · 0.80
ASSERT_OK_AND_ASSIGNFunction · 0.70
SortOptionsFunction · 0.50
SortKeyClass · 0.50
ToStringMethod · 0.45
StartProducingMethod · 0.45
SelectColumnsMethod · 0.45
num_columnsMethod · 0.45

Tested by

no test coverage detected