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

Function decode_scalar

datafusion/functions/src/encoding/inner.rs:248–270  ·  view source on GitHub ↗
(value: &ScalarValue, encoding: Encoding)

Source from the content-addressed store, hash-verified

246}
247
248fn decode_scalar(value: &ScalarValue, encoding: Encoding) -> Result<ColumnarValue> {
249 match value {
250 ScalarValue::Binary(maybe_bytes)
251 | ScalarValue::BinaryView(maybe_bytes)
252 | ScalarValue::FixedSizeBinary(_, maybe_bytes) => {
253 Ok(ColumnarValue::Scalar(ScalarValue::Binary(
254 maybe_bytes
255 .as_ref()
256 .map(|x| encoding.decode_bytes(x))
257 .transpose()?,
258 )))
259 }
260 ScalarValue::LargeBinary(maybe_bytes) => {
261 Ok(ColumnarValue::Scalar(ScalarValue::LargeBinary(
262 maybe_bytes
263 .as_ref()
264 .map(|x| encoding.decode_bytes(x))
265 .transpose()?,
266 )))
267 }
268 v => internal_err!("Unexpected value for decode: {v}"),
269 }
270}
271
272/// Estimate how many bytes are actually represented by the array; in case the
273/// the array slices it's internal buffer, this returns the byte size of that slice

Callers 1

invoke_with_argsMethod · 0.85

Calls 3

decode_bytesMethod · 0.80
mapMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…