Skip to content

fix(desktop): resolve unqualified imported JOIN tables in S3 queries - #58

Merged
cccadet merged 1 commit into
mainfrom
claude/s3-query-cross-database-join-53d5eb
Dec 3, 2026
Merged

cccadet merged 1 commit into
mainfrom
claude/s3-query-cross-database-join-53d5eb

Conversation

@cccadet

@cccadet cccadet commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Summary

Tables added with "Add a table from another database to the JOIN" are copied to local DuckDB. The S3 query engine only staged them when the SQL wrote them as local."name". The local DuckDB tab opened from the sidebar suggests the plain "name", so an S3 query such as

WITH dim_Documento AS (SELECT * FROM "dim_documento")
SELECT m.*, d.* FROM marcado m LEFT JOIN dim_Documento d ON d.SK_DOCUMENTO = m.SK_DOCUMENTO

failed with a missing-table error, which looked like the S3 part had broken.

  • with_s3_catalog now also stages local/federated datasets referenced by bare identifier (via the existing sql_tokens_with_identifiers tokenizer, so strings and comments are ignored).
  • Each staged dataset is exposed as main.<name> in addition to local.<name>. Unqualified names resolve only in main, so this never shadows the S3 views registered under bucket schemas; it is skipped if an S3 source is itself main.<name>.

Tests

  • New regression in s3_catalog_query_reads_an_imported_join_table_without_s3_sources: CTE named like the imported table reading it unqualified, plus LEFT JOIN.
  • cargo test --lib s3_catalog_query: 2 passed.
  • cargo test --lib: 81 passed, 1 failed: development_runtime_paths_resolve_to_real_project_dependencies, which needs a dev Node executable that this worktree lacks; unrelated to this change.
  • Pre-push hook (typecheck, lint, test:fast) passed.
  • Not exercised in the running desktop app against a real S3/DuckLake catalog.

Release notes

  • Fixed: S3 queries can reference a table added for a cross-database JOIN by its plain name ("dim_documento"), not only as local."dim_documento".

🤖 Generated with Claude Code

Tables added via "Add a table from another database to the JOIN" were
only staged into the S3 query engine when written as local."name". The
local DuckDB tab suggests the plain "name", so pasting it into an S3
query failed. Detect bare identifier references too and expose each
staged dataset as a main.<name> view alongside local.<name>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cccadet
cccadet merged commit 0762d15 into main Dec 3, 2026
7 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.

1 participant