lead_str

Function lead_str 

Source
pub fn lead_str<T: Integer>(
    arr: StringAVT<'_, T>,
    n: usize,
) -> Result<StringArray<T>, KernelError>
Expand description

Accesses string values from future positions with efficient UTF-8 processing.

Implements SQL LEAD() function for string data, retrieving textual values from later positions in the array sequence. Critical for forward-looking text analysis and sequential string pattern recognition.

§Parameters

  • arr - String array view containing sequential textual data
  • n - Lead offset specifying forward position distance

§Returns

Returns Result<StringArray<T>, KernelError> containing:

  • Success: String values from n positions later
  • Error: KernelError if string processing encounters issues
  • Empty strings for positions beyond available future
  • Null mask indicating lead validity and source availability

§Examples

use minarrow::StringArray;
use simd_kernels::kernels::window::lead_str;

let arr = StringArray::<u32>::from_slice(&["alpha", "beta", "gamma"]);
let result = lead_str((&arr, 0, arr.len()), 1).unwrap();