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

Function hex_encode_int64

datafusion/spark/src/function/math/hex.rs:198–218  ·  view source on GitHub ↗

Generic hex encoding for int64 type

(
    iter: impl Iterator<Item = Option<i64>>,
    len: usize,
)

Source from the content-addressed store, hash-verified

196
197/// Generic hex encoding for int64 type
198fn hex_encode_int64(
199 iter: impl Iterator<Item = Option<i64>>,
200 len: usize,
201) -> Result<ArrayRef, DataFusionError> {
202 let mut builder = StringBuilder::with_capacity(len, len * 16);
203
204 for v in iter {
205 if let Some(num) = v {
206 let mut temp = [0u8; 16];
207 let slice = hex_int64(num, &mut temp);
208 // SAFETY: slice contains only ASCII hex digests, which are valid UTF-8
209 unsafe {
210 builder.append_value(from_utf8_unchecked(slice));
211 }
212 } else {
213 builder.append_null();
214 }
215 }
216
217 Ok(Arc::new(builder.finish()))
218}
219
220/// Spark-compatible `hex` function
221pub fn spark_hex(args: &[ColumnarValue]) -> Result<ColumnarValue, DataFusionError> {

Callers 1

compute_hexFunction · 0.85

Calls 5

hex_int64Function · 0.85
newFunction · 0.85
append_valueMethod · 0.45
append_nullMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…