MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / decode

Function decode

src/expr/src/scalar/func.rs:372–380  ·  view source on GitHub ↗
(string: &str, format: &str)

Source from the content-addressed store, hash-verified

370
371#[sqlfunc]
372fn decode(string: &str, format: &str) -> Result<Vec<u8>, EvalError> {
373 let format = encoding::lookup_format(format)?;
374 let out = format.decode(string)?;
375 if out.len() > MAX_STRING_FUNC_RESULT_BYTES {
376 Err(EvalError::LengthTooLarge)
377 } else {
378 Ok(out)
379 }
380}
381
382#[sqlfunc(sqlname = "length", propagates_nulls = true)]
383fn encoded_bytes_char_length(a: &[u8], b: &str) -> Result<i32, EvalError> {

Callers 1

execute_stmtFunction · 0.50

Calls 3

lookup_formatFunction · 0.85
decodeMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected