Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
utf8 unneeded check
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Jun 8, 2022
1 parent 720d858 commit 6aca7c6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/io/json_integration/read/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,14 @@ fn to_utf8<O: Offset>(json_col: &ArrowJsonColumn, data_type: DataType) -> Arc<dy
.iter()
.flat_map(|value| value.as_str().unwrap().as_bytes().to_vec())
.collect();
Arc::new(Utf8Array::new(data_type, offsets, values, validity))
// Safety:
// - we just created monotonically increasing offsets
// - we converted valid `&str` to bytes, so not needed to check utf8 again
unsafe {
Arc::new(Utf8Array::new_unchecked(
data_type, offsets, values, validity,
))
}
}

fn to_list<O: Offset>(
Expand Down

0 comments on commit 6aca7c6

Please sign in to comment.