Tpt opened a new issue, #18992:
URL: https://github.com/apache/datafusion/issues/18992

   ### Describe the bug
   
   The `CteWorkTable`  discards the `projection` argument of the 
`TableProvider::scan` instead of properly applying it. It can cause issues when 
the projection is not the identity
   
   ### To Reproduce
   
   Use `CteWorkTable` with a projection that is not the identity
   
   Example of query plan where the optimizer create a projection:
   ```
   RecursiveQuery: is_distinct=true
     Projection: quads.subject, quads.predicate, quads.object
       Inner Join: 98c0b23282ec3edfa32aea6fa0af5240 = quads.subject
         Projection: 
Binary("1,98,167,105,102,76,38,234,212,25,70,164,18,107,5,43,205") AS 
98c0b23282ec3edfa32aea6fa0af5240
           EmptyRelation: rows=1
         TableScan: quads projection=[subject, predicate, object], 
full_filters=[quads.graph_name IS NULL]
     Projection: quads.subject, quads.predicate, quads.object
       Inner Join: cbd.object = quads.subject
         Filter: sparql:isBlank(cbd.object)
           TableScan: cbd projection=[object]
         TableScan: quads projection=[subject, predicate, object], 
full_filters=[quads.graph_name IS NULL]
   ```
   Note the `TableScan: cbd projection=[object]` that is using `CteWorkTable
   
   ### Expected behavior
   
   Projection properly applied
   
   ### Additional context
   
   _No response_


-- 
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]

Reply via email to