jpfeuffer commented on issue #27745:
URL: https://github.com/apache/datafusion/issues/27745#issuecomment-7159606507

   Oh and if you are wondering, yes, this impacts correctness of queries with 
DataFusion after that (i.e. you are not correcting for that mistake during 
reading):
   
   In a separate test on DataFusion 55.0.0, the table schema was `payload 
STRUCT<a BIGINT, b BIGINT>, b BIGINT, id BIGINT`, and the write used `WITH 
ORDER (id ASC NULLS FIRST)`. The written rows, in `(b, id)` order, were `(30, 
1), (20, 2), (10, 3)`. The Parquet leaves and metadata were:
   
   ```text
   leaves: ['payload.a', 'payload.b', 'b', 'id']
   sorting metadata: (SortingColumn(column_index=2, descending=False, 
nulls_first=True),)
   ```
   
   Index 2 refers to the top-level `b`, not `id`. When a fresh DataFusion 
session registered the file without `WITH ORDER`, `EXPLAIN SELECT b, id FROM 
readback ORDER BY b ASC NULLS FIRST` showed a `DataSourceExec` with 
`output_ordering=[b@0 ASC]` and no `SortExec`. The query returned `(30, 1), 
(20, 2), (10, 3)` instead of sorting by `b`.
   


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