index

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRWHelper = new(RWHelper)
)

Functions

func BlockZoneMapIndexConstructor

func BlockZoneMapIndexConstructor(vf common.IVFile, useCompress bool, freeFunc buf.MemoryFreeFunc) buf.IMemoryNode

func BuildBitSlicedIndex

func BuildBitSlicedIndex(data []*vector.Vector, t types.Type, colIdx int16, startPos int) (bsi.BitSlicedIndex, error)

func NewNumericBsiEmptyNode

func NewNumericBsiEmptyNode(vf common.IVFile, useCompress bool, freeFunc buf.MemoryFreeFunc) buf.IMemoryNode

func NewStringBsiEmptyNode

func NewStringBsiEmptyNode(vf common.IVFile, useCompress bool, freeFunc buf.MemoryFreeFunc) buf.IMemoryNode

func NumericBsiIndexConstructor

func NumericBsiIndexConstructor(vf common.IVFile, useCompress bool, freeFunc buf.MemoryFreeFunc) buf.IMemoryNode

func SegmentZoneMapIndexConstructor

func SegmentZoneMapIndexConstructor(vf common.IVFile, useCompress bool, freeFunc buf.MemoryFreeFunc) buf.IMemoryNode

func StringBsiIndexConstructor

func StringBsiIndexConstructor(vf common.IVFile, useCompress bool, freeFunc buf.MemoryFreeFunc) buf.IMemoryNode

Types

type BlockHoldersManager

type BlockHoldersManager interface {
	StrongRefBlock(uint64) *BlockIndexHolder
	RegisterBlock(common.ID, base.BlockType, PostCloseCB) *BlockIndexHolder
	DropBlock(uint64) *BlockIndexHolder
	GetBlockCount() int32
	// contains filtered or unexported methods
}

type BlockIndexHolder

type BlockIndexHolder struct {
	common.RefHelper
	ID common.ID

	BufMgr      mgrif.IBufferManager
	Inited      bool
	PostCloseCB PostCloseCB
	// contains filtered or unexported fields
}

func (*BlockIndexHolder) AllocateVersion

func (holder *BlockIndexHolder) AllocateVersion(colIdx int) uint64

func (*BlockIndexHolder) Count

func (holder *BlockIndexHolder) Count(colIdx int, filter *roaring.Bitmap) (uint64, error)

func (*BlockIndexHolder) DropIndex

func (holder *BlockIndexHolder) DropIndex(filename string)

func (*BlockIndexHolder) EvalFilter

func (holder *BlockIndexHolder) EvalFilter(colIdx int, ctx *FilterCtx) error

func (*BlockIndexHolder) IndicesCount

func (holder *BlockIndexHolder) IndicesCount() int

func (*BlockIndexHolder) Init

func (holder *BlockIndexHolder) Init(segFile base.ISegmentFile)

func (*BlockIndexHolder) LoadIndex

func (holder *BlockIndexHolder) LoadIndex(segFile base.ISegmentFile, filename string)

func (*BlockIndexHolder) Max

func (holder *BlockIndexHolder) Max(colIdx int, filter *roaring.Bitmap) (interface{}, error)

func (*BlockIndexHolder) Min

func (holder *BlockIndexHolder) Min(colIdx int, filter *roaring.Bitmap) (interface{}, error)

func (*BlockIndexHolder) NullCount

func (holder *BlockIndexHolder) NullCount(colIdx int, maxRows uint64, filter *roaring.Bitmap) (uint64, error)

func (*BlockIndexHolder) StringIndicesRefsNoLock

func (holder *BlockIndexHolder) StringIndicesRefsNoLock() string

func (*BlockIndexHolder) Sum

func (holder *BlockIndexHolder) Sum(colIdx int, filter *roaring.Bitmap) (int64, uint64, error)

type BlockZoneMapIndex

type BlockZoneMapIndex struct {
	T           types.Type
	MinV        interface{}
	MaxV        interface{}
	Col         int16
	FreeFunc    buf.MemoryFreeFunc
	File        common.IVFile
	UseCompress bool
}

func (*BlockZoneMapIndex) Btw

func (i *BlockZoneMapIndex) Btw(minv interface{}, maxv interface{}) bool

func (*BlockZoneMapIndex) Eq

func (i *BlockZoneMapIndex) Eq(v interface{}) bool

func (*BlockZoneMapIndex) Eval

func (i *BlockZoneMapIndex) Eval(ctx *FilterCtx) error

func (*BlockZoneMapIndex) FreeMemory

func (i *BlockZoneMapIndex) FreeMemory()

func (*BlockZoneMapIndex) Ge

func (i *BlockZoneMapIndex) Ge(v interface{}) bool

func (*BlockZoneMapIndex) GetCol

func (i *BlockZoneMapIndex) GetCol() int16

func (*BlockZoneMapIndex) GetMemoryCapacity

func (i *BlockZoneMapIndex) GetMemoryCapacity() uint64

func (*BlockZoneMapIndex) GetMemorySize

func (i *BlockZoneMapIndex) GetMemorySize() uint64

func (*BlockZoneMapIndex) Gt

func (i *BlockZoneMapIndex) Gt(v interface{}) bool

func (*BlockZoneMapIndex) IndexFile

func (i *BlockZoneMapIndex) IndexFile() common.IVFile

func (*BlockZoneMapIndex) Le

func (i *BlockZoneMapIndex) Le(v interface{}) bool

func (*BlockZoneMapIndex) Lt

func (i *BlockZoneMapIndex) Lt(v interface{}) bool

func (*BlockZoneMapIndex) Marshal

func (i *BlockZoneMapIndex) Marshal() ([]byte, error)

func (*BlockZoneMapIndex) Ne

func (i *BlockZoneMapIndex) Ne(v interface{}) bool

func (*BlockZoneMapIndex) ReadFrom

func (i *BlockZoneMapIndex) ReadFrom(r io.Reader) (n int64, err error)

func (*BlockZoneMapIndex) Reset

func (i *BlockZoneMapIndex) Reset()

func (*BlockZoneMapIndex) Type

func (i *BlockZoneMapIndex) Type() base.IndexType

func (*BlockZoneMapIndex) Unmarshal

func (i *BlockZoneMapIndex) Unmarshal(data []byte) error

func (*BlockZoneMapIndex) WriteTo

func (i *BlockZoneMapIndex) WriteTo(w io.Writer) (n int64, err error)

type ColumnsAllocator

type ColumnsAllocator struct {
	sync.RWMutex
	Allocators map[int]*common.IDAlloctor
}

type FilterCtx

type FilterCtx struct {
	Op  OpType
	Val interface{}

	// Used for IN | NOT IN
	ValSet map[interface{}]bool

	ValMin interface{}
	ValMax interface{}

	BoolRes bool
	BMRes   *roaring.Bitmap
	Err     error

	BsiRequired bool
	BlockSet    []uint64
}

func NewFilterCtx

func NewFilterCtx(t OpType) *FilterCtx

func (*FilterCtx) Eval

func (ctx *FilterCtx) Eval(i Index) error

func (*FilterCtx) Reset

func (ctx *FilterCtx) Reset()

type Index

type Index interface {
	buf.IMemoryNode
	Type() base.IndexType
	GetCol() int16
	Eval(ctx *FilterCtx) error
	IndexFile() common.IVFile
}

func BuildBlockZoneMapIndex

func BuildBlockZoneMapIndex(data *vector.Vector, t types.Type, colIdx int16, isSorted bool) (Index, error)

func BuildSegmentZoneMapIndex

func BuildSegmentZoneMapIndex(data []*vector.Vector, t types.Type, colIdx int16, isSorted bool) (Index, error)

func MockInt32ZmIndices

func MockInt32ZmIndices(cols int) (indices []Index)

func NewBlockZoneMap

func NewBlockZoneMap(t types.Type, minv, maxv interface{}, colIdx int16) Index

func NewBlockZoneMapEmptyNode

func NewBlockZoneMapEmptyNode(vf common.IVFile, useCompress bool, freeFunc buf.MemoryFreeFunc) Index

func NewSegmentZoneMap

func NewSegmentZoneMap(t types.Type, minv, maxv interface{}, colIdx int16, blkMin []interface{}, blkMax []interface{}) Index

func NewSegmentZoneMapEmptyNode

func NewSegmentZoneMapEmptyNode(vf common.IVFile, useCompress bool, freeFunc buf.MemoryFreeFunc) Index

type Node

type Node struct {
	*bmgr.Node
	common.RefHelper
	Cols        *roaring.Bitmap
	PostCloseCB PostCloseCB
}

func (*Node) AllCols

func (node *Node) AllCols() []uint32

func (*Node) ContainsCol

func (node *Node) ContainsCol(v uint64) bool

func (*Node) ContainsOnlyCol

func (node *Node) ContainsOnlyCol(v uint64) bool

type NumericBsiIndex

type NumericBsiIndex struct {
	bsi.NumericBSI
	T           types.Type
	Col         int16
	File        common.IVFile
	UseCompress bool
	FreeFunc    buf.MemoryFreeFunc
}

