[MCOL-1234] Nested CASE filters not processed Created: 2018-02-27 Updated: 2018-07-05 Resolved: 2018-04-16 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | None |
| Fix Version/s: | 1.1.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andrew Hutchings (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Sprint: | 2018-05, 2018-06, 2018-07, 2018-08 | ||||||||||||||||
| Description |
|
This appears to return no data:
|
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2018-03-07 ] |
|
Looks like nested "case_searched" statements appear to break the ptWorkStack after switching the gwi.clauseType to SELECT in a WHERE condition. |
| Comment by David Hall (Inactive) [ 2018-04-02 ] |
|
The problem turns out to be a bit more complex than switching off where clause processing for the inner case. The problem occurs because sometimes processing puts things on the ptWorkStack, and sometimes on the rcWorkStack. When we get to CASE processing, we don't know which, so we re-run the processing for each part. Then pop the appropriate stack. But we don't know which stack as I stated above, so there's no "appropriate" stack. Sometimes we guess wrong and things go haywire. The fix includes a consolidation of the logic for WHERE and SELECT in buildCaseFunction(), wherein it pops stacks regardless of clauseType. Since we don't know what stack to pop (if any), we do a deep compare of the top of each stack against the newly created object. This is inefficient as the original processing sometimes puts the correct items on one of the stacks. We just don't know if or which. We redo that processing for each item and then deep compare to see which stack the item is on, if on any stack at all, and pop that stack. There are comments in the code implying that there were plans to move to single stack processing. However those plans were never realized. Such an effort would be large but it might relieve some of the fragility in this section. |
| Comment by David Hall (Inactive) [ 2018-04-02 ] |
|
I commented a kludge I put in years ago for reasons that may be related. Said kludge seems to break case now. I don't remember if there were other reasons for the kludge (see RecursionCounter), so I left it in the code for now. I tried various nested functions and the regression tests also have such things which passed. The comment says MariaDB bug 750, but the old bug database appears to not be available any more. |
| Comment by Andrew Hutchings (Inactive) [ 2018-04-03 ] |
|
Excellent work! For QA: please use my test case in the developers comment. |
| Comment by Daniel Lee (Inactive) [ 2018-04-16 ] |
|
Build verified: 1.1.4-1 source /root/columnstore/mariadb-columnstore-server Merge pull request #108 from mariadb-corporation/ /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge pull request #438 from mariadb-corporation/ diff --cc writeengine/splitter/we_splitterapp.cpp Executed the mentioned test case in 1.1.3-1 and had 20 rows returned. Verified using the fixed version, as well as innodb, empty set was returned. |