dbms: development [#CONV-2944].

This commit is contained in:
Alexey Milovidov 2011-09-26 14:06:19 +00:00
parent cd94f5cccb
commit de9845ee22

View File

@ -12,16 +12,21 @@
namespace DB
{
class FieldVisitorMD5 : public boost::static_visitor<>
class FieldVisitorHash : public boost::static_visitor<>
{
public:
MD5_CTX state;
FieldVisitorMD5()
FieldVisitorHash()
{
MD5_Init(&state);
}
void finalize(unsigned char * place)
{
MD5_Final(place, &state);
}
void operator() (const Null & x)
{
int type = FieldType::Null;
@ -281,7 +286,7 @@ void Aggregator::execute(BlockInputStreamPtr stream, AggregatedDataVariants & re
}
else /// Иначе используем md5.
{
FieldVisitorMD5 key_hash_visitor;
FieldVisitorHash key_hash_visitor;
for (size_t j = 0; j < keys_size; ++j)
{
@ -289,7 +294,7 @@ void Aggregator::execute(BlockInputStreamPtr stream, AggregatedDataVariants & re
boost::apply_visitor(key_hash_visitor, key[j]);
}
MD5_Final(key_hash_union.bytes, &key_hash_visitor.state);
key_hash_visitor.finalize(key_hash_union.bytes);
}
AggregatedDataHashed::iterator it = res.find(key_hash_union.key_hash);