Skip to main content

Python bindings for Vortex, an Apache Arrow-compatible toolkit for working with compressed array data.

Reason this release was yanked:

Renamed to vortex-data

Project description

Vortex

Build Status Crates.io Documentation PyPI - Python Version

[!TIP] Check out our Docs and per-commit Benchmarks

Vortex is an extensible, state-of-the-art columnar file format, with associated tools for working with compressed Apache Arrow arrays in-memory, on-disk, and over-the-wire.

Vortex is an aspiring successor to Apache Parquet, with dramatically faster random access reads (100-200x faster) and scans (2-10x faster), while preserving approximately the same compression ratio and write throughput as Parquet with zstd. It is designed to support very wide tables (i.e., very efficient, zero-copy/zero-parse metadata) and (eventually) on-device decompression on GPUs.

Vortex is intended to be to columnar file formats what Apache DataFusion is to query engines: highly extensible, extremely fast, & batteries-included.

[!CAUTION] This library is still under rapid development and is a work in progress!

Some key features are not yet implemented, both the API and the serialized format are likely to change in breaking ways, and we cannot yet guarantee correctness in all cases.

The major features of Vortex are:

  • Logical Types - a schema definition that makes no assertions about physical layout.
  • Zero-Copy to Arrow - "canonicalized" (i.e., fully decompressed) Vortex arrays can be zero-copy converted to/from Apache Arrow arrays.
  • Extensible Encodings - a pluggable set of physical layouts. In addition to the builtin set of Arrow-compatible encodings, the Vortex repository includes a number of state-of-the-art encodings (e.g., FastLanes, ALP, FSST, etc.) that are implemented as extensions. While arbitrary encodings can be implemented as extensions, we have intentionally chosen a small set of encodings that are highly data-parallel, which in turn allows for efficient vectorized decoding, random access reads, and (in the future) decompression on GPUs.
  • Cascading Compression - data can be recursively compressed with multiple nested encodings.
  • Pluggable Compression Strategies - the built-in Compressor is based on BtrBlocks, but other strategies can trivially be used instead.
  • Compute - basic compute kernels that can operate over encoded data (e.g., for filter pushdown).
  • Statistics - each array carries around lazily computed summary statistics, optionally populated at read-time. These are available to compute kernels as well as to the compressor.
  • Serialization - Zero-copy serialization of arrays, both for IPC and for file formats.
  • Columnar File Format (in progress) - A modern file format that uses the Vortex serde library to store compressed array data. Optimized for random access reads and extremely fast scans; an aspiring successor to Apache Parquet.

Overview: Logical vs Physical

One of the core design principles in Vortex is strict separation of logical and physical concerns.

For example, a Vortex array is defined by a logical data type (i.e., the type of scalar elements) as well as a physical encoding (the type of the array itself). Vortex ships with several built-in encodings, as well as several extension encodings.

The built-in encodings are primarily designed to model the Apache Arrow in-memory format, enabling us to construct Vortex arrays with zero-copy from Arrow arrays. There are also several built-in encodings (e.g., sparse and chunked) that are useful building blocks for other encodings. The included extension encodings are mostly designed to model compressed in-memory arrays, such as run-length or dictionary encoding.

Analogously, vortex-serde is designed to handle the low-level physical details of reading and writing Vortex arrays. Choices about which encodings to use or how to logically chunk data are left up to the Compressor implementation.

One of the unique attributes of the (in-progress) Vortex file format is that it encodes the physical layout of the data within the file's footer. This allows the file format to be effectively self-describing and to evolve without breaking changes to the file format specification.

For example, the Compressor implementation can choose to chunk data into a Parquet-like layout with row groups and aligned pages (ChunkedArray of StructArray of ChunkedArrays with equal chunk sizes). Alternatively, it can choose to chunk different columns differently based on their compressed size and data distributions (e.g., a column that is constant across all rows can be a single chunk, whereas a large string column may be split arbitrarily many times).

In the same vein, the format is designed to support forward compatibility by optionally embedding WASM decoders directly into the files themselves. This should help avoid the rapid calcification that has plagued other columnar file formats.

Components

Logical Types

The Vortex type-system is still in flux. The current set of logical types is:

  • Null
  • Bool
  • Integer(8, 16, 32, 64)
  • Float(16, 32, 64)
  • Binary
  • UTF8
  • Struct
  • List
  • Date/Time/DateTime/Duration (implemented as an extension type)
  • FixedList: TODO
  • Tensor: TODO
  • Union: TODO

Canonical/Flat Encodings

Vortex includes a base set of "flat" encodings that are designed to be zero-copy with Apache Arrow. These are the canonical representations of each of the logical data types. The canonical encodings currently supported are:

  • Null
  • Bool
  • Primitive (Integer, Float)
  • Struct
  • List
  • VarBinView (Binary, UTF8)
  • Extension

Compressed Encodings

Vortex includes a set of highly data-parallel, vectorized encodings. These encodings each correspond to a compressed in-memory array implementation, allowing us to defer decompression. Currently, these are:

  • Adaptive Lossless Floating Point (ALP)
  • BitPacked (FastLanes)
  • Constant
  • Chunked
  • DateTimeParts
  • Delta (FastLanes)
  • Dictionary
  • Fast Static Symbol Table (FSST)
  • Frame-of-Reference
  • Run-end Encoding
  • Sparse
  • ZigZag
  • ...with more to come

Compression

Vortex's default compression strategy is based on the BtrBlocks paper.

Roughly, for each chunk of data, a sample of at least ~1% of the data is taken. Compression is then attempted (recursively) with a set of lightweight encodings. The best-performing combination of encodings is then chosen to encode the entire chunk. This sounds like it would be very expensive, but given the logical types and basic statistics about a chunk, it is possible to cheaply prune many encodings and ensure the search space does not explode in size.

Compute

Vortex provides the ability for each encoding to specialize the implementation of a compute function to avoid decompressing where possible. For example, filtering a dictionary-encoded UTF8 array can be more cheaply performed by filtering the dictionary first.

Note--as mentioned above--that Vortex does not intend to become a full-fledged compute engine, but rather to implement basic compute operations as may be required for efficient scanning & pushdown.

Statistics

Vortex arrays carry lazily-computed summary statistics. Unlike other array libraries, these statistics can be populated from disk formats such as Parquet and preserved all the way into a compute engine. Statistics are available to compute kernels as well as to the compressor.

The current statistics are:

  • IsConstant
  • IsSorted
  • IsStrictSorted
  • Max
  • Min
  • Sum
  • NullCount
  • UncompressedSizeInBytes

Serialization / Deserialization (Serde)

The goals of the vortex-serde implementation are:

  • Support scanning (column projection + row filter) with zero-copy and zero heap allocation.
  • Support random access in constant or near-constant time.
  • Forward statistical information (such as sortedness) to consumers.
  • Provide IPC format for sending arrays between processes.
  • Provide an extensible, best-in-class file format for storing columnar data on disk or in object storage.

TODO: insert diagram here

Integration with Apache Arrow

Apache Arrow is the de facto standard for interoperating on columnar array data. Naturally, Vortex is designed to be maximally compatible with Apache Arrow. All Arrow arrays can be converted into Vortex arrays with zero-copy, and a Vortex array constructed from an Arrow array can be converted back to Arrow, again with zero-copy.

It is important to note that Vortex and Arrow have different--albeit complementary--goals.

Vortex explicitly separates logical types from physical encodings, distinguishing it from Arrow. This allows Vortex to model more complex arrays while still exposing a logical interface. For example, Vortex can model a UTF8 ChunkedArray where the first chunk is run-length encoded and the second chunk is dictionary encoded. In Arrow, RunLengthArray and DictionaryArray are separate incompatible types, and so cannot be combined in this way.

Usage

For best performance we recommend using MiMalloc as the application's allocator.

#[global_allocator]
static GLOBAL_ALLOC: MiMalloc = MiMalloc;

Contributing

Please see CONTRIBUTING.md.

Setup

Mac

The project has several optional-but-recommended external dependencies:

# Required if you want to modify any of the .fbs or .proto files
brew install flatbuffers protobuf

# Required for benchmarks
brew install duckdb

You also need the Rust toolchain installed. If you haven't already, install rustup with one of the following commands:

# option 1
brew install rustup

# option 2
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Setup git submodules:

git submodule update --init --recursive

This repo uses uv to manage the combined Rust/Python monorepo build. After installing uv, make sure to run:

# Install uv from https://docs.astral.sh/uv/getting-started/installation/
uv sync --all-packages

License

Licensed under the Apache License, Version 2.0 (the "License").

Governance

Vortex is and will remain an open-source project. Our intent is to model its governance structure after the Substrait project, which in turn is based on the model of the Apache Software Foundation. Expect more details on this in Q4 2024.

Acknowledgments 🏆

This project is inspired by and--in some cases--directly based upon the existing, excellent work of many researchers and OSS developers.

In particular, the following academic papers have strongly influenced development:

Additionally, we benefited greatly from:

Thanks to all of the aforementioned for sharing their work and knowledge with the world! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vortex_array-0.28.0.tar.gz (713.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vortex_array-0.28.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

vortex_array-0.28.0-cp310-abi3-macosx_11_0_arm64.whl (9.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

vortex_array-0.28.0-cp310-abi3-macosx_10_12_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file vortex_array-0.28.0.tar.gz.

File metadata

  • Download URL: vortex_array-0.28.0.tar.gz
  • Upload date:
  • Size: 713.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for vortex_array-0.28.0.tar.gz
Algorithm Hash digest
SHA256 f60edb1ae0d0eaa980237ae42b6d19c768758040d9724d2b687a0628ba08d566
MD5 f80d9ff9d97bcb90494453eb7de1cf07
BLAKE2b-256 f59c5ad03cb842f077197c4fb1824d287c4491d1bb7e5a03bf4eaf3dc44e4361

See more details on using hashes here.

Provenance

The following attestation bundles were made for vortex_array-0.28.0.tar.gz:

Publisher: release-plz.yml on spiraldb/vortex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vortex_array-0.28.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vortex_array-0.28.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9e2e3404b70766c47cc7213aababa5806ccc818d79cb6961d34c652ddec2c2e
MD5 b82f7af7f4941fdc6df0f5611c50ce9c
BLAKE2b-256 40deb6a33ef0ff66291c29dc2fa3b8049f03a27ae19f55627fed7db8b64e5392

See more details on using hashes here.

Provenance

The following attestation bundles were made for vortex_array-0.28.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-plz.yml on spiraldb/vortex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vortex_array-0.28.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vortex_array-0.28.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d653324715b59d28162ce17df32e7e18f499498f33bc2fbfa58acd257127c7df
MD5 c177187dd749d399df4c985941ba65ac
BLAKE2b-256 4fed419e77687a320eb9e53f5093c2a43eab99b383e0f558002ff215c8d35523

See more details on using hashes here.

Provenance

The following attestation bundles were made for vortex_array-0.28.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release-plz.yml on spiraldb/vortex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vortex_array-0.28.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vortex_array-0.28.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b01cfabcbd4da81d4880ea599f0eaa073d5d7cfcbe1536c1dfae97a522c7b126
MD5 588af27dadccfeb0b6a9936006772321
BLAKE2b-256 2a9572976e39397cbf5942061a118ebd896202fd272a7256f9217d1840e5c452

See more details on using hashes here.

Provenance

The following attestation bundles were made for vortex_array-0.28.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release-plz.yml on spiraldb/vortex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page