func NewNumericBsiIndex

func NewNumericBsiIndex(t types.Type, bitSize int, colIdx int16) *NumericBsiIndex

func (*NumericBsiIndex) Eval

func (i *NumericBsiIndex) Eval(ctx *FilterCtx) error

func (*NumericBsiIndex) FreeMemory

func (i *NumericBsiIndex) FreeMemory()

func (*NumericBsiIndex) GetCol

func (i *NumericBsiIndex) GetCol() int16

func (*NumericBsiIndex) GetMemoryCapacity

func (i *NumericBsiIndex) GetMemoryCapacity() uint64

func (*NumericBsiIndex) GetMemorySize

func (i *NumericBsiIndex) GetMemorySize() uint64

func (*NumericBsiIndex) IndexFile

func (i *NumericBsiIndex) IndexFile() common.IVFile

func (*NumericBsiIndex) Marshal

func (i *NumericBsiIndex) Marshal() ([]byte, error)

func (*NumericBsiIndex) ReadFrom

func (i *NumericBsiIndex) ReadFrom(r io.Reader) (n int64, err error)

func (*NumericBsiIndex) Reset

func (i *NumericBsiIndex) Reset()

func (*NumericBsiIndex) Type

func (i *NumericBsiIndex) Type() base.IndexType

func (*NumericBsiIndex) Unmarshal

func (i *NumericBsiIndex) Unmarshal(data []byte) error

func (*NumericBsiIndex) WriteTo

func (i *NumericBsiIndex) WriteTo(w io.Writer) (n int64, err error)

type OpType

type OpType uint8
const (
	OpInv OpType = iota
	OpEq
	OpNe
	OpLt
	OpLe
	OpGt
	OpGe
	OpIn
	OpOut
)

type PostCloseCB

type PostCloseCB = func(interface{})

type RWHelper

type RWHelper struct{}

func (*RWHelper) FlushBitSlicedIndex

func (h *RWHelper) FlushBitSlicedIndex(idx Index, filename string) error

func (*RWHelper) ReadIndices

func (h *RWHelper) ReadIndices(f os.File) (indices []Index, err error)

func (*RWHelper) ReadIndicesMeta

func (h *RWHelper) ReadIndicesMeta(f os.File) (meta *base.IndicesMeta, err error)

func (*RWHelper) WriteIndices

func (h *RWHelper) WriteIndices(indices []Index) ([]byte, error)

type SegmentIndexHolder

type SegmentIndexHolder interface {
	common.IRef
	BlockHoldersManager
	StandaloneIndicesManager
	Init(base.ISegmentFile)
	EvalFilter(int, *FilterCtx) error
	CollectMinMax(int) ([]interface{}, []interface{}, error)
	Count(int, *roaring64.Bitmap) (uint64, error)
	NullCount(int, uint64, *roaring64.Bitmap) (uint64, error)
	Min(int, *roaring64.Bitmap) (interface{}, error)
	Max(int, *roaring64.Bitmap) (interface{}, error)
	Sum(int, *roaring64.Bitmap) (int64, uint64, error)
	HolderType() base.SegmentType
	GetID() common.ID
	GetCB() PostCloseCB
	// contains filtered or unexported methods
}

type SegmentZoneMapIndex

type SegmentZoneMapIndex struct {
	T           types.Type
	MinV        interface{}
	MaxV        interface{}
	Col         int16
	FreeFunc    buf.MemoryFreeFunc
	File        common.IVFile
	UseCompress bool
	BlkMin      []interface{}
	BlkMax      []interface{}
}

func (*SegmentZoneMapIndex) Btw

func (i *SegmentZoneMapIndex) Btw(v interface{}) bool

func (*SegmentZoneMapIndex) Eq

func (i *SegmentZoneMapIndex) Eq(v interface{}) bool

func (*SegmentZoneMapIndex) Eval

func (i *SegmentZoneMapIndex) Eval(ctx *FilterCtx) error

func (*SegmentZoneMapIndex) FreeMemory

func (i *SegmentZoneMapIndex) FreeMemory()

func (*SegmentZoneMapIndex) Ge

func (i *SegmentZoneMapIndex) Ge(v interface{}) bool

func (*SegmentZoneMapIndex) GetCol

func (i *SegmentZoneMapIndex) GetCol() int16

func (*SegmentZoneMapIndex) GetMemoryCapacity

func (i *SegmentZoneMapIndex) GetMemoryCapacity() uint64

func (*SegmentZoneMapIndex) GetMemorySize

func (i *SegmentZoneMapIndex) GetMemorySize() uint64

