← Back to Official Package Registry
Tier 3: AI, Vector RAG & DataFrames • Columnar DataFrames & Arrowv1.0.0 • 66 KB • Ed25519 Verified

dataframe_parquet@1.0.0

Typed columnar DataFrames with homoiconic filter/join/group-agg pipelines, Arrow IPC framing, and Zstd columnar zone-map snapshots.

use [dataframe_parquet/arrow]use [dataframe_parquet/core]use [dataframe_parquet]
veko pkg add dataframe_parquet@1.0.0
Run in Browser PlaygroundDownload 1.0.0.vkpRaw demo.vk

dataframe_parquet

Pure-Veko typed columnar DataFrame engine, homoiconic relational/analytical query verbs, binary Arrow-style IPC (VKAR), and Zstd-compressed Parquet-lite columnar storage (VKZP) with zone-map predicate pushdown.

Overview

dataframe_parquet brings zero-dependency in-memory analytics and compressed columnar storage to Veko across VM, Wasm 3.0, and Native targets:

  • dataframe_parquet/core: Typed Column buffers (.i64_col, .f64_col, .bool_col, and dictionary-encoded .str_col) paired with 1-bit-per-row validity null bitmaps, schema inference, and homoiconic row expression evaluation.
  • dataframe_parquet/arrow: Binary columnar IPC framing (encode-ipc, decode-ipc) with IEEE CRC-32 verification, plus a Zstd-compressed Parquet-lite row-group container (write-columnar-zstd, read-columnar-zstd) featuring leading/trailing 'VKZP' magic headers, Zstd-compressed schema footer, per-column (min, max, null_count) zone-map statistics for zero-decompression row-group pruning, per-chunk CRC-32 checksums, and whole-file SHA-256 integrity.
  • dataframe_parquet: Pipe-friendly (\) relational and analytical verbs (select-cols, drop-cols, filter-rows, with-col, sort-by, limit-rows, inner-join, left-join, group-agg, describe, format-table) plus RFC 4180 CSV and JSONL codecs (from-csv, to-csv, to-jsonl).

Installation

powershell
veko pkg add dataframe_parquet@1.0.0

Import the facade and columnar codec module:

rebol
use [
    df    = dataframe_parquet
    arrow = dataframe_parquet/arrow
]

Architecture

  1. Dictionary Encoding & Packed Null Bitmaps: String columns (.str_col) automatically deduplicate unique UTF-8 values into str_dict and store compact integer codes per row, while missing .null values across all column types occupy 1 bit per row in a validity byte bitmap.
  2. Homoiconic Query & Aggregation Dialects: filter-rows, with-col, and group-agg accept native Veko quote [...] code blocks directly alongside first-class closures, evaluating compound predicates (quote [amount > 100 and status == 'paid']) and named aggregations (quote [total = sum amount, orders = count id, avg_amt = avg amount, top = max amount]) with zero code generation.
  3. Zone-Map Predicate Pushdown & Cryptographic Integrity: write-columnar-zstd partitions rows into configurable row groups, recording (min, max, null_count) zone maps per column chunk before compressing with RFC 8878 Zstandard (compress/zstd). On read, read-columnar-zstd/where verifies the 32-byte SHA-256 container digest in constant time (bits/ct-eq?) and skips entire row groups whose [min, max] bounds cannot satisfy the predicate without decompressing their Zstd column pages.

Complete API Reference

dataframe_parquet

Type / SignatureDescription
col-from-values = fn [name str, kind enum, vals block] ColumnConstructs a typed .i64_col, .f64_col, .bool_col, or dictionary-encoded .str_col.
infer-col = fn [name str, vals block] ColumnInfers column type from non-.null values.
from-columns = fn [cols block[Column]] DataFrameBuilds a DataFrame from equal-length Columns.
from-rows = fn [rows block] DataFrame / to-rows = fn [df DataFrame] block[map]Converts between row maps and columnar DataFrames.
row-count = fn [df DataFrame] i64 / col-names = fn [df DataFrame] block[str] / schema = fn [df DataFrame] block[map]Inspects row count, column order, and column schema metadata.
describe = fn [df DataFrame] DataFrameComputes count, nulls, min, max, and mean across all columns.
format-table = fn [df DataFrame /max_rows max_rows i64 = 50] strRenders an aligned ASCII box table.
select-cols = fn [df DataFrame, names block] DataFrame / drop-cols = fn [df DataFrame, names block] DataFrameProjects or removes columns (['a' 'b'] or quote [a b]).
filter-rows = fn [df DataFrame, pred any] DataFrameFilters rows via closure fn [row map] bool or homoiconic quote [...] expression.
with-col = fn [df DataFrame, col_name str, compute any] DataFrameAppends or replaces a computed column via closure or quote [...] arithmetic expression.
sort-by = fn [df DataFrame, col_name any /desc descending bool = false] DataFrameStably sorts rows by col_name (.null last).
limit-rows = fn [df DataFrame, n i64 /offset offset i64 = 0] DataFrameSlices up to n rows starting at offset.
inner-join = fn [left DataFrame, right DataFrame, left_on str, right_on str] DataFrameHash-based inner equi-join.
left-join = fn [left DataFrame, right DataFrame, left_on str, right_on str] DataFrameHash-based left outer equi-join filling unmatched right columns with .null.
group-agg = fn [df DataFrame, group_cols block, aggs block] DataFrameGroups by group_cols and evaluates sum, count, avg, min, max aggregations.
from-csv = fn [csv_text str] DataFrame / to-csv = fn [df DataFrame] str / to-jsonl = fn [df DataFrame] strRFC 4180 CSV and JSON Lines import/export.

