@@ -48,25 +48,24 @@ class SimpleAggregationHashTable {
48
48
for (const auto &agg_type : agg_types_) {
49
49
switch (agg_type) {
50
50
case AggregationType::CountStarAggregate:
51
- case AggregationType::CountAggregate:
52
- case AggregationType::SumAggregate:
53
- // Count/Sum starts at zero.
51
+ // Count start starts at zero.
54
52
values.emplace_back (ValueFactory::GetIntegerValue (0 ));
55
53
break ;
54
+ case AggregationType::CountAggregate:
55
+ case AggregationType::SumAggregate:
56
56
case AggregationType::MinAggregate:
57
- // Min starts at INT_MAX.
58
- values.emplace_back (ValueFactory::GetIntegerValue (BUSTUB_INT32_MAX));
59
- break ;
60
57
case AggregationType::MaxAggregate:
61
- // Max starts at INT_MIN .
62
- values.emplace_back (ValueFactory::GetIntegerValue (BUSTUB_INT32_MIN ));
58
+ // Others starts at null .
59
+ values.emplace_back (ValueFactory::GetNullValueByType (TypeId::INTEGER ));
63
60
break ;
64
61
}
65
62
}
66
63
return {values};
67
64
}
68
65
69
66
/* *
67
+ * TODO(Student)
68
+ *
70
69
* Combines the input into the aggregation result.
71
70
* @param[out] result The output aggregate value
72
71
* @param input The input value
@@ -96,6 +95,11 @@ class SimpleAggregationHashTable {
96
95
CombineAggregateValues (&ht_[agg_key], agg_val);
97
96
}
98
97
98
+ /* *
99
+ * Clear the hash table
100
+ */
101
+ void Clear () { ht_.clear (); }
102
+
99
103
/* * An iterator over the aggregation hash table */
100
104
class Iterator {
101
105
public:
0 commit comments