parquetio

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package parquetio reads and writes Parquet files for the SQL engines (Athena, S3 Select, Firehose format conversion).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedType is returned for a column type the writer cannot encode.
	ErrUnsupportedType = errors.New("unsupported parquet column type")
	// ErrBadValue is returned when a cell does not parse as its column type.
	ErrBadValue = errors.New("invalid parquet cell value")
	// ErrBadFile is returned when the bytes are not a readable Parquet file.
	ErrBadFile = errors.New("invalid parquet file")
)

Functions

func Write

func Write(w io.Writer, cols []Column, rows [][]any, compression string) error

Write encodes rows as one Parquet file. Cells are nil, bool, int64, float64 or string; date/timestamp/decimal cells are strings. Nested Hive types (array/map/struct) take decoded JSON values or JSON text and are written as LIST, MAP and group columns.

Types

type Column

type Column struct {
	// NestedIDs gives field ids to nested members by logical path ("col.member", "col.element",
	// "col.key", "col.value").
	NestedIDs map[string]int
	Name      string
	Type      string
	// FieldID is written as the Parquet field id when positive (Iceberg data files).
	FieldID int
}

Column is one top-level column to write; Type is a Hive/Athena type name.

type File

type File struct {
	// contains filtered or unexported fields
}

File is an opened Parquet file held in memory.

func Open

func Open(data []byte) (*File, error)

Open parses the footer of an in-memory Parquet file.

func (*File) ColumnIDs

func (f *File) ColumnIDs() map[int]string

ColumnIDs maps each top-level Parquet field id to its column name.

func (*File) Columns

func (f *File) Columns() []string

Columns lists the top-level column names in file order.

func (*File) ForEach

func (f *File) ForEach(cols []string, fn func(vals []any) error) (err error)

ForEach streams every row, yielding one value per requested column (case-insensitive match; nil when the column is null or absent). Leaf values are bool, int64, float64 or string (date, timestamp, time and decimal are formatted as Athena prints them); nested columns yield JSON-marshalable map[string]any / []any.

func (*File) MaxRowGroupBytes

func (f *File) MaxRowGroupBytes() int64

MaxRowGroupBytes is the largest uncompressed row-group size in the footer.

func (*File) NumRows

func (f *File) NumRows() int64

NumRows is the total row count from the footer.

func (*File) ScanBytes

func (f *File) ScanBytes(cols []string) int64

ScanBytes is the footer plus the compressed size of every column chunk belonging to the named top-level columns (case-insensitive).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL