[MCOL-256] queries return random data when they have inline comments Created: 2016-07-21 Updated: 2016-09-09 Resolved: 2016-08-26 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | 1.0.1 |
| Fix Version/s: | 1.0.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Hill (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Sprint: | 1.0.3 | ||||||||||||||||
| Description |
|
Alpha customer reported following issue: We continue to do testing, actively, with the ColumnStore engine… and our tools place in-line comments in some of the queries. Removing the inline comments results in successful querying of data. example: Before: After: |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2016-08-18 ] | ||
|
Note that this isn't reproducible on the command line, but I've managed to reproduce it using a PHP script to access MySQL. | ||
| Comment by Andrew Hutchings (Inactive) [ 2016-08-18 ] | ||
|
It is taking everything after the start of the comment including following lines of SQL as the whole comment | ||
| Comment by Andrew Hutchings (Inactive) [ 2016-08-18 ] | ||
|
Progress notes... In the debug log during my test:
So the engine is creating a temporary table with the data using the original query, newlines removed. This means that the double dash is commenting out the rest of the query. This temporary table query is generated in mysql/ha_calpont_execplan.cpp, getSelectPlan() around line 6179 onwards:
Cause found, now for a fix... | ||
| Comment by Andrew Hutchings (Inactive) [ 2016-08-18 ] | ||
|
Right problem, wrong place. It was actually being triggered in similar code in the modified sql/sql_parse.cc. It was triggered due to the ColumnStore modifications to MariaDB stripping newline characters from the original query which is later used to generate a temporary table query. The following pull request fixes this by also stripping the comments when stripping the newline charaters: https://github.com/mariadb-corporation/mariadb-columnstore-server/pull/2 Recommend for a test case that you test any query with a comment in the middle and also test using something like:
| ||
| Comment by Andrew Hutchings (Inactive) [ 2016-08-18 ] | ||
|
Obviously not for review until after the freeze | ||
| Comment by Daniel Lee (Inactive) [ 2016-08-26 ] | ||
|
Verified in 1.0.2.1-1. The order by clause was not skipped due to the inline comment [root@builder dlee]# cat /tmp/test.php $sql = "select n_name from nation if (!$result = $mysql1->query($sql)) { echo "Error: Our query failed to execute and here is why: \n"; echo "Query: " . $sql . "\n"; echo "Errno: " . $mysql1->errno . "\n"; echo "Error: " . $mysql1->error . "\n"; exit; }for ($i = 0; $i < $result->num_rows; $i++) { $row = $result->fetch_row(); echo $row[0] . "\n"; //echo $row[1] . "\n"; //echo $row[2] . "\n"; }echo $result->num_rows; Release 1.0.2-1 output: [root@builder dlee]# php /tmp/test.php Release 1.0.2.1-1 output [root@builder dlee]# php /tmp/test.php | ||
| Comment by Daniel Lee (Inactive) [ 2016-08-26 ] | ||
|
Closed per last comment. |