You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Andrew Lamb (Jira)" <ji...@apache.org> on 2021/02/11 11:56:00 UTC

[jira] [Created] (ARROW-11594) [Rust] Support pretty printing with NullArrays

Andrew Lamb created ARROW-11594:
-----------------------------------

             Summary: [Rust] Support pretty printing with NullArrays
                 Key: ARROW-11594
                 URL: https://issues.apache.org/jira/browse/ARROW-11594
             Project: Apache Arrow
          Issue Type: Improvement
          Components: Rust
            Reporter: Andrew Lamb




The whole point of `NullArray::new_with_type` is to to be able to cheaply construct entirely null columns, with a smaller memory footprint.

Currently trying to print them out causes a painic:

{code}
    #[test]
    fn test_pretty_format_null() -> Result<()> {
        // define a schema.
        let schema = Arc::new(Schema::new(vec![
            Field::new("a", DataType::Utf8, true),
            Field::new("b", DataType::Int32, true),
        ]));

        let num_rows = 4;

        // define data (null)
        let batch = RecordBatch::try_new(
            schema,
            vec![
                Arc::new(NullArray::new_with_type(num_rows, DataType::Utf8)),
                Arc::new(NullArray::new_with_type(num_rows, DataType::Int32)),
            ],
        )?;

        let table = pretty_format_batches(&[batch])?;
}

{code}

Panics:

{code}

failures:

---- util::pretty::tests::test_pretty_format_null stdout ----
thread 'util::pretty::tests::test_pretty_format_null' panicked at 'called `Option::unwrap()` on a `None` value', arrow/src/util/display.rs:201:27

{code}



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