summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorVarun Gupta <varunraiko1803@gmail.com>2017-12-30 10:18:22 +0530
committerVarun Gupta <varunraiko1803@gmail.com>2017-12-30 10:18:22 +0530
commita118c20c8151a4e95f133b6d5bf92bafc7835e23 (patch)
treeb74a4d00cb0a8e07b631d3ca68c39baab52a1491 /mysql-test
parent8bcbcac053b96a39465e4651f51e625c37f94964 (diff)
downloadmariadb-git-a118c20c8151a4e95f133b6d5bf92bafc7835e23.tar.gz
MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort
Currently explain format=json does not show the order direction of fields used during filesort. This patch would remove this limitation
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/explain_json.result60
-rw-r--r--mysql-test/r/win.result2
-rw-r--r--mysql-test/t/explain_json.test11
3 files changed, 72 insertions, 1 deletions
diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result
index b83334c8b08..db792f4f2b6 100644
--- a/mysql-test/r/explain_json.result
+++ b/mysql-test/r/explain_json.result
@@ -1582,3 +1582,63 @@ EXPLAIN
}
}
drop table t0,t1;
+#
+# MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort
+#
+create table t1 (a int, b int);
+insert into t1 values (1,2),(3,4),(2,3);
+explain format=json select * from t1 order by a, b desc;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a, t1.b desc",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json select * from t1 order by a desc, b desc;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc, t1.b desc",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json select * from t1 order by a desc, b ;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc, t1.b",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+drop table t1;
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index cfe3ebe6a3c..7e0c86b1668 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -1779,7 +1779,7 @@ EXPLAIN
"query_block": {
"select_id": 1,
"filesort": {
- "sort_key": "row_number() over ( order by t1.s1,t1.s2)",
+ "sort_key": "row_number() over ( order by t1.s1,t1.s2) desc",
"window_functions_computation": {
"sorts": {
"filesort": {
diff --git a/mysql-test/t/explain_json.test b/mysql-test/t/explain_json.test
index d253b8380e9..c3665b1818b 100644
--- a/mysql-test/t/explain_json.test
+++ b/mysql-test/t/explain_json.test
@@ -406,3 +406,14 @@ explain format=json
select a, (select max(a) from t1 where t0.a<5 and t1.b<t0.a) from t0;
drop table t0,t1;
+--echo #
+--echo # MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort
+--echo #
+
+create table t1 (a int, b int);
+insert into t1 values (1,2),(3,4),(2,3);
+explain format=json select * from t1 order by a, b desc;
+explain format=json select * from t1 order by a desc, b desc;
+explain format=json select * from t1 order by a desc, b ;
+drop table t1;
+