-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WeakHash32 #9735
WeakHash32 #9735
Changes from all commits
9e0c257
21d9752
a19937a
e26eac4
e76877c
0a61f32
e94f572
9f82f43
6d16406
e6f5181
7246f81
fe36c27
dcd8321
c9d808e
c4e73c1
33db7f3
ebba6a6
75192d4
0344978
46f63c1
1d94b8b
7f6dda4
05fb176
9ab6f6a
7582f66
2e22727
0bd502f
3c31139
9e105b8
c0dea7b
4cfdef4
ad56da8
ee907da
6d63d4b
c437088
67ed4d4
488b21c
20d3e34
07b2945
08a9486
5400ffb
778be31
a70a9e5
1a37afa
f37b30f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
#include <Columns/ColumnsCommon.h> | ||
#include <Common/PODArray.h> | ||
#include <Common/typeid_cast.h> | ||
#include <Common/WeakHash.h> | ||
#include <Common/HashTable/Hash.h> | ||
|
||
|
||
namespace DB | ||
|
@@ -12,6 +14,7 @@ namespace DB | |
namespace ErrorCodes | ||
{ | ||
extern const int SIZES_OF_COLUMNS_DOESNT_MATCH; | ||
extern const int LOGICAL_ERROR; | ||
} | ||
|
||
ColumnConst::ColumnConst(const ColumnPtr & data_, size_t s_) | ||
|
@@ -103,4 +106,18 @@ void ColumnConst::getPermutation(bool /*reverse*/, size_t /*limit*/, int /*nan_d | |
res[i] = i; | ||
} | ||
|
||
void ColumnConst::updateWeakHash32(WeakHash32 & hash) const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe don't update hash at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need it. |
||
{ | ||
if (hash.getData().size() != s) | ||
throw Exception("Size of WeakHash32 does not match size of column: column size is " + std::to_string(s) + | ||
", hash size is " + std::to_string(hash.getData().size()), ErrorCodes::LOGICAL_ERROR); | ||
|
||
WeakHash32 element_hash(1); | ||
data->updateWeakHash32(element_hash); | ||
size_t data_hash = element_hash.getData()[0]; | ||
|
||
for (auto & value : hash.getData()) | ||
value = intHashCRC32(data_hash, value); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't get it. Why don't simply update hashes with all corresponding array elements in chain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we don't have method for single array element.
It would be possible if offsets will be added to
updateWeakHash
as the second argument.