stevomitric opened a new pull request, #60059:
URL: https://github.com/apache/spark/pull/60059
### What changes were proposed in this pull request?
`OuterReference` now returns the metadata of the attribute it wraps, like it
already does for `dataType`, `nullable` and `toAttribute`.
### Why are the changes needed?
When a subquery returns an outer column, the analyzer wraps it in an
`Alias`, which copies its child's metadata. `OuterReference` reported empty
metadata, so a CHAR(n) column lost its CHAR type and comparisons against it
were no longer padded. This silently returns wrong results:
```sql
CREATE TABLE t (c CHAR(5), s STRING) USING parquet;
INSERT INTO t VALUES ('ab', 'x');
SELECT t.s FROM t, LATERAL (SELECT t.c) l WHERE l.c = 'ab'; -- before: no
rows, after: x
```
### Does this PR introduce _any_ user-facing change?
Yes. A CHAR column of the outer query returned by a LATERAL or correlated
subquery keeps its CHAR type, so comparisons against it return the correct rows.
### How was this patch tested?
New tests in `CharVarcharTestSuite` for LATERAL and correlated subqueries.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Isaac (Claude Opus 5.5)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]