Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
Description
Null values should be printed as "" when pretty printing. However, as of now, null values in primative arrays are rendered as the type's default value .
For example:
fn test_pretty_format_batches() -> Result<()> { // define a schema. let schema = Arc::new(Schema::new(vec![ Field::new("a", DataType::Utf8, true), Field::new("b", DataType::Int32, true), ])); // define data. let batch = RecordBatch::try_new( schema, vec![ Arc::new(array::StringArray::from(vec![Some("a"), Some("b"), None, Some("d")])), Arc::new(array::Int32Array::from(vec![Some(1), None, Some(10), Some(100)])), ], )?; println!(pretty_format_batches(&[batch])?); Ok(()) }
Outputs:
+---+-----+ | a | b | +---+-----+ | a | 1 | | b | 0 | | | 10 | | d | 100 | +---+-----+
The second row of b should be '', not 0. The third row of a should also be '', which I think t is by accident
Thanks to jhorstmann horstmann for pointing this out on https://github.com/apache/arrow/pull/8331#issuecomment-702964608
Attachments
Issue Links
- links to