How to use apache drill do page search

霸气de小男生 提交于 2019-12-12 05:14:02

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!