rowcodec

package
v0.0.0-...-1338f1b Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NilFlag          byte = 0
	BytesFlag        byte = 1
	CompactBytesFlag byte = 2
	IntFlag          byte = 3
	UintFlag         byte = 4
	VarintFlag       byte = 8
	VaruintFlag      byte = 9
)

First byte in the encoded value which specifies the encoding type.

View Source
const CodecVer = 128

CodecVer is the constant number that represent the new row format.

Variables

This section is empty.

Functions

func IsRowKey

func IsRowKey(key []byte) bool

func IsRowKeyWithShardByte

func IsRowKeyWithShardByte(key []byte) bool

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder decodes the row to chunk.Chunk.

func NewDecoder

func NewDecoder(requestColIDs []int64, handleColID int64, tps []*types.FieldType, origDefaults [][]byte,
	loc *time.Location) (*Decoder, error)

NewDecoder creates a NewDecoder. requestColIDs is the columnIDs to decode. tps is the field types for request columns. origDefault is the original default value in old format, if the column ID is not found in the row, the origDefault will be used.

func (*Decoder) ColumnIsNull

func (decoder *Decoder) ColumnIsNull(rowData []byte, colID int64, defaultVal []byte) (bool, error)

ColumnIsNull returns if the column value is null. Mainly used for count column aggregation.

func (*Decoder) Decode

func (decoder *Decoder) Decode(rowData []byte, handle int64, chk *chunk.Chunk) error

Decode decodes a row to chunk.

func (Decoder) String

func (r Decoder) String() string

String implements the strings.Stringer interface.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder is used to encode a row.

func (*Encoder) Encode

func (encoder *Encoder) Encode(colIDs []int64, values []types.Datum, buf []byte) ([]byte, error)

Encode encodes a row from a datums slice.

func (*Encoder) EncodeFromOldRow

func (encoder *Encoder) EncodeFromOldRow(oldRow, buf []byte) ([]byte, error)

EncodeFromOldRow encodes a row from an old-format row.

func (Encoder) String

func (r Encoder) String() string

String implements the strings.Stringer interface.

Jump to

Keyboard shortcuts

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