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

Method invoke_with_args

datafusion/functions/src/string/octet_length.rs:84–102  ·  view source on GitHub ↗
(&self, args: ScalarFunctionArgs)

Source from the content-addressed store, hash-verified

82 }
83
84 fn invoke_with_args(&self, args: ScalarFunctionArgs) -> Result<ColumnarValue> {
85 let [array] = take_function_args(self.name(), &args.args)?;
86
87 match array {
88 ColumnarValue::Array(v) => Ok(ColumnarValue::Array(length(v.as_ref())?)),
89 ColumnarValue::Scalar(v) => match v {
90 ScalarValue::Utf8(v) => Ok(ColumnarValue::Scalar(ScalarValue::Int32(
91 v.as_ref().map(|x| x.len() as i32),
92 ))),
93 ScalarValue::LargeUtf8(v) => Ok(ColumnarValue::Scalar(
94 ScalarValue::Int64(v.as_ref().map(|x| x.len() as i64)),
95 )),
96 ScalarValue::Utf8View(v) => Ok(ColumnarValue::Scalar(
97 ScalarValue::Int32(v.as_ref().map(|x| x.len() as i32)),
98 )),
99 _ => unreachable!("OctetLengthFunc"),
100 },
101 }
102 }
103
104 fn documentation(&self) -> Option<&Documentation> {
105 self.doc()

Callers

nothing calls this directly

Calls 6

take_function_argsFunction · 0.85
lengthFunction · 0.85
nameMethod · 0.45
as_refMethod · 0.45
mapMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected