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

[BUG](python): The order of the table was changed after executing the compact_files operation #3465

Open
ZhuochengZhang98 opened this issue Feb 20, 2025 · 3 comments

Comments

@ZhuochengZhang98
Copy link

Lance Version

pylance 0.20.0

What happened

The order of the dataset was changed after executing the compact_files operation.

My code is as follows:

import lance
from lance.dataset import DatasetOptimizer

DB_PATH = "<path-to-my-dataset>"

def main():
    dataset = lance.dataset(DB_PATH)
    print(dataset.take([0,1,2,3,4,5,6,7,8,9])  # show the first ten elements

    # compact the dataset
    optim = DatasetOptimizer(dataset)
    optim.compact_files(num_threads=8)
    print(dataset.take([0,1,2,3,4,5,6,7,8,9])  # the first ten elements was changed
    return

if __name__ == "__main__":
    main()

My enviroment

I am using a ubuntu server with 64 cores and 512G memory.
The dataset has 5 columns: title(str), section(str), text(str), id(str), and vector(list[float]).

How to reproduce

This dataset has 38 Million records of 768 dim vector and payload. I'm not sure if its feasible to share the dataset.

@westonpace
Copy link
Contributor

If there are enough files to justify multiple concurrent compaction tasks (by default this would mean at least 2Mi uncompacted rows) then we run compaction tasks in parallel.

I'm not sure whether or not we sequence the results but this seems a likely candidate for the reordering.

@wjones127
Copy link
Contributor

In general, we don’t guarantee order of rows stays the same. They will also change order if you update rows.

@ZhuochengZhang98
Copy link
Author

Thank you for your reply. I think I have to find another way to take the row I needed.

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

No branches or pull requests

3 participants