partition

package
v0.18.13 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package partition implements Hive-style partitioning for table data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchesFilter

func MatchesFilter(partValues map[string]string, filter map[string]string) bool

MatchesFilter returns true if the partition values match all of the given filter values.

func ParsePartitionPath

func ParsePartitionPath(path string) (map[string]string, error)

ParsePartitionPath extracts partition key-value pairs from a Hive-style path.

func SortPartitions

func SortPartitions(partitions []PartitionInfo)

SortPartitions sorts partition infos by path for deterministic ordering.

func TablePrefix

func TablePrefix(tableName string) string

TablePrefix returns the base path for a table's data files.

func TimePartitionValues

func TimePartitionValues(t time.Time, keys []string) map[string]string

TimePartitionValues generates partition values from a timestamp using common time partition keys (year, month, day, hour).

Types

type PartitionInfo

type PartitionInfo struct {
	Path   string
	Values map[string]string
	Files  []string
}

PartitionInfo holds information about a single partition.

func PrunePartitions

func PrunePartitions(partitions []PartitionInfo, filter map[string]string) []PartitionInfo

PrunePartitions returns only the partitions that match the filter.

type Strategy

type Strategy struct {
	Keys []string // partition key columns, in order
}

Strategy determines how rows are partitioned.

func NewStrategy

func NewStrategy(keys []string) *Strategy

NewStrategy creates a partition strategy with the given keys.

func (*Strategy) FilePath

func (s *Strategy) FilePath(tablePrefix string, values map[string]string, chunkID string) string

FilePath generates a full file path for a chunk within a partition. Example: tables/events/year=2026/month=03/day=15/chunk_<uuidv7>.parquet (the caller — storage/ingest — builds chunkID; see #494 for why it must carry a full 128-bit identifier, not a truncated one).

func (*Strategy) PartitionPath

func (s *Strategy) PartitionPath(values map[string]string) string

PartitionPath generates a Hive-style partition path from partition values. Example: year=2026/month=03/day=15

Jump to

Keyboard shortcuts

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