summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-04-24 00:16:56 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2019-04-24 12:58:04 +0530
commit1f1a61cfc41a01ffa65d568eebdc037a54b5c463 (patch)
tree302a4d84cbc058f67c9f4d6a40a75356bd615fa2 /mysql-test
parent5fc8dd8b82e995b3c685f4e71700201097431358 (diff)
downloadmariadb-git-1f1a61cfc41a01ffa65d568eebdc037a54b5c463.tar.gz
MDEV-15837: Assertion `item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM'
failed in compare_order_elements function The issue here is the function compare_order_lists() is called for the order by list of the window functions so that those window function that can be computed together are adjacent. So in the function compare_order_list we iterate over all the elements in the order list of the two functions and compare the items in their order by clause. The function compare_order_elements() is called for each item in the order by clause. This function assumes that all the items that are in the order by list would be of the type Item::FIELD_ITEM. The case we have is that we have constants in the order by clause. We should ignore the constant and only compare items of the type Item::FIELD_ITEM in compare_order_elements()
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/win.result12
-rw-r--r--mysql-test/t/win.test10
2 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index 083b5dfd16d..0ddffc551dc 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -3506,5 +3506,17 @@ id a b sum_a_b
2 2 2 4
drop table t1;
#
+# MDEV-15837: Assertion `item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM'
+# failed in compare_order_elements function
+#
+CREATE TABLE t1 (a1 int);
+insert into t1 values (1),(2),(3);
+SELECT rank() OVER (ORDER BY 1), ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4))) FROM t1;
+rank() OVER (ORDER BY 1) ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4)))
+1 1
+1 2
+1 3
+drop table t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index 0f02b1414a0..fd31e9d4bd9 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -2256,5 +2256,15 @@ from t1 e;
drop table t1;
--echo #
+--echo # MDEV-15837: Assertion `item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM'
+--echo # failed in compare_order_elements function
+--echo #
+
+CREATE TABLE t1 (a1 int);
+insert into t1 values (1),(2),(3);
+SELECT rank() OVER (ORDER BY 1), ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4))) FROM t1;
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #