sparseindex

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Continuous = "continuous"
View Source
const Empty = "empty"

Variables

View Source
var ConsiderOnlyBeTrue = NewMark(false, true)
View Source
var (
	// InitIndexFragmentFixedSize means that each fragment is fixed in size except the last fragment.
	InitIndexFragmentFixedSize = true
)
View Source
var NEGATIVE_INFINITY = &FieldRef{row: math.MinInt64}
View Source
var POSITIVE_INFINITY = &FieldRef{row: math.MaxInt64}

Functions

This section is empty.

Types

type ColumnRef

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

func NewColumnRef

func NewColumnRef(name string, dataType int, column *record.ColVal) *ColumnRef

type FieldRef

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

func NewFieldRef

func NewFieldRef(cols []*ColumnRef, column int, row int) *FieldRef

func (*FieldRef) Equals

func (f *FieldRef) Equals(rhs *FieldRef) bool

func (*FieldRef) IsNegativeInfinity

func (f *FieldRef) IsNegativeInfinity() bool

func (*FieldRef) IsNull

func (f *FieldRef) IsNull() bool

func (*FieldRef) IsPositiveInfinity

func (f *FieldRef) IsPositiveInfinity() bool

func (*FieldRef) Less

func (f *FieldRef) Less(rhs *FieldRef) bool

func (*FieldRef) Set

func (f *FieldRef) Set(cols []*ColumnRef, column, row int)

func (*FieldRef) SetNegativeInfinity

func (f *FieldRef) SetNegativeInfinity()

func (*FieldRef) SetPositiveInfinity

func (f *FieldRef) SetPositiveInfinity()

type FunctionBase

type FunctionBase struct {
}

type IndexProperty

type IndexProperty struct {
	RowsNumPerFragment  int
	CoarseIndexFragment int
	MinRowsForSeek      int
}

func NewIndexProperty

func NewIndexProperty(rowsNumPerFragment, coarseIndexFragment, minRowsForSeek int) *IndexProperty

type IndexReader

type IndexReader interface {
	Scan(pkFile string,
		pkRec *record.Record,
		pkMark fragment.IndexFragment,
		keyCondition KeyCondition,
	) (fragment.FragmentRanges, error)
	Close() error
}

type IndexReaderImpl

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

func NewIndexReader

func NewIndexReader(rowsNumPerFragment int, coarseIndexFragment int, minRowsForSeek int) *IndexReaderImpl

func (*IndexReaderImpl) Close

func (s *IndexReaderImpl) Close() error

func (*IndexReaderImpl) Scan

func (s *IndexReaderImpl) Scan(
	pkFile string,
	pkRec *record.Record,
	pkMark fragment.IndexFragment,
	keyCondition KeyCondition,
) (fragment.FragmentRanges, error)

Scan is used to filter fragment ranges based on the primary key in the condition, and it determines whether to do binary search or exclusion search according to the sequence of keys in the primary key. give a specific example to illustrate the usage of scan.

  1. origin record: x -> [1, 2, 1, 2, 1, 2, 2, 1] y -> [1, 1, 3, 4, 2, 2, 3, 4]

  2. sorted record(sorted by x, y): x -> [1, 1, 1, 1, 2, 2, 2, 2] y -> [1, 2, 3, 4, 1, 2, 3, 4]

  3. primary index record(fragment size is 2): x -> [1, 1, 2, 2, 2] y -> [1, 3, 1, 3, 4] fragment index -> [0, 1, 2, 3]

  4. key condition: x > 1 and y < 3

  5. scan results: fragment range -> [1, 3)

type IndexWriter

type IndexWriter interface {
	CreatePrimaryIndex(
		srcRec *record.Record,
		pkSchema record.Schemas,
		rowsNumPerFragment int,
		tcLocation int8,
	) (
		*record.Record, fragment.IndexFragment, error,
	)
	Close() error
}

type IndexWriterImpl

type IndexWriterImpl struct {
}

func NewIndexWriter

func NewIndexWriter() *IndexWriterImpl

func (*IndexWriterImpl) Close

func (w *IndexWriterImpl) Close() error

func (*IndexWriterImpl) CreatePrimaryIndex

func (w *IndexWriterImpl) CreatePrimaryIndex(
	srcRec *record.Record,
	pkSchema record.Schemas,
	rowsNumPerFragment int,
	tcLocation int8,
) (
	*record.Record,
	fragment.IndexFragment,
	error,
)

CretePrimaryIndex generates sparse primary index based on sorted data to be flushed to disks.

type KeyCondition

type KeyCondition interface {
	HavePrimaryKey() bool
	GetMaxKeyIndex() int
	IsFirstPrimaryKey() bool
	CanDoBinarySearch() bool
	MayBeInRange(usedKeySize int, indexLeft []*FieldRef, indexRight []*FieldRef, dataTypes []int) (bool, error)
}

type KeyConditionImpl

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

func NewKeyCondition

func NewKeyCondition(timeCondition, condition influxql.Expr, pkSchema record.Schemas) (*KeyConditionImpl, error)

func (*KeyConditionImpl) CanDoBinarySearch

func (kc *KeyConditionImpl) CanDoBinarySearch() bool

func (*KeyConditionImpl) CheckInRange

func (kc *KeyConditionImpl) CheckInRange(
	rgs []*Range,
	dataTypes []int,
) (Mark, error)

CheckInRange check Whether the condition and its negation are feasible in the direct product of single column ranges specified by hyper-rectangle.

func (*KeyConditionImpl) GetMaxKeyIndex

func (kc *KeyConditionImpl) GetMaxKeyIndex() int

func (*KeyConditionImpl) GetRPN

func (kc *KeyConditionImpl) GetRPN() []*RPNElement

func (*KeyConditionImpl) HavePrimaryKey

func (kc *KeyConditionImpl) HavePrimaryKey() bool

func (*KeyConditionImpl) IsFirstPrimaryKey

func (kc *KeyConditionImpl) IsFirstPrimaryKey() bool

func (*KeyConditionImpl) MayBeInRange

func (kc *KeyConditionImpl) MayBeInRange(
	usedKeySize int,
	leftKeys []*FieldRef,
	rightKeys []*FieldRef,
	dataTypes []int,
) (bool, error)

MayBeInRange is used to check whether the condition is likely to be in the target range.

func (*KeyConditionImpl) SetRPN

func (kc *KeyConditionImpl) SetRPN(rpn []*RPNElement)

type Mark

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

Mark these special constants are used to implement KeyCondition. When used as an initial_mask argument in KeyCondition.CheckInRange methods, they effectively prevent calculation of discarded Mark component as it is already set to true.

func NewMark

func NewMark(canBeTrue, canBeFalse bool) Mark

func (Mark) And

func (m Mark) And(mask Mark) Mark

func (Mark) Not

func (m Mark) Not() Mark

func (Mark) Or

func (m Mark) Or(mask Mark) Mark

type RPNElement

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

RPNElement means that Reverse Polish notation (RPN) is a method for conveying mathematical expressions without the use of separators such as brackets and parentheses. In this notation, the operators follow their operands, hence removing the need for brackets to define evaluation priority. More details: https://en.wikipedia.org/wiki/Reverse_Polish_notation.

type Range

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

Range means that the range with open or closed ends, possibly unbounded.

func NewRange

func NewRange(left, right *FieldRef, li, ri bool) *Range

type SetIndex

type SetIndex struct {
}

func (*SetIndex) Not

func (si *SetIndex) Not() bool

Jump to

Keyboard shortcuts

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