Documentation
¶
Overview ¶
Package keyvaluelist provides KeyValue string tuples and a sorted list of KeyValues as well as utilities to transalte these into hadoop like key/path-based-partitions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFormat = fmt.Errorf("invalid format for hadoop partitions; must be QueryEscape({key})=QueryEscape({val})")
ErrInvalidFormat is returned when FromHadoopPartition fails to parse the input
Functions ¶
func MaybePartitions ¶
func MaybePartitions(record interface{}) string
MaybePartitions returns GetPartitions().ToPartitionKey() if the record is of type PartitionGetter; Otherwise it returns ""
Types ¶
type KeyValue ¶
type KeyValue struct {
Key, Value string
}
KeyValue is a string tuple used to represent an order list of KeyValue pairs (unlike a map which is un-ordered)
func FromHadoopPartition ¶
FromHadoopPartition encodes the KeyValue pair into a hadoop style partition string with the key and value QueryEncoded
func (KeyValue) ToHadoopPartition ¶
ToHadoopPartition encodes the KeyValue pair into a hadoop style partition string with the key and value QueryEncoded
type KeyValues ¶
type KeyValues []KeyValue
KeyValues is an ordered list of KeyValue elements.
func NewKeyValuesFromPath ¶
NewKeyValuesFromPath parses a hadoop/hive style path and returns any valid (if any) partition definitions as KeyValue pairs
func (KeyValues) ToFilter ¶
ToFilter turns the key values into AND:ed filename-predicates during ReadFilteredByPrefix() scans It will return a (filter) function(string) bool which will answers the question "Does all the key value pairs exist as hadoop encoded partition keys in the provided string". Only supports exact matches.
func (KeyValues) ToPartitionKey ¶
ToPartitionKey formats KeyValues as key1=va1/key2=val2/.... as is common in hadoop file storage. keys and values are query escaped
type PartitionGetter ¶
PartitionGetter is implemented by records that know how they want to be saved / clustered together.