#!/bin/sh
set -e

# Write 500 integers to a Snappy-compressed Parquet file and read them back.
# Verifies that the parquet extension works with the unbundled snappy library.

tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT

file="$tmp/test.parquet"

duckdb -c "COPY (SELECT i FROM range(500) t(i))
           TO '$file' (FORMAT PARQUET, COMPRESSION SNAPPY);"

result=$(duckdb -c "SELECT sum(i) FROM read_parquet('$file');")
echo "$result" | grep -q "124750"
