Skip to content

Commit

Permalink
remove const hash func
Browse files Browse the repository at this point in the history
  • Loading branch information
Mryange committed Nov 18, 2024
1 parent aa3141b commit 7b5b869
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 44 deletions.
33 changes: 0 additions & 33 deletions be/src/vec/columns/column_const.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,39 +110,6 @@ ColumnPtr ColumnConst::permute(const Permutation& perm, size_t limit) const {
return ColumnConst::create(data, limit);
}

void ColumnConst::update_crcs_with_value(uint32_t* __restrict hashes, doris::PrimitiveType type,
uint32_t rows, uint32_t offset,
const uint8_t* __restrict null_data) const {
DCHECK(null_data == nullptr);
DCHECK(rows == size());
auto real_data = data->get_data_at(0);
if (real_data.data == nullptr) {
for (int i = 0; i < rows; ++i) {
hashes[i] = HashUtil::zlib_crc_hash_null(hashes[i]);
}
} else {
for (int i = 0; i < rows; ++i) {
hashes[i] = RawValue::zlib_crc32(real_data.data, real_data.size, type, hashes[i]);
}
}
}

void ColumnConst::update_hashes_with_value(uint64_t* __restrict hashes,
const uint8_t* __restrict null_data) const {
DCHECK(null_data == nullptr);
auto real_data = data->get_data_at(0);
auto real_size = size();
if (real_data.data == nullptr) {
for (int i = 0; i < real_size; ++i) {
hashes[i] = HashUtil::xxHash64NullWithSeed(hashes[i]);
}
} else {
for (int i = 0; i < real_size; ++i) {
hashes[i] = HashUtil::xxHash64WithSeed(real_data.data, real_data.size, hashes[i]);
}
}
}

void ColumnConst::get_permutation(bool /*reverse*/, size_t /*limit*/, int /*nan_direction_hint*/,
Permutation& res) const {
res.resize(s);
Expand Down
8 changes: 0 additions & 8 deletions be/src/vec/columns/column_const.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,6 @@ class ColumnConst final : public COWHelper<IColumn, ColumnConst> {
data->update_hash_with_value(0, hash);
}

// (TODO.Amory) here may not use column_const update hash, and PrimitiveType is not used.
void update_crcs_with_value(uint32_t* __restrict hashes, PrimitiveType type, uint32_t rows,
uint32_t offset = 0,
const uint8_t* __restrict null_data = nullptr) const override;

void update_hashes_with_value(uint64_t* __restrict hashes,
const uint8_t* __restrict null_data) const override;

ColumnPtr filter(const Filter& filt, ssize_t result_size_hint) const override;
size_t filter(const Filter& filter) override;

Expand Down
6 changes: 3 additions & 3 deletions be/test/vec/columns/column_hash_func_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ TEST(HashFuncTest, ArrayTypeTest) {
DataTypePtr a = std::make_shared<DataTypeArray>(d);
ColumnPtr col_a = a->create_column_const_with_default_value(1);
// xxHash
EXPECT_NO_FATAL_FAILURE(col_a->update_hashes_with_value(xx_hashes));
EXPECT_NO_FATAL_FAILURE(unpack_if_const(col_a).first->update_hashes_with_value(xx_hashes));
std::cout << xx_hashes[0] << std::endl;
// crcHash
EXPECT_NO_FATAL_FAILURE(
col_a->update_crcs_with_value(crc_hashes, PrimitiveType::TYPE_ARRAY, 1));
EXPECT_NO_FATAL_FAILURE(unpack_if_const(col_a).first->update_crcs_with_value(
crc_hashes, PrimitiveType::TYPE_ARRAY, 1));
std::cout << crc_hashes[0] << std::endl;
}
}
Expand Down

0 comments on commit 7b5b869

Please sign in to comment.