orcio

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: 24 Imported by: ? modules, 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 orcio reads and writes Apache ORC files for the SQL engines (specification: https://orc.apache.org/specification/ORCv1/).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadFile is returned when the bytes are not a readable ORC file.
	ErrBadFile = errors.New("invalid orc file")
	// ErrUnsupported is returned for ORC features this package does not implement.
	ErrUnsupported = errors.New("unsupported orc feature")
	// ErrBadValue is returned when a cell does not parse as its column type.
	ErrBadValue = errors.New("invalid orc cell value")
)

Functions

func Write

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

Write encodes rows as one ORC file. Cells are nil, bool, int64, float64 or string; date, timestamp and decimal cells are strings; nested types take decoded JSON values (map[string]any / []any) or JSON text.

Types

type Column

type Column struct {
	// NestedIDs gives iceberg.id attributes 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 iceberg.id type attribute when positive.
	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 ORC file held in memory.

func Open

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

Open parses the tail (postscript and footer) of an in-memory ORC file.

func (*File) ColumnIDs

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

ColumnIDs maps each top-level Iceberg field id (the iceberg.id type attribute) 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) error

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

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 tail plus the length of every stripe stream belonging to the named top-level columns.

Jump to

Keyboard shortcuts

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