Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
None
-
None
-
Server version: 10.5.6
MCS version: 1.5.4-1
Drone buildNo: 463
Description
SELECT...UNION...ORDER BY results are not consistent on both the engines Columnstore and Innodb. Due to this some tests are failing.
MariaDB [test]> CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Columnstore;
Query OK, 0 rows affected (0.127 sec)
MariaDB [test]> CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore;
Query OK, 0 rows affected (0.138 sec)
MariaDB [test]> INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, ''),(7, 'eee');
Query OK, 8 rows affected (0.824 sec)
Records: 8 Duplicates: 0 Warnings: 0
MariaDB [test]> INSERT INTO t2 VALUES (NULL, ''),(1, 'eee'),(3, 'ccc'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'eee'),(11, 'nnn');
Query OK, 8 rows affected (0.503 sec)
Records: 8 Duplicates: 0 Warnings: 0
Run 1 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| ddd | Character |
| eee | Character |
| NULL | Character |
| aaa | Character |
| ccc | Character |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
------------------+
13 rows in set (0.153 sec)
Run 2 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| ddd | Character |
| eee | Character |
| NULL | Character |
| aaa | Character |
| ccc | Character |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
------------------+
13 rows in set (0.026 sec)
Run 3 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| ddd | Character |
| eee | Character |
| NULL | Character |
| aaa | Character |
| ccc | Character |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
------------------+
13 rows in set (0.025 sec)
Run 4 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| ddd | Character |
| eee | Character |
| NULL | Character |
| aaa | Character |
| ccc | Character |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
------------------+
13 rows in set (0.017 sec)
Run 5 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| ddd | Character |
| eee | Character |
| NULL | Character |
| aaa | Character |
| ccc | Character |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
------------------+
13 rows in set (0.349 sec)
Run 6 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| ddd | Character |
| eee | Character |
| NULL | Character |
| aaa | Character |
| ccc | Character |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
------------------+
13 rows in set (0.022 sec)
Run 7 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| ddd | Character |
| eee | Character |
| NULL | Character |
| aaa | Character |
| ccc | Character |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
------------------+
13 rows in set (0.018 sec)
Run 8 (here it started giving different result) -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| ccc | Character |
| ddd | Character |
| eee | Character |
| NULL | Character |
| aaa | Character |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
------------------+
13 rows in set (0.019 sec)
Run 9 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| aaa | Character |
| ccc | Character |
| ddd | Character |
| eee | Character |
| NULL | Character |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
| 5 | Integer |
| 6 | Integer |
| 7 | Integer |
| NULL | Integer |
------------------+
13 rows in set (0.022 sec)
Run 10 -
MariaDB [test]> SELECT t1_char, 'Character' AS Table1 FROM t1 UNION SELECT t2_int, 'Integer' AS Table2 FROM t2 ORDER BY 2 ASC;
------------------+
| t1_char | Table1 |
------------------+
| eee | Character |
| NULL | Character |
| aaa | Character |
| ccc | Character |
| ddd | Character |
| 7 | Integer |
| NULL | Integer |
| 9 | Integer |
| 1 | Integer |
| 11 | Integer |
| 3 | Integer |
| 5 | Integer |
| 6 | Integer |
------------------+
13 rows in set (0.024 sec)