filesort

package
v0.0.0-...-08a93fc Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder builds a new FileSorter.

func (*Builder) Build

func (b *Builder) Build() (*FileSorter, error)

Build creates a FileSorter instance using given data.

func (*Builder) SetBuf

func (b *Builder) SetBuf(bufSize int) *Builder

SetBuf sets the number of rows FileSorter can hold in memory at a time.

func (*Builder) SetDesc

func (b *Builder) SetDesc(byDesc []bool) *Builder

SetDesc sets the ordering rule of row comparison.

func (*Builder) SetDir

func (b *Builder) SetDir(tmpDir string) *Builder

SetDir sets the working directory for FileSorter.

func (*Builder) SetSC

func (b *Builder) SetSC(sc *variable.StatementContext) *Builder

SetSC sets StatementContext instance which is required in row comparison.

func (*Builder) SetSchema

func (b *Builder) SetSchema(keySize, valSize int) *Builder

SetSchema sets the schema of row, including key size and value size.

type FileSorter

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

FileSorter sorts the given rows according to the byDesc order. FileSorter can sort rows that exceed predefined memory capacity.

func (*FileSorter) Close

func (fs *FileSorter) Close() error

Close terminates the input or output process and discards all remaining data.

func (*FileSorter) Input

func (fs *FileSorter) Input(key []types.Datum, val []types.Datum, handle int64) error

Input adds one row into FileSorter. Caller should not call Input after calling Output.

func (*FileSorter) Len

func (fs *FileSorter) Len() int

Len implements sort.Interface Len interface.

func (*FileSorter) Less

func (fs *FileSorter) Less(i, j int) bool

Less implements sort.Interface Less interface.

func (*FileSorter) Output

func (fs *FileSorter) Output() ([]types.Datum, []types.Datum, int64, error)

Output gets the next sorted row.

func (*FileSorter) Swap

func (fs *FileSorter) Swap(i, j int)

Swap implements sort.Interface Swap interface.

Jump to

Keyboard shortcuts

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