diff options
author | Alexander Barkov <bar@mariadb.com> | 2021-10-19 13:17:11 +0400 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-10-29 18:29:02 +0200 |
commit | b9f19f7eae960b6ebf769a3d0c63045ed5f2ce6c (patch) | |
tree | a75713f72ebdb5d6d00fd75c024d8178ab5e9120 | |
parent | 50bcda010f1d9f389ce41b331b355fdb5b5d587c (diff) | |
download | mariadb-git-b9f19f7eae960b6ebf769a3d0c63045ed5f2ce6c.tar.gz |
MDEV-26664 Store UUIDs in a more efficient manner
UUID values
llllllll-mmmm-Vhhh-vsss-nnnnnnnnnnnn
are now stored as
nnnnnnnnnnnn-vsss-Vhhh-mmmm-llllllll
inside the record:
- the groups (segments separated by dash) are reordered right-to-left.
- the bytes inside the groups are not reordered (stored as before,
in big-endian format).
This provides a better sorting order: the earlier UUID was generated,
the higher it appears in the ORDER BY output.
Also, this change enables a good key prefix compression,
because the constant part is now in the beginning, while
the non-constant part (the timestamp) is in the end.
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm | bin | 0 -> 944 bytes | |||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm | bin | 0 -> 944 bytes | |||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid.result | 1067 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid.test | 44 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc | 40 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result | 63 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result | 71 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result | 125 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test | 49 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result | 1768 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test | 72 | ||||
-rw-r--r-- | plugin/type_uuid/sql_type_uuid.h | 154 | ||||
-rw-r--r-- | sql/sql_string.h | 5 | ||||
-rw-r--r-- | sql/sql_type_fixedbin.h | 72 | ||||
-rw-r--r-- | sql/sql_type_fixedbin_storage.h | 107 |
15 files changed, 3601 insertions, 36 deletions
diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm Binary files differnew file mode 100644 index 00000000000..ca934198cf7 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm Binary files differnew file mode 100644 index 00000000000..b3d8e433e9d --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result index 6a08ffe8c23..615222651a5 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result @@ -369,6 +369,1069 @@ SELECT * FROM t1 WHERE a IN ('::', 10); ERROR HY000: Illegal parameter data types uuid and int for operation 'in' DROP TABLE t1; # +# ORDER BY +# +CREATE TABLE t1 (a UUID); +FOR i IN 0..15 +DO +INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +# +# Logical ORDER BY +# +SELECT * FROM t1 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000005 +00000000-0000-0000-0000-000000000006 +00000000-0000-0000-0000-000000000007 +00000000-0000-0000-0000-000000000008 +00000000-0000-0000-0000-000000000009 +00000000-0000-0000-0000-00000000000a +00000000-0000-0000-0000-00000000000b +00000000-0000-0000-0000-00000000000c +00000000-0000-0000-0000-00000000000d +00000000-0000-0000-0000-00000000000e +00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000100 +00000000-0000-0000-0000-000000000200 +00000000-0000-0000-0000-000000000300 +00000000-0000-0000-0000-000000000400 +00000000-0000-0000-0000-000000000500 +00000000-0000-0000-0000-000000000600 +00000000-0000-0000-0000-000000000700 +00000000-0000-0000-0000-000000000800 +00000000-0000-0000-0000-000000000900 +00000000-0000-0000-0000-000000000a00 +00000000-0000-0000-0000-000000000b00 +00000000-0000-0000-0000-000000000c00 +00000000-0000-0000-0000-000000000d00 +00000000-0000-0000-0000-000000000e00 +00000000-0000-0000-0000-000000000f00 +00000000-0000-0000-0000-000000010000 +00000000-0000-0000-0000-000000020000 +00000000-0000-0000-0000-000000030000 +00000000-0000-0000-0000-000000040000 +00000000-0000-0000-0000-000000050000 +00000000-0000-0000-0000-000000060000 +00000000-0000-0000-0000-000000070000 +00000000-0000-0000-0000-000000080000 +00000000-0000-0000-0000-000000090000 +00000000-0000-0000-0000-0000000a0000 +00000000-0000-0000-0000-0000000b0000 +00000000-0000-0000-0000-0000000c0000 +00000000-0000-0000-0000-0000000d0000 +00000000-0000-0000-0000-0000000e0000 +00000000-0000-0000-0000-0000000f0000 +00000000-0000-0000-0000-000001000000 +00000000-0000-0000-0000-000002000000 +00000000-0000-0000-0000-000003000000 +00000000-0000-0000-0000-000004000000 +00000000-0000-0000-0000-000005000000 +00000000-0000-0000-0000-000006000000 +00000000-0000-0000-0000-000007000000 +00000000-0000-0000-0000-000008000000 +00000000-0000-0000-0000-000009000000 +00000000-0000-0000-0000-00000a000000 +00000000-0000-0000-0000-00000b000000 +00000000-0000-0000-0000-00000c000000 +00000000-0000-0000-0000-00000d000000 +00000000-0000-0000-0000-00000e000000 +00000000-0000-0000-0000-00000f000000 +00000000-0000-0000-0000-000100000000 +00000000-0000-0000-0000-000200000000 +00000000-0000-0000-0000-000300000000 +00000000-0000-0000-0000-000400000000 +00000000-0000-0000-0000-000500000000 +00000000-0000-0000-0000-000600000000 +00000000-0000-0000-0000-000700000000 +00000000-0000-0000-0000-000800000000 +00000000-0000-0000-0000-000900000000 +00000000-0000-0000-0000-000a00000000 +00000000-0000-0000-0000-000b00000000 +00000000-0000-0000-0000-000c00000000 +00000000-0000-0000-0000-000d00000000 +00000000-0000-0000-0000-000e00000000 +00000000-0000-0000-0000-000f00000000 +00000000-0000-0000-0000-010000000000 +00000000-0000-0000-0000-020000000000 +00000000-0000-0000-0000-030000000000 +00000000-0000-0000-0000-040000000000 +00000000-0000-0000-0000-050000000000 +00000000-0000-0000-0000-060000000000 +00000000-0000-0000-0000-070000000000 +00000000-0000-0000-0000-080000000000 +00000000-0000-0000-0000-090000000000 +00000000-0000-0000-0000-0a0000000000 +00000000-0000-0000-0000-0b0000000000 +00000000-0000-0000-0000-0c0000000000 +00000000-0000-0000-0000-0d0000000000 +00000000-0000-0000-0000-0e0000000000 +00000000-0000-0000-0000-0f0000000000 +SELECT COALESCE(NULL, a) FROM t1 ORDER BY a; +COALESCE(NULL, a) +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000005 +00000000-0000-0000-0000-000000000006 +00000000-0000-0000-0000-000000000007 +00000000-0000-0000-0000-000000000008 +00000000-0000-0000-0000-000000000009 +00000000-0000-0000-0000-00000000000a +00000000-0000-0000-0000-00000000000b +00000000-0000-0000-0000-00000000000c +00000000-0000-0000-0000-00000000000d +00000000-0000-0000-0000-00000000000e +00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000100 +00000000-0000-0000-0000-000000000200 +00000000-0000-0000-0000-000000000300 +00000000-0000-0000-0000-000000000400 +00000000-0000-0000-0000-000000000500 +00000000-0000-0000-0000-000000000600 +00000000-0000-0000-0000-000000000700 +00000000-0000-0000-0000-000000000800 +00000000-0000-0000-0000-000000000900 +00000000-0000-0000-0000-000000000a00 +00000000-0000-0000-0000-000000000b00 +00000000-0000-0000-0000-000000000c00 +00000000-0000-0000-0000-000000000d00 +00000000-0000-0000-0000-000000000e00 +00000000-0000-0000-0000-000000000f00 +00000000-0000-0000-0000-000000010000 +00000000-0000-0000-0000-000000020000 +00000000-0000-0000-0000-000000030000 +00000000-0000-0000-0000-000000040000 +00000000-0000-0000-0000-000000050000 +00000000-0000-0000-0000-000000060000 +00000000-0000-0000-0000-000000070000 +00000000-0000-0000-0000-000000080000 +00000000-0000-0000-0000-000000090000 +00000000-0000-0000-0000-0000000a0000 +00000000-0000-0000-0000-0000000b0000 +00000000-0000-0000-0000-0000000c0000 +00000000-0000-0000-0000-0000000d0000 +00000000-0000-0000-0000-0000000e0000 +00000000-0000-0000-0000-0000000f0000 +00000000-0000-0000-0000-000001000000 +00000000-0000-0000-0000-000002000000 +00000000-0000-0000-0000-000003000000 +00000000-0000-0000-0000-000004000000 +00000000-0000-0000-0000-000005000000 +00000000-0000-0000-0000-000006000000 +00000000-0000-0000-0000-000007000000 +00000000-0000-0000-0000-000008000000 +00000000-0000-0000-0000-000009000000 +00000000-0000-0000-0000-00000a000000 +00000000-0000-0000-0000-00000b000000 +00000000-0000-0000-0000-00000c000000 +00000000-0000-0000-0000-00000d000000 +00000000-0000-0000-0000-00000e000000 +00000000-0000-0000-0000-00000f000000 +00000000-0000-0000-0000-000100000000 +00000000-0000-0000-0000-000200000000 +00000000-0000-0000-0000-000300000000 +00000000-0000-0000-0000-000400000000 +00000000-0000-0000-0000-000500000000 +00000000-0000-0000-0000-000600000000 +00000000-0000-0000-0000-000700000000 +00000000-0000-0000-0000-000800000000 +00000000-0000-0000-0000-000900000000 +00000000-0000-0000-0000-000a00000000 +00000000-0000-0000-0000-000b00000000 +00000000-0000-0000-0000-000c00000000 +00000000-0000-0000-0000-000d00000000 +00000000-0000-0000-0000-000e00000000 +00000000-0000-0000-0000-000f00000000 +00000000-0000-0000-0000-010000000000 +00000000-0000-0000-0000-020000000000 +00000000-0000-0000-0000-030000000000 +00000000-0000-0000-0000-040000000000 +00000000-0000-0000-0000-050000000000 +00000000-0000-0000-0000-060000000000 +00000000-0000-0000-0000-070000000000 +00000000-0000-0000-0000-080000000000 +00000000-0000-0000-0000-090000000000 +00000000-0000-0000-0000-0a0000000000 +00000000-0000-0000-0000-0b0000000000 +00000000-0000-0000-0000-0c0000000000 +00000000-0000-0000-0000-0d0000000000 +00000000-0000-0000-0000-0e0000000000 +00000000-0000-0000-0000-0f0000000000 +# +# Lexicographical ORDER BY +# +SELECT * FROM t1 ORDER BY CAST(a AS BINARY(16)); +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000005 +00000000-0000-0000-0000-000000000006 +00000000-0000-0000-0000-000000000007 +00000000-0000-0000-0000-000000000008 +00000000-0000-0000-0000-000000000009 +00000000-0000-0000-0000-00000000000a +00000000-0000-0000-0000-00000000000b +00000000-0000-0000-0000-00000000000c +00000000-0000-0000-0000-00000000000d +00000000-0000-0000-0000-00000000000e +00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000100 +00000000-0000-0000-0000-000000000200 +00000000-0000-0000-0000-000000000300 +00000000-0000-0000-0000-000000000400 +00000000-0000-0000-0000-000000000500 +00000000-0000-0000-0000-000000000600 +00000000-0000-0000-0000-000000000700 +00000000-0000-0000-0000-000000000800 +00000000-0000-0000-0000-000000000900 +00000000-0000-0000-0000-000000000a00 +00000000-0000-0000-0000-000000000b00 +00000000-0000-0000-0000-000000000c00 +00000000-0000-0000-0000-000000000d00 +00000000-0000-0000-0000-000000000e00 +00000000-0000-0000-0000-000000000f00 +00000000-0000-0000-0000-000000010000 +00000000-0000-0000-0000-000000020000 +00000000-0000-0000-0000-000000030000 +00000000-0000-0000-0000-000000040000 +00000000-0000-0000-0000-000000050000 +00000000-0000-0000-0000-000000060000 +00000000-0000-0000-0000-000000070000 +00000000-0000-0000-0000-000000080000 +00000000-0000-0000-0000-000000090000 +00000000-0000-0000-0000-0000000a0000 +00000000-0000-0000-0000-0000000b0000 +00000000-0000-0000-0000-0000000c0000 +00000000-0000-0000-0000-0000000d0000 +00000000-0000-0000-0000-0000000e0000 +00000000-0000-0000-0000-0000000f0000 +00000000-0000-0000-0000-000001000000 +00000000-0000-0000-0000-000002000000 +00000000-0000-0000-0000-000003000000 +00000000-0000-0000-0000-000004000000 +00000000-0000-0000-0000-000005000000 +00000000-0000-0000-0000-000006000000 +00000000-0000-0000-0000-000007000000 +00000000-0000-0000-0000-000008000000 +00000000-0000-0000-0000-000009000000 +00000000-0000-0000-0000-00000a000000 +00000000-0000-0000-0000-00000b000000 +00000000-0000-0000-0000-00000c000000 +00000000-0000-0000-0000-00000d000000 +00000000-0000-0000-0000-00000e000000 +00000000-0000-0000-0000-00000f000000 +00000000-0000-0000-0000-000100000000 +00000000-0000-0000-0000-000200000000 +00000000-0000-0000-0000-000300000000 +00000000-0000-0000-0000-000400000000 +00000000-0000-0000-0000-000500000000 +00000000-0000-0000-0000-000600000000 +00000000-0000-0000-0000-000700000000 +00000000-0000-0000-0000-000800000000 +00000000-0000-0000-0000-000900000000 +00000000-0000-0000-0000-000a00000000 +00000000-0000-0000-0000-000b00000000 +00000000-0000-0000-0000-000c00000000 +00000000-0000-0000-0000-000d00000000 +00000000-0000-0000-0000-000e00000000 +00000000-0000-0000-0000-000f00000000 +00000000-0000-0000-0000-010000000000 +00000000-0000-0000-0000-020000000000 +00000000-0000-0000-0000-030000000000 +00000000-0000-0000-0000-040000000000 +00000000-0000-0000-0000-050000000000 +00000000-0000-0000-0000-060000000000 +00000000-0000-0000-0000-070000000000 +00000000-0000-0000-0000-080000000000 +00000000-0000-0000-0000-090000000000 +00000000-0000-0000-0000-0a0000000000 +00000000-0000-0000-0000-0b0000000000 +00000000-0000-0000-0000-0c0000000000 +00000000-0000-0000-0000-0d0000000000 +00000000-0000-0000-0000-0e0000000000 +00000000-0000-0000-0000-0f0000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 +SELECT * FROM t1 ORDER BY CAST(COALESCE(NULL,a) AS BINARY(16)); +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000005 +00000000-0000-0000-0000-000000000006 +00000000-0000-0000-0000-000000000007 +00000000-0000-0000-0000-000000000008 +00000000-0000-0000-0000-000000000009 +00000000-0000-0000-0000-00000000000a +00000000-0000-0000-0000-00000000000b +00000000-0000-0000-0000-00000000000c +00000000-0000-0000-0000-00000000000d +00000000-0000-0000-0000-00000000000e +00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000100 +00000000-0000-0000-0000-000000000200 +00000000-0000-0000-0000-000000000300 +00000000-0000-0000-0000-000000000400 +00000000-0000-0000-0000-000000000500 +00000000-0000-0000-0000-000000000600 +00000000-0000-0000-0000-000000000700 +00000000-0000-0000-0000-000000000800 +00000000-0000-0000-0000-000000000900 +00000000-0000-0000-0000-000000000a00 +00000000-0000-0000-0000-000000000b00 +00000000-0000-0000-0000-000000000c00 +00000000-0000-0000-0000-000000000d00 +00000000-0000-0000-0000-000000000e00 +00000000-0000-0000-0000-000000000f00 +00000000-0000-0000-0000-000000010000 +00000000-0000-0000-0000-000000020000 +00000000-0000-0000-0000-000000030000 +00000000-0000-0000-0000-000000040000 +00000000-0000-0000-0000-000000050000 +00000000-0000-0000-0000-000000060000 +00000000-0000-0000-0000-000000070000 +00000000-0000-0000-0000-000000080000 +00000000-0000-0000-0000-000000090000 +00000000-0000-0000-0000-0000000a0000 +00000000-0000-0000-0000-0000000b0000 +00000000-0000-0000-0000-0000000c0000 +00000000-0000-0000-0000-0000000d0000 +00000000-0000-0000-0000-0000000e0000 +00000000-0000-0000-0000-0000000f0000 +00000000-0000-0000-0000-000001000000 +00000000-0000-0000-0000-000002000000 +00000000-0000-0000-0000-000003000000 +00000000-0000-0000-0000-000004000000 +00000000-0000-0000-0000-000005000000 +00000000-0000-0000-0000-000006000000 +00000000-0000-0000-0000-000007000000 +00000000-0000-0000-0000-000008000000 +00000000-0000-0000-0000-000009000000 +00000000-0000-0000-0000-00000a000000 +00000000-0000-0000-0000-00000b000000 +00000000-0000-0000-0000-00000c000000 +00000000-0000-0000-0000-00000d000000 +00000000-0000-0000-0000-00000e000000 +00000000-0000-0000-0000-00000f000000 +00000000-0000-0000-0000-000100000000 +00000000-0000-0000-0000-000200000000 +00000000-0000-0000-0000-000300000000 +00000000-0000-0000-0000-000400000000 +00000000-0000-0000-0000-000500000000 +00000000-0000-0000-0000-000600000000 +00000000-0000-0000-0000-000700000000 +00000000-0000-0000-0000-000800000000 +00000000-0000-0000-0000-000900000000 +00000000-0000-0000-0000-000a00000000 +00000000-0000-0000-0000-000b00000000 +00000000-0000-0000-0000-000c00000000 +00000000-0000-0000-0000-000d00000000 +00000000-0000-0000-0000-000e00000000 +00000000-0000-0000-0000-000f00000000 +00000000-0000-0000-0000-010000000000 +00000000-0000-0000-0000-020000000000 +00000000-0000-0000-0000-030000000000 +00000000-0000-0000-0000-040000000000 +00000000-0000-0000-0000-050000000000 +00000000-0000-0000-0000-060000000000 +00000000-0000-0000-0000-070000000000 +00000000-0000-0000-0000-080000000000 +00000000-0000-0000-0000-090000000000 +00000000-0000-0000-0000-0a0000000000 +00000000-0000-0000-0000-0b0000000000 +00000000-0000-0000-0000-0c0000000000 +00000000-0000-0000-0000-0d0000000000 +00000000-0000-0000-0000-0e0000000000 +00000000-0000-0000-0000-0f0000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 +DROP TABLE t1; +# # cmp_item_uuid: IN for non-constants # CREATE TABLE t1 (a UUID, b UUID); @@ -596,10 +1659,10 @@ INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000003') AS SELECT * FROM t1 ORDER BY a; a 10000000-0000-0000-0000-000000000001 -10000000-0000-0000-0000-000000000002 -10000000-0000-0000-0000-000000000003 20000000-0000-0000-0000-000000000001 +10000000-0000-0000-0000-000000000002 20000000-0000-0000-0000-000000000002 +10000000-0000-0000-0000-000000000003 20000000-0000-0000-0000-000000000003 DROP TABLE t1; # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test index ae6d3d40d5b..5f1ffc3e97c 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test @@ -139,6 +139,50 @@ SELECT * FROM t1 WHERE a IN ('::', 10); DROP TABLE t1; --echo # +--echo # ORDER BY +--echo # + +CREATE TABLE t1 (a UUID); +DELIMITER $$; +FOR i IN 0..15 +DO + INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +DELIMITER ;$$ + +--echo # +--echo # Logical ORDER BY +--echo # +SELECT * FROM t1 ORDER BY a; +SELECT COALESCE(NULL, a) FROM t1 ORDER BY a; + +--echo # +--echo # Lexicographical ORDER BY +--echo # + +SELECT * FROM t1 ORDER BY CAST(a AS BINARY(16)); +SELECT * FROM t1 ORDER BY CAST(COALESCE(NULL,a) AS BINARY(16)); + +DROP TABLE t1; + + +--echo # --echo # cmp_item_uuid: IN for non-constants --echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc index 91909d94228..41494c86ff6 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc @@ -66,3 +66,43 @@ SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); DROP TABLE t1; + + +CREATE OR REPLACE TABLE t1 (a UUID,KEY(a)); +SHOW CREATE TABLE t1; +BEGIN; +DELIMITER $$; +FOR i IN 0..255 +DO + INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +DELIMITER ;$$ +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result index 643a2e9f0cb..a23fb1865a4 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result @@ -115,6 +115,69 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff' DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID,KEY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +BEGIN; +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +DROP TABLE t1; # # End of 10.5 tests # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result index 42bb74d4b01..9d2c27a9e25 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result @@ -25,7 +25,7 @@ a 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 17 const 2 Using where +1 SIMPLE t1 ref a a 17 const 4 Using where SELECT * FROM t1 WHERE a='garbage'; a Warnings: @@ -66,7 +66,7 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000f0' ); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 6 Using where +1 SIMPLE t1 range a a 17 NULL 12 Using where SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -85,7 +85,7 @@ EXPLAIN SELECT * FROM t1 WHERE a IN 'garbage' ); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 4 Using where +1 SIMPLE t1 range a a 17 NULL 8 Using where Warnings: Warning 1292 Incorrect uuid value: 'garbage' SELECT * FROM t1 WHERE a BETWEEN @@ -178,10 +178,73 @@ a 00000000-0000-0000-0000-0000000000ff EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref a a 17 const 2 100.00 Using where +1 SIMPLE t1 ref a a 17 const 4 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff' DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID,KEY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +BEGIN; +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +DROP TABLE t1; # # End of 10.5 tests # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result index fb788dd91ab..35cc25abfd6 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result @@ -1,5 +1,5 @@ # -# Start of 10.5 tests +# Start of 10.7 tests # # # MDEV-4958 Adding datatype UUID @@ -41,7 +41,7 @@ a 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index +1 SIMPLE t1 range a a 17 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a>='garbage'; a EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; @@ -64,7 +64,7 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000f0' ); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 3 Using where; Using index +1 SIMPLE t1 range a a 17 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -115,6 +115,123 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff' DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID,KEY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +BEGIN; +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +DROP TABLE t1; +# +# Testing index prefix compression +# +CREATE PROCEDURE test_pack_key() +BEGIN +SHOW CREATE TABLE t1; +FOR i IN 0..0x1FFF +DO +INSERT INTO t1 VALUES (UUID()); +END FOR; +SELECT +CASE +WHEN INDEX_LENGTH/DATA_LENGTH < 0.7 THEN 'PACKED' + WHEN INDEX_LENGTH/DATA_LENGTH > 1.2 THEN 'NOT PACKED' + ELSE CONCAT('UNKNOWN ', INDEX_LENGTH/DATA_LENGTH) +END AS PackKey +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; +END; +$$ +"------------------ CREATE TABLE" +CREATE TABLE t1 (a UUID, KEY(a)); +CALL test_pack_key(); +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +PackKey +PACKED +DROP TABLE t1; +"------------------ t1packkey.frm" +TRUNCATE TABLE t1; +CALL test_pack_key(); +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +PackKey +PACKED +DROP TABLE t1; +"------------------ t1nopackkey.frm" +TRUNCATE TABLE t1; +CALL test_pack_key(); +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +PackKey +NOT PACKED +DROP TABLE t1; +DROP PROCEDURE test_pack_key; # -# End of 10.5 tests +# End of 10.7 tests # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test index 0f992779666..7526d344fc3 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test @@ -1,5 +1,7 @@ +let $MYSQLD_DATADIR= `select @@datadir`; + --echo # ---echo # Start of 10.5 tests +--echo # Start of 10.7 tests --echo # --echo # @@ -10,7 +12,50 @@ SET default_storage_engine=MyISAM; --source type_uuid_engines.inc +--echo # +--echo # Testing index prefix compression +--echo # + +DELIMITER $$; +CREATE PROCEDURE test_pack_key() +BEGIN + SHOW CREATE TABLE t1; + FOR i IN 0..0x1FFF + DO + INSERT INTO t1 VALUES (UUID()); + END FOR; + SELECT + CASE + WHEN INDEX_LENGTH/DATA_LENGTH < 0.7 THEN 'PACKED' + WHEN INDEX_LENGTH/DATA_LENGTH > 1.2 THEN 'NOT PACKED' + ELSE CONCAT('UNKNOWN ', INDEX_LENGTH/DATA_LENGTH) + END AS PackKey + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; +END; +$$ +DELIMITER ;$$ + +--echo "------------------ CREATE TABLE" +CREATE TABLE t1 (a UUID, KEY(a)); +CALL test_pack_key(); +DROP TABLE t1; + +--echo "------------------ t1packkey.frm" +--copy_file $MTR_SUITE_DIR/std_data/t1packkey.frm $MYSQLD_DATADIR/test/t1.frm +TRUNCATE TABLE t1; +CALL test_pack_key(); +DROP TABLE t1; + +--echo "------------------ t1nopackkey.frm" +--copy_file $MTR_SUITE_DIR/std_data/t1nopackkey.frm $MYSQLD_DATADIR/test/t1.frm +TRUNCATE TABLE t1; +CALL test_pack_key(); +DROP TABLE t1; + + +DROP PROCEDURE test_pack_key; --echo # ---echo # End of 10.5 tests +--echo # End of 10.7 tests --echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result index bd0879325e7..82b96002d2e 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result @@ -27,3 +27,1771 @@ SELECT * FROM t1 PARTITION (pFF); a ffff0000-0000-0000-0000-00000000ffff DROP TABLE t1; +CREATE TABLE t0 (a UUID); +FOR i IN 0..255 +DO +INSERT INTO t0 VALUES (REPLACE('XXfd306d-307f-11ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-XX7f-12ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-13XX-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-14ec-8dXX-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-15ec-8d10-XX0bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-16ec-8d10-d20bbc909bXX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +# Test that UUID and BINARY(16) implement the same distribution by key +CREATE PROCEDURE test_partition_by_key_uuid_vs_binary(parts INT) +BEGIN +EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts); +EXECUTE IMMEDIATE REPLACE('CREATE TABLE t2 (a BINARY(16)) PARTITION BY KEY (a) PARTITIONS 7','7',parts); +INSERT INTO t1 SELECT * FROM t0; +INSERT INTO t2 SELECT * FROM t0; +FOR i IN 0..(parts-1) +DO +BEGIN +DECLARE query_template TEXT DEFAULT 'SELECT a_p0, COUNT(*) FROM (' + 'SELECT a AS a_p0 FROM t1 PARTITION(p0) ' + 'UNION ALL ' + 'SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td ' + 'GROUP BY a_p0'; +DECLARE query TEXT DEFAULT REPLACE(query_template,'p0',CONCAT('p',i)); +SELECT query; +EXECUTE IMMEDIATE query; +END; +END FOR; +DROP TABLE t1,t2; +END; +$$ +# Display statistics how records are distributed between partitions +CREATE PROCEDURE test_partition_by_key_pstat(parts INT) +BEGIN +EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts); +CREATE TABLE t1_pstat (pname VARCHAR(32), pcount int); +INSERT INTO t1 SELECT * FROM t0; +FOR i IN 0..(parts-1) +DO +BEGIN +DECLARE query_template TEXT DEFAULT 'INSERT INTO t1_pstat VALUES (''p0'',(SELECT COUNT(*) FROM t1 PARTITION (p0)))'; +EXECUTE IMMEDIATE REPLACE(query_template,'p0',CONCAT('p',i)); +END; +END FOR; +SELECT * FROM t1_pstat ORDER BY CAST(SUBSTR(pname,2,100) AS UNSIGNED); +DROP TABLE t1,t1_pstat; +END; +$$ +CALL test_partition_by_key_uuid_vs_binary(7); +query +SELECT a_p0, COUNT(*) FROM (SELECT a AS a_p0 FROM t1 PARTITION(p0) UNION ALL SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td GROUP BY a_p0 +a_p0 COUNT(*) +9cfd306d-307f-15ec-8d10-010bbc909b57 2 +9cfd306d-307f-15ec-8d10-080bbc909b57 2 +9cfd306d-307f-15ec-8d10-0d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-250bbc909b57 2 +9cfd306d-307f-15ec-8d10-2b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-300bbc909b57 2 +9cfd306d-307f-15ec-8d10-3c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-480bbc909b57 2 +9cfd306d-307f-15ec-8d10-500bbc909b57 2 +9cfd306d-307f-15ec-8d10-530bbc909b57 2 +9cfd306d-307f-15ec-8d10-560bbc909b57 2 +9cfd306d-307f-15ec-8d10-570bbc909b57 2 +9cfd306d-307f-15ec-8d10-580bbc909b57 2 +9cfd306d-307f-15ec-8d10-630bbc909b57 2 +9cfd306d-307f-15ec-8d10-680bbc909b57 2 +9cfd306d-307f-15ec-8d10-6a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-700bbc909b57 2 +9cfd306d-307f-15ec-8d10-7e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-820bbc909b57 2 +9cfd306d-307f-15ec-8d10-8e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-930bbc909b57 2 +9cfd306d-307f-15ec-8d10-970bbc909b57 2 +9cfd306d-307f-15ec-8d10-980bbc909b57 2 +9cfd306d-307f-15ec-8d10-9b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-9f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-a00bbc909b57 2 +9cfd306d-307f-15ec-8d10-a70bbc909b57 2 +9cfd306d-307f-15ec-8d10-a80bbc909b57 2 +9cfd306d-307f-15ec-8d10-b80bbc909b57 2 +9cfd306d-307f-15ec-8d10-c10bbc909b57 2 +9cfd306d-307f-15ec-8d10-c30bbc909b57 2 +9cfd306d-307f-15ec-8d10-c60bbc909b57 2 +9cfd306d-307f-15ec-8d10-cb0bbc909b57 2 +9cfd306d-307f-15ec-8d10-cf0bbc909b57 2 +9cfd306d-307f-15ec-8d10-d00bbc909b57 2 +9cfd306d-307f-15ec-8d10-d10bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b04 2 +9cfd306d-307f-16ec-8d10-d20bbc909b13 2 +9cfd306d-307f-16ec-8d10-d20bbc909b29 2 +9cfd306d-307f-16ec-8d10-d20bbc909b31 2 +9cfd306d-307f-16ec-8d10-d20bbc909b37 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b45 2 +9cfd306d-307f-16ec-8d10-d20bbc909b51 2 +9cfd306d-307f-16ec-8d10-d20bbc909b56 2 +9cfd306d-307f-14ec-8d05-d20bbc909b57 2 +9cfd306d-307f-14ec-8d07-d20bbc909b57 2 +0bfd306d-307f-11ec-8d10-d20bbc909b57 2 +0dfd306d-307f-11ec-8d10-d20bbc909b57 2 +16fd306d-307f-11ec-8d10-d20bbc909b57 2 +17fd306d-307f-11ec-8d10-d20bbc909b57 2 +19fd306d-307f-11ec-8d10-d20bbc909b57 2 +34fd306d-307f-11ec-8d10-d20bbc909b57 2 +36fd306d-307f-11ec-8d10-d20bbc909b57 2 +48fd306d-307f-11ec-8d10-d20bbc909b57 2 +58fd306d-307f-11ec-8d10-d20bbc909b57 2 +61fd306d-307f-11ec-8d10-d20bbc909b57 2 +76fd306d-307f-11ec-8d10-d20bbc909b57 2 +78fd306d-307f-11ec-8d10-d20bbc909b57 2 +7efd306d-307f-11ec-8d10-d20bbc909b57 2 +7ffd306d-307f-11ec-8d10-d20bbc909b57 2 +85fd306d-307f-11ec-8d10-d20bbc909b57 2 +8ffd306d-307f-11ec-8d10-d20bbc909b57 2 +91fd306d-307f-11ec-8d10-d20bbc909b57 2 +9bfd306d-307f-11ec-8d10-d20bbc909b57 2 +affd306d-307f-11ec-8d10-d20bbc909b57 2 +b2fd306d-307f-11ec-8d10-d20bbc909b57 2 +b3fd306d-307f-11ec-8d10-d20bbc909b57 2 +b4fd306d-307f-11ec-8d10-d20bbc909b57 2 +c3fd306d-307f-11ec-8d10-d20bbc909b57 2 +cdfd306d-307f-11ec-8d10-d20bbc909b57 2 +d0fd306d-307f-11ec-8d10-d20bbc909b57 2 +d3fd306d-307f-11ec-8d10-d20bbc909b57 2 +d4fd306d-307f-11ec-8d10-d20bbc909b57 2 +e4fd306d-307f-11ec-8d10-d20bbc909b57 2 +f3fd306d-307f-11ec-8d10-d20bbc909b57 2 +f6fd306d-307f-11ec-8d10-d20bbc909b57 2 +f7fd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-0e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-177f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-347f-12ec-8d10-d20bbc909b57 2 +9cfd306d-377f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-447f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-527f-12ec-8d10-d20bbc909b57 2 +9cfd306d-537f-12ec-8d10-d20bbc909b57 2 +9cfd306d-547f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-727f-12ec-8d10-d20bbc909b57 2 +9cfd306d-787f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-807f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-977f-12ec-8d10-d20bbc909b57 2 +9cfd306d-987f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ac7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-bb7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fd7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1300-8d10-d20bbc909b57 2 +9cfd306d-307f-1309-8d10-d20bbc909b57 2 +9cfd306d-307f-130b-8d10-d20bbc909b57 2 +9cfd306d-307f-130e-8d10-d20bbc909b57 2 +9cfd306d-307f-1313-8d10-d20bbc909b57 2 +9cfd306d-307f-1329-8d10-d20bbc909b57 2 +9cfd306d-307f-132a-8d10-d20bbc909b57 2 +9cfd306d-307f-1332-8d10-d20bbc909b57 2 +9cfd306d-307f-1336-8d10-d20bbc909b57 2 +9cfd306d-307f-1337-8d10-d20bbc909b57 2 +9cfd306d-307f-133d-8d10-d20bbc909b57 2 +9cfd306d-307f-1340-8d10-d20bbc909b57 2 +9cfd306d-307f-134d-8d10-d20bbc909b57 2 +9cfd306d-307f-1351-8d10-d20bbc909b57 2 +9cfd306d-307f-1363-8d10-d20bbc909b57 2 +9cfd306d-307f-1375-8d10-d20bbc909b57 2 +9cfd306d-307f-137d-8d10-d20bbc909b57 2 +9cfd306d-307f-137e-8d10-d20bbc909b57 2 +9cfd306d-307f-138e-8d10-d20bbc909b57 2 +9cfd306d-307f-139f-8d10-d20bbc909b57 2 +9cfd306d-307f-13a1-8d10-d20bbc909b57 2 +9cfd306d-307f-13a2-8d10-d20bbc909b57 2 +9cfd306d-307f-13b1-8d10-d20bbc909b57 2 +9cfd306d-307f-13b3-8d10-d20bbc909b57 2 +9cfd306d-307f-13b5-8d10-d20bbc909b57 2 +9cfd306d-307f-13bf-8d10-d20bbc909b57 2 +9cfd306d-307f-13d0-8d10-d20bbc909b57 2 +9cfd306d-307f-13db-8d10-d20bbc909b57 2 +9cfd306d-307f-13fe-8d10-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d27-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d30-d20bbc909b57 2 +9cfd306d-307f-14ec-8d33-d20bbc909b57 2 +9cfd306d-307f-14ec-8d36-d20bbc909b57 2 +9cfd306d-307f-14ec-8d38-d20bbc909b57 2 +9cfd306d-307f-14ec-8d40-d20bbc909b57 2 +9cfd306d-307f-14ec-8d42-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d50-d20bbc909b57 2 +9cfd306d-307f-14ec-8d51-d20bbc909b57 2 +9cfd306d-307f-14ec-8d59-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d63-d20bbc909b57 2 +9cfd306d-307f-14ec-8d67-d20bbc909b57 2 +9cfd306d-307f-14ec-8d68-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d75-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d81-d20bbc909b57 2 +9cfd306d-307f-14ec-8d82-d20bbc909b57 2 +9cfd306d-307f-14ec-8d86-d20bbc909b57 2 +9cfd306d-307f-14ec-8d87-d20bbc909b57 2 +9cfd306d-307f-14ec-8d94-d20bbc909b57 2 +9cfd306d-307f-14ec-8d95-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9f-d20bbc909b57 2 +9cfd306d-307f-14ec-8db4-d20bbc909b57 2 +9cfd306d-307f-14ec-8db9-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd3-d20bbc909b57 2 +9cfd306d-307f-14ec-8de1-d20bbc909b57 2 +9cfd306d-307f-14ec-8de6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dee-d20bbc909b57 2 +9cfd306d-307f-14ec-8df1-d20bbc909b57 2 +9cfd306d-307f-14ec-8df6-d20bbc909b57 2 +9cfd306d-307f-14ec-8df7-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b69 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b72 2 +9cfd306d-307f-16ec-8d10-d20bbc909b78 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b82 2 +9cfd306d-307f-16ec-8d10-d20bbc909b83 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9c 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba2 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bab 2 +9cfd306d-307f-16ec-8d10-d20bbc909bac 2 +9cfd306d-307f-16ec-8d10-d20bbc909bad 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bdf 2 +9cfd306d-307f-16ec-8d10-d20bbc909be8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bee 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf0 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf1 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf2 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfb 2 +9cfd306d-307f-16ec-8d10-d20bbc909bff 2 +9cfd306d-307f-15ec-8d10-d40bbc909b57 2 +9cfd306d-307f-15ec-8d10-df0bbc909b57 2 +9cfd306d-307f-15ec-8d10-e40bbc909b57 2 +9cfd306d-307f-15ec-8d10-eb0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ef0bbc909b57 2 +9cfd306d-307f-15ec-8d10-f10bbc909b57 2 +9cfd306d-307f-15ec-8d10-f90bbc909b57 2 +query +SELECT a_p1, COUNT(*) FROM (SELECT a AS a_p1 FROM t1 PARTITION(p1) UNION ALL SELECT CAST(a AS UUID) AS a_p1 FROM t2 PARTITION(p1)) td GROUP BY a_p1 +a_p1 COUNT(*) +9cfd306d-307f-15ec-8d10-060bbc909b57 2 +9cfd306d-307f-15ec-8d10-0c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-120bbc909b57 2 +9cfd306d-307f-15ec-8d10-150bbc909b57 2 +9cfd306d-307f-15ec-8d10-1a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-1c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-1d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-1f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-230bbc909b57 2 +9cfd306d-307f-15ec-8d10-2d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-310bbc909b57 2 +9cfd306d-307f-15ec-8d10-3a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-3e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-400bbc909b57 2 +9cfd306d-307f-15ec-8d10-4c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-5e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-5f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-7b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-7d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-8c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-910bbc909b57 2 +9cfd306d-307f-15ec-8d10-920bbc909b57 2 +9cfd306d-307f-15ec-8d10-940bbc909b57 2 +9cfd306d-307f-15ec-8d10-950bbc909b57 2 +9cfd306d-307f-15ec-8d10-9d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-a20bbc909b57 2 +9cfd306d-307f-15ec-8d10-aa0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ac0bbc909b57 2 +9cfd306d-307f-15ec-8d10-af0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ba0bbc909b57 2 +9cfd306d-307f-15ec-8d10-bc0bbc909b57 2 +9cfd306d-307f-15ec-8d10-c50bbc909b57 2 +9cfd306d-307f-15ec-8d10-cc0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b05 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b34 2 +9cfd306d-307f-16ec-8d10-d20bbc909b35 2 +9cfd306d-307f-16ec-8d10-d20bbc909b42 2 +00fd306d-307f-11ec-8d10-d20bbc909b57 2 +09fd306d-307f-11ec-8d10-d20bbc909b57 2 +10fd306d-307f-11ec-8d10-d20bbc909b57 2 +13fd306d-307f-11ec-8d10-d20bbc909b57 2 +1cfd306d-307f-11ec-8d10-d20bbc909b57 2 +3ffd306d-307f-11ec-8d10-d20bbc909b57 2 +45fd306d-307f-11ec-8d10-d20bbc909b57 2 +4efd306d-307f-11ec-8d10-d20bbc909b57 2 +4ffd306d-307f-11ec-8d10-d20bbc909b57 2 +50fd306d-307f-11ec-8d10-d20bbc909b57 2 +54fd306d-307f-11ec-8d10-d20bbc909b57 2 +55fd306d-307f-11ec-8d10-d20bbc909b57 2 +5bfd306d-307f-11ec-8d10-d20bbc909b57 2 +5ffd306d-307f-11ec-8d10-d20bbc909b57 2 +6ffd306d-307f-11ec-8d10-d20bbc909b57 2 +73fd306d-307f-11ec-8d10-d20bbc909b57 2 +89fd306d-307f-11ec-8d10-d20bbc909b57 2 +8cfd306d-307f-11ec-8d10-d20bbc909b57 2 +8dfd306d-307f-11ec-8d10-d20bbc909b57 2 +93fd306d-307f-11ec-8d10-d20bbc909b57 2 +94fd306d-307f-11ec-8d10-d20bbc909b57 2 +9efd306d-307f-11ec-8d10-d20bbc909b57 2 +aefd306d-307f-11ec-8d10-d20bbc909b57 2 +b0fd306d-307f-11ec-8d10-d20bbc909b57 2 +c2fd306d-307f-11ec-8d10-d20bbc909b57 2 +cbfd306d-307f-11ec-8d10-d20bbc909b57 2 +ddfd306d-307f-11ec-8d10-d20bbc909b57 2 +defd306d-307f-11ec-8d10-d20bbc909b57 2 +e5fd306d-307f-11ec-8d10-d20bbc909b57 2 +e6fd306d-307f-11ec-8d10-d20bbc909b57 2 +edfd306d-307f-11ec-8d10-d20bbc909b57 2 +f9fd306d-307f-11ec-8d10-d20bbc909b57 2 +fafd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-007f-12ec-8d10-d20bbc909b57 2 +9cfd306d-037f-12ec-8d10-d20bbc909b57 2 +9cfd306d-047f-12ec-8d10-d20bbc909b57 2 +9cfd306d-057f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-117f-12ec-8d10-d20bbc909b57 2 +9cfd306d-127f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-207f-12ec-8d10-d20bbc909b57 2 +9cfd306d-227f-12ec-8d10-d20bbc909b57 2 +9cfd306d-247f-12ec-8d10-d20bbc909b57 2 +9cfd306d-277f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-12ec-8d10-d20bbc909b57 2 +9cfd306d-317f-12ec-8d10-d20bbc909b57 2 +9cfd306d-357f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-407f-12ec-8d10-d20bbc909b57 2 +9cfd306d-437f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-657f-12ec-8d10-d20bbc909b57 2 +9cfd306d-747f-12ec-8d10-d20bbc909b57 2 +9cfd306d-817f-12ec-8d10-d20bbc909b57 2 +9cfd306d-927f-12ec-8d10-d20bbc909b57 2 +9cfd306d-967f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-bd7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-dd7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ea7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1314-8d10-d20bbc909b57 2 +9cfd306d-307f-1319-8d10-d20bbc909b57 2 +9cfd306d-307f-131e-8d10-d20bbc909b57 2 +9cfd306d-307f-1325-8d10-d20bbc909b57 2 +9cfd306d-307f-132d-8d10-d20bbc909b57 2 +9cfd306d-307f-132e-8d10-d20bbc909b57 2 +9cfd306d-307f-1330-8d10-d20bbc909b57 2 +9cfd306d-307f-1335-8d10-d20bbc909b57 2 +9cfd306d-307f-1339-8d10-d20bbc909b57 2 +9cfd306d-307f-1341-8d10-d20bbc909b57 2 +9cfd306d-307f-1345-8d10-d20bbc909b57 2 +9cfd306d-307f-1355-8d10-d20bbc909b57 2 +9cfd306d-307f-135a-8d10-d20bbc909b57 2 +9cfd306d-307f-135b-8d10-d20bbc909b57 2 +9cfd306d-307f-135c-8d10-d20bbc909b57 2 +9cfd306d-307f-1379-8d10-d20bbc909b57 2 +9cfd306d-307f-137f-8d10-d20bbc909b57 2 +9cfd306d-307f-1383-8d10-d20bbc909b57 2 +9cfd306d-307f-1388-8d10-d20bbc909b57 2 +9cfd306d-307f-1389-8d10-d20bbc909b57 2 +9cfd306d-307f-138c-8d10-d20bbc909b57 2 +9cfd306d-307f-138d-8d10-d20bbc909b57 2 +9cfd306d-307f-138f-8d10-d20bbc909b57 2 +9cfd306d-307f-1390-8d10-d20bbc909b57 2 +9cfd306d-307f-1391-8d10-d20bbc909b57 2 +9cfd306d-307f-139c-8d10-d20bbc909b57 2 +9cfd306d-307f-13a3-8d10-d20bbc909b57 2 +9cfd306d-307f-13aa-8d10-d20bbc909b57 2 +9cfd306d-307f-13ab-8d10-d20bbc909b57 2 +9cfd306d-307f-13af-8d10-d20bbc909b57 2 +9cfd306d-307f-13b4-8d10-d20bbc909b57 2 +9cfd306d-307f-13bc-8d10-d20bbc909b57 2 +9cfd306d-307f-13be-8d10-d20bbc909b57 2 +9cfd306d-307f-13c2-8d10-d20bbc909b57 2 +9cfd306d-307f-13c8-8d10-d20bbc909b57 2 +9cfd306d-307f-13cf-8d10-d20bbc909b57 2 +9cfd306d-307f-13e0-8d10-d20bbc909b57 2 +9cfd306d-307f-13e7-8d10-d20bbc909b57 2 +9cfd306d-307f-13fa-8d10-d20bbc909b57 2 +9cfd306d-307f-15ec-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d11-d20bbc909b57 2 +9cfd306d-307f-14ec-8d17-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d37-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d45-d20bbc909b57 2 +9cfd306d-307f-14ec-8d47-d20bbc909b57 2 +9cfd306d-307f-14ec-8d49-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d57-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d78-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d88-d20bbc909b57 2 +9cfd306d-307f-14ec-8d89-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d92-d20bbc909b57 2 +9cfd306d-307f-14ec-8d97-d20bbc909b57 2 +9cfd306d-307f-14ec-8da0-d20bbc909b57 2 +9cfd306d-307f-14ec-8da3-d20bbc909b57 2 +9cfd306d-307f-14ec-8da5-d20bbc909b57 2 +9cfd306d-307f-14ec-8daa-d20bbc909b57 2 +9cfd306d-307f-14ec-8db5-d20bbc909b57 2 +9cfd306d-307f-14ec-8dcc-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd1-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dda-d20bbc909b57 2 +9cfd306d-307f-14ec-8ddd-d20bbc909b57 2 +9cfd306d-307f-14ec-8df9-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b65 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b73 2 +9cfd306d-307f-16ec-8d10-d20bbc909b80 2 +9cfd306d-307f-16ec-8d10-d20bbc909b86 2 +9cfd306d-307f-16ec-8d10-d20bbc909b87 2 +9cfd306d-307f-16ec-8d10-d20bbc909b89 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8e 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bae 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb0 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb1 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb7 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbb 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bca 2 +9cfd306d-307f-16ec-8d10-d20bbc909bcf 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfc 2 +9cfd306d-307f-15ec-8d10-d30bbc909b57 2 +9cfd306d-307f-15ec-8d10-dc0bbc909b57 2 +9cfd306d-307f-15ec-8d10-e30bbc909b57 2 +9cfd306d-307f-15ec-8d10-e80bbc909b57 2 +9cfd306d-307f-15ec-8d10-ed0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ee0bbc909b57 2 +query +SELECT a_p2, COUNT(*) FROM (SELECT a AS a_p2 FROM t1 PARTITION(p2) UNION ALL SELECT CAST(a AS UUID) AS a_p2 FROM t2 PARTITION(p2)) td GROUP BY a_p2 +a_p2 COUNT(*) +9cfd306d-307f-15ec-8d10-040bbc909b57 2 +9cfd306d-307f-15ec-8d10-0f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-100bbc909b57 2 +9cfd306d-307f-15ec-8d10-110bbc909b57 2 +9cfd306d-307f-15ec-8d10-130bbc909b57 2 +9cfd306d-307f-15ec-8d10-180bbc909b57 2 +9cfd306d-307f-15ec-8d10-1e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-320bbc909b57 2 +9cfd306d-307f-15ec-8d10-330bbc909b57 2 +9cfd306d-307f-15ec-8d10-430bbc909b57 2 +9cfd306d-307f-15ec-8d10-460bbc909b57 2 +9cfd306d-307f-15ec-8d10-520bbc909b57 2 +9cfd306d-307f-15ec-8d10-650bbc909b57 2 +9cfd306d-307f-15ec-8d10-660bbc909b57 2 +9cfd306d-307f-15ec-8d10-6e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-750bbc909b57 2 +9cfd306d-307f-15ec-8d10-780bbc909b57 2 +9cfd306d-307f-15ec-8d10-790bbc909b57 2 +9cfd306d-307f-15ec-8d10-830bbc909b57 2 +9cfd306d-307f-15ec-8d10-8f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-900bbc909b57 2 +9cfd306d-307f-15ec-8d10-9a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-9c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-a40bbc909b57 2 +9cfd306d-307f-15ec-8d10-c00bbc909b57 2 +9cfd306d-307f-15ec-8d10-c20bbc909b57 2 +9cfd306d-307f-15ec-8d10-c40bbc909b57 2 +9cfd306d-307f-15ec-8d10-cd0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b02 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b16 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b26 2 +9cfd306d-307f-16ec-8d10-d20bbc909b27 2 +9cfd306d-307f-16ec-8d10-d20bbc909b38 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b43 2 +9cfd306d-307f-16ec-8d10-d20bbc909b46 2 +9cfd306d-307f-16ec-8d10-d20bbc909b47 2 +9cfd306d-307f-16ec-8d10-d20bbc909b49 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4f 2 +9cfd306d-307f-14ec-8d01-d20bbc909b57 2 +9cfd306d-307f-14ec-8d06-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0a-d20bbc909b57 2 +02fd306d-307f-11ec-8d10-d20bbc909b57 2 +07fd306d-307f-11ec-8d10-d20bbc909b57 2 +08fd306d-307f-11ec-8d10-d20bbc909b57 2 +0efd306d-307f-11ec-8d10-d20bbc909b57 2 +1afd306d-307f-11ec-8d10-d20bbc909b57 2 +20fd306d-307f-11ec-8d10-d20bbc909b57 2 +25fd306d-307f-11ec-8d10-d20bbc909b57 2 +26fd306d-307f-11ec-8d10-d20bbc909b57 2 +2afd306d-307f-11ec-8d10-d20bbc909b57 2 +2dfd306d-307f-11ec-8d10-d20bbc909b57 2 +32fd306d-307f-11ec-8d10-d20bbc909b57 2 +33fd306d-307f-11ec-8d10-d20bbc909b57 2 +3dfd306d-307f-11ec-8d10-d20bbc909b57 2 +42fd306d-307f-11ec-8d10-d20bbc909b57 2 +46fd306d-307f-11ec-8d10-d20bbc909b57 2 +4bfd306d-307f-11ec-8d10-d20bbc909b57 2 +53fd306d-307f-11ec-8d10-d20bbc909b57 2 +5afd306d-307f-11ec-8d10-d20bbc909b57 2 +65fd306d-307f-11ec-8d10-d20bbc909b57 2 +69fd306d-307f-11ec-8d10-d20bbc909b57 2 +6bfd306d-307f-11ec-8d10-d20bbc909b57 2 +7cfd306d-307f-11ec-8d10-d20bbc909b57 2 +82fd306d-307f-11ec-8d10-d20bbc909b57 2 +86fd306d-307f-11ec-8d10-d20bbc909b57 2 +99fd306d-307f-11ec-8d10-d20bbc909b57 2 +9afd306d-307f-11ec-8d10-d20bbc909b57 2 +a3fd306d-307f-11ec-8d10-d20bbc909b57 2 +aafd306d-307f-11ec-8d10-d20bbc909b57 2 +ccfd306d-307f-11ec-8d10-d20bbc909b57 2 +d5fd306d-307f-11ec-8d10-d20bbc909b57 2 +dcfd306d-307f-11ec-8d10-d20bbc909b57 2 +e0fd306d-307f-11ec-8d10-d20bbc909b57 2 +f0fd306d-307f-11ec-8d10-d20bbc909b57 2 +f1fd306d-307f-11ec-8d10-d20bbc909b57 2 +f4fd306d-307f-11ec-8d10-d20bbc909b57 2 +f8fd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-097f-12ec-8d10-d20bbc909b57 2 +9cfd306d-137f-12ec-8d10-d20bbc909b57 2 +9cfd306d-267f-12ec-8d10-d20bbc909b57 2 +9cfd306d-297f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-757f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-867f-12ec-8d10-d20bbc909b57 2 +9cfd306d-897f-12ec-8d10-d20bbc909b57 2 +9cfd306d-907f-12ec-8d10-d20bbc909b57 2 +9cfd306d-937f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ab7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-da7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-eb7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ec7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ff7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-131c-8d10-d20bbc909b57 2 +9cfd306d-307f-1320-8d10-d20bbc909b57 2 +9cfd306d-307f-1321-8d10-d20bbc909b57 2 +9cfd306d-307f-1327-8d10-d20bbc909b57 2 +9cfd306d-307f-1331-8d10-d20bbc909b57 2 +9cfd306d-307f-1338-8d10-d20bbc909b57 2 +9cfd306d-307f-133a-8d10-d20bbc909b57 2 +9cfd306d-307f-133b-8d10-d20bbc909b57 2 +9cfd306d-307f-133e-8d10-d20bbc909b57 2 +9cfd306d-307f-1356-8d10-d20bbc909b57 2 +9cfd306d-307f-135e-8d10-d20bbc909b57 2 +9cfd306d-307f-1361-8d10-d20bbc909b57 2 +9cfd306d-307f-1368-8d10-d20bbc909b57 2 +9cfd306d-307f-136a-8d10-d20bbc909b57 2 +9cfd306d-307f-136c-8d10-d20bbc909b57 2 +9cfd306d-307f-136e-8d10-d20bbc909b57 2 +9cfd306d-307f-136f-8d10-d20bbc909b57 2 +9cfd306d-307f-1372-8d10-d20bbc909b57 2 +9cfd306d-307f-1376-8d10-d20bbc909b57 2 +9cfd306d-307f-1381-8d10-d20bbc909b57 2 +9cfd306d-307f-1382-8d10-d20bbc909b57 2 +9cfd306d-307f-1385-8d10-d20bbc909b57 2 +9cfd306d-307f-1386-8d10-d20bbc909b57 2 +9cfd306d-307f-1387-8d10-d20bbc909b57 2 +9cfd306d-307f-138a-8d10-d20bbc909b57 2 +9cfd306d-307f-1394-8d10-d20bbc909b57 2 +9cfd306d-307f-1398-8d10-d20bbc909b57 2 +9cfd306d-307f-13a6-8d10-d20bbc909b57 2 +9cfd306d-307f-13a7-8d10-d20bbc909b57 2 +9cfd306d-307f-13b0-8d10-d20bbc909b57 2 +9cfd306d-307f-13b8-8d10-d20bbc909b57 2 +9cfd306d-307f-13ba-8d10-d20bbc909b57 2 +9cfd306d-307f-13bb-8d10-d20bbc909b57 2 +9cfd306d-307f-13c0-8d10-d20bbc909b57 2 +9cfd306d-307f-13ca-8d10-d20bbc909b57 2 +9cfd306d-307f-13ce-8d10-d20bbc909b57 2 +9cfd306d-307f-13d1-8d10-d20bbc909b57 2 +9cfd306d-307f-13d3-8d10-d20bbc909b57 2 +9cfd306d-307f-13d6-8d10-d20bbc909b57 2 +9cfd306d-307f-13d8-8d10-d20bbc909b57 2 +9cfd306d-307f-13df-8d10-d20bbc909b57 2 +9cfd306d-307f-13e9-8d10-d20bbc909b57 2 +9cfd306d-307f-13eb-8d10-d20bbc909b57 2 +9cfd306d-307f-13f5-8d10-d20bbc909b57 2 +9cfd306d-307f-13f7-8d10-d20bbc909b57 2 +9cfd306d-307f-13f9-8d10-d20bbc909b57 2 +9cfd306d-307f-13fb-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d31-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d44-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d61-d20bbc909b57 2 +9cfd306d-307f-14ec-8d76-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d96-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9b-d20bbc909b57 2 +9cfd306d-307f-14ec-8da6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dab-d20bbc909b57 2 +9cfd306d-307f-14ec-8dad-d20bbc909b57 2 +9cfd306d-307f-14ec-8dba-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbd-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc5-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd4-d20bbc909b57 2 +9cfd306d-307f-14ec-8de5-d20bbc909b57 2 +9cfd306d-307f-14ec-8de8-d20bbc909b57 2 +9cfd306d-307f-14ec-8de9-d20bbc909b57 2 +9cfd306d-307f-14ec-8def-d20bbc909b57 2 +9cfd306d-307f-14ec-8df8-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b58 2 +9cfd306d-307f-16ec-8d10-d20bbc909b62 2 +9cfd306d-307f-16ec-8d10-d20bbc909b63 2 +9cfd306d-307f-16ec-8d10-d20bbc909b70 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b81 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b94 2 +9cfd306d-307f-16ec-8d10-d20bbc909b95 2 +9cfd306d-307f-16ec-8d10-d20bbc909b96 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9f 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba7 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb5 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbc 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbf 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc7 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd2 2 +9cfd306d-307f-16ec-8d10-d20bbc909bdd 2 +9cfd306d-307f-16ec-8d10-d20bbc909be0 2 +9cfd306d-307f-16ec-8d10-d20bbc909be1 2 +9cfd306d-307f-16ec-8d10-d20bbc909be6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bec 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfa 2 +9cfd306d-307f-15ec-8d10-e20bbc909b57 2 +9cfd306d-307f-15ec-8d10-ec0bbc909b57 2 +9cfd306d-307f-15ec-8d10-f70bbc909b57 2 +9cfd306d-307f-15ec-8d10-fb0bbc909b57 2 +query +SELECT a_p3, COUNT(*) FROM (SELECT a AS a_p3 FROM t1 PARTITION(p3) UNION ALL SELECT CAST(a AS UUID) AS a_p3 FROM t2 PARTITION(p3)) td GROUP BY a_p3 +a_p3 COUNT(*) +9cfd306d-307f-15ec-8d10-090bbc909b57 2 +9cfd306d-307f-15ec-8d10-190bbc909b57 2 +9cfd306d-307f-15ec-8d10-240bbc909b57 2 +9cfd306d-307f-15ec-8d10-260bbc909b57 2 +9cfd306d-307f-15ec-8d10-270bbc909b57 2 +9cfd306d-307f-15ec-8d10-470bbc909b57 2 +9cfd306d-307f-15ec-8d10-490bbc909b57 2 +9cfd306d-307f-15ec-8d10-510bbc909b57 2 +9cfd306d-307f-15ec-8d10-5a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-5d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-640bbc909b57 2 +9cfd306d-307f-15ec-8d10-740bbc909b57 2 +9cfd306d-307f-15ec-8d10-770bbc909b57 2 +9cfd306d-307f-15ec-8d10-840bbc909b57 2 +9cfd306d-307f-15ec-8d10-860bbc909b57 2 +9cfd306d-307f-15ec-8d10-880bbc909b57 2 +9cfd306d-307f-15ec-8d10-8b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-990bbc909b57 2 +9cfd306d-307f-15ec-8d10-ad0bbc909b57 2 +9cfd306d-307f-15ec-8d10-b00bbc909b57 2 +9cfd306d-307f-15ec-8d10-b60bbc909b57 2 +9cfd306d-307f-15ec-8d10-b70bbc909b57 2 +9cfd306d-307f-15ec-8d10-c70bbc909b57 2 +9cfd306d-307f-15ec-8d10-ca0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b03 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b10 2 +9cfd306d-307f-16ec-8d10-d20bbc909b11 2 +9cfd306d-307f-16ec-8d10-d20bbc909b17 2 +9cfd306d-307f-16ec-8d10-d20bbc909b19 2 +9cfd306d-307f-16ec-8d10-d20bbc909b22 2 +9cfd306d-307f-16ec-8d10-d20bbc909b24 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b40 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b54 2 +9cfd306d-307f-16ec-8d10-d20bbc909b55 2 +9cfd306d-307f-14ec-8d02-d20bbc909b57 2 +03fd306d-307f-11ec-8d10-d20bbc909b57 2 +04fd306d-307f-11ec-8d10-d20bbc909b57 2 +11fd306d-307f-11ec-8d10-d20bbc909b57 2 +14fd306d-307f-11ec-8d10-d20bbc909b57 2 +1bfd306d-307f-11ec-8d10-d20bbc909b57 2 +21fd306d-307f-11ec-8d10-d20bbc909b57 2 +29fd306d-307f-11ec-8d10-d20bbc909b57 2 +2bfd306d-307f-11ec-8d10-d20bbc909b57 2 +38fd306d-307f-11ec-8d10-d20bbc909b57 2 +3bfd306d-307f-11ec-8d10-d20bbc909b57 2 +3efd306d-307f-11ec-8d10-d20bbc909b57 2 +51fd306d-307f-11ec-8d10-d20bbc909b57 2 +52fd306d-307f-11ec-8d10-d20bbc909b57 2 +5cfd306d-307f-11ec-8d10-d20bbc909b57 2 +60fd306d-307f-11ec-8d10-d20bbc909b57 2 +62fd306d-307f-11ec-8d10-d20bbc909b57 2 +66fd306d-307f-11ec-8d10-d20bbc909b57 2 +6efd306d-307f-11ec-8d10-d20bbc909b57 2 +75fd306d-307f-11ec-8d10-d20bbc909b57 2 +83fd306d-307f-11ec-8d10-d20bbc909b57 2 +97fd306d-307f-11ec-8d10-d20bbc909b57 2 +a1fd306d-307f-11ec-8d10-d20bbc909b57 2 +adfd306d-307f-11ec-8d10-d20bbc909b57 2 +b7fd306d-307f-11ec-8d10-d20bbc909b57 2 +b8fd306d-307f-11ec-8d10-d20bbc909b57 2 +b9fd306d-307f-11ec-8d10-d20bbc909b57 2 +bcfd306d-307f-11ec-8d10-d20bbc909b57 2 +c7fd306d-307f-11ec-8d10-d20bbc909b57 2 +d8fd306d-307f-11ec-8d10-d20bbc909b57 2 +dbfd306d-307f-11ec-8d10-d20bbc909b57 2 +ebfd306d-307f-11ec-8d10-d20bbc909b57 2 +eefd306d-307f-11ec-8d10-d20bbc909b57 2 +fdfd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-077f-12ec-8d10-d20bbc909b57 2 +9cfd306d-087f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-147f-12ec-8d10-d20bbc909b57 2 +9cfd306d-187f-12ec-8d10-d20bbc909b57 2 +9cfd306d-197f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-367f-12ec-8d10-d20bbc909b57 2 +9cfd306d-387f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-467f-12ec-8d10-d20bbc909b57 2 +9cfd306d-517f-12ec-8d10-d20bbc909b57 2 +9cfd306d-587f-12ec-8d10-d20bbc909b57 2 +9cfd306d-617f-12ec-8d10-d20bbc909b57 2 +9cfd306d-667f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-777f-12ec-8d10-d20bbc909b57 2 +9cfd306d-797f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-837f-12ec-8d10-d20bbc909b57 2 +9cfd306d-917f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-aa7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ad7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-bc7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-cb7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-cf7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-df7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fb7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fc7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1304-8d10-d20bbc909b57 2 +9cfd306d-307f-1310-8d10-d20bbc909b57 2 +9cfd306d-307f-1316-8d10-d20bbc909b57 2 +9cfd306d-307f-1317-8d10-d20bbc909b57 2 +9cfd306d-307f-131a-8d10-d20bbc909b57 2 +9cfd306d-307f-131b-8d10-d20bbc909b57 2 +9cfd306d-307f-131f-8d10-d20bbc909b57 2 +9cfd306d-307f-132c-8d10-d20bbc909b57 2 +9cfd306d-307f-134a-8d10-d20bbc909b57 2 +9cfd306d-307f-134c-8d10-d20bbc909b57 2 +9cfd306d-307f-134f-8d10-d20bbc909b57 2 +9cfd306d-307f-1358-8d10-d20bbc909b57 2 +9cfd306d-307f-1360-8d10-d20bbc909b57 2 +9cfd306d-307f-1365-8d10-d20bbc909b57 2 +9cfd306d-307f-1371-8d10-d20bbc909b57 2 +9cfd306d-307f-137a-8d10-d20bbc909b57 2 +9cfd306d-307f-1380-8d10-d20bbc909b57 2 +9cfd306d-307f-1384-8d10-d20bbc909b57 2 +9cfd306d-307f-1393-8d10-d20bbc909b57 2 +9cfd306d-307f-1395-8d10-d20bbc909b57 2 +9cfd306d-307f-139e-8d10-d20bbc909b57 2 +9cfd306d-307f-13a0-8d10-d20bbc909b57 2 +9cfd306d-307f-13a5-8d10-d20bbc909b57 2 +9cfd306d-307f-13a9-8d10-d20bbc909b57 2 +9cfd306d-307f-13ac-8d10-d20bbc909b57 2 +9cfd306d-307f-13ad-8d10-d20bbc909b57 2 +9cfd306d-307f-13c3-8d10-d20bbc909b57 2 +9cfd306d-307f-13cb-8d10-d20bbc909b57 2 +9cfd306d-307f-13d9-8d10-d20bbc909b57 2 +9cfd306d-307f-13dc-8d10-d20bbc909b57 2 +9cfd306d-307f-13e2-8d10-d20bbc909b57 2 +9cfd306d-307f-13e5-8d10-d20bbc909b57 2 +9cfd306d-307f-13ef-8d10-d20bbc909b57 2 +9cfd306d-307f-13f1-8d10-d20bbc909b57 2 +9cfd306d-307f-13f6-8d10-d20bbc909b57 2 +9cfd306d-307f-13fc-8d10-d20bbc909b57 2 +9cfd306d-307f-13fd-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d14-d20bbc909b57 2 +9cfd306d-307f-14ec-8d19-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d23-d20bbc909b57 2 +9cfd306d-307f-14ec-8d26-d20bbc909b57 2 +9cfd306d-307f-14ec-8d28-d20bbc909b57 2 +9cfd306d-307f-14ec-8d35-d20bbc909b57 2 +9cfd306d-307f-14ec-8d39-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d56-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d66-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d93-d20bbc909b57 2 +9cfd306d-307f-14ec-8dac-d20bbc909b57 2 +9cfd306d-307f-14ec-8daf-d20bbc909b57 2 +9cfd306d-307f-14ec-8db7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbb-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbe-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc2-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd9-d20bbc909b57 2 +9cfd306d-307f-14ec-8de7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dea-d20bbc909b57 2 +9cfd306d-307f-14ec-8deb-d20bbc909b57 2 +9cfd306d-307f-14ec-8df5-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfc-d20bbc909b57 2 +9cfd306d-307f-14ec-8dff-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b68 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b71 2 +9cfd306d-307f-16ec-8d10-d20bbc909b79 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b92 2 +9cfd306d-307f-16ec-8d10-d20bbc909b97 2 +9cfd306d-307f-16ec-8d10-d20bbc909b99 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9a 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba6 2 +9cfd306d-307f-16ec-8d10-d20bbc909baa 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bba 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc2 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bcd 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bde 2 +9cfd306d-307f-16ec-8d10-d20bbc909beb 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfe 2 +9cfd306d-307f-15ec-8d10-d70bbc909b57 2 +9cfd306d-307f-15ec-8d10-d80bbc909b57 2 +9cfd306d-307f-15ec-8d10-dd0bbc909b57 2 +9cfd306d-307f-15ec-8d10-de0bbc909b57 2 +9cfd306d-307f-15ec-8d10-e00bbc909b57 2 +9cfd306d-307f-15ec-8d10-ea0bbc909b57 2 +9cfd306d-307f-15ec-8d10-f60bbc909b57 2 +9cfd306d-307f-15ec-8d10-fa0bbc909b57 2 +9cfd306d-307f-15ec-8d10-fd0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ff0bbc909b57 2 +query +SELECT a_p4, COUNT(*) FROM (SELECT a AS a_p4 FROM t1 PARTITION(p4) UNION ALL SELECT CAST(a AS UUID) AS a_p4 FROM t2 PARTITION(p4)) td GROUP BY a_p4 +a_p4 COUNT(*) +9cfd306d-307f-15ec-8d10-000bbc909b57 2 +9cfd306d-307f-15ec-8d10-020bbc909b57 2 +9cfd306d-307f-15ec-8d10-030bbc909b57 2 +9cfd306d-307f-15ec-8d10-050bbc909b57 2 +9cfd306d-307f-15ec-8d10-220bbc909b57 2 +9cfd306d-307f-15ec-8d10-2c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-340bbc909b57 2 +9cfd306d-307f-15ec-8d10-370bbc909b57 2 +9cfd306d-307f-15ec-8d10-380bbc909b57 2 +9cfd306d-307f-15ec-8d10-3d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-440bbc909b57 2 +9cfd306d-307f-15ec-8d10-4a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-4d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-4f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-5c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-610bbc909b57 2 +9cfd306d-307f-15ec-8d10-6c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-6d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-6f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-710bbc909b57 2 +9cfd306d-307f-15ec-8d10-7c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-800bbc909b57 2 +9cfd306d-307f-15ec-8d10-850bbc909b57 2 +9cfd306d-307f-15ec-8d10-890bbc909b57 2 +9cfd306d-307f-15ec-8d10-a50bbc909b57 2 +9cfd306d-307f-15ec-8d10-a90bbc909b57 2 +9cfd306d-307f-15ec-8d10-c90bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b00 2 +9cfd306d-307f-16ec-8d10-d20bbc909b06 2 +9cfd306d-307f-16ec-8d10-d20bbc909b07 2 +9cfd306d-307f-16ec-8d10-d20bbc909b09 2 +9cfd306d-307f-16ec-8d10-d20bbc909b14 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b25 2 +9cfd306d-307f-16ec-8d10-d20bbc909b28 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b32 2 +9cfd306d-307f-16ec-8d10-d20bbc909b41 2 +9cfd306d-307f-16ec-8d10-d20bbc909b50 2 +9cfd306d-307f-16ec-8d10-d20bbc909b52 2 +9cfd306d-307f-14ec-8d0f-d20bbc909b57 2 +0ffd306d-307f-11ec-8d10-d20bbc909b57 2 +15fd306d-307f-11ec-8d10-d20bbc909b57 2 +1dfd306d-307f-11ec-8d10-d20bbc909b57 2 +23fd306d-307f-11ec-8d10-d20bbc909b57 2 +24fd306d-307f-11ec-8d10-d20bbc909b57 2 +28fd306d-307f-11ec-8d10-d20bbc909b57 2 +2cfd306d-307f-11ec-8d10-d20bbc909b57 2 +2ffd306d-307f-11ec-8d10-d20bbc909b57 2 +35fd306d-307f-11ec-8d10-d20bbc909b57 2 +37fd306d-307f-11ec-8d10-d20bbc909b57 2 +43fd306d-307f-11ec-8d10-d20bbc909b57 2 +44fd306d-307f-11ec-8d10-d20bbc909b57 2 +49fd306d-307f-11ec-8d10-d20bbc909b57 2 +4dfd306d-307f-11ec-8d10-d20bbc909b57 2 +59fd306d-307f-11ec-8d10-d20bbc909b57 2 +63fd306d-307f-11ec-8d10-d20bbc909b57 2 +64fd306d-307f-11ec-8d10-d20bbc909b57 2 +67fd306d-307f-11ec-8d10-d20bbc909b57 2 +6afd306d-307f-11ec-8d10-d20bbc909b57 2 +70fd306d-307f-11ec-8d10-d20bbc909b57 2 +72fd306d-307f-11ec-8d10-d20bbc909b57 2 +79fd306d-307f-11ec-8d10-d20bbc909b57 2 +7afd306d-307f-11ec-8d10-d20bbc909b57 2 +81fd306d-307f-11ec-8d10-d20bbc909b57 2 +8afd306d-307f-11ec-8d10-d20bbc909b57 2 +8bfd306d-307f-11ec-8d10-d20bbc909b57 2 +96fd306d-307f-11ec-8d10-d20bbc909b57 2 +98fd306d-307f-11ec-8d10-d20bbc909b57 2 +a6fd306d-307f-11ec-8d10-d20bbc909b57 2 +abfd306d-307f-11ec-8d10-d20bbc909b57 2 +acfd306d-307f-11ec-8d10-d20bbc909b57 2 +b1fd306d-307f-11ec-8d10-d20bbc909b57 2 +b5fd306d-307f-11ec-8d10-d20bbc909b57 2 +bbfd306d-307f-11ec-8d10-d20bbc909b57 2 +bdfd306d-307f-11ec-8d10-d20bbc909b57 2 +bffd306d-307f-11ec-8d10-d20bbc909b57 2 +c0fd306d-307f-11ec-8d10-d20bbc909b57 2 +c4fd306d-307f-11ec-8d10-d20bbc909b57 2 +c6fd306d-307f-11ec-8d10-d20bbc909b57 2 +c9fd306d-307f-11ec-8d10-d20bbc909b57 2 +d1fd306d-307f-11ec-8d10-d20bbc909b57 2 +d6fd306d-307f-11ec-8d10-d20bbc909b57 2 +d9fd306d-307f-11ec-8d10-d20bbc909b57 2 +dafd306d-307f-11ec-8d10-d20bbc909b57 2 +e8fd306d-307f-11ec-8d10-d20bbc909b57 2 +eafd306d-307f-11ec-8d10-d20bbc909b57 2 +effd306d-307f-11ec-8d10-d20bbc909b57 2 +f5fd306d-307f-11ec-8d10-d20bbc909b57 2 +fbfd306d-307f-11ec-8d10-d20bbc909b57 2 +fcfd306d-307f-11ec-8d10-d20bbc909b57 2 +fefd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-017f-12ec-8d10-d20bbc909b57 2 +9cfd306d-067f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-107f-12ec-8d10-d20bbc909b57 2 +9cfd306d-167f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-217f-12ec-8d10-d20bbc909b57 2 +9cfd306d-237f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-327f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-417f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-507f-12ec-8d10-d20bbc909b57 2 +9cfd306d-597f-12ec-8d10-d20bbc909b57 2 +9cfd306d-607f-12ec-8d10-d20bbc909b57 2 +9cfd306d-627f-12ec-8d10-d20bbc909b57 2 +9cfd306d-637f-12ec-8d10-d20bbc909b57 2 +9cfd306d-677f-12ec-8d10-d20bbc909b57 2 +9cfd306d-697f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-737f-12ec-8d10-d20bbc909b57 2 +9cfd306d-767f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-827f-12ec-8d10-d20bbc909b57 2 +9cfd306d-847f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-997f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-af7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ba7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-be7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ce7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-db7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ee7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fa7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fe7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1302-8d10-d20bbc909b57 2 +9cfd306d-307f-1303-8d10-d20bbc909b57 2 +9cfd306d-307f-1308-8d10-d20bbc909b57 2 +9cfd306d-307f-130d-8d10-d20bbc909b57 2 +9cfd306d-307f-130f-8d10-d20bbc909b57 2 +9cfd306d-307f-1311-8d10-d20bbc909b57 2 +9cfd306d-307f-1315-8d10-d20bbc909b57 2 +9cfd306d-307f-1318-8d10-d20bbc909b57 2 +9cfd306d-307f-1326-8d10-d20bbc909b57 2 +9cfd306d-307f-132f-8d10-d20bbc909b57 2 +9cfd306d-307f-1333-8d10-d20bbc909b57 2 +9cfd306d-307f-1342-8d10-d20bbc909b57 2 +9cfd306d-307f-1344-8d10-d20bbc909b57 2 +9cfd306d-307f-134b-8d10-d20bbc909b57 2 +9cfd306d-307f-134e-8d10-d20bbc909b57 2 +9cfd306d-307f-1350-8d10-d20bbc909b57 2 +9cfd306d-307f-1354-8d10-d20bbc909b57 2 +9cfd306d-307f-1357-8d10-d20bbc909b57 2 +9cfd306d-307f-1369-8d10-d20bbc909b57 2 +9cfd306d-307f-1370-8d10-d20bbc909b57 2 +9cfd306d-307f-1373-8d10-d20bbc909b57 2 +9cfd306d-307f-1378-8d10-d20bbc909b57 2 +9cfd306d-307f-1392-8d10-d20bbc909b57 2 +9cfd306d-307f-1397-8d10-d20bbc909b57 2 +9cfd306d-307f-139a-8d10-d20bbc909b57 2 +9cfd306d-307f-139d-8d10-d20bbc909b57 2 +9cfd306d-307f-13b2-8d10-d20bbc909b57 2 +9cfd306d-307f-13b7-8d10-d20bbc909b57 2 +9cfd306d-307f-13b9-8d10-d20bbc909b57 2 +9cfd306d-307f-13c1-8d10-d20bbc909b57 2 +9cfd306d-307f-13d2-8d10-d20bbc909b57 2 +9cfd306d-307f-13e3-8d10-d20bbc909b57 2 +9cfd306d-307f-13e8-8d10-d20bbc909b57 2 +9cfd306d-307f-13f0-8d10-d20bbc909b57 2 +9cfd306d-307f-13f2-8d10-d20bbc909b57 2 +9cfd306d-307f-13ff-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d13-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d24-d20bbc909b57 2 +9cfd306d-307f-14ec-8d29-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d34-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d41-d20bbc909b57 2 +9cfd306d-307f-14ec-8d46-d20bbc909b57 2 +9cfd306d-307f-14ec-8d55-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d60-d20bbc909b57 2 +9cfd306d-307f-14ec-8d69-d20bbc909b57 2 +9cfd306d-307f-14ec-8d70-d20bbc909b57 2 +9cfd306d-307f-14ec-8d73-d20bbc909b57 2 +9cfd306d-307f-14ec-8d77-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d80-d20bbc909b57 2 +9cfd306d-307f-14ec-8d85-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d90-d20bbc909b57 2 +9cfd306d-307f-14ec-8d91-d20bbc909b57 2 +9cfd306d-307f-14ec-8d98-d20bbc909b57 2 +9cfd306d-307f-14ec-8d99-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9d-d20bbc909b57 2 +9cfd306d-307f-14ec-8da2-d20bbc909b57 2 +9cfd306d-307f-14ec-8da4-d20bbc909b57 2 +9cfd306d-307f-14ec-8da8-d20bbc909b57 2 +9cfd306d-307f-14ec-8da9-d20bbc909b57 2 +9cfd306d-307f-14ec-8db1-d20bbc909b57 2 +9cfd306d-307f-14ec-8db6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc0-d20bbc909b57 2 +9cfd306d-307f-14ec-8dca-d20bbc909b57 2 +9cfd306d-307f-14ec-8dcb-d20bbc909b57 2 +9cfd306d-307f-14ec-8ddf-d20bbc909b57 2 +9cfd306d-307f-14ec-8de0-d20bbc909b57 2 +9cfd306d-307f-14ec-8de4-d20bbc909b57 2 +9cfd306d-307f-14ec-8ded-d20bbc909b57 2 +9cfd306d-307f-14ec-8df3-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b76 2 +9cfd306d-307f-16ec-8d10-d20bbc909b84 2 +9cfd306d-307f-16ec-8d10-d20bbc909b85 2 +9cfd306d-307f-16ec-8d10-d20bbc909b88 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9e 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba0 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc0 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc5 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bce 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd0 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd1 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd7 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bda 2 +9cfd306d-307f-16ec-8d10-d20bbc909bdb 2 +9cfd306d-307f-16ec-8d10-d20bbc909be4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf7 2 +9cfd306d-307f-15ec-8d10-d60bbc909b57 2 +9cfd306d-307f-15ec-8d10-d90bbc909b57 2 +9cfd306d-307f-15ec-8d10-e10bbc909b57 2 +9cfd306d-307f-15ec-8d10-e90bbc909b57 2 +9cfd306d-307f-15ec-8d10-f80bbc909b57 2 +query +SELECT a_p5, COUNT(*) FROM (SELECT a AS a_p5 FROM t1 PARTITION(p5) UNION ALL SELECT CAST(a AS UUID) AS a_p5 FROM t2 PARTITION(p5)) td GROUP BY a_p5 +a_p5 COUNT(*) +9cfd306d-307f-15ec-8d10-070bbc909b57 2 +9cfd306d-307f-15ec-8d10-0a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-0b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-140bbc909b57 2 +9cfd306d-307f-15ec-8d10-1b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-200bbc909b57 2 +9cfd306d-307f-15ec-8d10-210bbc909b57 2 +9cfd306d-307f-15ec-8d10-280bbc909b57 2 +9cfd306d-307f-15ec-8d10-2a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-2f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-360bbc909b57 2 +9cfd306d-307f-15ec-8d10-390bbc909b57 2 +9cfd306d-307f-15ec-8d10-3b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-3f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-410bbc909b57 2 +9cfd306d-307f-15ec-8d10-420bbc909b57 2 +9cfd306d-307f-15ec-8d10-4b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-4e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-590bbc909b57 2 +9cfd306d-307f-15ec-8d10-720bbc909b57 2 +9cfd306d-307f-15ec-8d10-760bbc909b57 2 +9cfd306d-307f-15ec-8d10-7f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-810bbc909b57 2 +9cfd306d-307f-15ec-8d10-8d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-960bbc909b57 2 +9cfd306d-307f-15ec-8d10-a10bbc909b57 2 +9cfd306d-307f-15ec-8d10-a30bbc909b57 2 +9cfd306d-307f-15ec-8d10-ab0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ae0bbc909b57 2 +9cfd306d-307f-15ec-8d10-b10bbc909b57 2 +9cfd306d-307f-15ec-8d10-b20bbc909b57 2 +9cfd306d-307f-15ec-8d10-b30bbc909b57 2 +9cfd306d-307f-15ec-8d10-bb0bbc909b57 2 +9cfd306d-307f-15ec-8d10-be0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b01 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b15 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b20 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b33 2 +9cfd306d-307f-16ec-8d10-d20bbc909b36 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b48 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b53 2 +9cfd306d-307f-14ec-8d00-d20bbc909b57 2 +9cfd306d-307f-14ec-8d04-d20bbc909b57 2 +9cfd306d-307f-14ec-8d08-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0b-d20bbc909b57 2 +06fd306d-307f-11ec-8d10-d20bbc909b57 2 +0afd306d-307f-11ec-8d10-d20bbc909b57 2 +12fd306d-307f-11ec-8d10-d20bbc909b57 2 +18fd306d-307f-11ec-8d10-d20bbc909b57 2 +22fd306d-307f-11ec-8d10-d20bbc909b57 2 +27fd306d-307f-11ec-8d10-d20bbc909b57 2 +39fd306d-307f-11ec-8d10-d20bbc909b57 2 +41fd306d-307f-11ec-8d10-d20bbc909b57 2 +47fd306d-307f-11ec-8d10-d20bbc909b57 2 +4cfd306d-307f-11ec-8d10-d20bbc909b57 2 +56fd306d-307f-11ec-8d10-d20bbc909b57 2 +5dfd306d-307f-11ec-8d10-d20bbc909b57 2 +68fd306d-307f-11ec-8d10-d20bbc909b57 2 +6dfd306d-307f-11ec-8d10-d20bbc909b57 2 +77fd306d-307f-11ec-8d10-d20bbc909b57 2 +7dfd306d-307f-11ec-8d10-d20bbc909b57 2 +80fd306d-307f-11ec-8d10-d20bbc909b57 2 +84fd306d-307f-11ec-8d10-d20bbc909b57 2 +87fd306d-307f-11ec-8d10-d20bbc909b57 2 +90fd306d-307f-11ec-8d10-d20bbc909b57 2 +92fd306d-307f-11ec-8d10-d20bbc909b57 2 +95fd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-307f-11ec-8d10-d20bbc909b57 2 +9dfd306d-307f-11ec-8d10-d20bbc909b57 2 +a4fd306d-307f-11ec-8d10-d20bbc909b57 2 +a5fd306d-307f-11ec-8d10-d20bbc909b57 2 +a7fd306d-307f-11ec-8d10-d20bbc909b57 2 +a8fd306d-307f-11ec-8d10-d20bbc909b57 2 +a9fd306d-307f-11ec-8d10-d20bbc909b57 2 +b6fd306d-307f-11ec-8d10-d20bbc909b57 2 +cafd306d-307f-11ec-8d10-d20bbc909b57 2 +cefd306d-307f-11ec-8d10-d20bbc909b57 2 +d2fd306d-307f-11ec-8d10-d20bbc909b57 2 +e1fd306d-307f-11ec-8d10-d20bbc909b57 2 +e2fd306d-307f-11ec-8d10-d20bbc909b57 2 +ecfd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-1d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-257f-12ec-8d10-d20bbc909b57 2 +9cfd306d-337f-12ec-8d10-d20bbc909b57 2 +9cfd306d-457f-12ec-8d10-d20bbc909b57 2 +9cfd306d-477f-12ec-8d10-d20bbc909b57 2 +9cfd306d-487f-12ec-8d10-d20bbc909b57 2 +9cfd306d-497f-12ec-8d10-d20bbc909b57 2 +9cfd306d-557f-12ec-8d10-d20bbc909b57 2 +9cfd306d-577f-12ec-8d10-d20bbc909b57 2 +9cfd306d-647f-12ec-8d10-d20bbc909b57 2 +9cfd306d-687f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-707f-12ec-8d10-d20bbc909b57 2 +9cfd306d-717f-12ec-8d10-d20bbc909b57 2 +9cfd306d-857f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ae7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-cd7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-dc7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-de7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ef7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-130a-8d10-d20bbc909b57 2 +9cfd306d-307f-1322-8d10-d20bbc909b57 2 +9cfd306d-307f-1323-8d10-d20bbc909b57 2 +9cfd306d-307f-1324-8d10-d20bbc909b57 2 +9cfd306d-307f-1328-8d10-d20bbc909b57 2 +9cfd306d-307f-132b-8d10-d20bbc909b57 2 +9cfd306d-307f-1346-8d10-d20bbc909b57 2 +9cfd306d-307f-1348-8d10-d20bbc909b57 2 +9cfd306d-307f-1352-8d10-d20bbc909b57 2 +9cfd306d-307f-1353-8d10-d20bbc909b57 2 +9cfd306d-307f-1359-8d10-d20bbc909b57 2 +9cfd306d-307f-135f-8d10-d20bbc909b57 2 +9cfd306d-307f-1366-8d10-d20bbc909b57 2 +9cfd306d-307f-1367-8d10-d20bbc909b57 2 +9cfd306d-307f-136b-8d10-d20bbc909b57 2 +9cfd306d-307f-1374-8d10-d20bbc909b57 2 +9cfd306d-307f-139b-8d10-d20bbc909b57 2 +9cfd306d-307f-13a4-8d10-d20bbc909b57 2 +9cfd306d-307f-13a8-8d10-d20bbc909b57 2 +9cfd306d-307f-13b6-8d10-d20bbc909b57 2 +9cfd306d-307f-13c5-8d10-d20bbc909b57 2 +9cfd306d-307f-13c6-8d10-d20bbc909b57 2 +9cfd306d-307f-13c7-8d10-d20bbc909b57 2 +9cfd306d-307f-13d4-8d10-d20bbc909b57 2 +9cfd306d-307f-13d5-8d10-d20bbc909b57 2 +9cfd306d-307f-13de-8d10-d20bbc909b57 2 +9cfd306d-307f-13e4-8d10-d20bbc909b57 2 +9cfd306d-307f-13ea-8d10-d20bbc909b57 2 +9cfd306d-307f-13f3-8d10-d20bbc909b57 2 +9cfd306d-307f-13f4-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d12-d20bbc909b57 2 +9cfd306d-307f-14ec-8d15-d20bbc909b57 2 +9cfd306d-307f-14ec-8d16-d20bbc909b57 2 +9cfd306d-307f-14ec-8d18-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d20-d20bbc909b57 2 +9cfd306d-307f-14ec-8d43-d20bbc909b57 2 +9cfd306d-307f-14ec-8d52-d20bbc909b57 2 +9cfd306d-307f-14ec-8d53-d20bbc909b57 2 +9cfd306d-307f-14ec-8d54-d20bbc909b57 2 +9cfd306d-307f-14ec-8d58-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d65-d20bbc909b57 2 +9cfd306d-307f-14ec-8d72-d20bbc909b57 2 +9cfd306d-307f-14ec-8d74-d20bbc909b57 2 +9cfd306d-307f-14ec-8d79-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d83-d20bbc909b57 2 +9cfd306d-307f-14ec-8db3-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbc-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbf-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc4-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc9-d20bbc909b57 2 +9cfd306d-307f-14ec-8dcd-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd2-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd5-d20bbc909b57 2 +9cfd306d-307f-14ec-8dde-d20bbc909b57 2 +9cfd306d-307f-14ec-8dec-d20bbc909b57 2 +9cfd306d-307f-14ec-8df0-d20bbc909b57 2 +9cfd306d-307f-14ec-8df2-d20bbc909b57 2 +9cfd306d-307f-14ec-8df4-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfa-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfe-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b60 2 +9cfd306d-307f-16ec-8d10-d20bbc909b66 2 +9cfd306d-307f-16ec-8d10-d20bbc909b67 2 +9cfd306d-307f-16ec-8d10-d20bbc909b77 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b93 2 +9cfd306d-307f-16ec-8d10-d20bbc909b98 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba1 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba4 2 +9cfd306d-307f-16ec-8d10-d20bbc909baf 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb2 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbe 2 +9cfd306d-307f-16ec-8d10-d20bbc909bcb 2 +9cfd306d-307f-16ec-8d10-d20bbc909bcc 2 +9cfd306d-307f-16ec-8d10-d20bbc909bdc 2 +9cfd306d-307f-16ec-8d10-d20bbc909be5 2 +9cfd306d-307f-16ec-8d10-d20bbc909be7 2 +9cfd306d-307f-16ec-8d10-d20bbc909be9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bef 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfd 2 +9cfd306d-307f-15ec-8d10-e50bbc909b57 2 +9cfd306d-307f-15ec-8d10-f20bbc909b57 2 +9cfd306d-307f-15ec-8d10-f40bbc909b57 2 +9cfd306d-307f-15ec-8d10-f50bbc909b57 2 +9cfd306d-307f-15ec-8d10-fc0bbc909b57 2 +query +SELECT a_p6, COUNT(*) FROM (SELECT a AS a_p6 FROM t1 PARTITION(p6) UNION ALL SELECT CAST(a AS UUID) AS a_p6 FROM t2 PARTITION(p6)) td GROUP BY a_p6 +a_p6 COUNT(*) +9cfd306d-307f-15ec-8d10-0e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-160bbc909b57 2 +9cfd306d-307f-15ec-8d10-170bbc909b57 2 +9cfd306d-307f-15ec-8d10-290bbc909b57 2 +9cfd306d-307f-15ec-8d10-2e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-350bbc909b57 2 +9cfd306d-307f-15ec-8d10-450bbc909b57 2 +9cfd306d-307f-15ec-8d10-540bbc909b57 2 +9cfd306d-307f-15ec-8d10-550bbc909b57 2 +9cfd306d-307f-15ec-8d10-5b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-600bbc909b57 2 +9cfd306d-307f-15ec-8d10-620bbc909b57 2 +9cfd306d-307f-15ec-8d10-670bbc909b57 2 +9cfd306d-307f-15ec-8d10-690bbc909b57 2 +9cfd306d-307f-15ec-8d10-6b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-730bbc909b57 2 +9cfd306d-307f-15ec-8d10-7a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-870bbc909b57 2 +9cfd306d-307f-15ec-8d10-8a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-9e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-a60bbc909b57 2 +9cfd306d-307f-15ec-8d10-b40bbc909b57 2 +9cfd306d-307f-15ec-8d10-b50bbc909b57 2 +9cfd306d-307f-15ec-8d10-b90bbc909b57 2 +9cfd306d-307f-15ec-8d10-bd0bbc909b57 2 +9cfd306d-307f-15ec-8d10-bf0bbc909b57 2 +9cfd306d-307f-15ec-8d10-c80bbc909b57 2 +9cfd306d-307f-15ec-8d10-ce0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b08 2 +9cfd306d-307f-16ec-8d10-d20bbc909b12 2 +9cfd306d-307f-16ec-8d10-d20bbc909b18 2 +9cfd306d-307f-16ec-8d10-d20bbc909b21 2 +9cfd306d-307f-16ec-8d10-d20bbc909b23 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b30 2 +9cfd306d-307f-16ec-8d10-d20bbc909b39 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b44 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4c 2 +9cfd306d-307f-14ec-8d03-d20bbc909b57 2 +9cfd306d-307f-14ec-8d09-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0e-d20bbc909b57 2 +01fd306d-307f-11ec-8d10-d20bbc909b57 2 +05fd306d-307f-11ec-8d10-d20bbc909b57 2 +0cfd306d-307f-11ec-8d10-d20bbc909b57 2 +1efd306d-307f-11ec-8d10-d20bbc909b57 2 +1ffd306d-307f-11ec-8d10-d20bbc909b57 2 +2efd306d-307f-11ec-8d10-d20bbc909b57 2 +30fd306d-307f-11ec-8d10-d20bbc909b57 2 +31fd306d-307f-11ec-8d10-d20bbc909b57 2 +3afd306d-307f-11ec-8d10-d20bbc909b57 2 +3cfd306d-307f-11ec-8d10-d20bbc909b57 2 +40fd306d-307f-11ec-8d10-d20bbc909b57 2 +4afd306d-307f-11ec-8d10-d20bbc909b57 2 +57fd306d-307f-11ec-8d10-d20bbc909b57 2 +5efd306d-307f-11ec-8d10-d20bbc909b57 2 +6cfd306d-307f-11ec-8d10-d20bbc909b57 2 +71fd306d-307f-11ec-8d10-d20bbc909b57 2 +74fd306d-307f-11ec-8d10-d20bbc909b57 2 +7bfd306d-307f-11ec-8d10-d20bbc909b57 2 +88fd306d-307f-11ec-8d10-d20bbc909b57 2 +8efd306d-307f-11ec-8d10-d20bbc909b57 2 +9ffd306d-307f-11ec-8d10-d20bbc909b57 2 +a0fd306d-307f-11ec-8d10-d20bbc909b57 2 +a2fd306d-307f-11ec-8d10-d20bbc909b57 2 +bafd306d-307f-11ec-8d10-d20bbc909b57 2 +befd306d-307f-11ec-8d10-d20bbc909b57 2 +c1fd306d-307f-11ec-8d10-d20bbc909b57 2 +c5fd306d-307f-11ec-8d10-d20bbc909b57 2 +c8fd306d-307f-11ec-8d10-d20bbc909b57 2 +cffd306d-307f-11ec-8d10-d20bbc909b57 2 +d7fd306d-307f-11ec-8d10-d20bbc909b57 2 +dffd306d-307f-11ec-8d10-d20bbc909b57 2 +e3fd306d-307f-11ec-8d10-d20bbc909b57 2 +e7fd306d-307f-11ec-8d10-d20bbc909b57 2 +e9fd306d-307f-11ec-8d10-d20bbc909b57 2 +f2fd306d-307f-11ec-8d10-d20bbc909b57 2 +fffd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-027f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-157f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-287f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-397f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-427f-12ec-8d10-d20bbc909b57 2 +9cfd306d-567f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-877f-12ec-8d10-d20bbc909b57 2 +9cfd306d-887f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-947f-12ec-8d10-d20bbc909b57 2 +9cfd306d-957f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-bf7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ca7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-cc7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ed7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1301-8d10-d20bbc909b57 2 +9cfd306d-307f-1305-8d10-d20bbc909b57 2 +9cfd306d-307f-1306-8d10-d20bbc909b57 2 +9cfd306d-307f-1307-8d10-d20bbc909b57 2 +9cfd306d-307f-130c-8d10-d20bbc909b57 2 +9cfd306d-307f-1312-8d10-d20bbc909b57 2 +9cfd306d-307f-131d-8d10-d20bbc909b57 2 +9cfd306d-307f-1334-8d10-d20bbc909b57 2 +9cfd306d-307f-133c-8d10-d20bbc909b57 2 +9cfd306d-307f-133f-8d10-d20bbc909b57 2 +9cfd306d-307f-1343-8d10-d20bbc909b57 2 +9cfd306d-307f-1347-8d10-d20bbc909b57 2 +9cfd306d-307f-1349-8d10-d20bbc909b57 2 +9cfd306d-307f-135d-8d10-d20bbc909b57 2 +9cfd306d-307f-1362-8d10-d20bbc909b57 2 +9cfd306d-307f-1364-8d10-d20bbc909b57 2 +9cfd306d-307f-136d-8d10-d20bbc909b57 2 +9cfd306d-307f-1377-8d10-d20bbc909b57 2 +9cfd306d-307f-137b-8d10-d20bbc909b57 2 +9cfd306d-307f-137c-8d10-d20bbc909b57 2 +9cfd306d-307f-138b-8d10-d20bbc909b57 2 +9cfd306d-307f-1396-8d10-d20bbc909b57 2 +9cfd306d-307f-1399-8d10-d20bbc909b57 2 +9cfd306d-307f-13ae-8d10-d20bbc909b57 2 +9cfd306d-307f-13bd-8d10-d20bbc909b57 2 +9cfd306d-307f-13c4-8d10-d20bbc909b57 2 +9cfd306d-307f-13c9-8d10-d20bbc909b57 2 +9cfd306d-307f-13cc-8d10-d20bbc909b57 2 +9cfd306d-307f-13cd-8d10-d20bbc909b57 2 +9cfd306d-307f-13d7-8d10-d20bbc909b57 2 +9cfd306d-307f-13da-8d10-d20bbc909b57 2 +9cfd306d-307f-13dd-8d10-d20bbc909b57 2 +9cfd306d-307f-13e1-8d10-d20bbc909b57 2 +9cfd306d-307f-13e6-8d10-d20bbc909b57 2 +9cfd306d-307f-13ec-8d10-d20bbc909b57 2 +9cfd306d-307f-13ed-8d10-d20bbc909b57 2 +9cfd306d-307f-13ee-8d10-d20bbc909b57 2 +9cfd306d-307f-13f8-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d21-d20bbc909b57 2 +9cfd306d-307f-14ec-8d22-d20bbc909b57 2 +9cfd306d-307f-14ec-8d25-d20bbc909b57 2 +9cfd306d-307f-14ec-8d32-d20bbc909b57 2 +9cfd306d-307f-14ec-8d48-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d62-d20bbc909b57 2 +9cfd306d-307f-14ec-8d64-d20bbc909b57 2 +9cfd306d-307f-14ec-8d71-d20bbc909b57 2 +9cfd306d-307f-14ec-8d84-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9a-d20bbc909b57 2 +9cfd306d-307f-14ec-8da1-d20bbc909b57 2 +9cfd306d-307f-14ec-8da7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dae-d20bbc909b57 2 +9cfd306d-307f-14ec-8db0-d20bbc909b57 2 +9cfd306d-307f-14ec-8db2-d20bbc909b57 2 +9cfd306d-307f-14ec-8db8-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc1-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc3-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc8-d20bbc909b57 2 +9cfd306d-307f-14ec-8dce-d20bbc909b57 2 +9cfd306d-307f-14ec-8dcf-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd0-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd8-d20bbc909b57 2 +9cfd306d-307f-14ec-8ddb-d20bbc909b57 2 +9cfd306d-307f-14ec-8ddc-d20bbc909b57 2 +9cfd306d-307f-14ec-8de2-d20bbc909b57 2 +9cfd306d-307f-14ec-8de3-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfb-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfd-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b59 2 +9cfd306d-307f-16ec-8d10-d20bbc909b61 2 +9cfd306d-307f-16ec-8d10-d20bbc909b64 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b74 2 +9cfd306d-307f-16ec-8d10-d20bbc909b75 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b90 2 +9cfd306d-307f-16ec-8d10-d20bbc909b91 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba5 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbd 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc1 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd5 2 +9cfd306d-307f-16ec-8d10-d20bbc909be2 2 +9cfd306d-307f-16ec-8d10-d20bbc909be3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bea 2 +9cfd306d-307f-16ec-8d10-d20bbc909bed 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf5 2 +9cfd306d-307f-15ec-8d10-d50bbc909b57 2 +9cfd306d-307f-15ec-8d10-da0bbc909b57 2 +9cfd306d-307f-15ec-8d10-db0bbc909b57 2 +9cfd306d-307f-15ec-8d10-e60bbc909b57 2 +9cfd306d-307f-15ec-8d10-e70bbc909b57 2 +9cfd306d-307f-15ec-8d10-f00bbc909b57 2 +9cfd306d-307f-15ec-8d10-f30bbc909b57 2 +9cfd306d-307f-15ec-8d10-fe0bbc909b57 2 +CALL test_partition_by_key_pstat(7); +pname pcount +p0 213 +p1 212 +p2 216 +p3 216 +p4 240 +p5 213 +p6 226 +CALL test_partition_by_key_pstat(4); +pname pcount +p0 64 +p1 64 +p2 64 +p3 1344 +CALL test_partition_by_key_pstat(5); +pname pcount +p0 343 +p1 305 +p2 288 +p3 307 +p4 293 +CALL test_partition_by_key_pstat(6); +pname pcount +p0 47 +p1 469 +p2 38 +p3 451 +p4 43 +p5 488 +CALL test_partition_by_key_pstat(8); +pname pcount +p0 32 +p1 32 +p2 32 +p3 32 +p4 32 +p5 32 +p6 32 +p7 1312 +CALL test_partition_by_key_pstat(9); +pname pcount +p0 174 +p1 171 +p2 175 +p3 155 +p4 157 +p5 180 +p6 169 +p7 184 +p8 171 +CALL test_partition_by_key_pstat(10); +pname pcount +p0 23 +p1 283 +p2 31 +p3 282 +p4 27 +p5 320 +p6 22 +p7 257 +p8 25 +p9 266 +CALL test_partition_by_key_pstat(11); +pname pcount +p0 119 +p1 149 +p2 166 +p3 147 +p4 150 +p5 138 +p6 150 +p7 142 +p8 131 +p9 126 +p10 118 +CALL test_partition_by_key_pstat(12); +pname pcount +p0 23 +p1 21 +p2 19 +p3 435 +p4 22 +p5 27 +p6 24 +p7 448 +p8 19 +p9 16 +p10 21 +p11 461 +CALL test_partition_by_key_pstat(13); +pname pcount +p0 123 +p1 108 +p2 115 +p3 104 +p4 124 +p5 118 +p6 134 +p7 107 +p8 119 +p9 126 +p10 114 +p11 117 +p12 127 +CALL test_partition_by_key_pstat(14); +pname pcount +p0 17 +p1 200 +p2 22 +p3 194 +p4 21 +p5 193 +p6 14 +p7 196 +p8 12 +p9 194 +p10 22 +p11 219 +p12 20 +p13 212 +CALL test_partition_by_key_pstat(15); +pname pcount +p0 121 +p1 110 +p2 99 +p3 90 +p4 82 +p5 112 +p6 105 +p7 110 +p8 117 +p9 103 +p10 110 +p11 90 +p12 79 +p13 100 +p14 108 +CALL test_partition_by_key_pstat(16); +pname pcount +p0 16 +p1 16 +p2 16 +p3 16 +p4 16 +p5 16 +p6 16 +p7 1296 +p8 16 +p9 16 +p10 16 +p11 16 +p12 16 +p13 16 +p14 16 +p15 16 +DROP PROCEDURE test_partition_by_key_uuid_vs_binary; +DROP PROCEDURE test_partition_by_key_pstat; +DROP TABLE t0; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test index 6c4341079c9..5bd198c4e8b 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test @@ -30,3 +30,75 @@ INSERT INTO t1 VALUES ('ffff0000-0000-0000-0000-00000000ffff'); SELECT * FROM t1 PARTITION (p00); SELECT * FROM t1 PARTITION (pFF); DROP TABLE t1; + + +CREATE TABLE t0 (a UUID); +DELIMITER $$; +FOR i IN 0..255 +DO + INSERT INTO t0 VALUES (REPLACE('XXfd306d-307f-11ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-XX7f-12ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-13XX-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-14ec-8dXX-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-15ec-8d10-XX0bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-16ec-8d10-d20bbc909bXX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +--echo # Test that UUID and BINARY(16) implement the same distribution by key +CREATE PROCEDURE test_partition_by_key_uuid_vs_binary(parts INT) +BEGIN + EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts); + EXECUTE IMMEDIATE REPLACE('CREATE TABLE t2 (a BINARY(16)) PARTITION BY KEY (a) PARTITIONS 7','7',parts); + INSERT INTO t1 SELECT * FROM t0; + INSERT INTO t2 SELECT * FROM t0; + FOR i IN 0..(parts-1) + DO + BEGIN + DECLARE query_template TEXT DEFAULT 'SELECT a_p0, COUNT(*) FROM (' + 'SELECT a AS a_p0 FROM t1 PARTITION(p0) ' + 'UNION ALL ' + 'SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td ' + 'GROUP BY a_p0'; + DECLARE query TEXT DEFAULT REPLACE(query_template,'p0',CONCAT('p',i)); + SELECT query; + EXECUTE IMMEDIATE query; + END; + END FOR; + DROP TABLE t1,t2; +END; +$$ +--echo # Display statistics how records are distributed between partitions +CREATE PROCEDURE test_partition_by_key_pstat(parts INT) +BEGIN + EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts); + CREATE TABLE t1_pstat (pname VARCHAR(32), pcount int); + INSERT INTO t1 SELECT * FROM t0; + FOR i IN 0..(parts-1) + DO + BEGIN + DECLARE query_template TEXT DEFAULT 'INSERT INTO t1_pstat VALUES (''p0'',(SELECT COUNT(*) FROM t1 PARTITION (p0)))'; + EXECUTE IMMEDIATE REPLACE(query_template,'p0',CONCAT('p',i)); + END; + END FOR; + SELECT * FROM t1_pstat ORDER BY CAST(SUBSTR(pname,2,100) AS UNSIGNED); + DROP TABLE t1,t1_pstat; +END; +$$ +DELIMITER ;$$ +CALL test_partition_by_key_uuid_vs_binary(7); +CALL test_partition_by_key_pstat(7); +CALL test_partition_by_key_pstat(4); +CALL test_partition_by_key_pstat(5); +CALL test_partition_by_key_pstat(6); +CALL test_partition_by_key_pstat(8); +CALL test_partition_by_key_pstat(9); +CALL test_partition_by_key_pstat(10); +CALL test_partition_by_key_pstat(11); +CALL test_partition_by_key_pstat(12); +CALL test_partition_by_key_pstat(13); +CALL test_partition_by_key_pstat(14); +CALL test_partition_by_key_pstat(15); +CALL test_partition_by_key_pstat(16); +DROP PROCEDURE test_partition_by_key_uuid_vs_binary; +DROP PROCEDURE test_partition_by_key_pstat; +DROP TABLE t0; diff --git a/plugin/type_uuid/sql_type_uuid.h b/plugin/type_uuid/sql_type_uuid.h index 9076c874e98..be9fea8ebc9 100644 --- a/plugin/type_uuid/sql_type_uuid.h +++ b/plugin/type_uuid/sql_type_uuid.h @@ -24,8 +24,162 @@ public: bool ascii_to_fbt(const char *str, size_t str_length); size_t to_string(char *dst, size_t dstsize) const; static const Name &default_value(); + + /* + Binary (in-memory) UUIDv1 representation: + + llllllll-mmmm-Vhhh-vsss-nnnnnnnnnnnn + + Binary sortable (in-record) representation: + + nnnnnnnnnnnn-vsss-Vhhh-mmmm-llllllll + + Sign Section Bits Bytes Pos PosBinSortable + ------------- ------- ---- ----- --- -------------- + llllllll time low 32 4 0 12 + mmmm time mid 16 2 4 10 + Vhhh version and time hi 16 2 6 8 + vsss variant and clock seq 16 2 8 6 + nnnnnnnnnnnn node ID 48 6 10 0 + */ + + class Segment + { + size_t m_memory_pos; + size_t m_record_pos; + size_t m_length; + public: + constexpr Segment(size_t memory_pos, size_t record_pos, size_t length) + :m_memory_pos(memory_pos), m_record_pos(record_pos), m_length(length) + { } + void memory_to_record(char *to, const char *from) const + { + memcpy(to + m_record_pos, from + m_memory_pos, m_length); + } + void record_to_memory(char *to, const char * from) const + { + memcpy(to + m_memory_pos, from + m_record_pos, m_length); + } + int cmp_memory(const char *a, const char *b) const + { + return memcmp(a + m_memory_pos, b + m_memory_pos, m_length); + } + void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) const + { + my_charset_bin.hash_sort(ptr + m_record_pos, m_length, nr, nr2); + } + }; + + static const Segment & segment(uint i) + { + static Segment segments[]= + { + {0, 12, 4}, // llllllll + {4, 10, 2}, // mmmm + {6, 8, 2}, // Vhhh + {8, 6, 2}, // vsss + {10, 0, 6} // nnnnnnnnnnnn + }; + return segments[i]; + } + + // Convert the in-memory representation to the in-record representation + static void memory_to_record(char *to, const char *from) + { + segment(0).memory_to_record(to, from); + segment(1).memory_to_record(to, from); + segment(2).memory_to_record(to, from); + segment(3).memory_to_record(to, from); + segment(4).memory_to_record(to, from); + } + + // Convert the in-record representation to the in-memory representation + static void record_to_memory(char *to, const char *from) + { + segment(0).record_to_memory(to, from); + segment(1).record_to_memory(to, from); + segment(2).record_to_memory(to, from); + segment(3).record_to_memory(to, from); + segment(4).record_to_memory(to, from); + } + + /* + Calculate a hash of the in-record representation. + Used in Field_uuid::hash(), e.g. for KEY partitioning. This + makes partition distribution for UUID and BINARY(16) equal, + so for example: + + CREATE OR REPLACE TABLE t1 (c1 UUID) PARTITION BY KEY(c1) PARTITIONS 5; + INSERT INTO t1 (c1) VALUES (UUID()); + + and + + CREATE OR REPLACE TABLE t1 (c1 BINARY(16)) PARTITION BY KEY(c1) PARTITIONS 5; + INSERT INTO t1 (c1) VALUES (UUID()); + + put values into the same partition. + */ + static void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) + { + segment(0).hash_record(ptr, nr, nr2); + segment(1).hash_record(ptr, nr, nr2); + segment(2).hash_record(ptr, nr, nr2); + segment(3).hash_record(ptr, nr, nr2); + segment(4).hash_record(ptr, nr, nr2); + } + + // Compare two in-memory values + static int cmp(const LEX_CSTRING &a, const LEX_CSTRING &b) + { + DBUG_ASSERT(a.length == binary_length()); + DBUG_ASSERT(b.length == binary_length()); + int res; + if ((res= segment(4).cmp_memory(a.str, b.str)) || + (res= segment(3).cmp_memory(a.str, b.str)) || + (res= segment(2).cmp_memory(a.str, b.str)) || + (res= segment(1).cmp_memory(a.str, b.str)) || + (res= segment(0).cmp_memory(a.str, b.str))) + return res; + return 0; + } + + static ulong KEY_pack_flags(uint column_nr) + { + return HA_PACK_KEY; + } + + /* + Convert in-record representation to binlog representation. + We tranfer UUID values in binlog by compressing in-memory representation. + This makes replication between UUID and BINARY(16) simpler: + + Transferring by compressing the in-record representation would require + extending the binary log format to put the extact data type name into + the column metadata. + */ + static uchar *pack(uchar *to, const uchar *from, uint max_length) + { + uchar buf[binary_length()]; + record_to_memory((char *) buf, (const char *) from); + return StringPack(&my_charset_bin, binary_length()). + pack(to, buf, max_length); + } + + // Convert binlog representation to in-record representation + static const uchar *unpack(uchar *to, + const uchar *from, const uchar *from_end, + uint param_data) + { + uchar buf[binary_length()]; + const uchar *rc= StringPack(&my_charset_bin, binary_length()). + unpack(buf, from, from_end, param_data); + memory_to_record((char *) to, (const char *) buf); + return rc; + } + }; + #include "sql_type_fixedbin.h" typedef FixedBinTypeBundle<UUID> UUIDBundle; diff --git a/sql/sql_string.h b/sql/sql_string.h index fe57c8153bb..795f80c3e08 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -484,6 +484,11 @@ public: if (str.Alloced_length) Alloced_length= (uint32) (str.Alloced_length - offset); } + LEX_CSTRING to_lex_cstring() const + { + LEX_CSTRING tmp= {Ptr, str_length}; + return tmp; + } inline LEX_CSTRING *get_value(LEX_CSTRING *res) { res->str= Ptr; diff --git a/sql/sql_type_fixedbin.h b/sql/sql_type_fixedbin.h index 5c6d496be5f..b7dcfdde9d3 100644 --- a/sql/sql_type_fixedbin.h +++ b/sql/sql_type_fixedbin.h @@ -111,6 +111,12 @@ public: return fbt; } + static Fbt record_to_memory(const char *ptr) + { + Fbt fbt; + FbtImpl::record_to_memory(fbt.m_buffer, ptr); + return fbt; + } /* Check at Item's fix_fields() time if "item" can return a nullable value on conversion to Fbt, or conversion produces a NOT NULL Fbt value. @@ -132,10 +138,10 @@ public: { *error= make_from_item(item, warn); } - void to_binary(char *str, size_t str_size) const + void to_record(char *str, size_t str_size) const { DBUG_ASSERT(str_size >= sizeof(m_buffer)); - memcpy(str, m_buffer, sizeof(m_buffer)); + FbtImpl::memory_to_record(str, m_buffer); } bool to_binary(String *to) const { @@ -154,18 +160,13 @@ public: FbtImpl::max_char_length()+1)); return false; } - int cmp(const char *str, size_t length) const - { - DBUG_ASSERT(length == sizeof(m_buffer)); - return memcmp(m_buffer, str, length); - } int cmp(const Binary_string &other) const { - return cmp(other.ptr(), other.length()); + return FbtImpl::cmp(FbtImpl::to_lex_cstring(), other.to_lex_cstring()); } int cmp(const Fbt &other) const { - return memcmp(m_buffer, other.m_buffer, sizeof(m_buffer)); + return FbtImpl::cmp(FbtImpl::to_lex_cstring(), other.to_lex_cstring()); } }; @@ -191,9 +192,9 @@ public: DBUG_ASSERT(!is_null()); return *this; } - void to_binary(char *str, size_t str_size) const + void to_record(char *str, size_t str_size) const { - to_fbt().to_binary(str, str_size); + to_fbt().to_record(str, str_size); } bool to_binary(String *to) const { @@ -257,6 +258,10 @@ public: { return FbtImpl::default_value(); } + ulong KEY_pack_flags(uint column_nr) const override + { + return FbtImpl::KEY_pack_flags(column_nr); + } protocol_send_type_t protocol_send_type() const override { return PROTOCOL_SEND_STRING; @@ -480,7 +485,7 @@ public: DBUG_ASSERT(!item->null_value); DBUG_ASSERT(FbtImpl::binary_length() == tmp.length()); DBUG_ASSERT(FbtImpl::binary_length() == sort_field->length); - memcpy(to, tmp.ptr(), tmp.length()); + FbtImpl::memory_to_record((char*) to, tmp.ptr()); } uint make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, @@ -501,7 +506,7 @@ public: DBUG_ASSERT(!item->null_value); DBUG_ASSERT(FbtImpl::binary_length() == tmp.length()); DBUG_ASSERT(FbtImpl::binary_length() == sort_field->length); - memcpy(to, tmp.ptr(), tmp.length()); + FbtImpl::memory_to_record((char*) to, tmp.ptr()); return tmp.length(); } void sort_length(THD *thd, const Type_std_attributes *item, @@ -700,9 +705,7 @@ public: } int cmp_native(const Native &a, const Native &b) const override { - DBUG_ASSERT(a.length() == FbtImpl::binary_length()); - DBUG_ASSERT(b.length() == FbtImpl::binary_length()); - return memcmp(a.ptr(), b.ptr(), FbtImpl::binary_length()); + return FbtImpl::cmp(a.to_lex_cstring(), b.to_lex_cstring()); } bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override { @@ -1107,7 +1110,7 @@ public: if (fbt.is_null()) return maybe_null() ? set_null_with_warn(err) : set_min_value_with_warn(err); - fbt.to_binary((char *) ptr, FbtImpl::binary_length()); + fbt.to_record((char *) ptr, FbtImpl::binary_length()); return 0; } @@ -1184,11 +1187,27 @@ public: return false; } - String *val_str(String *val_buffer, String *) override + bool val_native(Native *to) override + { + DBUG_ASSERT(marked_for_read()); + DBUG_ASSERT(!is_null()); + if (to->alloc(FbtImpl::binary_length())) + return true; + to->length(FbtImpl::binary_length()); + FbtImpl::record_to_memory((char*) to->ptr(), (const char*) ptr); + return false; + } + + Fbt to_fbt() const { DBUG_ASSERT(marked_for_read()); - Fbt_null tmp((const char *) ptr, pack_length()); - return tmp.to_string(val_buffer) ? NULL : val_buffer; + DBUG_ASSERT(!is_null()); + return Fbt::record_to_memory((const char*) ptr); + } + + String *val_str(String *val_buffer, String *) override + { + return to_fbt().to_string(val_buffer) ? NULL : val_buffer; } my_decimal *val_decimal(my_decimal *to) override @@ -1227,7 +1246,7 @@ public: { DBUG_ASSERT(marked_for_write_or_computed()); DBUG_ASSERT(value.length() == FbtImpl::binary_length()); - memcpy(ptr, value.ptr(), value.length()); + FbtImpl::memory_to_record((char*) ptr, value.ptr()); return 0; } @@ -1409,6 +1428,13 @@ public: item->type_handler() == type_handler()); return true; } + void hash(ulong *nr, ulong *nr2) + { + if (is_null()) + *nr^= (*nr << 1) | 1; + else + FbtImpl::hash_record(ptr, nr, nr2); + } SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *prm, KEY_PART *key_part, const Item_bool_func *cond, scalar_comparison_op op, Item *value) override @@ -1450,13 +1476,13 @@ public: uchar *pack(uchar *to, const uchar *from, uint max_length) override { DBUG_PRINT("debug", ("Packing field '%s'", field_name.str)); - return StringPack(&my_charset_bin, FbtImpl::binary_length()).pack(to, from, max_length); + return FbtImpl::pack(to, from, max_length); } const uchar *unpack(uchar *to, const uchar *from, const uchar *from_end, uint param_data) override { - return StringPack(&my_charset_bin, FbtImpl::binary_length()).unpack(to, from, from_end, param_data); + return FbtImpl::unpack(to, from, from_end, param_data); } uint max_packed_col_length(uint max_length) override diff --git a/sql/sql_type_fixedbin_storage.h b/sql/sql_type_fixedbin_storage.h index 0e8ac81ab59..6e18335bd4c 100644 --- a/sql/sql_type_fixedbin_storage.h +++ b/sql/sql_type_fixedbin_storage.h @@ -21,6 +21,38 @@ format and their own (variable size) canonical string representation. Examples are INET6 and UUID types. + + The MariaDB server uses three binary representations of a data type: + + 1. In-memory binary representation (user visible) + This representation: + - can be used in INSERT..VALUES (X'AABBCC') + - can be used in WHERE conditions: WHERE c1=X'AABBCC' + - is returned by CAST(x AS BINARY(N)) + - is returned by Field::val_native() and Item::val_native() + + 2. In-record binary representation (user invisible) + This representation: + - is used in records (is pointed by Field::ptr) + - must be comparable by memcmp() + + 3. Binlog binary (row) representation + Usually, for string data types the binlog representation + is based on the in-record representation with trailing byte compression: + - trailing space compression for text string data types + - trailing zero compression for binary string data types + + We have to have separate in-memory and in-record representations + because we use HA_KEYTYPE_BINARY for indexing. The engine API + does not have a way to pass a comparison function as a parameter. + + The default implementation below assumes that: + - the in-memory and in-record representations are equal + - the binlog representation is compatible with BINARY(N) + This is OK for simple data types, like INET6. + + Data type implementations that need different representations + can override the default implementation (like e.g. UUID does). */ /***********************************************************************/ @@ -29,6 +61,7 @@ template<size_t NATIVE_LEN, size_t MAX_CHAR_LEN> class FixedBinTypeStorage { protected: + // The buffer that stores the in-memory binary representation char m_buffer[NATIVE_LEN]; // Non-initializing constructor @@ -42,7 +75,7 @@ protected: } public: - // Initialize from binary representation + // Initialize from the in-memory binary representation FixedBinTypeStorage(const char *str, size_t length) { if (length != binary_length()) @@ -51,9 +84,49 @@ public: memcpy(&m_buffer, str, sizeof(m_buffer)); } + // Return the buffer with the in-memory representation + Lex_cstring to_lex_cstring() const + { + return Lex_cstring(m_buffer, sizeof(m_buffer)); + } + static constexpr uint binary_length() { return NATIVE_LEN; } static constexpr uint max_char_length() { return MAX_CHAR_LEN; } + // Compare the in-memory binary representations of two values + static int cmp(const LEX_CSTRING &a, const LEX_CSTRING &b) + { + DBUG_ASSERT(a.length == binary_length()); + DBUG_ASSERT(b.length == binary_length()); + return memcmp(a.str, b.str, b.length); + } + + /* + Convert from the in-memory to the in-record representation. + Used in Field::store_native(). + */ + static void memory_to_record(char *to, const char *from) + { + memcpy(to, from, NATIVE_LEN); + } + /* + Convert from the in-record to the in-memory representation + Used in Field::val_native(). + */ + static void record_to_memory(char *to, const char *from) + { + memcpy(to, from, NATIVE_LEN); + } + + /* + Hash the in-record representation + Used in Field::hash(). + */ + static void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) + { + my_charset_bin.hash_sort(ptr, binary_length(), nr, nr2); + } + static bool only_zero_bytes(const char *ptr, size_t length) { for (uint i= 0 ; i < length; i++) @@ -64,5 +137,37 @@ public: return true; } + static ulong KEY_pack_flags(uint column_nr) + { + /* + Return zero by default. A particular data type can override + this method return some flags, e.g. HA_PACK_KEY to enable + key prefix compression. + */ + return 0; + } + + /* + Convert from the in-record to the binlog representation. + Used in Field::pack(), and in filesort to store the addon fields. + By default, do what BINARY(N) does. + */ + static uchar *pack(uchar *to, const uchar *from, uint max_length) + { + return StringPack(&my_charset_bin, binary_length()).pack(to, from, max_length); + } + + /* + Convert from the in-binary-log to the in-record representation. + Used in Field::unpack(). + By default, do what BINARY(N) does. + */ + static const uchar *unpack(uchar *to, const uchar *from, const uchar *from_end, + uint param_data) + { + return StringPack(&my_charset_bin, binary_length()).unpack(to, from, from_end, + param_data); + } + }; #endif /* SQL_TYPE_FIXEDBIN_STORAGE */ |