Skip to content

Commit 74035bc

Browse files
committed
safety comment
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
1 parent aa87260 commit 74035bc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

datafusion/functions/src/unicode/character_length.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ where
141141
if is_array_ascii_only {
142142
let values: Vec<_> = (0..array.len())
143143
.map(|i| {
144+
// Safety: we are iterating with array.len() so the index is always valid
144145
let value = unsafe { array.value_unchecked(i) };
145146
T::Native::usize_as(value.len())
146147
})
@@ -149,6 +150,7 @@ where
149150
} else {
150151
let values: Vec<_> = (0..array.len())
151152
.map(|i| {
153+
// Safety: we are iterating with array.len() so the index is always valid
152154
let value = unsafe { array.value_unchecked(i) };
153155
if value.is_ascii() {
154156
T::Native::usize_as(value.len())

0 commit comments

Comments
 (0)