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_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.