dataframe_parquet/arrow

SignatureDescription
encode-ipc = fn [df DataFrame] bytes / decode-ipc = fn [raw bytes] DataFrameEncodes and decodes CRC32-verified Arrow-style binary columnar IPC frames (VKAR).
write-columnar-zstd = fn [df DataFrame, path str /row_group_size rg_size i64 = 1024] enumWrites a Zstd-compressed Parquet-lite columnar file (VKZP) with zone maps and SHA-256 trailer.
read-columnar-zstd = fn [path str /where pred block = []] DataFrameReads a VKZP file with optional homoiconic zone-map predicate pushdown.
read-columnar-zstd-stats = fn [path str /where pred block = []] mapReads a VKZP file and returns { df, total_row_groups, scanned_row_groups, skipped_row_groups }.
inspect-zone-maps = fn [path str] mapReads and verifies the schema + per-row-group zone-map footer without decompressing column chunks.

Example Usage

rebol
use [df = dataframe_parquet]

sales = df/from-rows [
    { id = 1, region = 'eu-west', amount = 450, status = 'paid' }
    { id = 2, region = 'us-east', amount = 280, status = 'paid' }
    { id = 3, region = 'eu-west', amount = 80,  status = 'refunded' }
]

summary = sales
    \ df/filter-rows (quote [amount > 100 and status == 'paid'])
    \ df/group-agg (quote [region]) (quote [total = sum amount, orders = count id, avg_amt = avg amount, top = max amount])
    \ df/sort-by/desc 'total' true

println (df/format-table summary)

Verification

powershell
veko check packages/dataframe_parquet/src/core.vk
veko check packages/dataframe_parquet/src/arrow.vk
veko check packages/dataframe_parquet/src/mod.vk
veko check packages/dataframe_parquet/examples/demo.vk
veko run -C all packages/dataframe_parquet/examples/demo.vk
packages/dataframe_parquet/examples/demo.vkSelf-contained runnable example & assertion suite
Raw .vk
// packages/dataframe_parquet/examples/demo.vk
// Self-contained runnable verification suite for `dataframe_parquet` (`1.0.0`):
// Typed columns (dictionary-encoded `.str_col` + validity bitmaps), homoiconic `filter-rows`,
// `with-col`, `inner-join`, `left-join`, `group-agg`, `sort-by`, `describe`, `format-table`,
// CSV/JSONL codecs, Arrow IPC (`VKAR`), and Zstd Columnar Zone-Map (`VKZP`) roundtrip + pushdown.

use [
	fs
	df    = dataframe_parquet
	arrow = dataframe_parquet/arrow
]

assert-eq = fn [label str, got any, want any] any [
	if got != want [
		println `[FAIL] {label}: got {mold got}, expected {mold want}`
		return (err `assert-eq failed: {label}`)
	]
	println `[PASS] {label}`
	.ok
]

assert-true = fn [label str, cond bool] any [
	if not cond [
		println `[FAIL] {label}`
		return (err `assert-true failed: {label}`)
	]
	println `[PASS] {label}`
	.ok
]

