Skip to content

Commit

Permalink
chore(query): turn on new agg hashtable (databendlabs#15155)
Browse files Browse the repository at this point in the history
* fix hits-q18-perf

* turn on new agg hashtable

* rewrite sqllogical test

* fix sqllogical test

---------

Co-authored-by: jw <freejw@gmail.com>
  • Loading branch information
Freejww and jw authored Apr 3, 2024
1 parent a91361d commit 7e9b835
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/query/expression/src/aggregate/aggregate_hashtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,11 @@ impl AggregateHashTable {
}
}

if self.config.partial_agg && self.capacity >= self.config.max_partial_capacity {
if self.config.partial_agg {
// check size
if self.count + BATCH_ADD_SIZE > self.resize_threshold() {
if self.count + BATCH_ADD_SIZE > self.resize_threshold()
&& self.capacity >= self.config.max_partial_capacity
{
self.clear_ht();
self.reset_count();
}
Expand Down
2 changes: 1 addition & 1 deletion src/query/settings/src/settings_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ impl DefaultSettings {
range: Some(SettingRange::Numeric(0..=1)),
}),
("enable_experimental_aggregate_hashtable", DefaultSettingValue {
value: UserSettingValue::UInt64(0),
value: UserSettingValue::UInt64(1),
desc: "Enables experimental aggregate hashtable",
mode: SettingMode::Both,
range: Some(SettingRange::Numeric(0..=1)),
Expand Down
8 changes: 4 additions & 4 deletions tests/sqllogictests/suites/mode/cluster/exchange.test
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ Exchange
│ ├── aggregate functions: [sum(number)]
│ ├── estimated rows: 1.00
│ └── Exchange
│ ├── output columns: [sum(number) (#2), #_group_by_key]
│ ├── exchange type: Hash(_group_by_key)
│ ├── output columns: [sum(number) (#2), numbers.number (#0)]
│ ├── exchange type: Hash(0)
│ └── AggregatePartial
│ ├── group by: [number]
│ ├── aggregate functions: [sum(number)]
Expand Down Expand Up @@ -198,7 +198,7 @@ explain fragments select * from (select sum(number) as number from numbers(1) gr
Fragment 0:
DataExchange: Shuffle
ExchangeSink
├── output columns: [sum(number) (#2), #_group_by_key]
├── output columns: [sum(number) (#2), numbers.number (#0)]
├── destination fragment: [1]
└── AggregatePartial
├── group by: [number]
Expand Down Expand Up @@ -226,7 +226,7 @@ Fragment 1:
├── aggregate functions: [sum(number)]
├── estimated rows: 1.00
└── ExchangeSource
├── output columns: [sum(number) (#2), #_group_by_key]
├── output columns: [sum(number) (#2), numbers.number (#0)]
└── source fragment: [0]
(empty)
(empty)
Expand Down
4 changes: 2 additions & 2 deletions tests/sqllogictests/suites/mode/cluster/explain_v2.test
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ Exchange
│ ├── aggregate functions: []
│ ├── estimated rows: 2.00
│ └── Exchange
│ ├── output columns: [#_group_by_key]
│ ├── exchange type: Hash(_group_by_key)
│ ├── output columns: [col0 (#2)]
│ ├── exchange type: Hash(0)
│ └── AggregatePartial
│ ├── group by: [col0]
│ ├── aggregate functions: []
Expand Down
4 changes: 2 additions & 2 deletions tests/sqllogictests/suites/mode/cluster/group_shuffle.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Exchange
├── aggregate functions: []
├── estimated rows: 100000.00
└── Exchange
├── output columns: [#_group_by_key]
├── exchange type: Hash(_group_by_key)
├── output columns: [numbers_mt.number (#0)]
├── exchange type: Hash(0)
└── AggregatePartial
├── group by: [number]
├── aggregate functions: []
Expand Down

0 comments on commit 7e9b835

Please sign in to comment.