Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
13.2
-
None
-
Not for Release Notes
Description
Plugin aggregate DISTINCT replay order depends on the argument data type
INSTALL SONAME 'func_test';
|
CREATE TABLE t (i INT, vc VARCHAR(16), tx TEXT);
|
INSERT INTO t VALUES (9,'zzz','zzz'), (5,'mmm','mmm'), (9,'zzz','zzz'), (1,'aaa','aaa'), (5,'mmm','mmm');
|
|
|
SELECT test_plugin_first(i), test_plugin_first(vc), test_plugin_first(tx) FROM t;
|
SELECT test_plugin_first(DISTINCT i), test_plugin_first(DISTINCT vc), test_plugin_first(DISTINCT tx) FROM t;
|
column type no DISTINCT with DISTINCT
|
INT (tree path) 9 1
|
VARCHAR(16) (tree path) zzz aaa
|
TEXT (blob replay) zzz zzz
|
VARCHAR and TEXT holding identical values disagree:
test_plugin_first(DISTINCT vc) = 'aaa'
|
test_plugin_first(DISTINCT tx) = 'zzz'
|
Adding DISTINCT also changes the answer for the non-blob types (9 -> 1, zzz -> aaa) while leaving the blob type unchanged.
CLI Output
13.2.0-dbg>INSTALL SONAME 'func_test'; |
Query OK, 0 rows affected (0.003 sec) |
|
|
13.2.0-dbg>CREATE TABLE t (i INT, vc VARCHAR(16), tx TEXT); |
Query OK, 0 rows affected (0.010 sec) |
|
|
13.2.0-dbg>INSERT INTO t VALUES (9,'zzz','zzz'), (5,'mmm','mmm'), (9,'zzz','zzz'), (1,'aaa','aaa'), (5,'mmm','mmm'); |
Query OK, 5 rows affected (0.002 sec) |
Records: 5 Duplicates: 0 Warnings: 0
|
|
|
13.2.0-dbg>
|
13.2.0-dbg>SELECT test_plugin_first(i), test_plugin_first(vc), test_plugin_first(tx) FROM t; |
+----------------------+-----------------------+-----------------------+ |
| test_plugin_first(i) | test_plugin_first(vc) | test_plugin_first(tx) |
|
+----------------------+-----------------------+-----------------------+ |
| 9 | zzz | zzz |
|
+----------------------+-----------------------+-----------------------+ |
1 row in set (0.000 sec) |
|
|
13.2.0-dbg>SELECT test_plugin_first(DISTINCT i), test_plugin_first(DISTINCT vc), test_plugin_first(DISTINCT tx) FROM t; |
+-------------------------------+--------------------------------+--------------------------------+ |
| test_plugin_first(DISTINCT i) | test_plugin_first(DISTINCT vc) | test_plugin_first(DISTINCT tx) | |
+-------------------------------+--------------------------------+--------------------------------+ |
| 1 | aaa | zzz |
|
+-------------------------------+--------------------------------+--------------------------------+ |
1 row in set (0.002 sec) |
|
|
13.2.0-dbg>
|
Attachments
Issue Links
- blocks
-
MDEV-40672 Pluggable aggregate functions
-
- In Testing
-