Skip to content

Commit 4da7aa5

Browse files
committed
Add a testcase for EXPLAIN FORMAT=JSON for ROR-union index_merge.
1 parent 3e2849d commit 4da7aa5

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

mysql-test/r/explain_json.result

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,35 @@ EXPLAIN
148148
}
149149
}
150150
}
151+
explain format=json select * from t2 where (a1=1 and a2=1) or
152+
(b1=2 and b2=1);
153+
EXPLAIN
154+
{
155+
"query_block": {
156+
"select_id": 1,
157+
"table": {
158+
"table_name": "t2",
159+
"access_type": "index_merge",
160+
"possible_keys": ["a1", "b1"],
161+
"key_length": "10,10",
162+
"index_merge": {
163+
"union": {
164+
"range": {
165+
"key": "a1",
166+
"used_key_parts": ["a1", "a2"]
167+
},
168+
"range": {
169+
"key": "b1",
170+
"used_key_parts": ["b1", "b2"]
171+
}
172+
}
173+
},
174+
"rows": 2,
175+
"filtered": 100,
176+
"attached_condition": "(((t2.a1 = 1) and (t2.a2 = 1)) or ((t2.b1 = 2) and (t2.b2 = 1)))"
177+
}
178+
}
179+
}
151180
# Try ref access on two key components
152181
explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4;
153182
EXPLAIN

mysql-test/t/explain_json.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ explain format=json select * from t2 where a1<5;
3434
explain format=json select * from t2 where a1=1 or b1=2;
3535
explain format=json select * from t2 where a1=1 or (b1=2 and b2=3);
3636

37+
explain format=json select * from t2 where (a1=1 and a2=1) or
38+
(b1=2 and b2=1);
39+
3740
--echo # Try ref access on two key components
3841

3942
explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4;

0 commit comments

Comments
 (0)