Documentation
¶
Index ¶
- Constants
- func AnalyzeVariantShredding(sample []variant.Value) (arrow.DataType, bool)
- func AppendVariantInt8(b *variant.Builder, v int8) error
- func AppendVariantInt16(b *variant.Builder, v int16) error
- func AppendVariantInt32(b *variant.Builder, v int32) error
- func AppendVariantInt64(b *variant.Builder, v int64) error
- func BBoxIntersectsXY(aMinX, aMinY, aMaxX, aMaxY, bMinX, bMinY, bMaxX, bMaxY float64) bool
- func BigEndianToDecimal(buf []byte) (decimal.Decimal128, error)
- func BuildPartitionMatchPredicate(spec iceberg.PartitionSpec, schema *iceberg.Schema, partitions []map[int]any) (iceberg.BooleanExpression, error)
- func ClonePartition(partition map[int]any) map[int]any
- func CoercePartition(values map[int]any, partitionType *iceberg.StructType) map[int]any
- func ComparablePartitionKey(value any) any
- func FilePathValues(values arrow.Array) (arrow.TypedArray[string], error)
- func GeoBoundsXY(lower, upper []byte) (minX, minY, maxX, maxY float64, ok bool)
- func LiteralForPartitionValue(v any) (iceberg.Literal, error)
- func MakeSequencedChan[T any](bufferSize uint, source <-chan T, comesAfter, isNext func(a, b *T) bool, ...) <-chan T
- func MakeSequencedChanWithDiscard[T any](bufferSize uint, source <-chan T, comesAfter, isNext func(a, b *T) bool, ...) <-chan T
- func MapExec[T, S any](ctx context.Context, nWorkers int, slice iter.Seq[T], fn func(T) (S, error)) iter.Seq2[S, error]
- func MapExecWithDiscard[T, S any](ctx context.Context, nWorkers int, slice iter.Seq[T], fn func(T) (S, error), ...) iter.Seq2[S, error]
- func NewBuilderLookup(scope string, fields []arrow.Field, builder func(int) array.Builder) (map[int]array.Builder, error)
- func ParquetCompressionCodec(value string) (compress.Compression, bool)
- func ParquetRowGroupTargetSizeBytes(props iceberg.Properties) (int64, error)
- func PartitionValueScalar(value any, typ iceberg.Type, arrowType arrow.DataType) (scalar.Scalar, error)
- func PositionDeleteColumnIndices(schema *arrow.Schema) (int, int, error)
- func ResolveParquetBloomColumnPaths(props iceberg.Properties, tableSchema, fileSchema *iceberg.Schema, ...) iceberg.Properties
- func ResolveParquetStatsColumnPaths(props iceberg.Properties, tableSchema, fileSchema *iceberg.Schema, ...) iceberg.Properties
- func ShredRecordVariants(rec arrow.RecordBatch, shreddedSchema *arrow.Schema, mem memory.Allocator) (out arrow.RecordBatch, err error)
- func ShreddedArrowSchema(base *arrow.Schema, inferred map[int]arrow.DataType) *arrow.Schema
- func TablePropertiesFromContext(ctx context.Context) iceberg.Properties
- func TruncateUpperBoundBinary(val []byte, trunc int) []byte
- func TruncateUpperBoundText(s string, trunc int) string
- func UnifiedPartitionType(specs []iceberg.PartitionSpec, currentSchema *iceberg.Schema) (*iceberg.StructType, error)
- func ValidateBuilderLookup(scope string, lookup map[int]array.Builder, expected map[int]struct{}) error
- func ValidateNameMappingProperty(props iceberg.Properties, key string, mapping iceberg.NameMapping, ...) error
- func ValidateParquetReadProperties(props iceberg.Properties) error
- func ValidateParquetWriteProperties(props iceberg.Properties) error
- func ValidatePositionDeletePositions(positions *array.Int64) error
- func VariantBoundLiteral(raw []byte, path string, typ iceberg.PrimitiveType) (lit iceberg.Literal, ok bool, err error)
- func VariantFieldIDsFromSchema(sc *iceberg.Schema) map[int]struct{}
- func WKBCenterXY(data []byte) (x, y float64, ok bool, err error)
- func WithParquetMetadataCache(ctx context.Context) context.Context
- func WithTableProperties(ctx context.Context, props iceberg.Properties) context.Context
- type AvroFileSource
- type DataFileOpts
- type DataFileStatistics
- type Enumerated
- type FileFormat
- type FileReader
- type FileSource
- type FileWriter
- type GeoBoundsAggregator
- type Metadata
- type MetricModeType
- type MetricsMode
- type ParquetFileSource
- type ParquetFileWriter
- type ParquetRowGroupTester
- type PartitionAggregate
- type PartitionAggregateTree
- func (t *PartitionAggregateTree) Insert(record PartitionRecord, aggregate *PartitionAggregate)
- func (t *PartitionAggregateTree) Lookup(record PartitionRecord) *PartitionAggregate
- func (t *PartitionAggregateTree) LookupPartition(partition map[int]any, partitionType *iceberg.StructType) *PartitionAggregate
- type PartitionRecord
- type PartitionStructBuilder
- type RowGroupBloomPred
- type RowGroupDictionaryPred
- type RowGroupSpan
- type StatisticsCollector
- type StatsAgg
- type TypedStats
- type WriteFileInfo
Constants ¶
const ( ParquetRowGroupSizeBytesKey = "write.parquet.row-group-size-bytes" ParquetRowGroupSizeBytesDefault = 128 * 1024 * 1024 // 128 MB ParquetRowGroupLimitKey = "write.parquet.row-group-limit" ParquetRowGroupLimitDefault = 1048576 ParquetPageSizeBytesKey = "write.parquet.page-size-bytes" ParquetPageSizeBytesDefault = 1024 * 1024 // 1 MB ParquetPageRowLimitKey = "write.parquet.page-row-limit" ParquetPageRowLimitDefault = 20000 ParquetDictSizeBytesKey = "write.parquet.dict-size-bytes" ParquetDictSizeBytesDefault = 2 * 1024 * 1024 // 2 MB ParquetPageVersionKey = "write.parquet.page-version" ParquetPageVersionDefault = "2" ParquetCompressionKey = "write.parquet.compression-codec" ParquetCompressionDefault = "zstd" ParquetCompressionLevelKey = "write.parquet.compression-level" ParquetCompressionLevelDefault = -1 ParquetCompressionColumnCodecKeyPrefix = "write.parquet.compression-codec.column" ParquetCompressionColumnLevelKeyPrefix = "write.parquet.compression-level.column" ParquetBloomFilterMaxBytesKey = "write.parquet.bloom-filter-max-bytes" ParquetBloomFilterMaxBytesDefault = 1024 * 1024 ParquetBloomFilterColumnEnabledKeyPrefix = "write.parquet.bloom-filter-enabled.column" ParquetBloomFilterColumnFPPKeyPrefix = "write.parquet.bloom-filter-fpp.column" ParquetBloomFilterColumnNDVKeyPrefix = "write.parquet.bloom-filter-ndv.column" ParquetBloomFilterAdaptiveEnabledKey = "write.parquet.bloom-filter-adaptive-enabled" ParquetBloomFilterAdaptiveEnabledDefault = false ParquetColumnStatsEnabledKeyPrefix = "write.parquet.stats-enabled.column" // Deliberately not namespaced under write.parquet: this is the parquet-mr key // Iceberg Java reads straight from the table properties, so a table carrying // it gets the same dictionary behavior from either implementation. ParquetDictEnabledKey = "parquet.enable.dictionary" ParquetDictEnabledDefault = true ParquetDictEncodingColumnEnabledKeyPrefix = "write.parquet.dict-encoding-enabled.column" ParquetShredVariantsKey = "write.parquet.shred-variants" ParquetShredVariantsDefault = false // Rows buffered per file to infer shredding (held per open partition writer). ParquetVariantBufferSizeKey = "write.parquet.variant-inference-buffer-size" ParquetVariantBufferSizeDefault = 100 ParquetBatchSizeKey = "read.parquet.batch-size" ParquetBatchSizeDefault = 1 << 17 // 131072 rows )
const ( ParquetMaxCompressedPageSizeBytesKey = "read.parquet.max-compressed-page-size-bytes" ParquetMaxCompressedPageSizeBytesDefault = parquet.DefaultMaxCompressedPageSize ParquetMaxUncompressedPageSizeBytesKey = "read.parquet.max-uncompressed-page-size-bytes" ParquetMaxUncompressedPageSizeBytesDefault = parquet.DefaultMaxUncompressedPageSize )
const RecordBatchSize = 4096
RecordBatchSize is the number of rows per Arrow record batch produced by metadata tables and partition statistics.
const SummaryOperationKey = "operation"
SummaryOperationKey is the snapshot summary key that holds the operation in the serialized summary.
Variables ¶
This section is empty.
Functions ¶
func AnalyzeVariantShredding ¶ added in v0.7.0
AnalyzeVariantShredding infers the inner Arrow type to shred the sample by, or ok=false to not shred. The result is the INNER type for NewShreddedVariantType.
func AppendVariantInt8 ¶ added in v0.8.0
AppendVariantInt8 appends v as a variant int8.
func AppendVariantInt16 ¶ added in v0.8.0
AppendVariantInt16 appends v as a variant int16; AppendInt would pick the smallest width.
func AppendVariantInt32 ¶ added in v0.8.0
AppendVariantInt32 appends v as a variant int32; AppendInt would pick the smallest width.
func AppendVariantInt64 ¶ added in v0.8.0
AppendVariantInt64 appends v as a variant int64; AppendInt would pick the smallest width.
func BBoxIntersectsXY ¶ added in v0.7.0
BBoxIntersectsXY reports whether two planar (XY) bounding boxes intersect. Boxes touching only at an edge or corner count as intersecting (closed intervals), matching Iceberg's inclusive bbox pruning: a box that might contain a matching value must not be pruned. This is the geometry (planar) rule; geography columns emit no bounds (see Bounds), so the antimeridian wrap-around case never reaches pruning.
func BigEndianToDecimal ¶ added in v0.2.0
func BigEndianToDecimal(buf []byte) (decimal.Decimal128, error)
func BuildPartitionMatchPredicate ¶ added in v0.7.0
func BuildPartitionMatchPredicate(spec iceberg.PartitionSpec, schema *iceberg.Schema, partitions []map[int]any) (iceberg.BooleanExpression, error)
BuildPartitionMatchPredicate constructs a BooleanExpression matching all rows that belong to any of the given partitions. It can be used by row-filter operations involving partition transforms (issue #1216), but dynamic partition overwrite now matches stored partition tuples directly. Partial-file rewrites still need strict partition matching (issue #1215).
partitions holds partition tuples as returned by DataFile.Partition(), each keyed by partition-field ID and carrying the field's (transformed) value. The result is an OR across distinct partitions, each clause an AND across the spec's fields:
transform(source) == value when the partition value is present IsNaN(transform(source)) when the value is a floating-point NaN (x == NaN is never true) IsNull(transform(source)) when the partition value is explicitly nil Missing partition field IDs are rejected with ErrInvalidArgument.
Duplicate tuples collapse to a single clause, and an empty input yields AlwaysFalse (matching nothing). Callers are expected to pass a partitioned spec; unpartitioned dynamic overwrites do not need a row predicate. Void fields are also accepted when their source column has been dropped (the spec represents those tombstones with source ID 0), because void always produces a null partition value and does not need a source column.
The transform is retained in the row predicate so the post-transform partition value is compared against transform(source), not against the raw source column. This is phase 1 of issue #1216. The current overwrite path cannot execute non-identity predicates for partial-file rewrites because source-column metrics are conservative and the Substrait row-filter converter rejects transformed terms; partition-level strict matching is still needed before this helper can drive those rewrites (tracked in issue #1215).
func CoercePartition ¶ added in v0.8.0
func ComparablePartitionKey ¶ added in v0.8.0
func FilePathValues ¶ added in v0.8.0
func GeoBoundsXY ¶ added in v0.7.0
GeoBoundsXY decodes a geometry column's lower and upper geo bounds (Iceberg single-value serialization; see encodeGeoBound) into their planar XY extents. ok is false when either bound is missing, malformed, or carries a NaN X/Y coordinate - all cases where the bound is unusable for pruning.
func LiteralForPartitionValue ¶ added in v0.7.0
LiteralForPartitionValue converts a partition value (as stored on a DataFile) into a typed Literal so the resulting predicate binds against the source field with the correct type, rather than relying on a string rendering.
DataFile.Partition() yields either a Literal (e.g. DecimalLiteral for decimal fields, decoded in manifest.go) or a raw Go value; both are handled.
func MakeSequencedChan ¶
func MakeSequencedChan[T any](bufferSize uint, source <-chan T, comesAfter, isNext func(a, b *T) bool, initial T) <-chan T
MakeSequencedChan creates a channel that outputs values in a given order based on the comesAfter and isNext functions. The values are read in from the provided source and then re-ordered before being sent to the output.
func MakeSequencedChanWithDiscard ¶ added in v0.7.0
func MakeSequencedChanWithDiscard[T any](bufferSize uint, source <-chan T, comesAfter, isNext func(a, b *T) bool, initial T, discard func(T)) <-chan T
MakeSequencedChanWithDiscard is MakeSequencedChan with a callback for values that remain in the reorder queue when the source is closed. Values already sent to the output are not passed to discard.
func MapExecWithDiscard ¶ added in v0.8.0
func MapExecWithDiscard[T, S any](ctx context.Context, nWorkers int, slice iter.Seq[T], fn func(T) (S, error), discard func(T)) iter.Seq2[S, error]
MapExecWithDiscard calls discard for queued inputs that no worker consumed. Inputs passed to fn belong to fn, including when fn returns an error. Completed results are delivered even after cancellation so callers can clean up. Callers must consume the iterator to the end to receive every completed result.
func NewBuilderLookup ¶ added in v0.8.0
func ParquetCompressionCodec ¶ added in v0.8.0
func ParquetCompressionCodec(value string) (compress.Compression, bool)
ParquetCompressionCodec resolves the names accepted by the Parquet writer.
func ParquetRowGroupTargetSizeBytes ¶ added in v0.7.0
func ParquetRowGroupTargetSizeBytes(props iceberg.Properties) (int64, error)
ParquetRowGroupTargetSizeBytes returns the configured uncompressed row-group size target. Iceberg Java rejects invalid and non-positive values rather than silently falling back to the default.
func PartitionValueScalar ¶ added in v0.8.0
func PositionDeleteColumnIndices ¶ added in v0.8.0
func ResolveParquetBloomColumnPaths ¶ added in v0.8.0
func ResolveParquetBloomColumnPaths(props iceberg.Properties, tableSchema, fileSchema *iceberg.Schema, pathToID map[string]int, content iceberg.ManifestEntryContent) iceberg.Properties
ResolveParquetBloomColumnPaths maps logical names by field ID, including sanitized names and list/map wrappers. Keep existing physical-path settings as a fallback; an explicit logical setting takes precedence.
func ResolveParquetStatsColumnPaths ¶ added in v0.8.0
func ResolveParquetStatsColumnPaths(props iceberg.Properties, tableSchema, fileSchema *iceberg.Schema, pathToID map[string]int, content iceberg.ManifestEntryContent) iceberg.Properties
ResolveParquetStatsColumnPaths maps Iceberg field names to the physical Parquet paths in a data file. The schema used for writing may have sanitized names or be a projection of the table schema. Java ignores these settings for delete files, which also protects position-delete file_path and pos bounds.
func ShredRecordVariants ¶ added in v0.7.0
func ShredRecordVariants(rec arrow.RecordBatch, shreddedSchema *arrow.Schema, mem memory.Allocator) (out arrow.RecordBatch, err error)
ShredRecordVariants rebuilds the shredded-variant columns of rec to match shreddedSchema (the inverse of UnshredVariant); other columns pass through.
func ShreddedArrowSchema ¶ added in v0.7.0
ShreddedArrowSchema swaps each top-level variant field in inferred (that passes canShredVariant) for a shredded type, preserving name/nullability/field-id.
func TablePropertiesFromContext ¶ added in v0.6.0
func TablePropertiesFromContext(ctx context.Context) iceberg.Properties
TablePropertiesFromContext retrieves table properties from context. Returns nil if not set.
func TruncateUpperBoundBinary ¶ added in v0.3.0
func TruncateUpperBoundText ¶ added in v0.3.0
func UnifiedPartitionType ¶ added in v0.8.0
func UnifiedPartitionType( specs []iceberg.PartitionSpec, currentSchema *iceberg.Schema, ) (*iceberg.StructType, error)
UnifiedPartitionType returns the table-wide partition type for specs, resolved against currentSchema. It contains the union of partition fields from every spec, which lets metadata tables represent live files written before partition evolution.
func ValidateBuilderLookup ¶ added in v0.8.0
func ValidateNameMappingProperty ¶ added in v0.8.0
func ValidateNameMappingProperty(props iceberg.Properties, key string, mapping iceberg.NameMapping, errInvalid error) error
ValidateNameMappingProperty returns an error wrapping errInvalid when props sets key but mapping, the name mapping parsed from that property, is nil because the value could not be parsed.
func ValidateParquetReadProperties ¶ added in v0.8.0
func ValidateParquetReadProperties(props iceberg.Properties) error
ValidateParquetReadProperties rejects invalid explicit page limits before a scan or delete starts reader goroutines. Parquet page sizes are signed int32.
func ValidateParquetWriteProperties ¶ added in v0.7.0
func ValidateParquetWriteProperties(props iceberg.Properties) error
func ValidatePositionDeletePositions ¶ added in v0.8.0
func VariantBoundLiteral ¶ added in v0.7.0
func VariantBoundLiteral(raw []byte, path string, typ iceberg.PrimitiveType) (lit iceberg.Literal, ok bool, err error)
VariantBoundLiteral decodes the stored variant bound object at the normalized path and casts it to typ.
func VariantFieldIDsFromSchema ¶ added in v0.6.0
func WKBCenterXY ¶ added in v0.8.0
WKBCenterXY returns the center of the planar XY bounding box of one WKB geometry: the midpoint of the finite X and Y coordinates of its leaf geometries, recursing into geometry collections. Both ISO WKB and EWKB are accepted (see decodeWKB), and ISO empty points decode to NaN coordinates, which are skipped like any other NaN. ok is false when the geometry has no finite X and Y coordinate at all - an empty geometry, a collection of empty members, or coordinates that are infinite - so the geometry has no usable location. err reports a value that does not decode.
func WithParquetMetadataCache ¶ added in v0.7.0
WithParquetMetadataCache adds a per-operation cache for immutable Parquet file metadata. Readers and input handles are still created per task, so parallel split tasks do not share mutable reader state.
func WithTableProperties ¶ added in v0.6.0
WithTableProperties returns a new context with the given table properties attached. These properties are used by readers to configure read behavior (e.g. batch size).
Types ¶
type AvroFileSource ¶ added in v0.8.0
type AvroFileSource struct {
// contains filtered or unexported fields
}
AvroFileSource reads Iceberg Avro object container files. The decoder streams bounded Arrow batches, preserving field IDs and nested values. Projection is applied by the scanner after the full file schema is read.
func (*AvroFileSource) GetReader ¶ added in v0.8.0
func (s *AvroFileSource) GetReader(ctx context.Context) (FileReader, error)
type DataFileOpts ¶ added in v0.6.0
type DataFileOpts struct {
Schema *iceberg.Schema
Spec iceberg.PartitionSpec
Path string
Format iceberg.FileFormat
Content iceberg.ManifestEntryContent
FileSize int64
PartitionValues map[int]any
// PreserveNullPartitionValues distinguishes an explicit null from an omitted value.
PreserveNullPartitionValues bool
// SortOrderID claims the file's rows are fully sorted by that order; zero
// makes no claim and leaves the field absent.
SortOrderID int
// FirstRowID is honored only for EntryContentData; the spec requires it to
// be null for delete files.
FirstRowID *int64
ReferencedDataFile *string
}
DataFileOpts groups the fields needed to finalize a DataFile from DataFileStatistics. Collapsing the former positional arguments into a struct keeps call sites readable and makes future additions source- compatible.
type DataFileStatistics ¶ added in v0.3.0
type DataFileStatistics struct {
RecordCount int64
ColSizes map[int]int64
ValueCounts map[int]int64
NullValueCounts map[int]int64
NanValueCounts map[int]int64
ColAggs map[int]StatsAgg
SplitOffsets []int64
EqualityFieldIDs []int
// Variant bounds: serialized variant objects keyed by parent variant field id.
VariantLowerBounds map[int][]byte
VariantUpperBounds map[int][]byte
}
func (*DataFileStatistics) PartitionValue ¶ added in v0.3.0
func (d *DataFileStatistics) PartitionValue(field iceberg.PartitionField, sc *iceberg.Schema) any
func (*DataFileStatistics) ToDataFile ¶ added in v0.3.0
func (d *DataFileStatistics) ToDataFile(opts DataFileOpts) iceberg.DataFile
type Enumerated ¶
Enumerated is a quick way to represent a sequenced value that can be processed in parallel and then needs to be reordered.
type FileFormat ¶ added in v0.3.0
type FileFormat interface {
Open(context.Context, iceio.IO, string) (FileReader, error)
PathToIDMapping(*iceberg.Schema) (map[string]int, error)
DataFileStatsFromMeta(rdr Metadata, statsCols map[int]StatisticsCollector, colMapping map[string]int, variantFieldIDs map[int]struct{}, arrowSchema *arrow.Schema) *DataFileStatistics
GetWriteProperties(iceberg.Properties) any
WriteDataFile(ctx context.Context, fs iceio.WriteFileIO, partitionValues map[int]any, info WriteFileInfo, batches []arrow.RecordBatch) (iceberg.DataFile, error)
NewFileWriter(ctx context.Context, fs iceio.WriteFileIO, partitionValues map[int]any, info WriteFileInfo, arrowSchema *arrow.Schema) (FileWriter, error)
}
func FormatFromFileName ¶ added in v0.3.0
func FormatFromFileName(fileName string) FileFormat
func GetFileFormat ¶ added in v0.3.0
func GetFileFormat(format iceberg.FileFormat) FileFormat
type FileReader ¶
type FileReader interface {
io.Closer
Metadata() Metadata
SourceFileSize() int64
Schema() (*arrow.Schema, error)
// PrunedSchema takes in the list of projected field IDs and returns the arrow schema
// that represents the underlying file schema with only the projected fields. It also
// returns the indexes of the projected columns to allow reading *only* the needed
// columns.
PrunedSchema(projectedIDs map[int]struct{}, mapping iceberg.NameMapping) (*arrow.Schema, []int, error)
// GetRecords returns a record reader for only the provided columns (using nil will read
// all of the columns of the underlying file.) The `tester` is a function that can be used,
// if non-nil, to filter aspects of the file such as skipping row groups in a parquet file.
GetRecords(ctx context.Context, cols []int, tester any) (array.RecordReader, error)
// ReadTable reads the entire file and returns it as an arrow table.
ReadTable(context.Context) (arrow.Table, error)
}
type FileSource ¶
type FileSource interface {
GetReader(context.Context) (FileReader, error)
}
func GetFile ¶
func GetFile(ctx context.Context, fs iceio.IO, dataFile iceberg.DataFile, isPosDeletes bool) (FileSource, error)
GetFile opens the given file using the provided file system.
The FileSource interface allows abstracting away the underlying file format while providing utilties to read the file as Arrow record batches.
type FileWriter ¶ added in v0.6.0
type FileWriter interface {
Write(arrow.RecordBatch) error
BytesWritten() int64
Close() (iceberg.DataFile, error)
// Abort closes the underlying file handle without finalizing the
// file format (e.g. Parquet footer). It is safe to call regardless
// of how many rows have been written and should be used on error
// paths where Close() may panic or produce an invalid file.
Abort() error
}
FileWriter is an incremental single-file writer with open/write/close lifecycle. It writes Arrow record batches and tracks bytes written for rolling file decisions.
type GeoBoundsAggregator ¶ added in v0.7.0
type GeoBoundsAggregator struct {
// contains filtered or unexported fields
}
GeoBoundsAggregator combines the per-data-file geospatial bounds emitted by geoBoundsAccumulator (the single-value serialization written into a DataFile's lower/upper bounds; see Bounds) across multiple files into one bounding box. It is the manifest-level analogue of the primitive min/max aggregation the manifest writer already does per partition field, but geo bounds are coordinate tuples with no total order, so they must never be folded with a scalar byte comparison: each bound is decoded to its coordinates and merged dimension by dimension. The combined box is returned in the same serialization, so it round-trips through a manifest bound exactly like a per-file one.
The aggregator is geometry-only: it folds each dimension with a scalar min/max, which is correct for geometry's planar bounds but wrong for geography. A geography box may cross the antimeridian, encoded as lower_x > upper_x (spec Appendix D); scalar min/max would silently unwrap it (merging a wrapped [170, -170] with [10, 20] yields [10, 20], dropping the wrapped range), producing a box that prunes rows it should keep. Because the bound bytes carry no type, callers must declare geography via NewGeoBoundsAggregator so Add can reject it (see Add). iceberg-go itself emits no per-file bounds for geography (see Bounds), so the common path — passing empty geography bounds through — is a harmless no-op; only non-empty geography bounds (e.g. from files written by another engine) are refused, until geodesic/antimeridian-aware aggregation is added.
func NewGeoBoundsAggregator ¶ added in v0.7.0
func NewGeoBoundsAggregator(isGeography bool) *GeoBoundsAggregator
NewGeoBoundsAggregator returns an aggregator for a single geo column. Pass isGeography=true for geography columns so Add refuses their bounds rather than mis-merging antimeridian-crossing boxes (see GeoBoundsAggregator). The zero-value GeoBoundsAggregator is a valid geometry aggregator.
func (*GeoBoundsAggregator) Add ¶ added in v0.7.0
func (g *GeoBoundsAggregator) Add(lower, upper []byte) error
Add merges one data file's lower and upper geo bounds into the aggregate. The two bounds must share a layout, which they always do: a file's lower and upper are written together by geoBoundsAccumulator. An empty pair (nil/empty lower and upper) contributes nothing, so files without geo bounds - including every geography file written by iceberg-go - can be passed through harmlessly. It errors when a bound is a non-empty but invalid length, when lower and upper disagree on layout, or when a non-empty bound is added to a geography aggregator (scalar folding would mis-merge antimeridian-crossing boxes; see GeoBoundsAggregator).
func (*GeoBoundsAggregator) Bounds ¶ added in v0.7.0
func (g *GeoBoundsAggregator) Bounds() (lower, upper []byte)
Bounds returns the combined lower and upper bound points in the Iceberg geospatial single-value serialization, or nil when no file contributed a bounding box. An optional Z/M dimension is dropped unless every added file carried it (see the field docs).
type MetricModeType ¶ added in v0.3.0
type MetricModeType string
const ( MetricModeTruncate MetricModeType = "truncate" MetricModeNone MetricModeType = "none" MetricModeCounts MetricModeType = "counts" MetricModeFull MetricModeType = "full" )
type MetricsMode ¶ added in v0.3.0
type MetricsMode struct {
Typ MetricModeType
Len int
}
func MatchMetricsMode ¶ added in v0.3.0
func MatchMetricsMode(mode string) (MetricsMode, error)
type ParquetFileSource ¶
type ParquetFileSource struct {
// contains filtered or unexported fields
}
func (*ParquetFileSource) GetReader ¶
func (pfs *ParquetFileSource) GetReader(ctx context.Context) (result FileReader, err error)
type ParquetFileWriter ¶ added in v0.6.0
type ParquetFileWriter struct {
// contains filtered or unexported fields
}
ParquetFileWriter is an incremental single-file writer with open/write/close lifecycle. It writes Arrow record batches to a Parquet file and tracks bytes written for rolling file decisions.
func (*ParquetFileWriter) Abort ¶ added in v0.6.0
func (w *ParquetFileWriter) Abort() error
func (*ParquetFileWriter) BytesWritten ¶ added in v0.6.0
func (w *ParquetFileWriter) BytesWritten() int64
BytesWritten returns the number of bytes flushed to the output so far.
func (*ParquetFileWriter) Close ¶ added in v0.6.0
func (w *ParquetFileWriter) Close() (_ iceberg.DataFile, err error)
Close finalizes the Parquet file and returns the resulting DataFile with accurate file statistics and size.
func (*ParquetFileWriter) Write ¶ added in v0.6.0
func (w *ParquetFileWriter) Write(batch arrow.RecordBatch) error
Write appends a record batch to the Parquet file.
type ParquetRowGroupTester ¶ added in v0.6.0
type ParquetRowGroupTester struct {
StatsFn func(*metadata.RowGroupMetaData, []int) (bool, error)
// StatsFieldIDs limits StatsFn to Parquet columns referenced by the pruning
// expression. Nil preserves the historical behavior of using all read columns.
// A non-nil empty slice requests no column statistics.
StatsFieldIDs []int
BloomPreds []RowGroupBloomPred // nil = no bloom filter pass
DictionaryPreds []RowGroupDictionaryPred // nil = no dictionary filter pass
// RangeSet indicates that Start and Length came from an explicit scan task.
// Without it, the zero value keeps the historical full-file behavior for
// callers that construct a tester only for row-group pruning.
RangeSet bool
// When RangeSet is true, Start and Length select row groups whose absolute
// Parquet row-group offset falls in [Start, Start+Length).
Start, Length int64
// PlanningSplitOffsets contains the split offsets used when the scan task
// was planned. It may be a borrowed view of DataFile state and must be
// treated as read-only for the lifetime of this tester. When it contains one
// valid offset per row group, range selection uses these offsets instead of
// re-deriving them from the opened Parquet footer. Sparse split-offset lists
// fall back to the footer offsets.
PlanningSplitOffsets []int64
// Survivors, if non-nil, is reset and then filled with one span per row group
// that survives pruning, in file order, with positions relative to the full
// file. It lets callers reconstruct each emitted row's original position even
// when pruning skips groups. Set to nil when no group is skipped.
Survivors *[]RowGroupSpan
}
ParquetRowGroupTester combines stats-based, dictionary, and bloom filter row group pruning. Pass it as the tester argument to wrapPqArrowReader.GetRecords.
type PartitionAggregate ¶ added in v0.8.0
type PartitionAggregate struct {
SpecID int32
Partition map[int]any
DataRecordCount int64
DataFileCount int32
DataFileSize int64
PositionDeleteCount int64
PositionDeleteFiles int32
EqualityDeleteCount int64
EqualityDeleteFiles int32
LastUpdatedAt *int64
LastUpdatedSnapshot *int64
OrderingKey string
// Persisted partition statistics distinguish DVs from classic delete files
// and expose an exact live-row total only when metadata proves it.
DeletionVectorCount int32
TotalRecordCount *int64
// Partition statistics store timestamps in milliseconds, while the inspect
// Arrow output above uses microseconds.
StatisticsUpdatedAt *int64
StatisticsUpdatedSnapshot *int64
}
type PartitionAggregateTree ¶ added in v0.8.0
type PartitionAggregateTree struct {
// contains filtered or unexported fields
}
func NewPartitionAggregateTree ¶ added in v0.8.0
func NewPartitionAggregateTree() *PartitionAggregateTree
func (*PartitionAggregateTree) Insert ¶ added in v0.8.0
func (t *PartitionAggregateTree) Insert(record PartitionRecord, aggregate *PartitionAggregate)
Insert walks the positional record, while LookupPartition walks partition field IDs. Build records with the same partition type so their field order stays aligned.
func (*PartitionAggregateTree) Lookup ¶ added in v0.8.0
func (t *PartitionAggregateTree) Lookup(record PartitionRecord) *PartitionAggregate
func (*PartitionAggregateTree) LookupPartition ¶ added in v0.8.0
func (t *PartitionAggregateTree) LookupPartition( partition map[int]any, partitionType *iceberg.StructType, ) *PartitionAggregate
type PartitionRecord ¶ added in v0.8.0
type PartitionRecord []any
func NewPartitionRecord ¶ added in v0.8.0
func NewPartitionRecord(partitionData map[int]any, partitionType *iceberg.StructType) PartitionRecord
func (PartitionRecord) Get ¶ added in v0.8.0
func (p PartitionRecord) Get(pos int) any
func (PartitionRecord) Set ¶ added in v0.8.0
func (p PartitionRecord) Set(pos int, val any)
func (PartitionRecord) Size ¶ added in v0.8.0
func (p PartitionRecord) Size() int
type PartitionStructBuilder ¶ added in v0.8.0
type PartitionStructBuilder struct {
// contains filtered or unexported fields
}
func NewPartitionStructBuilder ¶ added in v0.8.0
func NewPartitionStructBuilder( builder *array.StructBuilder, partitionType *iceberg.StructType, ) (*PartitionStructBuilder, error)
type RowGroupBloomPred ¶ added in v0.6.0
type RowGroupBloomPred struct {
FieldID int
PhysBytes [][]byte // one entry for EqualTo; one per value for In
}
RowGroupBloomPred holds the physical-encoded bytes for each literal in a bloom-filterable predicate on one field. A row group can be skipped when NONE of the bytes appear in the column's bloom filter.
type RowGroupDictionaryPred ¶ added in v0.7.0
type RowGroupDictionaryPred struct {
FieldID int
PhysBytes [][]byte // one entry for EqualTo; one per value for In
}
RowGroupDictionaryPred holds the physical-encoded bytes for each literal in a dictionary-prunable predicate on one field. A row group can be skipped when NONE of the bytes occur in its complete dictionary. It intentionally mirrors RowGroupBloomPred because both predicates use the same physical literal encoding.
type RowGroupSpan ¶ added in v0.7.0
RowGroupSpan locates a surviving row group within the data file: the absolute position of its first row and the number of rows it holds.
type StatisticsCollector ¶ added in v0.3.0
type StatisticsCollector struct {
FieldID int
IcebergTyp iceberg.PrimitiveType
Mode MetricsMode
ColName string
}
type TypedStats ¶ added in v0.3.0
type TypedStats[T iceberg.LiteralType] interface { Min() T Max() T }
type WriteFileInfo ¶ added in v0.3.0
type WriteFileInfo struct {
FileSchema *iceberg.Schema
// PropertySchema retains the table's original field names when FileSchema
// has been sanitized for a file format. Field IDs are shared by both.
PropertySchema *iceberg.Schema
Spec iceberg.PartitionSpec
FileName string
StatsCols map[int]StatisticsCollector
ColMapping map[string]int
VariantFieldIDs map[int]struct{}
WriteProps any
RowGroupBytes int64
Content iceberg.ManifestEntryContent
EqualityFieldIDs []int
SortOrderID int
}
Source Files
¶
- avro_arrow.go
- avro_files.go
- avro_read_validation.go
- geo_codec.go
- interfaces.go
- name_mapping.go
- parquet_bloom_properties.go
- parquet_column_compression.go
- parquet_files.go
- parquet_read_cache.go
- parquet_read_properties.go
- partition_aggregate.go
- partition_key.go
- partition_predicate.go
- partition_record.go
- partition_struct_builder.go
- position_delete_columns.go
- record_batch_size.go
- snapshot_summary.go
- unified_partition_type.go
- utils.go
- variant_bounds.go
- variant_shredding.go
- variant_shredding_writer.go