Skip to content

Fix filter pushdown for FK-linked columns not projected by the CTE#2223

Draft
shangyian wants to merge 2 commits into
DataJunction:mainfrom
shangyian:nested-scope-filter
Draft

Fix filter pushdown for FK-linked columns not projected by the CTE#2223
shangyian wants to merge 2 commits into
DataJunction:mainfrom
shangyian:nested-scope-filter

Conversation

@shangyian
Copy link
Copy Markdown
Collaborator

@shangyian shangyian commented Jun 4, 2026

Summary

When a transform reads from a source that has a FK dimension link, but doesn't project the FK column in its own output, dimension filters on that FK were silently dropped. The primary rewrite failed (column absent from declared output), and the second pass always skipped target_select, which is the only scope where top-level source tables appear.

The fix is to include target_select in the second pass when the primary rewrite failed. The FK link registered on the source node is then found in the target_select scope map, allowing _rewrite_filter_for_scope to inject the filter directly into the CTE's WHERE clause.

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 4, 2026

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit 85c5fb3
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/6a21dafddbb1bf00083acdbd

@shangyian shangyian changed the title Fix source node with FK dimension link without projecting the column Fix filter pushdown for columns absent from a CTE's declared output Jun 4, 2026
@shangyian shangyian changed the title Fix filter pushdown for columns absent from a CTE's declared output Fix filter pushdown for FK-linked columns not projected by the CTE Jun 4, 2026
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