Skip to content

casting Dict(_, LargeUtf8) to Utf8View (StringViewArray) panicsΒ #9101

@valkum

Description

@valkum

Describe the bug

I tried to unpack a dict in a memory-efficient way by casting to Utf8View but got a panic.

To Reproduce

  let etld_values = LargeStringArray::from(vec!["com", "org", "net"]);
  let etld_keys = UInt32Array::from(vec![0, 1, 0, 2]);
  let etld: ArrayRef = Arc::new(DictionaryArray::new(etld_keys, Arc::new(etld_values)));

  let result = cast(&etld, &DataType::Utf8View).unwrap();

  assert_eq!(result.len(), 4);
  dbg!(&result);

Expected behavior

Should not panic and return a Utf8View (StringViewArray).

Or should panic higher up with a better error.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions