adamreeve opened a new issue, #10830: URL: https://github.com/apache/arrow-rs/issues/10830
### Describe the bug This is encountered when writing a Polars `Categorical` typed column to a Delta Lake table with delta-rs (see https://github.com/delta-io/delta-rs/issues/3284). Polars uses a `Dictionary(UInt32, Utf8View)` for categorical columns, and attempting to write these columns to Parquet results in a panic: `internal error: entered unreachable code: cannot downcast Utf8View dictionary value to byte array` ### To Reproduce ```rust use std::sync::Arc; use arrow_array::{Array, ArrayRef, DictionaryArray, RecordBatch, StringViewArray, UInt32Array}; use arrow_schema::{DataType, Field, Schema}; use parquet::arrow::ArrowWriter; fn main() { let values = StringViewArray::from(vec!["category_value_0", "category_value_1"]); let keys = UInt32Array::from(vec![0u32, 1, 0, 1]); let dict = DictionaryArray::<arrow_array::types::UInt32Type>::try_new(keys, Arc::new(values)) .unwrap(); let schema = Arc::new(Schema::new(vec![Field::new( "cat", DataType::Dictionary(Box::new(DataType::UInt32), Box::new(DataType::Utf8View)), false, )])); let batch = RecordBatch::try_new(schema.clone(), vec![Arc::new(dict) as ArrayRef]).unwrap(); let mut buf = Vec::new(); let mut writer = ArrowWriter::try_new(&mut buf, schema, None).unwrap(); writer.write(&batch).unwrap(); // panic writer.close().unwrap(); } ``` This panics with something like: ``` internal error: entered unreachable code: cannot downcast Utf8View dictionary value to byte array thread 'test_utf8view_dict_write' (373219) panicked at parquet/src/arrow/arrow_writer/byte_array.rs:471:9: ``` ### Expected behavior Successfully write this data to Parquet as a string logical-typed column. ### 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
