package main_test
import (
"context"
"os"
"testing"
"github.com/apache/arrow/go/v8/arrow/memory"
"github.com/apache/arrow/go/v8/parquet"
"github.com/apache/arrow/go/v8/parquet/file"
"github.com/apache/arrow/go/v8/parquet/pqarrow"
)
func TestParquetReading(t *testing.T) {
ctx := context.Background()
mem := memory.NewCheckedAllocator(memory.DefaultAllocator)
defer mem.AssertSize(t, 0)
f, err := os.Open("test.parquet")
if err != nil {
t.Fatal(err)
}
defer f.Close()
pf, err := file.NewParquetReader(
f,
file.WithReadProps(parquet.NewReaderProperties(mem)),
)
if err != nil {
t.Fatal(err)
}
defer pf.Close()
r, err := pqarrow.NewFileReader(pf, pqarrow.ArrowReadProperties{}, mem)
if err != nil {
t.Fatal(err)
}
table, err := r.ReadTable(ctx)
if err != nil {
t.Fatal(err)
}
defer table.Release()
}