Skip to content

feat: implement the Parser function to support the drop table #133

Open
Adez017 wants to merge 3 commits into
aviralgarg05:mainfrom
Adez017:main
Open

feat: implement the Parser function to support the drop table #133
Adez017 wants to merge 3 commits into
aviralgarg05:mainfrom
Adez017:main

Conversation

@Adez017

@Adez017 Adez017 commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

🚀 OSCG'26 Contributor Notice

NexumDB participates in the Open Source Contributor Games 2026! High-quality PRs earn you points, recognition, and networking opportunities. Please follow our contribution guidelines for maximum impact and ensure your submission meets OSCG quality standards.

Summary

Athough a PR had added the storage concerns solve for drop statement but yet the parser implementation is missing whihc will be full filled now

Closes #132

What Changed?

Why?

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update
  • Refactoring (code improvement without behavior change)
  • Style/UI changes
  • Performance improvement
  • Test addition or update
  • Configuration/build changes
  • Security fix

Testing

Local Testing Checklist

  • cargo fmt --all -- --check - Code formatting
  • cargo clippy --workspace --all-targets -- -D warnings - Linting
  • cargo test --workspace -- --test-threads=1 - All tests pass
  • cargo audit - No security vulnerabilities
  • python -m ruff check nexum_ai/ - Python linting (if applicable)
  • python -m compileall nexum_ai - Python compilation (if applicable)
  • Manual testing performed (describe below)

Testing Details

Screenshots/Examples

Performance Impact

  • No performance impact
  • Performance improvement (describe below)
  • Potential performance concern (describe below)

Security Considerations

  • No security concerns
  • Security improvement (describe below)
  • Requires security review (describe below)

Documentation

  • Updated inline code comments/documentation
  • Updated README.md (if applicable)
  • Updated CHANGELOG.md (will be auto-updated on release)
  • Updated TESTING.md (if test procedures changed)
  • Added/updated examples in demo.sh (if applicable)

Pre-Merge Checklist

  • Self-reviewed my own code thoroughly
  • Added comprehensive tests covering my changes
  • All existing tests pass locally
  • Updated relevant documentation
  • No uncommitted debug code or console logs
  • Commit messages follow Conventional Commits
  • Follows Code of Conduct
  • Branch is up to date with main

🎯 OSCG'26 Quality Standards

By submitting this PR, I confirm:

  • I have read and follow the CONTRIBUTING.md guidelines
  • My contribution meets OSCG'26 quality standards for production-ready code
  • I have tested my changes thoroughly across different scenarios
  • I understand the zero-tolerance policy for low-quality submissions
  • My code follows established patterns and maintains consistency
  • I have considered performance, security, and maintainability impacts
  • I acknowledge this project's participation in OSCG'26 and uphold its reputation

Additional Notes

Reviewers: Please check that all checkboxes are ticked before approving

Summary by CodeRabbit

  • New Features

    • Added support for DROP TABLE statements with optional IF EXISTS, handling quoted and unquoted table identifiers
  • Tests

    • Added comprehensive tests for DROP TABLE parsing scenarios, covering IF EXISTS variants, quoted identifiers, and error handling

@Adez017

Adez017 commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

@aviralgarg05

@coderabbitai

coderabbitai Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Extend the SQL parser to convert sqlparser DROP statements for tables into Statement::DropTable, extracting the table name and if_exists flag; adds tests covering basic DROP TABLE forms and quoted identifiers.

Changes

