Repository navigation
Port smart_autocomplete to DuckDB 2.0 - #1
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
DuckDB 2.0 moved the PEG grammar, tokenizer, matcher and transformer from extension/autocomplete into core (src/parser/peg, linked into libduckdb), and rewrote the matcher as a stack-based process. The forked matcher/tokenizer/ keyword helper this extension compiled is therefore gone, and everything it added on top of upstream 1.5 is now native in core: - token classification during matching (TokenType::CATALOG_NAME, ...) - suppressed suggestions for ExpressionStatement The extension now only keeps its own layer, on top of the core API: - drop matcher.cpp/keyword_helper/tokenizer shadows, PEGMatcherCache and the PEGParserExtension parser override (only used as a matcher cache holder) - use CompiledGrammar::Get(context) (honours grammar extensions); locate the FromClause/WithClause rule matchers by walking the compiled matcher graph - compute the dotted qualifier context after matching instead of from inside the forked IdentifierMatcher - adapt parse-tree walks to 2.0 parse results (reference children, Identifier, ColumnAliases, CatalogQualification ReservedSchemaQualification+, aliases with AS / TableAliasColon on subqueries) - adapt to 2.0 catalog/table function APIs (Identifier, QualifiedName lookups, typed kwargs, Vector::Append) - move everything into duckdb::smart_autocomplete to avoid clashing with the core GenerateAutoCompleteSuggestions/AutoCompleteCatalogProvider symbols Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Upstream deprecated SHOW <table/query> completion: SHOW now completes setting names and the special SHOW forms; DESCRIBE completes tables and queries. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Column scoping finds the core grammar rules FromClause and WithClause by name. If upstream renames them, the lookup silently comes back empty and completion falls back to every table's columns. The WithClause side was only covered by one incidental assertion; this test fails if either lookup breaks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
v2.0-cyanoptera made ParseResult::name a private pointer into the compiled grammar, exposed through Name(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Point the duckdb submodule back at duckdb/duckdb and pin it to v2.0-cyanoptera (d4355d01) instead of the altertable-2.0.0 fork; the extension needs nothing from the fork. - Pin extension-ci-tools to v2.0-cyanoptera (969bc762) and run the distribution and code-quality workflows against v2.0-cyanoptera. CI was still building against v1.5.5, which has no core PEG headers. - Reflow a CMakeLists.txt comment for 2.0's cmake-format check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
redox
marked this pull request as ready for review
October 14, 2026 07:27
leo-altertable
self-requested a review
October 14, 2026 07:51
leo-altertable
approved these changes
Oct 14, 2026
utay
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v2.0-cyanoptera(d4355d01/969bc762), the same pins as Port databricks to DuckDB 2.0 duckdb-databricks#5 and Bump to DuckDB v2.0-cyanoptera duckdb-altertable#11. Theduckdbsubmodule points at upstreamduckdb/duckdbagain instead of thealtertable-2.0.0fork. The extension needs nothing from the fork.v2.0-cyanoptera. It was still building againstv1.5.5, which has no core PEG headers (duckdb/parser/peg/*), and running the 1.5 format tooling on 2.0 sources.matcher.cpp, tokenizer and keyword helper are gone. The extension keeps only its own layer on top of the core API: catalog/schema/table/column suggestions, dotted-qualifier context, and FROM/WITH column scoping. Details are in the commit messages.v2.0-cyanopteraAPI changes:ParseResult::Name()replaces thenamefield, plusIdentifierandQualifiedNamecatalog lookups.show.testwith upstream: SHOW completes settings and DESCRIBE completes tables. Add a non-regression test for FROM/WITH column scoping.main. Its two commits were already backported here, so the tree is unchanged.Test plan
make releaseagainst DuckDBv2.0-cyanopteramake test: 26 passed, 1 skipped (require tpch)make format-checksmart_autocompleteagainst DuckDB v2.0 on all platforms🤖 Generated with Claude Code