encoding

package
v0.0.0-...-1a9adb5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package encoding provides the generic APIs implemented by parquet encodings in its sub-packages.

Index

Constants

View Source
const (
	MaxFixedLenByteArraySize = math.MaxInt16
)

Variables

View Source
var (
	// ErrNotSupported is an error returned when the underlying encoding does
	// not support the type of values being encoded or decoded.
	//
	// This error may be wrapped with type information, applications must use
	// errors.Is rather than equality comparisons to test the error values
	// returned by encoders and decoders.
	ErrNotSupported = errors.New("encoding not supported")

	// ErrInvalidArgument is an error returned one or more arguments passed to
	// the encoding functions are incorrect.
	//
	// As with ErrNotSupported, this error may be wrapped with specific
	// information about the problem and applications are expected to use
	// errors.Is for comparisons.
	ErrInvalidArgument = errors.New("invalid argument")
)

Functions

func CanEncodeBoolean

func CanEncodeBoolean(e Encoding) bool

CanEncodeBoolean reports whether e can encode BOOLEAN values.

func CanEncodeByteArray

func CanEncodeByteArray(e Encoding) bool

CanEncodeByteArray reports whether e can encode BYTE_ARRAY values.

func CanEncodeDouble

func CanEncodeDouble(e Encoding) bool

CanEncodeDouble reports whether e can encode DOUBLE values.

func CanEncodeFixedLenByteArray

func CanEncodeFixedLenByteArray(e Encoding) bool

CanEncodeFixedLenByteArray reports whether e can encode FIXED_LEN_BYTE_ARRAY values.

func CanEncodeFloat

func CanEncodeFloat(e Encoding) bool

CanEncodeFloat reports whether e can encode FLOAT values.

func CanEncodeInt32

func CanEncodeInt32(e Encoding) bool

CanEncodeInt32 reports whether e can encode INT32 values.

func CanEncodeInt64

func CanEncodeInt64(e Encoding) bool

CanEncodeInt64 reports whether e can encode INT64 values.

func CanEncodeInt96

func CanEncodeInt96(e Encoding) bool

CanEncodeInt96 reports whether e can encode INT96 values.

func CanEncodeLevels

func CanEncodeLevels(e Encoding) bool

CanEncodeInt8 reports whether e can encode LEVELS values.

func ErrDecodeInvalidInputSize

func ErrDecodeInvalidInputSize(e Encoding, typ string, size int) error

ErrDecodeInvalidInputSize constructs an error indicating that decoding failed due to the size of the input.

func ErrEncodeInvalidInputSize

func ErrEncodeInvalidInputSize(e Encoding, typ string, size int) error

ErrEncodeInvalidInputSize constructs an error indicating that encoding failed due to the size of the input.

func Error

func Error(e Encoding, err error) error

Error constructs an error which wraps err and indicates that it originated from the given encoding.

func Errorf

func Errorf(e Encoding, msg string, args ...interface{}) error

Errorf is like Error but constructs the error message from the given format and arguments.

Types

type Encoding

type Encoding interface {
	// Returns a human-readable name for the encoding.
	String() string

	// Returns the parquet code representing the encoding.
	Encoding() format.Encoding

	// Encode methods serialize the source sequence of values into the
	// destination buffer, potentially reallocating it if it was too short to
	// contain the output.
	//
	// The source are expected to be encoded using the PLAIN encoding, and
	// therefore the methods act as conversions into the target encoding.
	EncodeLevels(dst, src []byte) ([]byte, error)
	EncodeBoolean(dst, src []byte) ([]byte, error)
	EncodeInt32(dst, src []byte) ([]byte, error)
	EncodeInt64(dst, src []byte) ([]byte, error)
	EncodeInt96(dst, src []byte) ([]byte, error)
	EncodeFloat(dst, src []byte) ([]byte, error)
	EncodeDouble(dst, src []byte) ([]byte, error)
	EncodeByteArray(dst, src []byte) ([]byte, error)
	EncodeFixedLenByteArray(dst, src []byte, size int) ([]byte, error)

	// Decode methods deserialize from the source buffer into the destination
	// slice, potentially growing it if it was too short to contain the result.
	//
	// Values are written in the destination buffer in the PLAIN encoding.
	DecodeLevels(dst, src []byte) ([]byte, error)
	DecodeBoolean(dst, src []byte) ([]byte, error)
	DecodeInt32(dst, src []byte) ([]byte, error)
	DecodeInt64(dst, src []byte) ([]byte, error)
	DecodeInt96(dst, src []byte) ([]byte, error)
	DecodeFloat(dst, src []byte) ([]byte, error)
	DecodeDouble(dst, src []byte) ([]byte, error)
	DecodeByteArray(dst, src []byte) ([]byte, error)
	DecodeFixedLenByteArray(dst, src []byte, size int) ([]byte, error)
}

