jayzhan211 commented on code in PR #27669:
URL: https://github.com/apache/datafusion/pull/27669#discussion_r4665899072
##########
datafusion/sqllogictest/test_files/file_row_index.slt:
##########
@@ -314,6 +314,208 @@ SELECT file_row_index() + 1, column1 FROM parquet_table
ORDER BY column1
# `RESET` restores the global default rather than the harness value, which the
# harness rejects as leftover configuration.
+# A leaf expression must also reach the scan when the source pushes an
+# `OFFSET` down. Every query below errors out without that.
Review Comment:
Optional wording: the two controls and the `EXPLAIN`s below don't error
without the fix; only the value queries do.
```suggestion
# A leaf expression must also reach the scan when the source pushes an
# `OFFSET` down. Every value query below errors out without that.
```
##########
datafusion/physical-optimizer/src/projection_pushdown.rs:
##########
@@ -68,11 +70,12 @@ impl PhysicalOptimizerRule for ProjectionPushdown {
.map(|t| t.data)?;
// Push what can already descend, then split the projections that are
- // stuck above a `RepartitionExec`. The split needs no cleanup pass of
- // its own: the outer projection it leaves either keeps every
expression
- // a plain column, and is then no narrower than the widened child, or
it
- // narrows and holds a computed one. `RepartitionExec` declines both,
it
- // is not removable because it renames, and nothing else moved.
+ // stuck above a node that will not take a whole projection. The split
+ // needs no cleanup pass of its own: the outer projection it leaves
+ // either keeps every expression a plain column, and is then no
narrower
+ // than the widened child, or it narrows and holds a computed one.
Every
+ // node `split_host_child` allows declines both, the outer projection
is
+ // not removable because it renames, and nothing else moved.
Review Comment:
Optional cleanup: this comment says every node `split_host_child` allows
rejects the outer projection, but `CoalescePartitionsExec` takes a narrowing
one with computed expressions. With `[s['a'] + s['b'] + s['c'], x]` over a
coalesce, the first run leaves the outer projection above the coalesce and the
second run pushes it into the scan. Maybe say that instead:
```suggestion
// Push what can already descend, then split the projections that are
// stuck above a node that will not take a whole projection. The
split
// runs no cleanup pass: an outer projection it leaves narrowing on
top
// of a `CoalescePartitionsExec` is pushed below it by this rule's
second
// run in the physical optimizer.
```
--
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]