Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-11594

[Rust] Support pretty printing with NullArrays

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0
    • Rust

    Description

      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:

          #[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])?;
      }
      
      

      Panics:

      
      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
      
      

      Attachments

        Issue Links

          Activity

            People

              alamb Andrew Lamb
              alamb Andrew Lamb
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m