The Encoding interface is implemented by types representing parquet column encodings.

Encoding instances must be safe to use concurrently from multiple goroutines.

type NotSupported

type NotSupported struct {
}

NotSupported is a type satisfying the Encoding interface which does not support encoding nor decoding any value types.

func (NotSupported) DecodeBoolean

func (NotSupported) DecodeBoolean(dst, src []byte) ([]byte, error)

func (NotSupported) DecodeByteArray

func (NotSupported) DecodeByteArray(dst, src []byte) ([]byte, error)

func (NotSupported) DecodeDouble

func (NotSupported) DecodeDouble(dst, src []byte) ([]byte, error)

func (NotSupported) DecodeFixedLenByteArray

func (NotSupported) DecodeFixedLenByteArray(dst, src []byte, size int) ([]byte, error)

func (NotSupported) DecodeFloat

func (NotSupported) DecodeFloat(dst, src []byte) ([]byte, error)

func (NotSupported) DecodeInt32

func (NotSupported) DecodeInt32(dst, src []byte) ([]byte, error)

func (NotSupported) DecodeInt64

func (NotSupported) DecodeInt64(dst, src []byte) ([]byte, error)

func (NotSupported) DecodeInt96

func (NotSupported) DecodeInt96(dst, src []byte) ([]byte, error)

func (NotSupported) DecodeLevels

func (NotSupported) DecodeLevels(dst, src []byte) ([]byte, error)

func (NotSupported) EncodeBoolean

func (NotSupported) EncodeBoolean(dst, src []byte) ([]byte, error)

func (NotSupported) EncodeByteArray

func (NotSupported) EncodeByteArray(dst, src []byte) ([]byte, error)

func (NotSupported) EncodeDouble

func (NotSupported) EncodeDouble(dst, src []byte) ([]byte, error)

func (NotSupported) EncodeFixedLenByteArray

func (NotSupported) EncodeFixedLenByteArray(dst, src []byte, size int) ([]byte, error)

func (NotSupported) EncodeFloat

func (NotSupported) EncodeFloat(dst, src []byte) ([]byte, error)

func (NotSupported) EncodeInt32

func (NotSupported) EncodeInt32(dst, src []byte) ([]byte, error)

func (NotSupported) EncodeInt64

func (NotSupported) EncodeInt64(dst, src []byte) ([]byte, error)

func (NotSupported) EncodeInt96

func (NotSupported) EncodeInt96(dst, src []byte) ([]byte, error)

func (NotSupported) EncodeLevels

func (NotSupported) EncodeLevels(dst, src []byte) ([]byte, error)

func (NotSupported) Encoding

func (NotSupported) Encoding() format.Encoding

func (NotSupported) String

func (NotSupported) String() string

Directories

Path Synopsis
Package fuzz contains functions to help fuzz test parquet encodings.
Package fuzz contains functions to help fuzz test parquet encodings.
Package plain implements the PLAIN parquet encoding.
Package plain implements the PLAIN parquet encoding.
Package rle implements the hybrid RLE/Bit-Packed encoding employed in repetition and definition levels, dictionary indexed data pages, and boolean values in the PLAIN encoding.
Package rle implements the hybrid RLE/Bit-Packed encoding employed in repetition and definition levels, dictionary indexed data pages, and boolean values in the PLAIN encoding.

Jump to

Keyboard shortcuts

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