[MCOL-963] self join cte queries from tpcds alternately fail with parsing error and succeed but with incorrect results Created: 2017-10-09 Updated: 2017-11-20 Resolved: 2017-11-20 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 1.1.0 |
| Fix Version/s: | 1.1.1, 1.1.2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | David Thompson (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Sprint: | 2017-21, 2017-22, 2017-23 | ||||||||||||||||
| Description |
|
query47 and query57 in tpcds both are complex queries using 2 level CTE, self join, and window functions. For example query47:
will fail in one execution with: but succeed the next and so on. I tried to come up with a simpler example wasn't able to so will need more debugging to see what is going on. |
| Comments |
| Comment by David Thompson (Inactive) [ 2017-10-30 ] |
|
Confirm that the current band aid work fors query 78 and will move to |
| Comment by David Hall (Inactive) [ 2017-10-30 ] |
|
There are two issues here, first, the oscillating between an answer and no answer. This is caused by code in ha_calpont_execplan.cpp that notices the function calls in the order by clause and tries to re-write the query, then send it back thru the parser, but that fails and gives the error. The next time it tries, the execution plan hasn't been cleaned up (not good), so it uses it. That execution plan has already been deemed not correct, but gets run anyway, thus the incorrect results. Then the execution plan is cleaned up. Rinse and Repeat. Once the execution plan cleanup is corrected, the retry logic fails repeatedly into an infinite loop. Also not good. So, for this bug, I created a counter that stops the retry at 3 attempts, then switches to operating mode 0 if operating mode 2 is on, else throws an error. However, this query under operating mode 0 takes about 18 hours on my machine – it only takes 35 seconds on a reference MariaDB 10.2. The correct results are returned. The SQL that is causing the problem is the order by sum_sales - avg_monthly_sales. Using one or the other of the columns does not cause a problem but putting them into an expression in the order by confuses the engine.
|
| Comment by David Hall (Inactive) [ 2017-10-30 ] |
|
Pull requests: |
| Comment by Daniel Lee (Inactive) [ 2017-10-31 ] |
|
Build tested: Github source 1.1.1-1 Author: Andrew Hutchings <andrew@linuxjedi.co.uk> Merge pull request #74 from mariadb-corporation/ /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge pull request #308 from mariadb-corporation/ Mcol 963 Created and loaded tpcds database and executed test case. Repeating the query and now consistently getting this error message: ERROR 1815 (HY000): Internal error: Query cannot be processed using operational mode 1 (vtable mode) Is this the new expected behavior? Show we say it is an internal error? Should we say this query is not supported in mode 1 instead? |
| Comment by Daniel Lee (Inactive) [ 2017-10-31 ] |
|
It has been decided the error messages is good for now. |
| Comment by David Hall (Inactive) [ 2017-11-13 ] |
|
The fix broke some other queries. |
| Comment by David Hall (Inactive) [ 2017-11-14 ] |
|
Fix for the regressions introduced. |