Fix various type inference issues#1986
Merged
shangyian merged 2 commits intoDataJunction:mainfrom Apr 10, 2026
Merged
Conversation
…iew, unnest, values clause, correlated subqueries
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two sources of false-positive invalid column validation errors.
Lambda parameters incorrectly flagged as invalid columns
PR #1961 added surfacing of invalid column errors during node validation. However, lambda parameter identifiers (e.g.
cinc -> c.name = 'foo') are valid namespaces within their lambda body but were not included in local_aliases, causing them to be surfaced as unresolved column errors.The fix is to collect all lambda parameter names from
query_ast.find_all(ast.Lambda)and add them to local aliases before filtering.(VALUES ...) AS alias(cols)generates false errors(VALUES (1, 2)) AS v(a, b)is parsed byAliasedQueryContext, which was discarding the explicit column aliases(a, b)(the second return value ofvisit(tableAlias)was assigned to_). This caused two bugs:InlineTablecolumns stayed as auto-generatedcol1/col2, soadd_ref_columnreturned False forv.a/v.b, which lead to a false invalid column error.AttributeError: 'InlineTable' object has no attribute 'from_'because it assumedself.selectis always a SelectExpression.The fix:
AliasedQueryContextnow capturescol_aliasesand renamesInlineTable._columnsto the explicit aliases when present.self.selectis an inline table, exposing its columns directly.Test Plan
Added a number of tests, including:
Deployment Plan