func (*SegmentZoneMapIndex) Gt

func (i *SegmentZoneMapIndex) Gt(v interface{}) bool

func (*SegmentZoneMapIndex) IndexFile

func (i *SegmentZoneMapIndex) IndexFile() common.IVFile

func (*SegmentZoneMapIndex) Le

func (i *SegmentZoneMapIndex) Le(v interface{}) bool

func (*SegmentZoneMapIndex) Lt

func (i *SegmentZoneMapIndex) Lt(v interface{}) bool

func (*SegmentZoneMapIndex) Marshal

func (i *SegmentZoneMapIndex) Marshal() ([]byte, error)

func (*SegmentZoneMapIndex) Ne

func (i *SegmentZoneMapIndex) Ne(v interface{}) bool

func (*SegmentZoneMapIndex) ReadFrom

func (i *SegmentZoneMapIndex) ReadFrom(r io.Reader) (n int64, err error)

func (*SegmentZoneMapIndex) Reset

func (i *SegmentZoneMapIndex) Reset()

func (*SegmentZoneMapIndex) Type

func (*SegmentZoneMapIndex) Unmarshal

func (i *SegmentZoneMapIndex) Unmarshal(data []byte) error

func (*SegmentZoneMapIndex) WriteTo

func (i *SegmentZoneMapIndex) WriteTo(w io.Writer) (n int64, err error)

type StandaloneIndicesManager

type StandaloneIndicesManager interface {
	AllocateVersion(int) uint64
	FetchCurrentVersion(uint16, uint64) uint64
	IndicesCount() int
	DropIndex(filename string)
	LoadIndex(base.ISegmentFile, string)
	StringIndicesRefsNoLock() string
}

type StringBsiIndex

type StringBsiIndex struct {
	bsi.StringBSI
	T           types.Type
	Col         int16
	File        common.IVFile
	UseCompress bool
	FreeFunc    buf.MemoryFreeFunc
}

func NewStringBsiIndex

func NewStringBsiIndex(t types.Type, colIdx int16) *StringBsiIndex

func (*StringBsiIndex) Eval

func (i *StringBsiIndex) Eval(ctx *FilterCtx) error

func (*StringBsiIndex) FreeMemory

func (i *StringBsiIndex) FreeMemory()

func (*StringBsiIndex) GetCol

func (i *StringBsiIndex) GetCol() int16

func (*StringBsiIndex) GetMemoryCapacity

func (i *StringBsiIndex) GetMemoryCapacity() uint64

func (*StringBsiIndex) GetMemorySize

func (i *StringBsiIndex) GetMemorySize() uint64

func (*StringBsiIndex) IndexFile

func (i *StringBsiIndex) IndexFile() common.IVFile

func (*StringBsiIndex) Marshal

func (i *StringBsiIndex) Marshal() ([]byte, error)

func (*StringBsiIndex) ReadFrom

func (i *StringBsiIndex) ReadFrom(r io.Reader) (n int64, err error)

func (*StringBsiIndex) Reset

func (i *StringBsiIndex) Reset()

func (*StringBsiIndex) Type

func (i *StringBsiIndex) Type() base.IndexType

func (*StringBsiIndex) Unmarshal

func (i *StringBsiIndex) Unmarshal(data []byte) error

func (*StringBsiIndex) WriteTo

func (i *StringBsiIndex) WriteTo(w io.Writer) (n int64, err error)

type TableHolder

type TableHolder struct {
	common.RefHelper
	ID     uint64
	BufMgr mgrif.IBufferManager
	// contains filtered or unexported fields
}

func NewTableHolder

func NewTableHolder(bufMgr mgrif.IBufferManager, id uint64) *TableHolder

func (*TableHolder) DropSegment

func (holder *TableHolder) DropSegment(id uint64) SegmentIndexHolder

func (*TableHolder) GetSegmentCount

func (holder *TableHolder) GetSegmentCount() int64

func (*TableHolder) RegisterSegment

func (holder *TableHolder) RegisterSegment(id common.ID, segType base.SegmentType, cb PostCloseCB) SegmentIndexHolder

func (*TableHolder) String

func (holder *TableHolder) String() string

func (*TableHolder) StringIndicesRefs

func (holder *TableHolder) StringIndicesRefs() string

func (*TableHolder) StrongRefSegment

func (holder *TableHolder) StrongRefSegment(id uint64) (seg SegmentIndexHolder)

func (*TableHolder) UpgradeSegment

func (holder *TableHolder) UpgradeSegment(id uint64, segType base.SegmentType) SegmentIndexHolder

Jump to

Keyboard shortcuts

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