parquet-cli 0.2.0

A Parquet CLI for AI agents: inspect, measure and convert Parquet files.
Documentation
-- 元数据的账:bloom filter、统计截断、页索引 —— 每一个都要花固定成本。
--
-- 用法:pqt script script/metadata-cost.luau <file>

local file = arg[1]
if not file then
	print("用法:pqt script script/metadata-cost.luau <file>")
	return
end

local base = pqt.lookup_cost(file)
print(string.format("现在的:%d 字节,其中页脚 %d(%.1f%%)",
	base.size_bytes, base.footer_bytes,
	100 * base.footer_bytes / base.size_bytes))

-- 用我们自己的 writer 重写一遍当基线(下面每一档都是相对它比的)
local rewritten = pqt.bench(file, {})
local baseline = rewritten.runs[1].bytes

local plans = {
	{ name = "写 bloom filter", options = { write_bloom_filter = "on" } },
	{ name = "统计截断到 16 字节", options = { statistics_truncate_length = 16 } },
	{ name = "不写页索引", options = { write_page_index = "off" } },
	{ name = "页索引 + bloom + 统计截断", options = {
		write_bloom_filter = "on",
		statistics_truncate_length = 16,
	} },
}

for _, plan in plans do
	local result = pqt.bench(file, plan.options)
	local bytes = result.runs[1].bytes
	print(string.format("%-28s %10d 字节(%+.1f%%)", plan.name, bytes,
		100 * (bytes - baseline) / baseline))
end