pepijnve commented on PR #18183:
URL: https://github.com/apache/datafusion/pull/18183#issuecomment-3580917748

   Yep, this variant of the `case_with_expr_dictionary` panics due to the same 
problem
   
   ```
   #[test]
   fn case_with_expr_primitive_dictionary() -> Result<()> {
       let schema = Schema::new(vec![Field::new(
           "a",
           DataType::Dictionary(Box::new(DataType::UInt8), 
Box::new(DataType::UInt64)),
           true,
       )]);
       let keys = UInt8Array::from(vec![0u8, 1u8, 2u8, 3u8]);
       let values = UInt64Array::from(vec![Some(10), Some(20), None, Some(30)]);
       let dictionary = DictionaryArray::new(keys, Arc::new(values));
       let batch = RecordBatch::try_new(Arc::new(schema), 
vec![Arc::new(dictionary)])?;
   
       let schema = batch.schema();
   
       // CASE a WHEN 10 THEN 123 WHEN 30 THEN 456 END
       let when1 = lit(10);
       let then1 = lit(123i32);
       let when2 = lit(30);
       let then2 = lit(456i32);
   
       let expr = generate_case_when_with_type_coercion(
           Some(col("a", &schema)?),
           vec![(when1, then1), (when2, then2)],
           None,
           schema.as_ref(),
       )?;
       let result = expr
           .evaluate(&batch)?
           .into_array(batch.num_rows())
           .expect("Failed to convert to array");
       let result = as_int32_array(&result)?;
   
       let expected = &Int32Array::from(vec![Some(123), None, None, Some(456)]);
   
       assert_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: [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