@@ -563,12 +563,13 @@ TEST_F(ExecutorTest, DISABLED_SimpleGroupByAggregation) {
563
563
std::vector<const AbstractExpression *> aggregate_cols{col_a, col_c};
564
564
std::vector<AggregationType> agg_types{AggregationType::CountAggregate, AggregationType::SumAggregate};
565
565
const AbstractExpression *count_a = MakeAggregateValueExpression (false , 0 );
566
+ const AbstractExpression *sum_c = MakeAggregateValueExpression (false , 1 );
566
567
// Make having clause
567
568
const AbstractExpression *having = MakeComparisonExpression (
568
569
count_a, MakeConstantValueExpression (ValueFactory::GetIntegerValue (100 )), ComparisonType::GreaterThan);
569
570
570
571
// Create plan
571
- agg_schema = MakeOutputSchema ({{" countA" , count_a}, {" colB" , groupby_b}});
572
+ agg_schema = MakeOutputSchema ({{" countA" , count_a}, {" colB" , groupby_b}, { " sumC " , sum_c} });
572
573
agg_plan = std::make_unique<AggregationPlanNode>(agg_schema, scan_plan.get (), having, std::move (group_by_cols),
573
574
std::move (aggregate_cols), std::move (agg_types));
574
575
}
@@ -580,6 +581,9 @@ TEST_F(ExecutorTest, DISABLED_SimpleGroupByAggregation) {
580
581
for (const auto &tuple : result_set) {
581
582
// Should have count_a > 100
582
583
ASSERT_GT (tuple.GetValue (agg_schema, agg_schema->GetColIdx (" countA" )).GetAs <int32_t >(), 100 );
584
+ // Should have sum_c >= 0. Data for test_1 table is randomly generated, where colC is uniformly distributed from
585
+ // 0 to 9999. So we can only ensure sumC column exists by checking if it's >= 0 here.
586
+ ASSERT_GE (tuple.GetValue (agg_schema, agg_schema->GetColIdx (" sumC" )).GetAs <int32_t >(), 0 );
583
587
// Should have unique col_bs.
584
588
auto col_b = tuple.GetValue (agg_schema, agg_schema->GetColIdx (" colB" )).GetAs <int32_t >();
585
589
ASSERT_EQ (encountered.count (col_b), 0 );
0 commit comments