Merge pull request #31883 from CurtizJ/fix-empty-uuid

Fix function `empty` with `UUID` type
This commit is contained in:
alexey-milovidov 2021-11-27 00:23:47 +03:00 committed by GitHub
commit 75ac0f72bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -58,7 +58,7 @@ struct EmptyImpl
static void uuid(const ColumnUUID::Container & container, size_t n, PaddedPODArray<UInt8> & res)
{
for (size_t i = 0; i < n; ++i)
res[i] = negative ^ (container.data()->toUnderType() == 0);
res[i] = negative ^ (container[i].toUnderType() == 0);
}
};

View File

@ -0,0 +1,4 @@
00000000-0000-0000-0000-000000000000 1
992f6910-42b2-43cd-98bc-c812fbf9b683 0
992f6910-42b2-43cd-98bc-c812fbf9b683 0
00000000-0000-0000-0000-000000000000 1

View File

@ -0,0 +1,7 @@
SELECT
arrayJoin([toUUID('00000000-0000-0000-0000-000000000000'), toUUID('992f6910-42b2-43cd-98bc-c812fbf9b683')]) AS x,
empty(x) AS emp;
SELECT
arrayJoin([toUUID('992f6910-42b2-43cd-98bc-c812fbf9b683'), toUUID('00000000-0000-0000-0000-000000000000')]) AS x,
empty(x) AS emp;