Cohort / File(s) Summary
DROP TABLE Parser Support
nexum_core/src/sql/parser.rs
Added conversion for sqlparser DROP statements where object_type is Table and exactly one name is provided, producing Statement::DropTable with extracted name and if_exists; added tests for basic DROP TABLE, IF EXISTS, quoted identifiers, and sqlparser syntax.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • feat: Add DROP TABLE support #68 — Parser-side DROP TABLE support matches the issue's request to add DROP TABLE parsing (addresses the parser portion but not planner/executor/storage aspects).
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds parser unit tests (4 cases shown) for DROP TABLE and DROP TABLE IF EXISTS, partially addressing issue #132's parser testing requirement of 13 cases, but does not implement the full validation lifecycle, integration test, cache invalidation, or Windows build fixes mentioned in the linked issue. This PR should be scoped as parser-only OR extended to include integration test (test_verify_physical_deletion), semantic cache invalidation verification, and Windows build documentation as required by issue #132.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: implement the Parser function to support the drop table' directly describes the main code change—adding DROP TABLE statement parsing support to the parser.
Out of Scope Changes check ✅ Passed All changes are in-scope: the code modifications are limited to parser.rs with DROP TABLE parsing implementation and corresponding tests, directly aligned with the stated PR objective of implementing parser support for DROP TABLE.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎉 Thanks for opening your first pull request in NexumDB!

We appreciate your contribution! Here's what happens next:

  1. ✅ Automated checks will run (CI, tests, linting)
  2. 👀 A maintainer will review your changes
  3. 💬 We may suggest some improvements or ask questions
  4. 🚀 Once approved, we'll merge your contribution!

Before we can merge:

  • Make sure all CI checks pass
  • Sign your commits with DCO (git commit -s)
  • Address any review feedback

Check out our Contributing Guide for more details.

Thanks for making NexumDB better! 🙌

@Adez017 Adez017 changed the title Implement the Parser function to support the drop table feat: Implement the Parser function to support the drop table Feb 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
nexum_core/src/sql/parser.rs (1)

243-265: ⚠️ Potential issue | 🟡 Minor

Token-based parsing cannot handle table names containing whitespace.

split_whitespace at line 226 breaks identifiers with embedded spaces (e.g., DROP TABLE `my table` yields 4 tokens, matching neither the 3-token nor 5-token branch). This would silently fall through to sqlparser, which can parse it, but the sqlparser Drop arm uses names[0].to_string() instead of clean_identifier, potentially returning a differently-formatted name.

If whitespace-containing identifiers aren't supported by the engine, a brief comment noting this limitation would help future maintainers. Otherwise, removing these management-parser branches in favor of the sqlparser path (as noted above) would handle this correctly.

🤖 Fix all issues with AI agents
In `@nexum_core/src/sql/parser.rs`:
- Around line 581-594: The test test_parse_drop_table_sqlparser_syntax is a
duplicate of test_parse_drop_table and never exercises the sqlparser Drop arm;
either delete this redundant test or change its SQL to trigger the sqlparser
path (e.g., use "DROP TABLE users CASCADE" or "DROP TABLE schema.users") and
update assertions in the test_parse_drop_table_sqlparser_syntax function
accordingly so it validates the parsed form produced by the sqlparser Drop arm
(refer to Parser::parse, Statement::DropTable and the sqlparser Drop handling
added around the Drop arm).
- Around line 200-220: The SqlStatement::Drop arm in convert_statement
(producing Statement::DropTable via names[0].to_string()) duplicates and
inconsistently normalizes identifiers compared to the management parser which
uses clean_identifier and intercepts DROP TABLE earlier; pick one canonical
path: either remove the management-parser DROP TABLE handling and let
convert_statement's SqlStatement::Drop handle DROP TABLEs (update it to
normalize identifiers using clean_identifier for names[0] and honor if_exists),
or delete this SqlStatement::Drop arm and keep the management parser as the
single handler; also remove the duplicate test
test_parse_drop_table_sqlparser_syntax (keep test_parse_drop_table) so tests
match the chosen single parsing path.

Comment thread nexum_core/src/sql/parser.rs
Comment thread nexum_core/src/sql/parser.rs
@Adez017 Adez017 changed the title feat: Implement the Parser function to support the drop table feat: implement the Parser function to support the drop table Feb 11, 2026
@aviralgarg05 aviralgarg05 added the medium Intermediate difficulty label Feb 11, 2026

@aviralgarg05 aviralgarg05 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Pls fix the issues and failing workflow

@Adez017 Adez017 requested a review from aviralgarg05 February 18, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

medium Intermediate difficulty rust size/S sql

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants