[MDEV-24760] SELECT..CASE statement syntax error at Spider Engine table Created: 2021-02-02 Updated: 2021-09-27 Resolved: 2021-07-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Spider |
| Affects Version/s: | 10.4.17, 10.5.8, 10.3.30, 10.6.3 |
| Fix Version/s: | 10.3.31, 10.4.21, 10.5.12, 10.6.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | suresh ramagiri | Assignee: | Nayuta Yanagisawa (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | not-10.2, regression | ||
| Description |
|
SELECT ... CASE statement throwing syntax error at the Spider node. Here are the details of the same: Data Node:
Spider Nodes:
|
| Comments |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-02 ] | |
|
I tested on The Spider storage engine rewrites a query before routing it to a data node. The rewrite process seems to be buggy and the engine generates a broken query like the following:
| |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-19 ] | |
|
The bug is not reproducible on 10.2.39. The Spider bundled with 10.2.39 just do a full scan on a data node rather than trying to pushdown CASE WHEN ... THEN statement. | |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-19 ] | |
|
I created an MTR test case: https://github.com/MariaDB/server/commit/7fae7fd76e98b5d4b64a67a6aa0d4ef9aab97840 | |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-19 ] | |
|
The root cause of the bug is in spider_db_mbase_util::open_item_func(Item_func *item_func, ...). The item_func->functype()) of the CASE WHEN ... THEN is CASE_SEARCHED_FUNC. The Spider SE doesn't recognize this Functype because the Functype is newly added by 4de0d92. This results in the wrong handling of the CASE WHEN ... THEN}. | |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-19 ] | |
|
| |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-19 ] | |
|
serg I noticed that I have to cover the case of CASE_SIMPLE_FUNC. Let me withdraw the review request. | |
| Comment by Nayuta Yanagisawa (Inactive) [ 2021-07-19 ] | |
|
serg I'm sorry for repeating myself. Please review. https://github.com/MariaDB/server/commit/cf6d83e7d68bd2bc0af0404bf4dd15218847074d |