Skip to content

Conversation

@shangyian
Copy link
Contributor

Summary

This PR fixes the duplicate CTEs issue in generated SQL (using build v2). The duplicate CTEs were caused by two functions in build_v2.py that were adding CTEs to queries without checking if a CTE with the same name already existed: convert_to_cte and build_ast.

With this fix, both functions now deduplicate CTEs by their name before adding them.

Test Plan

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

Deployment Plan

@netlify
Copy link

netlify bot commented Jan 8, 2026

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit 06b016c
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/695fe3e2eabdbc0008655992

@shangyian shangyian added the bug Something isn't working label Jan 8, 2026
@shangyian shangyian marked this pull request as ready for review January 8, 2026 15:14
@shangyian shangyian merged commit 939c9d5 into DataJunction:main Jan 8, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant