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 other JavaScript types to indexes #1040

Open
aboodman opened this issue Dec 13, 2022 · 3 comments
Open

Add support for other JavaScript types to indexes #1040

aboodman opened this issue Dec 13, 2022 · 3 comments
Labels
Future Something we want to fix but is not blocking next release

Comments

@aboodman
Copy link
Contributor

aboodman commented Dec 13, 2022

This was just something we overlooked when first implementing. We would have to add some bits to the index value to distinguish types and decide on an ordering.

@arv arv added the Future Something we want to fix but is not blocking next release label Jan 2, 2023
@arv
Copy link
Contributor

arv commented Jan 2, 2023

The obvious type to add support for is number. However, the ordering we use is UTF8 strings. How do we encode an arbitrary number in a way that we preserve the ordering? This paper looks promising: https://www.zanopha.com/docs/elen.pdf

There is also the issue of how to deal with the secondary key in scan

@aboodman
Copy link
Contributor Author

aboodman commented Jan 3, 2023

I'm not following. At the basic level we can clearly encode the number however we want and decode it to compare. Is the problem that you're trying to find a way that we can avoid that and compare as a string? That's an interesting problem. It seems similar to the fracdex problem?

@arv
Copy link
Contributor

arv commented Jan 3, 2023

  1. The "value" is part of the key in the underlying B+Tree we use for the index.
  2. To get scan to iterate over the keys in the correct order we need to have a mapping from number to string that preserves the numeric order. If it was only ints we could zero pad the number for example.
  3. For scan we can pass the start key which is a tuple for index scans consisting of the [secondary: string, primary: string]. If the index is over numbers we would want to pass a number into secondary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Future Something we want to fix but is not blocking next release
Projects
None yet
Development

No branches or pull requests

2 participants