drusso commented on a change in pull request #8222: URL: https://github.com/apache/arrow/pull/8222#discussion_r501694386
########## File path: rust/datafusion/src/test/mod.rs ########## @@ -135,6 +135,13 @@ pub fn format_batch(batch: &RecordBatch) -> Vec<String> { } let array = batch.column(column_index); match array.data_type() { + DataType::Utf8 => s.push_str( + array + .as_any() + .downcast_ref::<array::StringArray>() + .unwrap() + .value(row_index), + ), Review comment: No problem! This makes perfect sense, and I added the test (2d0999a). However, I also had to make the `count(distinct)` field nullable (4cdb951), otherwise I ran into an assertion error [here](https://github.com/apache/arrow/blob/2d0999ac7f1d01a4fe392add53720ceeb6b0b1f3/rust/datafusion/tests/sql.rs#L652) due to a mismatch of the field's nullability between the logical plan and physical plan. The logical plan nullability is set [here](https://github.com/apache/arrow/blob/2d0999ac7f1d01a4fe392add53720ceeb6b0b1f3/rust/datafusion/src/logical_plan/mod.rs#L298), and is always nullable. All of the regular aggregate expressions mark their field as nullable, for example, [here](https://github.com/apache/arrow/blob/2d0999ac7f1d01a4fe392add53720ceeb6b0b1f3/rust/datafusion/src/physical_plan/expressions.rs#L846) for the regular `Count`. I might be mistaken, but I think regular and distinct counts should be non-nullable? In any case, I went with making `count(distinct)` nullable for consistency with `count()`. Perhaps there's a follow-up here? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org