daphnenhuch-at commented on issue #15833:
URL: https://github.com/apache/datafusion/issues/15833#issuecomment-2836826844

   > Thanks for the report [@daphnenhuch-at](https://github.com/daphnenhuch-at)
   > 
   > If you want the output sorted in a particular way I think you need to 
explicitly add a sort after computing the row number
   > 
   > If possible, DataFusion will optimize this sort away / compute it 
efficiently
   > 
   > without being explicitly requested, DataFusion will not attempt to 
maintain any input order.
   
   Thanks for the response! Unfortunately, If I try doing something like 
   
   ```
   let row_number_sub_query = ctx
           .table("fragments")
           .await?
           .sort(vec![ident(sort_op.get_sort_column_name()).sort(true, true)])?
           .window(vec![row_number().alias(DATA_FUSION_ROW_NUMBER)])?
           .sort(vec![ident(sort_op.get_sort_column_name()).sort(true, true)])
           .context("error adding row number window function")?;
   ```
   
   I still get the record batches in the wrong order


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

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