Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
kwannoel committed May 3, 2023
1 parent a868cff commit b948890
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/common/src/hash/key.rs
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ use std::marker::PhantomData;
use chrono::{Datelike, Timelike};
use derivative::Derivative;
use fixedbitset::FixedBitSet;
use itertools::Itertools;
use smallbitset::Set64;
use static_assertions::const_assert_eq;

@@ -40,12 +41,14 @@ use crate::array::{
ListRef, StructRef,
};
use crate::estimate_size::EstimateSize;
use crate::row::{OwnedRow, RowDeserializer};
use crate::row::{OwnedRow, Row, RowDeserializer};
use crate::types::num256::Int256Ref;
use crate::types::{DataType, Date, Decimal, ScalarRef, Time, Timestamp, F32, F64};
use crate::util::hash_util::{Crc32FastBuilder, XxHash64Builder};
use crate::util::iter_util::ZipEqFast;
use crate::util::value_encoding::{deserialize_datum, serialize_datum_into};
use crate::util::value_encoding::{
deserialize_datum, estimate_serialize_datum_size, serialize_datum_into,
};

/// This is determined by the stack based data structure we use,
/// `StackNullBitmap`, which can store 64 bits at most.
@@ -911,18 +914,19 @@ impl<B: NullBitmap> HashKey for SerializedKey<B> {
data_chunk: &DataChunk,
hash_codes: Vec<XxHash64HashCode>,
) -> Vec<Self> {
let estimated_key_size = data_chunk.estimate_value_encoding_size(column_idxes);
// for column_idx in column_idxes {
// data_chunk
// .column_at(*column_idx)
// .array_ref()
// .(&mut serializers[..]);
// }
//
// let estimated_key_size = data_chunk.estimate_value_encoding_size(column_idxes);
let estimated_key_sizes = data_chunk
.rows()
.map(|r| r.iter().map(estimate_serialize_datum_size).sum::<usize>())
.collect_vec();

// Construct serializers for each row.
let mut serializers: Vec<Self::S> = hash_codes
.into_iter()
.map(|hashcode| Self::S::from_hash_code(hashcode, estimated_key_size))
.zip_eq_fast(estimated_key_sizes)
.map(|(hashcode, estimated_key_size)| {
Self::S::from_hash_code(hashcode, estimated_key_size)
})
.collect();

for column_idx in column_idxes {

0 comments on commit b948890

Please sign in to comment.