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

Function spark_space_scalar

datafusion/spark/src/function/string/space.rs:119–135  ·  view source on GitHub ↗
(scalar: &ScalarValue)

Source from the content-addressed store, hash-verified

117}
118
119fn spark_space_scalar(scalar: &ScalarValue) -> Result<ScalarValue> {
120 match scalar {
121 ScalarValue::Int32(value) => {
122 let result = value.map(|v| {
123 if v <= 0 {
124 String::new()
125 } else {
126 " ".repeat(v as usize)
127 }
128 });
129 Ok(ScalarValue::Utf8(result))
130 }
131 other => {
132 exec_err!("Unsupported data type {other:?} for function `space`")
133 }
134 }
135}
136
137fn spark_space_array_inner(array: &Int32Array) -> StringArray {
138 let mut builder = StringBuilder::with_capacity(array.len(), array.len() * 16);

Callers 1

spark_spaceFunction · 0.85

Calls 2

newFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…