main = fn [] any [
	println '=== dataframe_parquet 1.0.0 Verification Suite ==='

	// 1. Build Sales & Customer DataFrames (testing dictionary encoding + `.null` validity bitmaps)
	customers = df/from-rows [
		{ cust_id = 1, name = 'Ada Lovelace',   region = 'eu-west', tier = 'enterprise' }
		{ cust_id = 2, name = 'Grace Hopper',   region = 'us-east', tier = 'enterprise' }
		{ cust_id = 3, name = 'Ken Thompson',   region = 'us-east', tier = 'pro' }
		{ cust_id = 4, name = 'Linus Torvalds', region = 'eu-west', tier = 'pro' }
	]

	sales = df/from-rows [
		{ id = 101, cust_id = 1, amount = 450, status = 'paid',     coupon = 'LAUNCH10' }
		{ id = 102, cust_id = 2, amount = 280, status = 'paid',     coupon = .null }
		{ id = 103, cust_id = 3, amount = 75,  status = 'paid',     coupon = .null }
		{ id = 104, cust_id = 1, amount = 620, status = 'paid',     coupon = 'VIP' }
		{ id = 105, cust_id = 2, amount = 500, status = 'refunded', coupon = .null }
		{ id = 106, cust_id = 4, amount = 190, status = 'paid',     coupon = .null }
		{ id = 107, cust_id = 2, amount = 320, status = 'paid',     coupon = 'Q4' }
	]

	status_col = df/get-col sales 'status'
	coupon_col = df/get-col sales 'coupon'
	_ = assert-eq/or 'Dictionary-encoded status column stores 2 unique entries for 7 rows' (len status_col.str_dict) 2 [e -> return e]
	_ = assert-eq/or 'Validity bitmap tracks 4 .null entries in coupon column' coupon_col.null_count 4 [e -> return e]

	// 2. Pipe-friendly homoiconic `filter-rows` + `inner-join` + `with-col` + `group-agg` + `sort-by`
	regional_summary = sales
		\ df/filter-rows (quote [amount > 100 and status == 'paid'])
		\ df/inner-join customers 'cust_id' 'cust_id'
		\ df/with-col 'net_cents' (quote [amount * 100])
		\ df/group-agg (quote [region]) (quote [total = sum amount, orders = count id, avg_amt = avg amount, top = max amount])
		\ df/sort-by/desc 'total' true

	_ = assert-eq/or 'Grouped summary has 2 regions (eu-west, us-east)' (df/row-count regional_summary) 2 [e -> return e]
	sum_rows = df/to-rows regional_summary
	// eu-west paid > 100: 450 + 620 + 190 = 1260 (3 orders, avg 420.0, top 620)
	// us-east paid > 100: 280 + 320 = 600 (2 orders, avg 300.0, top 320)
	_ = assert-eq/or 'Top region is eu-west' (map/get sum_rows[0] 'region') 'eu-west' [e -> return e]
	_ = assert-eq/or 'eu-west sum(amount) == 1260' (map/get sum_rows[0] 'total') 1260 [e -> return e]
	_ = assert-eq/or 'eu-west count(id) == 3' (map/get sum_rows[0] 'orders') 3 [e -> return e]
	_ = assert-eq/or 'eu-west avg(amount) == 420.0' (map/get sum_rows[0] 'avg_amt') 420.0 [e -> return e]
	_ = assert-eq/or 'eu-west max(amount) == 620' (map/get sum_rows[0] 'top') 620 [e -> return e]
	_ = assert-eq/or 'us-east sum(amount) == 600' (map/get sum_rows[1] 'total') 600 [e -> return e]

	// Closure-based `filter-rows`, `left-join`, `describe`, and ASCII `format-table`
	ascii_tbl = df/format-table regional_summary
	_ = assert-true/or 'ASCII format-table renders aligned header & rows' ((str/contains? ascii_tbl 'eu-west') and (str/contains? ascii_tbl '1260') and (str/contains? ascii_tbl '+--')) [e -> return e]
	println ascii_tbl

	desc_df = df/describe sales
	_ = assert-eq/or 'describe produces 1 summary row per column (5)' (df/row-count desc_df) 5 [e -> return e]

	// 3. CSV & JSONL import/export roundtrip
	csv_txt = df/to-csv sales
	csv_rt = df/from-csv/or csv_txt [e -> return e]
	_ = assert-eq/or 'CSV roundtrip preserves row count (7) & nulls' (df/row-count csv_rt) 7 [e -> return e]
	jsonl_txt = df/to-jsonl regional_summary
	_ = assert-eq/or 'JSONL export emits 2 newline-delimited JSON objects' (len (str/split jsonl_txt '\n')) 2 [e -> return e]

	// 4. Arrow-style Binary Columnar IPC (`VKAR`) roundtrip + CRC32 tamper detection
	ipc_bytes = arrow/encode-ipc sales
	ipc_rt = arrow/decode-ipc/or ipc_bytes [e -> return e]
	_ = assert-eq/or 'Arrow IPC roundtrip preserves 7 rows & null count' (df/row-count ipc_rt) 7 [e -> return e]
	rt_rows = df/to-rows ipc_rt
	_ = assert-eq/or 'Arrow IPC preserves .null cell on row 1 coupon' (map/get rt_rows[1] 'coupon') .null [e -> return e]
	_ = assert-eq/or 'Arrow IPC preserves dictionary string on row 3 coupon' (map/get rt_rows[3] 'coupon') 'VIP' [e -> return e]

	mut tampered_ipc = ipc_bytes
	_ = bytes/set mut tampered_ipc 12 (tampered_ipc[12] ^ 0xff)
	bad_ipc = arrow/decode-ipc/or tampered_ipc [e ->
		_ = e
		df/from-rows []
	]
	_ = assert-eq/or 'Arrow IPC CRC32 rejects bit-flipped frame' (df/row-count bad_ipc) 0 [e -> return e]

	// 5. Zstd-compressed Parquet-lite Columnar Container (`VKZP`) + Zone-Map Predicate Pushdown
	tmp_vkzp = str/join [(os/temp-dir) '/veko_df_parquet_demo_' (mold (time/unix)) '.vkzp'] ''
	defer [
		_ = os/remove/or tmp_vkzp [ .ok ]
	]

	sorted_sales = df/sort-by sales 'id'
	// Write with `row_group_size = 2` -> 4 row groups: [101,102], [103,104], [105,106], [107]
	w_rc = df/write-columnar-zstd/row_group_size sorted_sales tmp_vkzp 2
	if err? w_rc [ return w_rc ]
	_ = assert-true/or 'VKZP Zstd columnar file written to disk' (fs/file? tmp_vkzp) [e -> return e]

	zfooter = df/inspect-zone-maps/or tmp_vkzp [e -> return e]
	_ = assert-eq/or 'VKZP container partitioned into 4 row groups of <= 2 rows' (len (map/get zfooter 'row_groups')) 4 [e -> return e]

	// Full read roundtrip
	full_rt = df/read-columnar-zstd/or tmp_vkzp [e -> return e]
	_ = assert-eq/or 'VKZP full read roundtrip preserves all 7 rows' (df/row-count full_rt) 7 [e -> return e]

	// Zone-map predicate pushdown (`id >= 105` -> skips row groups 0 [101..102] and 1 [103..104]!)
	pushdown = arrow/read-columnar-zstd-stats/where/or tmp_vkzp (quote [id >= 105 and status == 'paid']) [e -> return e]
	_ = assert-eq/or 'Zone-map pushdown skipped 2 out-of-range row groups without decompressing' (map/get pushdown 'skipped_row_groups') 2 [e -> return e]
	_ = assert-eq/or 'Zone-map pushdown scanned only 2 candidate row groups' (map/get pushdown 'scanned_row_groups') 2 [e -> return e]
	pd_df = map/get pushdown 'df'
	_ = assert-eq/or 'Pushdown + row filter returns exact 2 matching rows (106, 107)' (df/row-count pd_df) 2 [e -> return e]

	println 'ALL dataframe_parquet 1.0.0 TESTS PASSED'
	.ok
]

