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

Btree leaf nodes point to wrong records of the main file #170

Open
vassilikikrg opened this issue Feb 8, 2023 · 0 comments
Open

Btree leaf nodes point to wrong records of the main file #170

vassilikikrg opened this issue Feb 8, 2023 · 0 comments

Comments

@vassilikikrg
Copy link

Bug description: When a Btree index is created on a (primary key) column that is not sorted, the final level of nodes (leaf nodes) point to wrong records of the main file.

Examples:

Note: The only changes made to the original project to identify the bug were:

  • to change the type of the ID field of the instructor table from string to int in smallRelationsInsertFile.sql
    create table instructor (ID int primary key, name str, dept_name str, salary int);

  • to add to line 301 (_select_where_with_btree function) of the table.py file the printing of the index.
    bt.show()

Case 1: the initial inserts in the instructor table are ordered by the ID field

image
We create the index and then SELECT.
image

The btree is printed first:
image
image
image
image

The pointers are correct as well as the results of the SELECT query
image


Case 2) the initial inserts in the instructor table are not ordered by the ID field

image

We follow the same process as before,
we create the index and then SELECT.
image

The btree is printed first:
image
image
image

The pointers are incorrect as well as the results of the SELECT query
image

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

1 participant