You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid argument error: the data type binary has no natural order #7343
This looks similar to #7039 which @jonahgao fixed by adding a coercion from binary --> UTF8 for comparison. I think we could do something similar here.
A slightly simpler way to reproduce without the need for datafusion-cli:
#[tokio::test]asyncfnbinary_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(())}
Activity
alamb commentedon Aug 21, 2023
This looks similar to #7039 which @jonahgao fixed by adding a coercion from binary --> UTF8 for comparison. I think we could do something similar here.
alamb commentedon Aug 21, 2023
Marking as a good first issue as there is a reproducer and I think the fix should be relatively straightforward
tustvold commentedon Aug 21, 2023
This may be fixed in the next arrow release, which adds Binary support to lexsort
yjshen commentedon Aug 27, 2023
A slightly simpler way to reproduce without the need for datafusion-cli:
alamb commentedon Oct 16, 2023
I have verified that this now works in datafusion 34. Tests added in #7839