hash

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenHashMurMur

func GenHashMurMur(key []byte) uint32

func HashValue

func HashValue(val *types.Value) uint32

* @return the hash of the value

Types

type LinearProbeHashTable

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

*

  • Implementation of linear probing hash table that is backed by a buffer pool
  • manager. Non-unique keys are supported. Supports insert and delete. The
  • table dynamically grows once full.

TODO: (SDB) LinearProbeHashTable does not dynamically grows...

func NewLinearProbeHashTable

func NewLinearProbeHashTable(bpm *buffer.BufferPoolManager, numBuckets int, headerPageId types.PageID) *LinearProbeHashTable

func (*LinearProbeHashTable) GetHeaderPageId added in v0.0.2

func (ht *LinearProbeHashTable) GetHeaderPageId() types.PageID

func (*LinearProbeHashTable) GetValue

func (ht *LinearProbeHashTable) GetValue(key []byte) []uint32

func (*LinearProbeHashTable) Insert

func (ht *LinearProbeHashTable) Insert(key []byte, value uint32) (err error)

func (*LinearProbeHashTable) Remove

func (ht *LinearProbeHashTable) Remove(key []byte, value uint32)

type TmpTuple

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

when doing hash join we create a temp page to store all the tuple from left table which corresponds to the input key from right tuple so that we can refer to this page when calling Next from the hash join executor

func NewTmpTuple

func NewTmpTuple(page_id types.PageID, offset uint32) *TmpTuple

func (*TmpTuple) Equals

func (tt *TmpTuple) Equals(rhs *TmpTuple) bool

func (*TmpTuple) GetOffset

func (tt *TmpTuple) GetOffset() uint32

func (*TmpTuple) GetPageId

func (tt *TmpTuple) GetPageId() types.PageID

type TmpTuplePage

type TmpTuplePage struct {
	page.Page
}

*

  • TmpTuplePage format: *
  • Sizes are in bytes.
  • | PageId (4) | LSN (4) | FreeSpace (4) | (free space) | TupleSize2 | TupleData2 | TupleSize1 | TupleData1 | *
  • We choose this format because DeserializeExpression expects to read Size followed by Data.

func CastPageAsTmpTuplePage

func CastPageAsTmpTuplePage(page *page.Page) *TmpTuplePage

CastPageAsTmpTuplePage casts the abstract Page struct into TmpTuplePage

func (*TmpTuplePage) Get

func (p *TmpTuplePage) Get(tuple_ *tuple.Tuple, offset uint32)

func (*TmpTuplePage) GetFreeSpacePointer

func (p *TmpTuplePage) GetFreeSpacePointer() uint32

func (*TmpTuplePage) GetNextPosToInsert

func (p *TmpTuplePage) GetNextPosToInsert() []byte

func (*TmpTuplePage) GetOffset

func (p *TmpTuplePage) GetOffset() uint32

func (*TmpTuplePage) GetTablePageId

func (p *TmpTuplePage) GetTablePageId() types.PageID

func (*TmpTuplePage) Init

func (p *TmpTuplePage) Init(page_id types.PageID, page_size uint32)

similar code learned from table_page.h/cpp :)

func (*TmpTuplePage) Insert

func (p *TmpTuplePage) Insert(tuple_ *tuple.Tuple, out *TmpTuple) bool

func (*TmpTuplePage) SetFreeSpacePointer

func (p *TmpTuplePage) SetFreeSpacePointer(size uint32)

func (*TmpTuplePage) SetPageId

func (p *TmpTuplePage) SetPageId(page_id types.PageID)

Jump to

Keyboard shortcuts

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