mergesort

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package heap provides heap operations for any type that implements heap.Interface. A heap is a tree with the property that each node is the minimum-valued node in its subtree.

The minimum element in the tree is the root, at index 0.

A heap is a common way to implement a priority queue. To build a priority queue, implement the Heap interface with the (negative) priority as the ordering for the Less method, so Push adds items while Pop removes the highest-priority item from the queue. The Examples include such an implementation; the file example_pq_test.go has the complete source.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMoreBlocks = moerr.NewInternalErrorNoCtx("no more blocks")

Functions

func AddSortPhaseMapping added in v1.2.0

func AddSortPhaseMapping(b *api.BlkTransferBooking, idx int, originRowCnt int, deletes *nulls.Nulls, mapping []int64)

func CleanTransMapping added in v1.2.0

func CleanTransMapping(b *api.BlkTransferBooking)

func DoMergeAndWrite added in v1.2.0

func DoMergeAndWrite(
	ctx context.Context,
	sortkeyPos int,
	blkMaxRow int,
	mergehost MergeTaskHost,
) (err error)

func GetNewWriter added in v1.2.0

func GetNewWriter(
	fs fileservice.FileService,
	ver uint32, seqnums []uint16,
	sortkeyPos int, sortkeyIsPK bool,
) *blockio.BlockWriter

func MergeAObj added in v1.2.0

func MergeAObj(
	ctx context.Context,
	vpool DisposableVecPool,
	batches []*containers.Batch,
	sortKeyPos int,
	rowPerBlk uint32,
	resultBlkCnt int) ([]*batch.Batch, func(), []uint32, error)

func NewBlkTransferBooking added in v1.2.0

func NewBlkTransferBooking(size int) *api.BlkTransferBooking

func ReshapeBatches added in v1.2.0

func ReshapeBatches(
	batches []*batch.Batch,
	fromLayout, toLayout []uint32,
	vpool DisposableVecPool) ([]*batch.Batch, func())

func SortBlockColumns

func SortBlockColumns(
	cols []containers.Vector, pk int, pool *containers.VectorPool,
) ([]int64, error)

func UpdateMappingAfterMerge added in v1.2.0

func UpdateMappingAfterMerge(b *api.BlkTransferBooking, mapping, toLayout []uint32)

Types

type AObjMerger added in v1.2.0

type AObjMerger interface {
	Merge(context.Context) ([]*batch.Batch, func(), []uint32, error)
}

type DisposableVecPool added in v1.2.0

type DisposableVecPool interface {
	GetVector(*types.Type) (ret *vector.Vector, release func())
	GetMPool() *mpool.MPool
}

DisposableVecPool bridge the gap between the vector pools in cn and tn

type MergeTaskHost added in v1.2.0

type MergeTaskHost interface {
	DisposableVecPool
	HostHintName() string
	PrepareData(context.Context) ([]*batch.Batch, []*nulls.Nulls, func(), error)
	GetCommitEntry() *api.MergeCommitEntry
	PrepareNewWriter() *blockio.BlockWriter
	DoTransfer() bool
	GetObjectCnt() int
	GetBlkCnts() []int
	GetAccBlkCnts() []int
	GetSortKeyType() types.Type
	LoadNextBatch(ctx context.Context, objIdx uint32) (*batch.Batch, *nulls.Nulls, func(), error)
	GetTotalSize() uint32
	GetTotalRowCnt() uint32
	GetBlockMaxRows() uint32
	GetObjectMaxBlocks() uint16
	GetTargetObjSize() uint32
}

type Merger added in v1.2.0

type Merger interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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