[ 
https://issues.apache.org/jira/browse/DRILL-8090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465763#comment-17465763
 ] 

Vova Vysotskyi commented on DRILL-8090:
---------------------------------------

I've checked, and the dialect is chosen correctly.
The issue here is that the MS SQL server allows FETCH and OFFSET with the ORDER 
BY statement only. Though we could replace FETCH with TOP N, we still cannot 
handle OFFSET without ORDER BY...

Ideally, we should prevent pushing down FETCH and OFFSET without ORDER BY based 
on specific dialect, but we should extend dialect API to be able to determine 
that (requires changes in Calcite).

> LIMIT clause is pushed down to an invalid OFFSET-FETCH clause for MS SQL 
> Server 
> --------------------------------------------------------------------------------
>
>                 Key: DRILL-8090
>                 URL: https://issues.apache.org/jira/browse/DRILL-8090
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.19.0
>            Reporter: James Turton
>            Assignee: Vova Vysotskyi
>            Priority: Major
>
> In MS SQL Server, ORDER BY is mandatory for using OFFSET and FETCH clauses.  
> Drill (or Calcite) does not include an ORDER BY clause in the SQL it 
> generates for a LIMIT clause.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to