You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "yjshen (via GitHub)" <gi...@apache.org> on 2023/08/27 17:54:46 UTC

[GitHub] [arrow-datafusion] yjshen commented on issue #7343: Invalid argument error: the data type binary has no natural order

yjshen commented on issue #7343:
URL: https://github.com/apache/arrow-datafusion/issues/7343#issuecomment-1694725645

   A slightly simpler way to reproduce without the need for datafusion-cli:
   ```rs
   #[tokio::test]
   async fn binary_order() -> Result<()> {
       let schema = Arc::new(Schema::new(vec![
           Field::new("a", DataType::Binary, false),
           Field::new("b", DataType::Int32, false),
       ]));
       let batch = RecordBatch::try_new(
           schema.clone(),
           vec![Arc::new(BinaryArray::from(vec![
               "a".as_bytes(),
               "b".as_bytes(),
               "c".as_bytes(),
           ])),
           Arc::new(Int32Array::from(vec![1, 2, 3]))],
       )?;
   
       let ctx = SessionContext::new();
       ctx.register_batch("aa", batch)?;
       let result = ctx.sql("select a from aa where a <> '' order by b, a").await?;
       let result = result.collect().await?;
       let expected = vec![
           "+----+",
           "| a  |",
           "+----+",
           "| 61 |",
           "| 62 |",
           "| 63 |",
           "+----+",
       ];
       assert_batches_eq!(expected, &result);
       Ok(())
   }
   ```


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