Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for offset in select queries #779

Merged
merged 6 commits into from
Jan 30, 2025

Conversation

ben594
Copy link
Contributor

@ben594 ben594 commented Jan 26, 2025

#739

Started adding support for LIMIT...OFFSET...

  • New OffsetLimit opcode
  • OFFSET is now supported for:
    • SELECT...LIMIT...OFFSET
    • SELECT...GROUP BY...LIMIT...OFFSET
    • SELECT...ORDER BY...LIMIT...OFFSET
    • Subqueries for SELECT statements

In progress/todo

  • Testing
  • Handle negative offset value
  • (will make in separate PR) Add support for DELETE...LIMIT...OFFSET
  • (will make in separate PR) Use limit + offset sum register from OffsetLimit to constrain number of records inserted into sorter

skip rows

Emit Integer, OffsetLimit instructions for offset, and define function to emit IfPosinstruction to skip rows

Emit IfPos instructions to handle offset for simple select

Emit IfPos to handle offset for select with order by

Moved repeated emit_offset function call into emit_select_result
@ben594 ben594 force-pushed the add-support-for-offset branch from 50f6d02 to 847617d Compare January 26, 2025 21:41
@ben594 ben594 marked this pull request as ready for review January 26, 2025 21:48
@ben594 ben594 changed the title WIP: Add support for offset Add support for offset Jan 26, 2025
@penberg penberg mentioned this pull request Jan 27, 2025
@ben594 ben594 changed the title Add support for offset Add support for offset in select queries Jan 27, 2025
@penberg penberg closed this in e66648b Jan 30, 2025
@penberg penberg merged commit e66648b into tursodatabase:main Jan 30, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants