Skip to content

Commit

Permalink
fix(query): revert to StackHashSet
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li committed Jan 15, 2025
1 parent 9f019b3 commit 72f1a01
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use databend_common_hashtable::HashSet as CommonHashSet;
use databend_common_hashtable::HashtableKeyable;
use databend_common_hashtable::HashtableLike;
use databend_common_hashtable::ShortStringHashSet;
use databend_common_hashtable::StackHashSet;
use databend_common_io::prelude::*;
use siphasher::sip128::Hasher128;
use siphasher::sip128::SipHasher24;
Expand Down Expand Up @@ -318,13 +319,13 @@ where T: Number + BorshSerialize + BorshDeserialize + HashtableKeyable

// For count(distinct string) and uniq(string)
pub struct AggregateUniqStringState {
set: CommonHashSet<u128>,
set: StackHashSet<u128>,
}

impl DistinctStateFunc for AggregateUniqStringState {
fn new() -> Self {
AggregateUniqStringState {
set: CommonHashSet::new(),
set: StackHashSet::new(),
}
}

Expand All @@ -338,7 +339,7 @@ impl DistinctStateFunc for AggregateUniqStringState {

fn deserialize(reader: &mut &[u8]) -> Result<Self> {
let size = reader.read_uvarint()?;
let mut set = CommonHashSet::with_capacity(size as usize);
let mut set = StackHashSet::with_capacity(size as usize);
for _ in 0..size {
let e = borsh_deserialize_state(reader)?;
let _ = set.set_insert(e).is_ok();
Expand Down

0 comments on commit 72f1a01

Please sign in to comment.