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

   ### Describe the bug
   
   EnforceDistribution fails with `"PhysicalOptimizer rule 
'EnforceDistribution' failed, due to generate a different schema, original 
schema:`
   
   ### To Reproduce
   
   ```sql
   WITH e1 AS (SELECT * FROM _default), e2 AS (SELECT * FROM _default), a AS 
(SELECT * FROM nodes), b AS (SELECT * FROM nodes), c AS (SELECT * FROM nodes) 
SELECT a.name, b.name, c.name FROM e1 JOIN a ON e1.src = a.id JOIN b ON e1.dst 
= b.id JOIN e2 ON b.id = e2.src JOIN c ON e2.dst = c.id WHERE e1.id <> e2.id
   ```
   
   Error
   ````
   called `Result::unwrap()` on an `Err` value: Context("EnforceDistribution", 
Internal("PhysicalOptimizer rule 'EnforceDistribution' failed, due to generate 
a different schema, original schema: Schema { fields: [Field { name: \"name\", 
data_type: LargeUtf8, nullable: true, dict_id: 0, dict_is_ordered: false, 
metadata: {} }, Field { name: \"name\", data_type: LargeUtf8, nullable: true, 
dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: \"name\", 
data_type: LargeUtf8, nullable: true, dict_id: 0, dict_is_ordered: false, 
metadata: {} }], metadata: {} }, new schema: Schema { fields: [Field { name: 
\"name\", data_type: UInt64, nullable: false, dict_id: 0, dict_is_ordered: 
false, metadata: {} }, Field { name: \"name\", data_type: UInt64, nullable: 
false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: 
\"name\", data_type: UInt64, nullable: false, dict_id: 0, dict_is_ordered: 
false, metadata: {} }], metadata: {} }"))
   ```
   
   
   ### Expected behavior
   
   Expected optimizer rules to be skipped or not to run
   
   ### Additional context
   
   ```Projection: a.name, b.name, c.name
     Inner Join: e2.dst = c.id
       Projection: a.name, b.name, e2.dst
         Inner Join: b.id = e2.src Filter: e2.id != e1.id
           Projection: e1.id, a.name, b.id, b.name
             Inner Join: e1.dst = b.id
               Projection: e1.id, e1.dst, a.name
                 Inner Join: e1.src = a.id
                   SubqueryAlias: e1
                     TableScan: _default projection=[id, src, dst]
                   SubqueryAlias: a
                     TableScan: nodes projection=[id, name]
               SubqueryAlias: b
                 TableScan: nodes projection=[id, name]
           SubqueryAlias: e2
             TableScan: _default projection=[id, src, dst]
       SubqueryAlias: c
         TableScan: nodes projection=[id, name]
   ```


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to