Merge pull request #6937 from amosbird/ubmemfix

In hash tables, properly initialize zero key cell.
This commit is contained in:
akuzm 2019-09-17 14:57:38 +03:00 committed by GitHub
commit 75dc7d331e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -224,8 +224,18 @@ private:
public: public:
bool hasZero() const { return has_zero; } bool hasZero() const { return has_zero; }
void setHasZero() { has_zero = true; }
void clearHasZero() { has_zero = false; } void setHasZero()
{
has_zero = true;
new (zeroValue()) Cell();
}
void clearHasZero()
{
has_zero = false;
zeroValue()->~Cell();
}
Cell * zeroValue() { return reinterpret_cast<Cell*>(&zero_value_storage); } Cell * zeroValue() { return reinterpret_cast<Cell*>(&zero_value_storage); }
const Cell * zeroValue() const { return reinterpret_cast<const Cell*>(&zero_value_storage); } const Cell * zeroValue() const { return reinterpret_cast<const Cell*>(&zero_value_storage); }

View File

@ -0,0 +1 @@
[[],[2]]

View File

@ -0,0 +1 @@
select groupUniqArray(v) from values('id int, v Array(int)', (1, [2]), (1, [])) group by id;