skip to main content
Supported SQL Functionality : Order By Clause
  

Try DataDirect Drivers Now

Order By Clause

The Order By clause is supported, with the following Entry SQL level restrictions:
*An integer sort key is not allowed.
*The COLLATE clause is not supported.
*A LIMIT clause or a default ORDER BY limit for result sets is required.

Default ORDER BY Limit

Impala will not return result sets for statements containing an order by clause unless a limit clause is included or a default limit is specified for result sets. A default limit can be set in the server; however, this limits the result sets for all queries, not just statements containing the ORDER BY clause.
The driver can work around these limitations by using the DefaultOrderByLimit connection property.
where:
x
is a positive integer that represents maximum number of rows returned.
If set to x, the number of rows returned by a SQL statement containing an ORDER BY clause are limited to the specified number of rows for the session. To override this value, specify a new value in a LIMIT clause in the statement that is being executed.
If set to -1(disabled), there is no default limit the number of rows returned by a statement containing an ORDER BY clause. The application must limit the number of rows returned by SQL statements that contain an ORDER BY clause, or Impala will return an error.