decoder

package
v1.1.0-beta.0...-2a72e7f Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFullDecodeColMap

func BuildFullDecodeColMap(cols []*table.Column, schema *expression.Schema) map[int64]Column

BuildFullDecodeColMap builds a map that contains [columnID -> struct{*table.Column, expression.Expression}] from all columns.

Types

type Column

type Column struct {
	Col     *table.Column
	GenExpr expression.Expression
}

Column contains the info and generated expr of column.

type RowDecoder

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

RowDecoder decodes a byte slice into datums and eval the generated column value.

func NewRowDecoder

func NewRowDecoder(tbl table.Table, cols []*table.Column, decodeColMap map[int64]Column) *RowDecoder

NewRowDecoder returns a new RowDecoder.

func (*RowDecoder) CurrentRowWithDefaultVal

func (rd *RowDecoder) CurrentRowWithDefaultVal() chunk.Row

CurrentRowWithDefaultVal returns current decoding row with default column values set properly. Please make sure calling DecodeAndEvalRowWithMap first.

func (*RowDecoder) DecodeAndEvalRowWithMap

func (rd *RowDecoder) DecodeAndEvalRowWithMap(ctx exprctx.BuildContext, handle kv.Handle, b []byte, decodeLoc *time.Location, row map[int64]types.Datum) (map[int64]types.Datum, error)

DecodeAndEvalRowWithMap decodes a byte slice into datums and evaluates the generated column value.

func (*RowDecoder) DecodeTheExistedColumnMap

func (rd *RowDecoder) DecodeTheExistedColumnMap(ctx exprctx.BuildContext, handle kv.Handle, b []byte, decodeLoc *time.Location, row map[int64]types.Datum) (map[int64]types.Datum, error)

DecodeTheExistedColumnMap is used by ddl column-type-change first column reorg stage. In the function, we only decode the existed column in the row and fill the default value. For changing column, we shouldn't cast it here, because we will do a unified cast operation latter. For generated column, we didn't cast it here too, because the eval process will depend on the changing column.

func (*RowDecoder) EvalRemainedExprColumnMap

func (rd *RowDecoder) EvalRemainedExprColumnMap(ctx exprctx.BuildContext, row map[int64]types.Datum) (map[int64]types.Datum, error)

EvalRemainedExprColumnMap is used by ddl column-type-change first column reorg stage. It is always called after DecodeTheExistedColumnMap to finish the generated column evaluation.

Jump to

Keyboard shortcuts

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