8000 [BUG] Preserve DML predicates when comments mention DDL clauses by eddiethedean · Pull Request #62 · dmux/minilake · GitHub
[go: up one dir, main page]

Skip to content

[BUG] Preserve DML predicates when comments mention DDL clauses - #62

Merged
dmux merged 10 commits into
dmux:mainfrom
eddiethedean:fix/sql-ddl-comment-58
Oct 28, 2026
Merged

dmux merged 10 commits into
dmux:mainfrom
eddiethedean:fix/sql-ddl-comment-58

Conversation

@eddiethedean
@eddiethedean eddiethedean commented Oct 25, 2026 •
Copy link
Copy Markdown
Collaborator

Summary

A comment containing ) USING DELTA could make the SQL rewrite remove a DELETE or UPDATE predicate. The rewrite now recognizes actual USING <format> clauses after a CREATE TABLE column list, while ignoring comments, quoted text, CTAS queries, and subsequent statements in a SQL script. Continued escape strings remain opaque to statement splitting and DDL matching. Commented USING DELTA LOCATION declarations are classified as external tables before the compatibility rewrite can remove their storage location, including comments beside catalog/schema qualification dots. If an external declaration uses a form the classifier cannot register, the rewrite keeps LOCATION in place so execution fails safely without replacing existing data.

Closes #58

Validation

  • Added SDK regressions for commented DELETE/UPDATE predicates, filtered CTAS, multi-statement DELETE, CTAS USING SAMPLE, continued E-string content, external Delta registration with comments before USING and beside a qualification dot, and preservation of an existing table when CREATE OR REPLACE ... LOCATION is unsupported.
  • Docker: pytest tests/test_sql_statements.py tests/unity_catalog/test_delta_tables.py -q — 56 passed.
  • ruff check src/minilake/services/sql_statements.py tests/test_sql_statements.py tests/unity_catalog/test_delta_tables.py
  • ruff format --check src/minilake/services/sql_statements.py tests/test_sql_statements.py tests/unity_catalog/test_delta_tables.py
  • git diff --check

@eddiethedean
Copy link
Copy Markdown
Collaborator Author

Ready to merge. Reviewed the full PR at commit 92e67c2; no remaining high or critical defects were confirmed within the requested review scope.

All 56 targeted Docker tests pass, including the regression that verifies an unsupported external-table replacement preserves existing data. GitHub CI lint, test, and UI checks are green.

@dmux dmux self-assigned this Oct 28, 2026
@dmux dmux added the bug Something isn't working label Oct 28, 2026
@dmux
dmux merged commit 2bbcee5 into dmux:main Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] DDL clause rewriting removes DELETE and UPDATE WHERE clauses after SQL comments

2 participants

0