internal

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NullNode   = avro.SchemaNode{Type: atype.Null}
	BoolNode   = avro.SchemaNode{Type: atype.Boolean}
	IntNode    = avro.SchemaNode{Type: atype.Int}
	LongNode   = avro.SchemaNode{Type: atype.Long}
	FloatNode  = avro.SchemaNode{Type: atype.Float}
	DoubleNode = avro.SchemaNode{Type: atype.Double}
	StringNode = avro.SchemaNode{Type: atype.String}
	BytesNode  = avro.SchemaNode{Type: atype.Bytes}

	DateNode        = avro.SchemaNode{Type: atype.Int, LogicalType: atype.Date}
	TimeNode        = avro.SchemaNode{Type: atype.Long, LogicalType: atype.TimeMicros}
	TimestampNode   = avro.SchemaNode{Type: atype.Long, LogicalType: atype.TimestampMicros, Props: map[string]any{"adjust-to-utc": false}}
	TimestampTzNode = avro.SchemaNode{Type: atype.Long, LogicalType: atype.TimestampMicros, Props: map[string]any{"adjust-to-utc": true}}
	UUIDNode        = avro.SchemaNode{Type: atype.Fixed, Name: "uuid_fixed", Size: 16, LogicalType: atype.UUID}
)

Schema nodes for reuse in composition.

View Source
var (
	NullSchema           = mustSchema(NullNode)
	BoolSchema           = mustSchema(BoolNode)
	NullableBoolSchema   = NullableSchema(BoolSchema)
	BinarySchema         = mustSchema(BytesNode)
	NullableBinarySchema = NullableSchema(BinarySchema)
	StringSchema         = mustSchema(StringNode)
	IntSchema            = mustSchema(IntNode)
	NullableIntSchema    = NullableSchema(IntSchema)
	LongSchema           = mustSchema(LongNode)
	NullableLongSchema   = NullableSchema(LongSchema)
	FloatSchema          = mustSchema(FloatNode)
	DoubleSchema         = mustSchema(DoubleNode)
	DateSchema           = mustSchema(DateNode)
	TimeSchema           = mustSchema(TimeNode)
	TimestampSchema      = mustSchema(TimestampNode)
	TimestampTzSchema    = mustSchema(TimestampTzNode)
	UUIDSchema           = mustSchema(UUIDNode)
)

Compiled schemas for direct encoding/decoding use.

View Source
var AvroSchemaMap = make(map[string]*avro.Schema)

AvroSchemaMap stores prebuilt schemas by name for lookup.

Functions

func CheckedClose added in v0.4.0

func CheckedClose(c io.Closer, err *error)

CheckedClose is a helper function to close a resource and return an error if it fails. It is intended to be used in a defer statement.

func Counter added in v0.3.0

func Counter(start int) iter.Seq[int]

func DecimalNode added in v0.6.0

func DecimalNode(precision, scale int) avro.SchemaNode

func DecimalRequiredBytes added in v0.2.0

func DecimalRequiredBytes(precision int) int

DecimalRequiredBytes returns the required number of bytes to store a decimal value of the given precision. If the precision is outside the range (0, 40], this returns -1 as it is invalid.

func DecimalSchema added in v0.2.0

func DecimalSchema(precision, scale int) *avro.Schema

func Difference added in v0.2.0

func Difference(a, b []string) []string

Helper function to find the difference between two slices (a - b).

func FixedNode added in v0.6.0

func FixedNode(size int) avro.SchemaNode

func FixedSchema added in v0.6.0

func FixedSchema(size int) *avro.Schema

func Must added in v0.2.0

func Must[T any](v T, err error) T

func NewManifestEntrySchema added in v0.2.0

func NewManifestEntrySchema(partitionType *avro.Schema, version int) (*avro.Schema, error)

func NewManifestFileSchema added in v0.2.0

func NewManifestFileSchema(version int) (*avro.Schema, error)

func NullableNode added in v0.6.0

func NullableNode(node avro.SchemaNode) avro.SchemaNode

