# skade — "winter queen" (Skaði). Fast Apache Iceberg writing/reading +
# ergonomic DataFusion SQL on top of nornir-catalog's embedded RedbCatalog.
#
# Detached workspace (own [workspace], same pattern as ../bench): keeps the
# published nornir-catalog crate's manifest and lockfile untouched. The
# nornir-catalog dependency carries both `version` and `path`, so local builds
# use the sibling sources and `cargo publish` uses the crates.io release.
[package]
name = "skade"
version = "0.4.0"
edition = "2021"
rust-version = "1.92"
description = "Fast Apache Iceberg table writing/reading (incl. identity-partitioned writes) and ergonomic DataFusion SQL over an embedded, pure-Rust catalog (nornir-catalog). Arrow RecordBatch in, SQL out."
license = "Apache-2.0"
repository = "https://codeberg.org/nordisk/nornir-catalog"
readme = "README.md"
keywords = ["iceberg", "datafusion", "arrow", "sql", "warehouse"]
categories = ["database"]

[dependencies]
# The embedded catalog: catalog.redb + file:// warehouse in one directory.
nornir-catalog = { version = "0.1.4", path = ".." }
iceberg = "0.9.1"

# Data plane — pinned to the arrow/parquet major iceberg 0.9.1 links (57.x).
arrow-array = "57"
arrow-schema = "57"
arrow-cast = "57"
parquet = "57"

futures = "0.3"
thiserror = "1"
# Parallel ingest: rayon fans Parquet encoding across all cores (the gatling
# topology — all-cores encode, one sequential writer/committer). `bytes` is the
# FileIO write payload type.
rayon = "1"
bytes = "1"

# SQL surface (feature `sql`, opt-in). datafusion 52.x shares arrow 57 with
# iceberg 0.9.1, so writer/reader RecordBatch types interop without bridging.
datafusion = { version = "52.2", optional = true }
iceberg-datafusion = { version = "0.9.1", optional = true }

[features]
# Lean by default: writer/reader + bridges, pure-Rust catalog. The `sql` surface
# (DataFusion) is opt-in — it pulls the datafusion tree incl. the C `liblzma-sys`
# (xz) via async-compression, which most consumers don't want. Enable with
# `features = ["sql"]` for `Table::sql` / `Warehouse::sql`.
# (The zstd-sys C dep still rides in via iceberg-rust's Avro manifests — not ours
# to drop without patching iceberg.)
default = []
sql = ["dep:datafusion", "dep:iceberg-datafusion"]

[dev-dependencies]
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tempfile = "3"
anyhow = "1"
criterion = "0.5"

[[bench]]
name = "throughput"
harness = false

# Detached from the nornir-catalog package on purpose (see header).
[workspace]

# LOCAL PATCH: parallel per-file partitioned Iceberg scan (the bench's vendored
# iceberg-datafusion 0.9.1 with one DataFusion partition per data file; upstream
# scans the whole table as a single stream → single-threaded Parquet decode,
# ~8× slower on a 32-core box). [patch] is stripped by `cargo package/publish`,
# so the published skade depends on stock iceberg-datafusion 0.9.1; only local
# builds/tests/benches get the fast scan until the patch is upstreamed.
[patch.crates-io]
iceberg-datafusion = { path = "../bench/vendor/iceberg-datafusion" }
