Documentation
¶
Overview ¶
Package variant decodes the values of the Parquet Variant encoding (apache/parquet-format, VariantEncoding.md): a metadata dictionary of the object keys and a value, both byte strings. It knows nothing of Vortex.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append is Encoder.Encode, the metadata and the value appended to meta and value. It takes no decimal. On an error it returns meta and value as they were.
func Decode ¶
func Decode(metadata, value []byte, dec DecimalFunc) (any, error)
Decode decodes one value, whose keys are in metadata. It returns nil, bool, int64, float64, string, []byte, time.Time, []any, map[string]any, or what dec returns for a decimal. A time of day is a time.Time on 1970-01-01, a UUID its 16 bytes.
func DecodeWith ¶
func DecodeWith(keys Keys, value []byte, dec DecimalFunc) (any, error)
DecodeWith is Decode with metadata already parsed.
Types ¶
type DecimalFunc ¶
DecimalFunc builds the Go value of a decimal: its unscaled value as little-endian two's complement bytes (4, 8 or 16 of them), and its scale.
type DecimalOf ¶
DecimalOf recognizes the decimal values of the caller: it returns the unscaled value as little-endian two's complement bytes (at most 32 of them) and the scale of v, and false for a value that is not a decimal.
type Encoder ¶
type Encoder struct {
// Decimal recognizes the decimals; nil for none.
Decimal DecimalOf
// contains filtered or unexported fields
}
Encoder turns Go values into the metadata and the value of a Variant row, the inverse of Decode. The zero Encoder takes no decimal. It reuses its buffers: after the first rows it allocates only for what a row holds besides its scalars. It is not safe for concurrent use, except for Check.
func (*Encoder) Check ¶
Check returns the error that Encode would, without building anything. It may be called concurrently.
func (*Encoder) Encode ¶
Encode returns the metadata and the value of v, which is nil, a bool, a Go integer or float of any width, a string, a []byte, a time.Time, a decimal the Encoder knows, a []any or a map[string]any of these. Integers take the narrowest width, the keys of the objects go in a sorted dictionary, and the fields of an object are in the order of their keys. The slices are valid until the next call.
type Keys ¶
type Keys struct {
// contains filtered or unexported fields
}
Keys is the dictionary of the keys of the objects of a value: the metadata.
func ParseMetadata ¶
ParseMetadata reads the header, the offsets and the strings of a metadata. The version must be 1.