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

Function try_cast_binary

datafusion/expr-common/src/casts.rs:400–412  ·  view source on GitHub ↗
(
    lit_value: &ScalarValue,
    target_type: &DataType,
)

Source from the content-addressed store, hash-verified

398}
399
400fn try_cast_binary(
401 lit_value: &ScalarValue,
402 target_type: &DataType,
403) -> Option<ScalarValue> {
404 match (lit_value, target_type) {
405 (ScalarValue::Binary(Some(v)), DataType::FixedSizeBinary(n))
406 if v.len() == *n as usize =>
407 {
408 Some(ScalarValue::FixedSizeBinary(*n, Some(v.clone())))
409 }
410 _ => None,
411 }
412}
413
414#[cfg(test)]
415mod tests {

Callers 1

try_cast_literal_to_typeFunction · 0.85

Calls 3

FixedSizeBinaryClass · 0.85
lenMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…