You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Andrew Lamb (Jira)" <ji...@apache.org> on 2020/10/03 10:34:00 UTC

[jira] [Created] (ARROW-10169) [Rust] Nulls should be rendered as "" rather than default value when pretty printing arrays

Andrew Lamb created ARROW-10169:
-----------------------------------

             Summary: [Rust] Nulls should be rendered as "" rather than default value when pretty printing arrays
                 Key: ARROW-10169
                 URL: https://issues.apache.org/jira/browse/ARROW-10169
             Project: Apache Arrow
          Issue Type: Bug
            Reporter: Andrew Lamb
            Assignee: Andrew Lamb



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:
{code}
    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(())
    }
{code}

Outputs:

{code}
+---+-----+
| a | b   |
+---+-----+
| a | 1   |
| b | 0   |
|   | 10  |
| d | 100 |
+---+-----+
{code}

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




--
This message was sent by Atlassian Jira
(v8.3.4#803005)