packages

table

Column-oriented tables. A Table is named, ordered Columns of one length; each column is one typed List (i64, f64, bool, str, dictionary-encoded str, date, datetime) plus a validity bitmap for nulls. Operations run a column at a time; grouping and joins hash rows into integer keys first (keys), so no per-row allocation.

Modules

  • arrow Arrow IPC: the file format (.arrow, Feather v2) and the streaming format, read and written without an Arrow library.
  • build Building tables: the table! literal, records of a struct (#[derive(Record)], or Record by hand), cells from Nabi values.
  • column Typed column storage: one packed List per column plus an optional validity bitmap.
  • csv CSV (RFC 4180) through the csv package: a header line, any one-byte delimiter, "-quoted fields with "" for a quote and line breaks inside, LF / CRLF / CR line ends, a UTF-8 BOM skipped.
  • date Calendar dates and timestamps in the proleptic Gregorian calendar, UTC, with no leap seconds.
  • display Text forms of a table: the aligned preview Display prints (rows and columns cut in the middle past a limit) and GitHub-flavoured Markdown.
  • error The one error type.
  • expr Column expressions: a small tree built with the dot operators (col("x") .* 2 .+ col("y"), col("a") .> 3 .&& col("b") .== "k") and evaluated column at a time against a table.
  • frame The table: named, ordered columns of one length, and the operations that only reshape rows or columns (selection, slicing, nulls).
  • group Group-by and aggregation.
  • join Hash joins.
  • jsonl JSON lines: one JSON object per line, a row each.
  • lazy Lazy queries: a Query records the operations of a table pipeline as a plan and runs it only on collect, after an optimizer has moved filters as early as they can go (into a file scan, where Parquet row groups whose statistics rule a filter out are not read) and pruned every column nothing downstream uses (a scan reads only those).
  • ops Relational algebra as operators: the join symbols of Codd's algebra (⋈ ⟕ ⟖ ⟗ ⋉ ▷), the set operators (∪ ∩ from core, ∖ here) and indexing by column name.
  • parquet Parquet files, read and written without a Parquet library.
  • reshape Long <-> wide: pivot spreads one column's values into columns, melt stacks columns into (variable, value) rows.
  • schema Column types and the schema of a table.
  • sort Sorting: every key becomes an order-preserving u64 per row (numbers by their bits, strings by rank among the distinct values), then a stable LSD radix sort of (key, row) pairs, last key first.
  • stats Summaries: describe, value_counts, null_counts.
  • value One cell, the element type of rows and the scalar of expressions.

Re-exports

arrow::{Arrow, arrow_schema, read_arrow, write_arrow}Source

pub use arrow::{Arrow, arrow_schema, read_arrow, write_arrow}
  • Arrow How to read or write Arrow IPC data.
  • arrow_schema The schema of the Arrow data in b, without reading its rows.
  • read_arrow The Arrow file (or stream) at path: Arrow::new().read_file(path).
  • write_arrow Write t to path in the Arrow file format.

build::{Record, ToValue, record_table}Source

pub use build::{Record, ToValue, record_table}
  • Record A struct whose values are rows: #[derive(table::Record)] writes it from the fields (each a ToValue type), or implement it by hand.
  • ToValue A Nabi value that is one cell.
  • record_table A table with one row per record; the column types come from the struct, so an empty list still has the columns.

column::ColumnSource

pub use column::Column

csv::{Csv, CsvReader, read_csv, read_csv_str, write_csv}Source

pub use csv::{Csv, CsvReader, read_csv, read_csv_str, write_csv}
  • Csv How to read or write CSV.
  • CsvReader Reads CSV from a stream in batches.
  • read_csv Read the CSV file at path with the default options.
  • read_csv_str A table from CSV text with the default options.
  • write_csv Write the table as CSV to path with the default options.

date::{Date, DateTime}Source

pub use date::{Date, DateTime}
  • Date A calendar date: days since 1970-01-01 (negative before it).
  • DateTime An instant: nanoseconds since 1970-01-01T00:00:00Z, which covers the years 1677 to 2262.

error::TableErrorSource

pub use error::TableError

expr::{Expr, IntoExpr, Then, When, col, lit, when}Source

pub use expr::{Expr, IntoExpr, Then, When, col, lit, when}
  • Expr A computed column: names columns with col, scalars with lit (or a plain number, string, bool or date on either side of an operator), and combines them with the dot operators.
  • IntoExpr What can stand on either side of an expression operator: an Expr, a number, string, bool, date or Value.
  • Then A when(..).then(..) waiting for its otherwise.
  • When A when(..) waiting for its then.
  • col Column name of the table the expression runs against.
  • lit A scalar, the same in every row.
  • when then where cond is true, else otherwise; start with when.

frame::{Row, Table}Source

pub use frame::{Row, Table}
  • Row One row of a table, read by column name.
  • Table Named, ordered columns of equal length.

group::{Agg, AggKind, GroupBy, count, count_of, custom, first, last, max, mean, median, min, n_unique, quantile, std, sum, var}Source

pub use group::{Agg, AggKind, GroupBy, count, count_of, custom, first, last, max, mean, median, min, n_unique, quantile, std, sum, var}
  • Agg One aggregation: a kind, its input column and the output name (<column>_<kind> unless named).
  • AggKind What an aggregation computes.
  • GroupBy A table split into groups by key columns, ready to aggregate.
  • count Rows per group, named count.
  • count_of Non-null values of c per group.
  • custom f of each group's slice of column c, named name.
  • first The first non-null value.
  • last The last non-null value.
  • max Largest value, any orderable type.
  • mean Arithmetic mean, compensated sum over the count.
  • median The 0.5 quantile, linear interpolation.
  • min Smallest value, any orderable type.
  • n_unique How many distinct non-null values.
  • quantile The q quantile (0 <= q <= 1), linear interpolation.
  • std Sample standard deviation, Welford's one-pass update.
  • sum Sum (i64 stays i64; f64 with Neumaier compensation).
  • var Sample variance (n - 1), Welford.

join::HowSource

pub use join::How
  • How Which rows a join keeps.

jsonl::{read_jsonl, read_jsonl_str, write_jsonl, write_jsonl_str}Source

pub use jsonl::{read_jsonl, read_jsonl_str, write_jsonl, write_jsonl_str}
  • read_jsonl The JSON lines file at path as a table.
  • read_jsonl_str A table from JSON lines text; blank lines are skipped.
  • write_jsonl Write the table as JSON lines to path.
  • write_jsonl_str The table as JSON lines, one object per row, each line ended by \n.

lazy::{LazyGroupBy, Query, scan_arrow, scan_csv, scan_parquet}Source

pub use lazy::{LazyGroupBy, Query, scan_arrow, scan_csv, scan_parquet}

parquet::{Compression, Parquet, parquet_schema, read_parquet, write_parquet}Source

pub use parquet::{Compression, Parquet, parquet_schema, read_parquet, write_parquet}
  • Compression The page compression a written file uses.
  • Parquet How to read or write Parquet.
  • parquet_schema The schema of the Parquet data in b (its readable columns), from the footer alone.
  • read_parquet The Parquet file at path: Parquet::new().read_file(path).
  • write_parquet Write t to path as Parquet with the defaults of Parquet::new().

schema::{DType, Field, Schema}Source

pub use schema::{DType, Field, Schema}
  • DType The type of a column.
  • Field A column's name and type.
  • Schema The names and types of a table's columns, in order.

sort::{SortKey, asc, desc}Source

pub use sort::{SortKey, asc, desc}
  • SortKey One sort key: a column, its direction and where nulls go.
  • asc Ascending by name, nulls last.
  • desc Descending by name, nulls last.

value::ValueSource

pub use value::Value