mergesort

package
v1.2.3-hotfix-20240916 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 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, 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,
	txnInfo string,
	sortkeyPos 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,
	toLayout []uint32) ([]*batch.Batch, func(), []int, error)

func NewBlkTransferBooking added in v1.2.0

func NewBlkTransferBooking(size int) *api.BlkTransferBooking

func ReshapeBatches added in v1.2.0

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

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 []int, toLayout []uint32)

Types

type AObjMerger added in v1.2.0

type AObjMerger interface {
	Merge(context.Context) ([]*batch.Batch, func(), []int, 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
	Name() string
	HostHintName() string
	GetCommitEntry() *api.MergeCommitEntry
	InitTransferMaps(blkCnt int)
	GetTransferMaps() *api.TransferMaps
	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() uint64 // total size of all objects, definitely there are cases where the size exceeds 4G, so use uint64
	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