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

Partial order by support #179

Merged
merged 4 commits into from
Jul 21, 2024
Merged

Partial order by support #179

merged 4 commits into from
Jul 21, 2024

Conversation

benclmnt
Copy link
Contributor

No description provided.

@benclmnt benclmnt marked this pull request as ready for review July 19, 2024 15:24
@benclmnt benclmnt force-pushed the orderby branch 2 times, most recently from d4f31f6 to e7b164a Compare July 19, 2024 16:27
@benclmnt
Copy link
Contributor Author

Only ascending sort is supported right now; we might need to write our own transient index to support ASC / DESC sort mix

@benclmnt benclmnt changed the title Implement orderby translation Partial order by support Jul 19, 2024
fn rowid(&self) -> Result<Ref<Option<u64>>> {
Ok(self.rowid.borrow())
fn rowid(&self) -> Result<Option<u64>> {
Ok(*self.rowid.borrow())
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for dropping Ref here? Wont it cause additional memory copies in the fast-path?

Copy link
Contributor Author

@benclmnt benclmnt Jul 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more of a hack because I can't figure out how to return a ref for PseudoCursor 😅. Any pointers would be helpful

    fn rowid(&self) -> Result<Ref<Option<u64>>> {
        let x = self
            .current
            .borrow()
            .as_ref()
            .map(|record| match record.values[0] {
                OwnedValue::Integer(rowid) => rowid as u64,
                _ => panic!("Expected integer value"),
            });
        Ok(x)
    }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benclmnt I am not sure I understand what the problem is. A PseudoCursor should be in ProgramState::cursors like BTree cursors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On discord, we discussed about it more. I've since changed the implementation of Sorter::record to follow the same function sig.

@penberg penberg merged commit 532b413 into tursodatabase:main Jul 21, 2024
11 checks passed
@penberg
Copy link
Collaborator

penberg commented Jul 21, 2024

Nice work, @benclmnt! 👏👏👏

@benclmnt benclmnt deleted the orderby branch July 23, 2024 02:00
penberg added a commit that referenced this pull request Sep 22, 2024
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