Skip to content

Port smart_autocomplete to DuckDB 2.0 - #1

Merged
redox merged 15 commits into
mainfrom
altertable-v2.0.0
Oct 14, 2026
Merged

redox merged 15 commits into
mainfrom
altertable-v2.0.0

Conversation

@redox

@redox redox commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Pin DuckDB and extension-ci-tools to 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. The duckdb submodule points at upstream duckdb/duckdb again instead of the altertable-2.0.0 fork. The extension needs nothing from the fork.
  • CI now builds and checks against v2.0-cyanoptera. It was still building against v1.5.5, which has no core PEG headers (duckdb/parser/peg/*), and running the 1.5 format tooling on 2.0 sources.
  • Build on the core PEG parser. DuckDB 2.0 moved the grammar, tokenizer, matcher and transformer into core, so the forked 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.
  • Adapt to v2.0-cyanoptera API changes: ParseResult::Name() replaces the name field, plus Identifier and QualifiedName catalog lookups.
  • Sync show.test with upstream: SHOW completes settings and DESCRIBE completes tables. Add a non-regression test for FROM/WITH column scoping.
  • Merge main. Its two commits were already backported here, so the tree is unchanged.

Test plan

  • make release against DuckDB v2.0-cyanoptera
  • make test: 26 passed, 1 skipped (require tpch)
  • make format-check
  • CI builds smart_autocomplete against DuckDB v2.0 on all platforms

🤖 Generated with Claude Code

redox and others added 15 commits April 18, 2026 18:20
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>
main's af8147c and c3acb30 are already on this branch as backports
(8953543, c5a5378); conflicts resolved to this branch's 2.0 version, so
the tree is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@redox redox changed the title Altertable v2.0.0 Port smart_autocomplete to DuckDB 2.0 Oct 14, 2026
@redox
redox marked this pull request as ready for review October 14, 2026 07:27
@leo-altertable
leo-altertable self-requested a review October 14, 2026 07:51
@redox
redox merged commit 13821c7 into main Oct 14, 2026
25 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.

3 participants