hashmap

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	UnitLimit             = 256
	HashMapSizeThreshHold = UnitLimit * 128
	HashMapSizeEstimate   = UnitLimit * 32
)

Variables

View Source
var (
	OneUInt8s []uint8
	OneInt64s []int64
)

Functions

This section is empty.

Types

type HashMap added in v0.6.0

type HashMap interface {
	// HasNull returns whether the hash map considers the null values.
	HasNull() bool
	// Free method frees the hash map.
	Free()
	// AddGroup adds 1 to the row count of hash map.
	AddGroup()
	// AddGroups adds N to the row count of hash map.
	AddGroups(uint64)
	// GroupCount returns the hash map's row count.
	GroupCount() uint64
	// Size returns the hash map's size
	Size() int64
}

HashMap is the encapsulated hash table interface exposed to the outside

type IntHashMap added in v0.6.0

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

IntHashMap key is int64, value is an uint64 (start from 1) before you use the IntHashMap, the user should make sure that sum of vectors' length equal to 8

func NewIntHashMap added in v0.6.0

func NewIntHashMap(hasNull bool, ibucket, nbucket uint64, m *mpool.MPool) (*IntHashMap, error)

func (*IntHashMap) AddGroup added in v0.6.0

func (m *IntHashMap) AddGroup()

func (*IntHashMap) AddGroups added in v0.6.0

func (m *IntHashMap) AddGroups(rows uint64)

func (*IntHashMap) Cardinality added in v0.6.0

func (m *IntHashMap) Cardinality() uint64

func (*IntHashMap) Free added in v0.6.0

func (m *IntHashMap) Free()

func (*IntHashMap) GroupCount added in v0.6.0

func (m *IntHashMap) GroupCount() uint64

func (*IntHashMap) HasNull added in v0.6.0

func (m *IntHashMap) HasNull() bool

func (*IntHashMap) NewIterator added in v0.6.0

func (m *IntHashMap) NewIterator() *intHashMapIterator

func (*IntHashMap) PreAlloc added in v1.0.0

func (m *IntHashMap) PreAlloc(n uint64, mp *mpool.MPool) error

func (*IntHashMap) Size added in v0.7.0

func (m *IntHashMap) Size() int64

type Iterator added in v0.6.0

type Iterator interface {
	// Insert vecs[start, start+count) into hashmap
	// vs  : the number of rows corresponding to each value in the hash table (start with 1)
	// zvs : if zvs[i] is 0 indicates the presence null, 1 indicates the absence of a null.
	Insert(start, count int, vecs []*vector.Vector) (vs []uint64, zvs []int64, err error)

	// Find vecs[start, start+count) in hashmap
	// vs  : the number of rows corresponding to each value in the hash table (start with 1, and 0 means not found.)
	// zvs : if zvs[i] is 0 indicates the presence null, 1 indicates the absence of a null.
	Find(start, count int, vecs []*vector.Vector, inBuckets []uint8) (vs []uint64, zvs []int64)
}

Iterator allows users to do insert or find operations on hash tables in bulk.

type JoinMap added in v0.6.0

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

JoinMap is used for join

func NewJoinMap added in v0.6.0

func NewJoinMap(sels [][]int32, expr *plan.Expr, ihm *IntHashMap, shm *StrHashMap, hasNull bool, isDup bool) *JoinMap

func (*JoinMap) Dup added in v0.6.0

func (jm *JoinMap) Dup() *JoinMap

func (*JoinMap) Expr added in v0.6.0

func (jm *JoinMap) Expr() *plan.Expr

func (*JoinMap) Free added in v0.6.0

func (jm *JoinMap) Free()

func (*JoinMap) HasNull added in v0.6.0

func (jm *JoinMap) HasNull() bool

func (*JoinMap) IncRef added in v0.6.0

func (jm *JoinMap) IncRef(ref int64)

func (*JoinMap) IsDup added in v1.0.0

func (jm *JoinMap) IsDup() bool

func (*JoinMap) NewIterator added in v1.0.0

func (jm *JoinMap) NewIterator() Iterator

func (*JoinMap) Sels added in v0.6.0

func (jm *JoinMap) Sels() [][]int32

func (*JoinMap) SetDupCount added in v0.7.0

func (jm *JoinMap) SetDupCount(ref int64)

func (*JoinMap) Size added in v0.7.0

func (jm *JoinMap) Size() int64

type StrHashMap

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

StrHashMap key is []byte, value is an uint64 value (starting from 1)

each time a new key is inserted, the hashtable returns a last-value+1 or, if the old key is inserted, the value corresponding to that key

func NewStrMap

func NewStrMap(hasNull bool, ibucket, nbucket uint64, m *mpool.MPool) (*StrHashMap, error)

func (*StrHashMap) AddGroup added in v0.6.0

func (m *StrHashMap) AddGroup()

func (*StrHashMap) AddGroups added in v0.6.0

func (m *StrHashMap) AddGroups(rows uint64)

func (*StrHashMap) Cardinality added in v0.6.0

func (m *StrHashMap) Cardinality() uint64

func (*StrHashMap) Free added in v0.6.0

func (m *StrHashMap) Free()

func (*StrHashMap) GroupCount added in v0.6.0

func (m *StrHashMap) GroupCount() uint64

func (*StrHashMap) HasNull added in v0.6.0

func (m *StrHashMap) HasNull() bool

func (*StrHashMap) Insert

func (m *StrHashMap) Insert(vecs []*vector.Vector, row int) (bool, error)

Insert a row from multiple columns into the hashmap, return true if it is new, otherwise false

func (*StrHashMap) InsertValue

func (m *StrHashMap) InsertValue(val any) (bool, error)

InsertValue insert a value, return true if it is new, otherwise false never handle null

func (*StrHashMap) NewIterator added in v0.6.0

func (m *StrHashMap) NewIterator() Iterator

func (*StrHashMap) PreAlloc added in v1.0.0

func (m *StrHashMap) PreAlloc(n uint64, mp *mpool.MPool) error

func (*StrHashMap) Size added in v0.7.0

func (m *StrHashMap) Size() int64

Jump to

Keyboard shortcuts

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