[MDEV-18965] ORDER BY is incorrect with window functions inside IF Created: 2019-03-17 Updated: 2019-03-20 Resolved: 2019-03-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions |
| Affects Version/s: | None |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Moshe L | Assignee: | Alice Sherepa |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Environment: |
windows |
||
| Issue Links: |
|
||||||||
| Description |
|
wrong order while using Window functions (RANK(), ROW_NUMBER) inside an IF, ordered also by joined table and st_distance function. testcase: CREATE TABLE `addresses` ( insert into test INSERT INTO addresses (`a_id`,`a_type`,`a_address`,`a_x`,`a_y`,`a_visible`,`a_status`,`a_city`) VALUES (57316,1,'רח\' הציונות 78 ,אריאל',32.105,35.19709,1,1,110); SET @hereami = POINT(35.22245,31.94236); /*בית אל */ /works/ select row_number() over (partition by cat) c, round( ST_Distance(@hereami, point( a_y,a_x) ) * 111195) distance, test.* /*wrong order */ select if( row_number() over (partition by cat) =1,1,0) c, round( ST_Distance(@hereami, point( a_y,a_x) ) * 111195) distance, test.* ;}} |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2019-03-19 ] |
|
Moved to MariaDB Server as this does not appears to be a ColumnStore issue. |
| Comment by Alice Sherepa [ 2019-03-20 ] |
|
Thanks! |