-
Sort kernel —
argsortandsort(marrow/kernels/sort.mojo): single-column sort for all array types. Primitive arrays use LSD radix sort (O(N), 8-bit passes, UInt64-encoded keys, float NaN/sign-bit transform) for N ≥ 32 768, with parallel histogram + scatter for N ≥ 524 288. PDQsort for N < 32 768 (faster on Apple M-series up to ~28K elements); insertion-sort leaf for N < 32.BoolArrayuses O(N) counting sort;StringArrayuses the Mojo stdlib comparison sort. Null partitioning (pre-sort bitmap scan) withnulls_first/nulls_lastplacement.sort(StructArray, key_indices, ascending)wrapsargsort+takefor multi-column sort. -
Large binary, string, and list types (
marrow/{dtypes,arrays,builders,ipc,c_data}.mojo): addedLargeBinaryType,LargeStringType,LargeListType(64-bit offsets);BinaryLikeTypetrait withcomptime offset: DTypeandStringLikeTypesub-trait for UTF-8 kernels; unifiedBinaryArray[T: BinaryLikeType]andBinaryBuilder[T: BinaryLikeType]with aliasesStringArray,LargeBinaryArray,LargeStringArray,StringBuilder,LargeBinaryBuilder,LargeStringBuilder; IPC type codes 19/20/21 for large binary/utf8/list; C Data format codesZ/U/+L. -
IPC support for dictionary-encoded columns (
marrow/ipc.mojo): the IPC file and stream writer now emits aDictionaryBatchmessage (header type 2) for each dictionary column before its firstRecordBatch, encoding the column's value array as a separate body. TheRecordBatchbody carries only the integer indices. Dictionary blocks are registered in the IPC file footer so C++ / Rust / Go readers can locate them. The IPC reader detectsDictionaryEncodingat schema-field slot 4, reconstructsDictionaryType(index type + value type + ordered flag), loadsDictionaryBatchmessages via footer-registered block offsets, and wires the decoded values back intoDictionaryArrayinstances when reading record batches. Validated across all Arrow implementations (dictionaryanddictionary_unsignedpass 14/14 integration phases with C++, Rust, and Go). -
Arrow interval types (
marrow/{dtypes,scalars,arrays,builders,ipc,c_data}.mojo,python/): addedIntervalTypetrait and three concrete types —YearMonthIntervalType(int32, months),DayTimeIntervalType(int64, days+millis),MonthDayNanoIntervalType(int128, months+days+nanos).AnyDataTypegainsis_interval(),is_year_month_interval(),is_day_time_interval(),is_month_day_nano_interval()predicates and matchingas_*accessors. Array, builder, and scalar aliases (YearMonthIntervalArray/Builder/Scalar, etc.) are fully wired into theAnyArray,AnyBuilder, andAnyScalartype-erased containers. C Data Interface uses format codestiM,tiD,tin; IPC uses theIntervalflatbuffer type with unit field. Python bindings exposeyear_month_interval(),day_time_interval(),month_day_nano_interval()factory functions. -
Dictionary-encoded Arrow type (
marrow/{dtypes,scalars,arrays,builders, c_data}.mojo): addedDictionaryType(index type + value type + ordered flag),DictionaryScalar,DictionaryArray, andDictionaryBuilder.DictionaryArray.from_arrays(indices, values)constructs from an integer indices array and an arbitrary values array;__getitem__decodes to the underlying value scalar;slice()is zero-copy. The C Data Interface emits the index type's format string and stores the value schema in thedictionaryfield ofCArrowSchema, withARROW_FLAG_DICT_ORDERED = 1when ordered; import detects a non-nulldictionaryfield and reconstructs the type. Enables zero-copy exchange of PyArrowDictionaryArrayvia the Arrow C Data Interface (__arrow_c_array__/__arrow_c_schema__protocol). -
Arrow Null type (
marrow/{arrays,scalars,builders,ipc,c_data}.mojo,python/arrays.mojo): addedNullArray,NullScalar,NullBuilder(registered in theAnyArray,AnyScalar,AnyBuildervariants); IPC writer emitsType.Null = 1with zero body buffers; IPC reader skips the validity slot for null fields; C Data Interface usesn_buffers = 0for null per the spec; Python factoryma.array(seq, type=ma.null())builds aNullArrayof the given length. -
Fixed-size binary type (
marrow/{dtypes,arrays,builders,ipc,c_data}.mojo): addedFixedSizeBinaryType,FixedSizeBinaryArray,FixedSizeBinaryBuilder; C Data format code"w:<n>"; IPC type code 15 (FixedSizeBinary). -
Temporal array types (
marrow/{dtypes,arrays,builders,ipc,c_data}.mojo):Date32Array,Date64Array,Time32Array,Time64Array,TimestampArray,DurationArraywith matching builders and type singletons; C Data format codes ("tdD","tdm","tts","ttu","tsn:","tDn", etc.); IPC type codes and unit serialisation. Python constructorsma.date32(),ma.date64(),ma.time32(unit),ma.time64(unit),ma.timestamp(unit),ma.duration(unit). -
Decimal types in C Data Interface and IPC (
marrow/c_data.mojo,marrow/ipc.mojo): wiredDecimal32Type,Decimal64Type,Decimal128Type,Decimal256Typeinto schema export/import and IPC flatbuffer serialisation (precision, scale, bit-width). -
Custom metadata round-trip via the C Data Interface (
marrow/c_data.mojo):CArrowSchema.from_field/from_schemanow encodeField.metadataandSchema.metadatainto the spec-defined metadata blob;to_field/to_schemadecode it back. New_encode_c_metadata/_decode_c_metadatahelpers handle theint32 num_pairs ; (int32 key_len, key_bytes, int32 val_len, val_bytes)*layout.from_schemanow takes a fullSchemarather thanList[Field]so schema-level metadata flows through. -
Per-field metadata (
marrow/dtypes.mojo,python/dtypes.mojo):Fieldcarries an optionalmetadata: Dict[String, String]; the Python factoryma.field(name, type, metadata={…})accepts a dict; the C Data Interface and IPC flatbuffer encoder/decoder round-trip field-level key-value metadata. -
Preserve nested-field names in IPC reader and C Data Interface (
marrow/ipc.mojo,marrow/c_data.mojo): the IPC_read_fielddecoder and theCArrowSchemalist / fixed_size_list importer now preserve child Field names as-is, so Arrow files written by other implementations round-trip with the original schema. -
Arrow IPC reader/writer (
marrow/ipc.mojo):read_ipc_file(),write_ipc_file(),read_ipc_stream(),write_ipc_stream(),read_ipc_file_schema(),read_ipc_stream_schema(), and streaming struct variantsRecordBatchFileReader,RecordBatchStreamReader,RecordBatchFileWriter,RecordBatchStreamWriter. Supports all implemented Arrow types (bool, int8–64, uint8–64, float16/32/64, binary, utf8, list, fixed_size_list, struct, dictionary, null, temporal, decimal) with full nested and nullable column support. FlatBuffer encoding/decoding is a self-contained Rust-faithful port with correct soffset sign convention andMetadataVersion::V5. -
GPU aggregate reductions (
marrow/kernels/aggregate.mojo):sum_,min_,max_,product,any_,all_now accept anExecutionContext; when.is_gpu()is true the reduction runs as a single-pass GPU kernel via_reduce_generator_wrapper. -
ExecutionContext(marrow/kernels/execution.mojo): new struct bundlingnum_threadsfor CPU stripe parallelism anddevice: Optional[DeviceContext]for GPU. Implicit conversions fromOptional[DeviceContext]andDeviceContextkeep existing callers working. Factories:.serial(),.parallel(num_threads=0)(0 =num_physical_cores()),.gpu(device). Wired through all kernels: arithmetic, aggregate, compare, filter, join, sort. -
Partition-parallel hash join (
marrow/kernels/join.mojo,marrow/kernels/hashtable.mojo):HashJoinandhash_join()gain anum_threadsargument. The parallel path radix-partitions both sides by the top bits of their hash into independentSwissHashTableinstances, builds and probes them concurrently viasync_parallelize, and concatenates per-partition index pairs. No atomics on the hot path. At 10M×10M INNER join: 330 ms (serial) → 67 ms (parallel, 4.9× speedup) — faster than Polars (97 ms), PyArrow (111 ms), and DuckDB (122 ms). -
RadixPartitioner(marrow/kernels/hashtable.mojo): partitions hashes + row indices by the topnum_bits(default 6 → 64 partitions). Per-thread histogram → partition-major prefix sum → parallel scatter into shared flat buffers, then per-partition zero-copy slice viaArcPointer-shared immutable buffers. -
Parallel per-column
take()(marrow/kernels/filter.mojo):take[T](PrimitiveArray, indices, ctx)and theAnyArraydispatcher accept anExecutionContextand stripe the no-null fast path across workers. End-to-end 10M inner join assembly: 143 ms → 67 ms. -
Variant-based dispatch for
DataType,AnyArray, andBuilder(marrow/dtypes.mojo,marrow/arrays.mojo,marrow/builders.mojo): Replaced integer-code dispatch withVariant-backed types usingcomptime forloops. Eliminates runtimeif/elifchains across kernels, Python bindings, and the expression system. -
BoolArraydedicated type (marrow/arrays.mojo): bit-packed boolean arrays backed by aBitmap, with.values() -> BitmapView, GPU transfer, and a matchingBoolBuilder. -
BufferView/BitmapViewabstractions (marrow/views.mojo): type-safe, non-owning views withapplydispatch,compressed_store,pext, and GPU-aware access. -
SwissHashTable(marrow/kernels/hashtable.mojo): open-addressing hash table with 7-bit control stamps, CSR chain storage, vectorised SIMD group matching, and a batch-build API. -
Hash join (
marrow/kernels/join.mojo):hash_joinkernel usingSwissHashTablewith separate build and probe phases. -
TestSuiteandBenchSuiteframework (marrow/testing): auto-discovery oftest_*/bench_*functions via__functions_in_module(), with pytest harness integration, competition tables, and per-element throughput metrics. -
AddressSanitizer support:
pytest --asancompiles test runners with ASAN instrumentation vialibcompiler-rt. -
GPU
BitmapViewand GPU rapidhash (marrow/kernels/):BitmapViewsupports device-resident bitmaps;rapidhashported to Metal/CUDA with 128-bit multiply emulation. -
Bounds checking (
marrow/buffers.mojo):Buffer,Bitmap, andBufferViewaccessors assert bounds in debug builds. -
Unary math kernels (
marrow/kernels/arithmetic.mojo):sign,sqrt,exp,exp2,log,log2,log10,log1p,floor,ceil,trunc,round,sin,cos(floating-point), plus binarypow_,floordiv,mod. -
Scalar types (
marrow/scalars.mojo):PrimitiveScalar[T],StringScalar,ListScalar,StructScalar,AnyScalar— typed and type-erased scalar values mirroring the array hierarchy. -
Group-by kernel (
marrow/kernels/groupby.mojo): fusedgroupby(keys, values, aggregations)that hashes, groups, and aggregates in a single pass. Supports"sum","min","max","count","mean". Single-key (any primitive/stringAnyArray) and multi-key (StructArray) grouping. -
Hashing kernel (
marrow/kernels/hashing.mojo):hash_for primitive, string, and struct arrays;hash_identityfor bool/uint8/int8. -
Expression execution system (
marrow/expr/): pull-based streaming query executor withcol(),lit(),if_else(), relational plan nodes (InMemoryTable,Filter,Project,ParquetScan,Aggregate), andexecute()to collectRecordBatchresults. -
Parquet I/O (
marrow/parquet.mojo):read_table(path)andwrite_table(table, path)via the Arrow C Stream Interface. -
Comparison kernels (
marrow/kernels/compare.mojo):equal,not_equal,less,less_equal,greater,greater_equalfor typed and runtime-typed arrays; null-propagating; GPU variants available. -
String kernels (
marrow/kernels/string.mojo):string_lengthsreturns byte lengths for each element. -
RecordBatch column operations (
marrow/tabular.mojo):slice,select,rename_columns,add_column,append_column,remove_column,set_column,to_struct_array. -
Table enhancements (
marrow/tabular.mojo):Table.from_batches,Table.to_batches,Table.combine_chunks. -
Schema enhancements (
marrow/schema.mojo):get_field_index,fieldlookup by name,names(), equality operators, Python interop via Arrow C Data Interface. -
Self-contained archery integration suite (
integration/,pixi.toml):pixi run integrationclones apache/arrow + arrow-rs + arrow-go, builds all reference implementations, and runs cross-implementation tests against C++, Rust, Go, and Mojo. All four implementations pass: 119 cases across 14 directional phases.