Skip to content

Fix query rewrite rules to match by source table#30

Merged
acmeguy merged 1 commit intomainfrom
fix/query-rewrite-table-matching
Mar 23, 2026
Merged

Fix query rewrite rules to match by source table#30
acmeguy merged 1 commit intomainfrom
fix/query-rewrite-table-matching

Conversation

@acmeguy
Copy link
Copy Markdown

@acmeguy acmeguy commented Mar 23, 2026

Summary

  • Query rewrite rules are defined against database table names (e.g. semantic_events) but were matching against Cube.js cube names, which can differ
  • Now parses active dataschemas to build a cube→source table mapping, cached by schema version
  • Rules apply to all cubes backed by the target table, regardless of cube name
  • Skips rule application when a cube lacks the rule's dimension (e.g. array join cubes without partition)

Test plan

  • Create a cube with a name different from its source table (e.g. cube MyEvents backed by semantic_events)
  • Verify partition filter is applied when querying MyEvents
  • Verify cubes not backed by internal tables are unaffected by partition rules
  • Verify cubes that lack the partition dimension are skipped gracefully

🤖 Generated with Claude Code

Rules are defined against database tables (e.g. semantic_events) but were
being matched against Cube.js cube names. This broke filtering when cubes
had different names than their source tables. Now parses active dataschemas
to build a cube→table mapping, applies rules to all cubes backed by the
target table, and skips cubes that lack the rule's dimension.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@acmeguy acmeguy merged commit fe688ee into main Mar 23, 2026
3 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.

2 participants