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

feat: Add 'show tables' functionality in SQL executor #61

Merged
merged 3 commits into from
Sep 22, 2023

Conversation

loloxwg
Copy link
Member

@loloxwg loloxwg commented Sep 17, 2023

This commit introduces 'show tables' feature, allowing users to display table names in the database. Necessary changes were made in the execution module, database, binder, and storage to facilitate this feature. This includes addition of ShowTables struct and implementing the Executor trait for it, modifications in Binder to create a logical plan for 'show tables' commands, and adding show_tables function in storage to return a list of existing table names. Additionally, a 'ShowTablesOperator' was added in operator module to support operation, and new test cases were added to validate the modifications.

What is changed and how it works?

Code changes

  • Has Rust code change
  • Has CI related scripts change

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Note for reviewer

This commit introduces 'show tables' feature, allowing users to display table names in the database. Necessary changes were made in the execution module, database, binder, and storage to facilitate this feature. This includes addition of `ShowTables` struct and implementing the `Executor` trait for it, modifications in `Binder` to create a logical plan for 'show tables' commands, and adding `show_tables` function in storage to return a list of existing table names. Additionally, a 'ShowTablesOperator' was added in operator module to support operation, and new test cases were added to validate the modifications.
table_name,
);

bincode::serialize(&table_name).ok()
Copy link
Member

Choose a reason for hiding this comment

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

oops, On the Index branch I am currently developing, I added this to the TypeError for bincode errors.

#[error("bindcode")]
    Bincode(
        #[source]
        #[from]
        Box<bincode::ErrorKind>
    )

So I can throw the error directly instead of returning Option:
image

Copy link
Member Author

Choose a reason for hiding this comment

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

When will you fix it to prevent conflict?

src/storage/table_codec.rs Outdated Show resolved Hide resolved
Functions `show_tables` in the Storage trait and its implementations in Kip and Memory now return a tuple containing table name and column count. The functions `encode_root_table` and `decode_root_table` in table_codec have been updated for the new format. These changes improve utility of `show_tables` by providing more detailed information.
@KKould KKould merged commit a348db1 into KipData:main Sep 22, 2023
1 of 2 checks passed
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