问题
i want use apache drill to do a page search. But it just provide a limit key words,I don't know how to write a good sql.Do any anybody can help me?Thank you!
回答1:
Drill supports both LIMIT and OFFSET operators. So, pagination can be achieved using these.
Sample query:
SELECT * FROM cp.`employee.json` order by employee_id LIMIT 20 OFFSET 10 ROWS
Some important ponits from Drill docs:
The OFFSET number must be a positive integer and cannot be larger than the number of rows in the underlying result set or no rows are returned. You can use the OFFSET clause in conjunction with the LIMIT and ORDER BY clauses.
When used with the LIMIT option, OFFSET rows are skipped before starting to count the LIMIT rows that are returned. If the LIMIT option is not used, the number of rows in the result set is reduced by the number of rows that are skipped.
The rows skipped by an OFFSET clause still have to be scanned, so it might be inefficient to use a large OFFSET value.
来源:https://stackoverflow.com/questions/37183523/how-to-use-apache-drill-do-page-search