Yibo-Dong opened a new issue, #27703:
URL: https://github.com/apache/datafusion/issues/27703
### Describe the bug
An equi-join whose key is an expression over a struct field (`x.s['f'] + 1`)
fails with a `Schema error` when that table has an alias. The same query
without the alias, or with
`datafusion.optimizer.enable_leaf_expression_pushdown = false`, returns the
correct row.
### To Reproduce
Tested with `datafusion-cli` built from main at
`67fefd07a4ef4b7773bbcc284583b45cef4edc3f` (2026-11-24), default configuration.
```sql
CREATE TABLE a AS SELECT {f: 1} AS s;
CREATE TABLE b AS SELECT 2 AS f;
-- fails: aliased input, join key is an expression over a struct field
SELECT * FROM a x JOIN b ON x.s['f'] + 1 = b.f;
-- works: same query without the alias
SELECT * FROM a JOIN b ON a.s['f'] + 1 = b.f;
-- works: aliased query with leaf expression pushdown disabled
SET datafusion.optimizer.enable_leaf_expression_pushdown = false;
SELECT * FROM a x JOIN b ON x.s['f'] + 1 = b.f;
```
Output:
```
Schema error: No field named "__datafusion_extracted_1 + Int64(1)". Did you
mean '"x.__datafusion_extracted_1 + Int64(1)"'?
Valid fields are x.__datafusion_extracted_1, x.s,
"x.__datafusion_extracted_1 + Int64(1)".
+--------+---+
| s | f |
+--------+---+
| {f: 1} | 2 |
+--------+---+
+--------+---+
| s | f |
+--------+---+
| {f: 1} | 2 |
+--------+---+
```
### Expected behavior
A table alias does not change the meaning of a query. The aliased query
should return the same row as the other two:
```
+--------+---+
| s | f |
+--------+---+
| {f: 1} | 2 |
+--------+---+
```
### Additional context
- A bare struct field as the join key (`ON x.s['f'] = b.f`) works.
### Willingness to contribute
None
--
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]