[MCOL-3827] view: column is not found in info map Created: 2020-02-21 Updated: 2020-09-21 Resolved: 2020-08-31 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | 1.4.3 |
| Fix Version/s: | 1.4.5, 5.4.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Hall (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Sprint: | 2020-7 |
| Epic/Theme: | 1.4_regressions |
| Description |
|
create table t1 (a int, b int) engine=columnstore; ERROR 1815 (HY000): Internal error: column is not found in info map. This is a regression since 1.2.6 |
| Comments |
| Comment by David Hall (Inactive) [ 2020-03-11 ] | ||||||||||||||||||||||||
|
It appears the problem only surfaces in queries with order by 1,2,3,4. The same query with order by 1,2 does not fail. | ||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2020-04-15 ] | ||||||||||||||||||||||||
|
The query found in working_tpch1_compareLogOnly/view/mts_view.sql
also shows this error. Note that it has order by 1,2. | ||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2020-07-01 ] | ||||||||||||||||||||||||
|
This is caused by an ORDER BY on the returned value of a subquery. Such results don't have oids in the key maps and it gets confused. | ||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2020-07-02 ] | ||||||||||||||||||||||||
|
mts.1.0200.sql has this query, which is the simplest to exhibit the problem: | ||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2020-08-14 ] | ||||||||||||||||||||||||
|
The problem stems from moving order by into our code. Order by, as coded, doesn't see the results of a subquery. In this case, the parser will syntax out (or runtime will error) if the subquery returns more than one value, so ordering on it is redundant. Still, we should support it, as automated query builders may create such things. A simplified way to reproduce:
An interesting note:
will not error. It won't put c in the sort, but it won't error. Since c must be a single value, it doesn't matter that it doesn't get into the sort:
Adding a second value to t3 results in an error which is consistent with InnoDB behavior:
| ||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2020-08-17 ] | ||||||||||||||||||||||||
|
The problem stems from moving order by into our code. Order by, as coded, doesn't see the results of a subquery. In this case, the parser will syntax out, or runtime will, if the subquery returns more than one row, so ordering on it is redundant. Still, we should support it, as automated query builders may create such things. A simplified way to reproduce:
An interesting note:
will not error. It won't put c in the sort, but it won't error. Since c must be a single value, it doesn't matter that it doesn't get into the sort:
Adding a second value to t3 results in an error:
| ||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2020-08-17 ] | ||||||||||||||||||||||||
|
Fixed by optimizing out any order by on a scaler subselect. This way, any internal confusion is avoided, and cost of sorting on a single value is saved. | ||||||||||||||||||||||||
| Comment by Gagan Goel (Inactive) [ 2020-08-18 ] | ||||||||||||||||||||||||
|
David.Hall Can you reinstate all the relevant regression tests for this fix? | ||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2020-08-20 ] | ||||||||||||||||||||||||
|
MariaDB [tpch1]> select * from v1 order by 1,2,3,4;
-----
----- | ||||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2020-08-31 ] | ||||||||||||||||||||||||
|
Builds verified: 1.4.5-1 (drone #483), 1.5.4-1 (drone #496) MariaDB [mytest]> create table t1 (a int, b int) engine=columnstore; MariaDB [mytest]> insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10); MariaDB [mytest]> create view v1 (c,d,e,f) as select a,b, MariaDB [mytest]> select * from v1 order by 1,2,3,4;
-----
----- |