adriangb commented on PR #20117:
URL: https://github.com/apache/datafusion/pull/20117#issuecomment-3845074249
> > BTW codex found a test that shows a single projection being extracted
doesn't get pushed down
> > I can make this a separate PR if you like
> > note how the get_field is not pushed into the datasource:
> > ```sql
> > ###
> > # Test 2.1b: Projection-only get_field (potential optimization target)
> > ###
> >
> > query TT
> > EXPLAIN SELECT s['label'] FROM simple_struct;
> > ----
> > logical_plan
> > 01)Projection: get_field(simple_struct.s, Utf8("label"))
> > 02)--TableScan: simple_struct projection=[s]
> > physical_plan DataSourceExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/projection_pushdown/simple.parquet]]},
projection=[get_field(s@1, label) as simple_struct.s[label]], file_type=parquet
> >
> > # Verify correctness
> > query T
> > SELECT s['label'] FROM simple_struct ORDER BY s['label'];
> > ----
> > alpha
> > beta
> > delta
> > epsilon
> > gamma
> > ```
>
> Thanks for reporting. I’ll make a new PR with this test + join tests +
benchmarks.
> > BTW codex found a test that shows a single projection being extracted
doesn't get pushed down
> > I can make this a separate PR if you like
> > note how the get_field is not pushed into the datasource:
> > ```sql
> > ###
> > # Test 2.1b: Projection-only get_field (potential optimization target)
> > ###
> >
> > query TT
> > EXPLAIN SELECT s['label'] FROM simple_struct;
> > ----
> > logical_plan
> > 01)Projection: get_field(simple_struct.s, Utf8("label"))
> > 02)--TableScan: simple_struct projection=[s]
> > physical_plan DataSourceExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/projection_pushdown/simple.parquet]]},
projection=[get_field(s@1, label) as simple_struct.s[label]], file_type=parquet
> >
> > # Verify correctness
> > query T
> > SELECT s['label'] FROM simple_struct ORDER BY s['label'];
> > ----
> > alpha
> > beta
> > delta
> > epsilon
> > gamma
> > ```
>
> Thanks for reporting. I’ll make a new PR with this test + join tests +
benchmarks.
Done in https://github.com/apache/datafusion/pull/20143
--
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]