MCPcopy Create free account
hub / github.com/apache/datafusion / spark_space_array_inner

Function spark_space_array_inner

datafusion/spark/src/function/string/space.rs:137–154  ·  view source on GitHub ↗
(array: &Int32Array)

Source from the content-addressed store, hash-verified

135}
136
137fn spark_space_array_inner(array: &Int32Array) -> StringArray {
138 let mut builder = StringBuilder::with_capacity(array.len(), array.len() * 16);
139 let mut space_buf = String::new();
140 for value in array.iter() {
141 match value {
142 None => builder.append_null(),
143 Some(l) if l > 0 => {
144 let l = l as usize;
145 if space_buf.len() < l {
146 space_buf = " ".repeat(l);
147 }
148 builder.append_value(&space_buf[..l]);
149 }
150 Some(_) => builder.append_value(""),
151 }
152 }
153 builder.finish()
154}
155
156#[cfg(test)]
157mod tests {

Callers 1

spark_space_arrayFunction · 0.85

Calls 6

newFunction · 0.85
lenMethod · 0.45
iterMethod · 0.45
append_nullMethod · 0.45
append_valueMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…