Skip to content

Commit

Permalink
impl
Browse files Browse the repository at this point in the history
  • Loading branch information
nickitat committed Jul 4, 2023
1 parent 4b02d83 commit da105d4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Functions/FunctionsHashing.h
Expand Up @@ -81,7 +81,7 @@ namespace impl

static SipHashKey parseSipHashKey(const ColumnWithTypeAndName & key)
{
SipHashKey ret;
SipHashKey ret{};

const auto * tuple = checkAndGetColumn<ColumnTuple>(key.column.get());
if (!tuple)
Expand All @@ -90,6 +90,9 @@ namespace impl
if (tuple->tupleSize() != 2)
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "wrong tuple size: key must be a tuple of 2 UInt64");

if (tuple->empty())
return ret;

if (const auto * key0col = checkAndGetColumn<ColumnUInt64>(&(tuple->getColumn(0))))
ret.key0 = key0col->get64(0);
else
Expand Down
1 change: 1 addition & 0 deletions tests/queries/0_stateless/02790_keyed_hash_bug.reference
@@ -0,0 +1 @@
16324913028386710556
2 changes: 2 additions & 0 deletions tests/queries/0_stateless/02790_keyed_hash_bug.sql
@@ -0,0 +1,2 @@
--- previously caused MemorySanitizer: use-of-uninitialized-value, because we tried to read hash key from empty tuple column during interpretation
SELECT sipHash64Keyed((1111111111111111111, toUInt64(222222222222223))) group by toUInt64(222222222222223);

0 comments on commit da105d4

Please sign in to comment.