Skip to content

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

@vassilikikrg

Description

@vassilikikrg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions