columnar

Introduction

serde_columnar is a crate that provides columnar storage for List and Map with compressible serialization and deserialization capabilities.

Columnar storage is very useful when you want to compress serialized data and you know that one or more fields of consecutive structs in the array have the same or equal difference values.

For example, you want to store this array:

plain [{a: 1, b: 1}, {a: 1, b: 2}, {a: 1, b: 3}, ...]

After columnar storage, it can be stored as:

plain a: [1, 1, 1,...] ---Rle---> [N, 1] b: [1, 2, 3,...] ---DeltaRle---> [N, 1] (each value is 1 greater than the previous one)

Usage

```rust ignore type ID = u64;

[columnar(vec, ser, de)]

[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]

pub struct Data { #[columnar(strategy = "Rle")] num: u32, #[columnar(strategy = "DeltaRle", original_type = "u64")] id: ID, #[columnar(strategy = "Rle")] gender: String, #[columnar(strategy = "BoolRle")] married: bool }

[columnar]

[derive(Debug, Serialize, Deserialize)]

pub struct VecStore { #[columnar(type = "vec")] pub data: Vec }

let store = VecStore::new(...); let bytes = serdecolumnar::tovec(&store).unwrap(); let store = serdecolumnar::frombytes::(&bytes).unwrap();

```

More Details

Container

Field Attributes

Compress (enable compress feature)