[ 
https://issues.apache.org/jira/browse/PHOENIX-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gabriel Reid resolved PHOENIX-160.
----------------------------------

    Resolution: Fixed

Bulk resolve of closed issues imported from GitHub. This status was reached by 
first re-opening all closed imported issues and then resolving them in bulk.

> ORDER BY with LIMIT evaluated in wrong order
> --------------------------------------------
>
>                 Key: PHOENIX-160
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-160
>             Project: Phoenix
>          Issue Type: Task
>            Reporter: Robert Dyer
>              Labels: bug
>
> Using the stock symbol example, if we do these queries:
> ```sql
> SELECT SYMBOL FROM STOCK_SYMBOL ORDER BY SYMBOL DESC LIMIT 3;
> SELECT SYMBOL FROM STOCK_SYMBOL ORDER BY SYMBOL ASC LIMIT 3;
> ```
> One would expect different symbols in each set.  Instead we get this result:
> ```
> SYMBOL     
> ---------- 
> GOOG       
> CRM        
> AAPL       
> SYMBOL     
> ---------- 
> AAPL       
> CRM        
> GOOG       
> ```
> Which implies that the LIMIT was applied first, then ORDER BY.  I could be 
> wrong but I believe most databases would not evaluate these expressions in 
> that order.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to