You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "progval (via GitHub)" <gi...@apache.org> on 2024/03/05 10:13:57 UTC

[I] ORDER BY is ignored when COPYing from an arrow table to a csv file [arrow-datafusion]

progval opened a new issue, #9463:
URL: https://github.com/apache/arrow-datafusion/issues/9463

   ### Describe the bug
   
   ORDER BY is ignored when COPYing from an arrow table to a csv file.
   
   I found this behavior on both `MemTable` and tables created from ORC files with `pyarrow`.
   
   ### To Reproduce
   
   ```rust
   use std::sync::Arc;
   use datafusion::arrow::array::PrimitiveArray;
   use datafusion::arrow::datatypes::{DataType, Field, Schema, Int64Type};
   use datafusion::arrow::record_batch::RecordBatch;
   use datafusion::prelude::*;
   use datafusion::datasource::MemTable;
   
   #[tokio::main]
   async fn main() {
       let ctx = SessionContext::new();
   
       let schema = Arc::new(Schema::new(vec![Field::new("value", DataType::Int64, false)]));
       let column: PrimitiveArray<Int64Type> = vec![2, 1, 3].into();
       let partition = RecordBatch::try_new(schema.clone(), vec![Arc::new(column)]).unwrap();
       let table = MemTable::try_new(schema, vec![vec![partition]]).unwrap();
       ctx.register_table("content", Arc::new(table)).unwrap();
   
       let df = ctx.sql("COPY (SELECT value FROM content) TO '/tmp/output.csv'").await.unwrap();
       df.collect().await.unwrap();
   }
   ```
   
   Outputs:
   
   ```
   value
   2
   1
   3
   ```
   
   ### Expected behavior
   
   Output should be:
   
   ```                            
   value
   1
   2
   3
   ```
   
   ### 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: github-unsubscribe@arrow.apache.org.apache.org

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


Re: [I] ORDER BY is ignored when COPYing from an arrow table to a csv file [arrow-datafusion]

Posted by "progval (via GitHub)" <gi...@apache.org>.
progval commented on issue #9463:
URL: https://github.com/apache/arrow-datafusion/issues/9463#issuecomment-1978412625

   Nevermind, I forgot to add `ORDER BY` while creating this repro code. Sorry


-- 
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-unsubscribe@arrow.apache.org

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


Re: [I] ORDER BY is ignored when COPYing from an arrow table to a csv file [arrow-datafusion]

Posted by "progval (via GitHub)" <gi...@apache.org>.
progval closed issue #9463: ORDER BY is ignored when COPYing from an arrow table to a csv file
URL: https://github.com/apache/arrow-datafusion/issues/9463


-- 
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-unsubscribe@arrow.apache.org

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