Module string

Module string 

Source
Expand description

§String Arithmetic Module - String Operations with Numeric Interactions

String-specific arithmetic operations including string multiplication, concatenation, and manipulation. This unifies strings into a typical numeric-compatible workloads. E.g., “hello” + “there” = “hellothere”. These are opt-in via the “str_arithmetic” feature.

§Overview

  • String multiplication: Repeat strings by numeric factors with configurable limits
  • String-numeric conversions: Format numbers into string representations
  • Categorical operations: Efficient string deduplication and categorical array generation
  • Null-aware processing: Full Arrow-compatible null propagation

§Features

  • Memory efficiency: Uses string interning and categorical encoding to reduce allocation overhead
  • Safety limits: Configurable multiplication limits prevent excessive memory usage
  • Optional dependencies: String-numeric arithmetic gated behind str_arithmetic feature

Constants§

W8
Auto-generated SIMD lane widths from build.rs SIMD lane count for 8-bit elements (u8, i8). Determined at build time based on target architecture capabilities, or overridden via SIMD_LANES_OVERRIDE.
W16
SIMD lane count for 16-bit elements (u16, i16). Determined at build time based on target architecture capabilities, or overridden via SIMD_LANES_OVERRIDE.
W32
SIMD lane count for 32-bit elements (u32, i32, f32). Determined at build time based on target architecture capabilities, or overridden via SIMD_LANES_OVERRIDE.
W64
SIMD lane count for 64-bit elements (u64, i64, f64). Determined at build time based on target architecture capabilities, or overridden via SIMD_LANES_OVERRIDE.

Functions§

apply_dict32_dict32
Applies an element-wise binary operation between two CategoricalArray<u32> arrays, producing a new CategoricalArray<u32>. The result reuses or extends the unified dictionary from both input arrays and ensures deterministic interned value codes.
apply_dict32_num
Applies element-wise binary arithmetic op between CategoricalArray<u32>s a numeric slice.
apply_dict32_str
Applies element-wise binary arithmetic ops between a CategoricalArray<u32> and a StringArray<T>.
apply_str_dict32
Applies element-wise binary arithmetic ops between StringArray<T> and CategoricalArray<u32>
apply_str_float
Applies an element-wise binary operation between a StringArray<T> and a slice of floating-point values, producing a new StringArray<T>. Each operation is performed by interpreting the float as a finite decimal string representation (f64 formatted with ryu), and applying string transformations accordingly.
apply_str_num
String-numeric arithmetic operation dispatcher. Supports string multiplication (repeat string N times) with safety limits. Other operations pass through unchanged. Handles null propagation correctly.
apply_str_str
Applies an element-wise binary operation between two StringArrays, producing a new StringArray. Requires both arrays to have the same length.