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

Function byte_array_to_string

datafusion-cli/src/functions.rs:304–310  ·  view source on GitHub ↗

Convert to a string if it has utf8 encoding, otherwise print bytes directly

(val: Option<&ByteArray>)

Source from the content-addressed store, hash-verified

302
303/// Convert to a string if it has utf8 encoding, otherwise print bytes directly
304fn byte_array_to_string(val: Option<&ByteArray>) -> Option<String> {
305 val.map(|v| {
306 v.as_utf8()
307 .map(|s| s.to_string())
308 .unwrap_or_else(|_e| v.to_string())
309 })
310}
311
312/// Convert to a string if it has utf8 encoding, otherwise print bytes directly
313fn fixed_len_byte_array_to_string(val: Option<&FixedLenByteArray>) -> Option<String> {

Callers 1

Calls 2

mapMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…