1
0
Fork 0

Merging upstream version 25.34.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:58:22 +01:00
parent f19abab1f0
commit 589d8e33dc
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
66 changed files with 53358 additions and 52814 deletions

View file

@ -220,11 +220,16 @@ def _expand_using(scope: Scope, resolver: Resolver) -> t.Dict[str, t.Any]:
if not column.table and column.name in column_tables:
tables = column_tables[column.name]
coalesce_args = [exp.column(column.name, table=table) for table in tables]
replacement = exp.func("coalesce", *coalesce_args)
replacement: exp.Expression = exp.func("coalesce", *coalesce_args)
# Ensure selects keep their output name
if isinstance(column.parent, exp.Select):
# Ensure the USING column keeps its name if it's projected
replacement = alias(replacement, alias=column.name, copy=False)
elif isinstance(column.parent, exp.Struct):
# Ensure the USING column keeps its name if it's an anonymous STRUCT field
replacement = exp.PropertyEQ(
this=exp.to_identifier(column.name), expression=replacement
)
scope.replace(column, replacement)