func NullableSchema added in v0.2.0

func NullableSchema(schema *avro.Schema) *avro.Schema

func PackingIterator added in v0.3.0

func PackingIterator[T any](itr iter.Seq[T], targetWeight int64, lookback int, weightFunc func(T) int64, largestBinFirst bool) iter.Seq[[]T]

func RecoverError added in v0.2.0

func RecoverError(err *error)

func SingleErrorIter added in v0.6.0

func SingleErrorIter[T any](err error) iter.Seq2[T, error]

func SliceEqualHelper added in v0.5.0

func SliceEqualHelper[T interface{ Equals(T) bool }](s1, s2 []T) bool

SliceEqualHelper compares the equality of two slices whose elements have an Equals method

func WithFieldID added in v0.2.0

func WithFieldID(id int) map[string]any

WithFieldID returns a props map for use with SchemaField for Iceberg field IDs.

Types

type Bin added in v0.2.0

type Bin[T any] struct {
	// contains filtered or unexported fields
}

func (*Bin[T]) Add added in v0.2.0

func (b *Bin[T]) Add(item T, weight int64)

func (*Bin[T]) CanAdd added in v0.2.0

func (b *Bin[T]) CanAdd(weight int64) bool

func (*Bin[T]) Weight added in v0.2.0

func (b *Bin[T]) Weight() int64

type CountingWriter added in v0.2.0

type CountingWriter struct {
	Count int64
	W     io.Writer
}

func (*CountingWriter) Write added in v0.2.0

func (w *CountingWriter) Write(p []byte) (int, error)

type MockFS

type MockFS struct {
	mock.Mock
}

func (*MockFS) Create added in v0.2.0

func (m *MockFS) Create(name string) (io.FileWriter, error)

func (*MockFS) Open

func (m *MockFS) Open(name string) (io.File, error)

func (*MockFS) Remove

func (m *MockFS) Remove(name string) error

func (*MockFS) WriteFile added in v0.2.0

func (m *MockFS) WriteFile(name string, content []byte) error

type MockFSReadFile

type MockFSReadFile struct {
	MockFS
	ErrOnClose bool
}

func (*MockFSReadFile) ReadFile

func (m *MockFSReadFile) ReadFile(name string) ([]byte, error)

type MockFile

type MockFile struct {
	Contents   *bytes.Reader
	ErrOnClose bool
	// contains filtered or unexported fields
}

func (*MockFile) Close

func (m *MockFile) Close() error

func (*MockFile) Read

func (m *MockFile) Read(p []byte) (int, error)

func (*MockFile) ReadAt

func (m *MockFile) ReadAt(p []byte, off int64) (n int, err error)

func (*MockFile) ReadFrom added in v0.4.0

func (m *MockFile) ReadFrom(r sio.Reader) (n int64, err error)

func (*MockFile) Seek

func (m *MockFile) Seek(offset int64, whence int) (n int64, err error)

func (*MockFile) Stat

func (m *MockFile) Stat() (fs.FileInfo, error)

func (*MockFile) Write added in v0.4.0

func (m *MockFile) Write(p []byte) (n int, err error)

type SlicePacker added in v0.2.0

type SlicePacker[T any] struct {
	TargetWeight    int64
	Lookback        int
	LargestBinFirst bool
}

func (*SlicePacker[T]) Pack added in v0.2.0

func (s *SlicePacker[T]) Pack(items []T, weightFunc func(T) int64) [][]T

func (*SlicePacker[T]) PackEnd added in v0.2.0

func (s *SlicePacker[T]) PackEnd(items []T, weightFunc func(T) int64) [][]T

Directories

Path Synopsis
Package datafileavro is an internal bridge that lets the github.com/apache/iceberg-go/codec package consume the iceberg package's manifest-entry Avro decoder without iceberg having to export it publicly.
Package datafileavro is an internal bridge that lets the github.com/apache/iceberg-go/codec package consume the iceberg package's manifest-entry Avro decoder without iceberg having to export it publicly.

Jump to

Keyboard shortcuts

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