res = main
if err? res [
	println (mold res)
	os/exit 1
]
Cryptographic Provenance

Ed25519 Signature & Merkle Integrity

Registry URL: https://veko-lang.org/pkg/dataframe_parquet/1.0.0.vkp
Archive SHA-256: 01e7827c13ba45f8e1a67f22fa0a46a6ab08abb9165f975f6631d0ef1e1a79ef
Merkle Root: d36dff8bf05f474debd0f477589bf3a2c8433871f3617442bc4d248274c80380
Signer Trust Key: ed25519:27406074d8681da1d4e6420f5d887cac15c313334c249ac047ba9d4e2df72b70
Embedded VKP1 Manifest

manifest.json

{"name":"dataframe_parquet","version":"1.0.0","tier":3.0,"tier_label":"Tier 3: AI, Vector RAG & DataFrames","category":"Columnar DataFrames & Arrow","description":"Typed columnar DataFrames with homoiconic filter/join/group-agg pipelines, Arrow IPC framing, and Zstd columnar zone-map snapshots.","modules":["dataframe_parquet/arrow","dataframe_parquet/core","dataframe_parquet"],"homepage":"https://veko-lang.org/packages/dataframe_parquet"}
Bundle Entry PathSizeLeaf SHA-256 Digest
README.md6 KBdd4eba98115ff83743d062c62b5a3dc5f3e9a1879b2f11c4670423fd94a2041f
arrow.vk19 KB9a0003a59585ef3a43334e2fc91916cc4abc514728118274b1eee0a40b0d2c0a
core.vk13 KBcd6fab17e5c321e5777fd124c43688cda151a497668d44c8a2461cb169413032
examples/demo.vk6 KBa8cd4b8fbbdf9f154355713bddda255f374eb10e6d0fc4b3da82a20639d59386
mod.vk18 KB2cf80f2e920f2e6ed9382dd71f694b9ac95f63325a5403fef94907ea09b08726