#apache-arrow #arrow #analytics #storage

nightly strawboat

A native storage format based on Apache Arrow

7 releases

0.2.6 Jul 25, 2023
0.2.5 Jul 22, 2023
0.1.0 Jan 10, 2023

#220 in Compression

Download history 5/week @ 2024-03-08 9/week @ 2024-03-15 167/week @ 2024-03-22 6/week @ 2024-03-29

1,975 downloads per month

Apache-2.0

280KB
6.5K SLoC

strawboat

A native storage format based on Apache Arrow.

strawboat is similar to Arrow IPC and is primarily aimed at optimizing the storage layer. We hope to use it in databend as another storage_format, and it is currently in a very early stage.

Difference with parquet

  • No RowGroup, row based multiple pages.

We think that multi RowGroup per file is useless in columnar database. To make life easier, we did not implement RowGroup (just like one single RowGroup per file).

Each Column will be spilted into fixed row size Page by WriteOptions. Page is the smallest unit of compression like parquet.

  • Zero-Overhead reading and writing.

  • Adaptive compression.

Strawboat integrates adaptive compressions based on the data, see more in btrblocks

Storage Format Layout

We have three different data page layouts to store different types of data.

Non-Nullable data pages:

+-------------------+
|    codec type     |
+-------------------+
|  compressed size  |
+-------------------+
| uncompressed size |
+-------------------+
|     values        |
+-------------------+

Nullable data pages:

+-------------------+
|  def levels len   |
+-------------------+
|    def values     |
+-------------------+
|    codec type     |
+-------------------+
|  compressed size  |
+-------------------+
| uncompressed size |
+-------------------+
|     values        |
+-------------------+

Nested data pages:

+-------------------+
|    offsets len    |
+-------------------+
|  rep levels len   |
+-------------------+
|  def levels len   |
+-------------------+
|    rep values     |
+-------------------+
|    def values     |
+-------------------+
|    codec type     |
+-------------------+
|  compressed size  |
+-------------------+
| uncompressed size |
+-------------------+
|     values        |
+-------------------+

DataTypes

  • Boolean
  • Primitive
  • Binary/Utf8
  • Null
  • List
  • LargeList
  • Fixed sized binary
  • Fixed sized list
  • Struct
  • Dictionary
  • Union
  • Map

Performance compare with parquet

TODO

Examples

// you need a simple parquet file in /tmp/input.str

// then generate strawboat file
cargo run --example strawboat_write --release /tmp/input.str

// read strawboat file
cargo run --example strawboat_read  --release /tmp/input.str

// compare parquet reader
cargo run --example parquet_read --release /tmp/input.str

Dependencies

~23MB
~584K SLoC