Documentation
¶
Overview ¶
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Index ¶
- type BSIData
- type BsiBuilder
- type ColumnInfo
- type DataType
- type Row
- func (r *Row) Any() bool
- func (r *Row) Clone() (clone *Row)
- func (r *Row) Columns() []uint64
- func (r *Row) Count() uint64
- func (r *Row) Difference(others ...*Row) *Row
- func (r *Row) Freeze()
- func (r *Row) Hash() uint64
- func (r *Row) Includes(col uint64) bool
- func (r *Row) Intersect(other *Row) *Row
- func (r *Row) InvalidateCount()
- func (r *Row) IsEmpty() bool
- func (r *Row) MarshalJSON() ([]byte, error)
- func (r *Row) Merge(other *Row)
- func (r *Row) RangeColumns(f func(uint64) error) error
- func (r *Row) Roaring() []byte
- func (r *Row) SetBit(i uint64) (changed bool)
- func (r *Row) ShardColumns() []int64
- func (r *Row) Shift(n int64) (*Row, error)
- func (r *Row) ToRows(callback func(*RowResult) error) error
- func (r *Row) ToTable() (*Table, error)
- func (r *Row) Union(others ...*Row) *Row
- func (r *Row) Xor(other *Row) *Row
- type RowBuilder
- type RowResult
- type RowSegment
- func (s *RowSegment) ClearBit(i uint64) (changed bool)
- func (s *RowSegment) Columns() []uint64
- func (s *RowSegment) Count() uint64
- func (s *RowSegment) Data() *roaring.Bitmap
- func (s *RowSegment) Difference(others ...*RowSegment) *RowSegment
- func (s *RowSegment) Freeze()
- func (s *RowSegment) Intersect(other *RowSegment) *RowSegment
- func (s *RowSegment) IntersectionCount(other *RowSegment) uint64
- func (s *RowSegment) InvalidateCount()
- func (s *RowSegment) Merge(other *RowSegment)
- func (s *RowSegment) RangeColumns(f func(uint64) error) error
- func (s *RowSegment) SetBit(i uint64) (changed bool)
- func (s *RowSegment) Shard() uint64
- func (s *RowSegment) ShardColumns() []int64
- func (s *RowSegment) Shift() (*RowSegment, error)
- func (s *RowSegment) Union(others ...*RowSegment) *RowSegment
- func (s *RowSegment) Xor(other *RowSegment) *RowSegment
- type RowValue
- type Table
- type ToRowser
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BSIData ¶ added in v1.22.4
type BSIData []*Row
BSIData contains BSI-structured data.
func AddBSI ¶ added in v1.22.4
AddBSI adds two BSI bitmaps together. It does not handle sign and has no concept of overflow.
func (BSIData) PivotDescending ¶ added in v1.22.4
func (bsi BSIData) PivotDescending(filter *Row, branch uint64, limit, offset *uint64, fn func(uint64, ...uint64))
PivotDescending loops over nonzero BSI values in descending order. For each value, the provided function is called with the value and a slice of the associated columns. If limit or offset are not-nil, they will be applied. Applying a limit or offset may modify the pointed-to value.
type BsiBuilder ¶ added in v1.22.4
type BsiBuilder []RowBuilder
BsiBuilder assembles BSI data. It is optimized for the case in which values are generated sequentially.
func (*BsiBuilder) Build ¶ added in v1.22.4
func (b *BsiBuilder) Build() BSIData
Build BSI data. This resets the builder.
func (*BsiBuilder) Insert ¶ added in v1.22.4
func (b *BsiBuilder) Insert(col, val uint64)
Insert a value into the BSI data. Columns must be inserted sequentially, and duplicates are not allowed.
type ColumnInfo ¶
type Row ¶
type Row struct { Segments []RowSegment // String keys translated to/from segment columns. Keys []string // Index tells what index this row is from - needed for key translation. Index string // Field tells what field this row is from if it's a "vertical" // row. It may be the result of a Distinct query or Rows // query. Knowing the index and field, we can figure out how to // interpret the row data. Field string // NoSplit indicates that this row may not be split. // This is used for `Rows` calls in a GroupBy. NoSplit bool }
Row is a set of integers (the associated columns).
func NewRowFromBitmap ¶
NewRowFromBitmap divides a bitmap into rows, which it now calls shards. This transposes; data that was in any shard for Row 0 is now considered shard 0, etcetera.
func NewRowFromRoaring ¶
NewRowFromRoaring parses a roaring data file as a row, dividing it into bitmaps and rowSegments based on shard width.
func (*Row) Difference ¶
Difference returns the diff of r and other.
func (*Row) InvalidateCount ¶ added in v1.22.6
func (r *Row) InvalidateCount()
InvalidateCount updates the cached count in the row.
func (*Row) MarshalJSON ¶
MarshalJSON returns a JSON-encoded byte slice of r.
func (*Row) ShardColumns ¶
func (*Row) Shift ¶
Shift returns the bitwise shift of r by n bits. Currently only positive shift values are supported.
NOTE: the Shift method is currently unsupported, and is considerred to be incorrect. Please DO NOT use it. We are leaving it here in case someone internally wants to use it with the understanding that the results may be incorrect.
Why unsupported? For a full description, see: https://github.com/featurebasedb/pilosa/issues/403. In short, the current implementation will shift a bit at the edge of a shard out of the shard and into a container which is assumed to be an invalid container for the shard. So for example, shifting the last bit of shard 0 (containers 0-15) will shift that bit out to container 16. While this "sort of" works, it breaks an assumption about containers, and might stop working in the future if that assumption is enforced.
type RowBuilder ¶ added in v1.22.4
type RowBuilder struct {
// contains filtered or unexported fields
}
RowBuilder builds a row quickly from individual values. It is optimized for the case in which values are generated sequentially.
func (*RowBuilder) Add ¶ added in v1.22.4
func (b *RowBuilder) Add(v uint64)
Add a value to the bitmap. Values must be added sequentially.
func (*RowBuilder) Build ¶ added in v1.22.4
func (b *RowBuilder) Build() *Row
Build a Row from stored data. This resets the builder.
type RowResult ¶
type RowResult struct { Headers []*ColumnInfo Columns []Value }
type RowSegment ¶
type RowSegment struct {
// contains filtered or unexported fields
}
RowSegment holds a subset of a row. This could point to a mmapped roaring bitmap or an in-memory bitmap. The width of the segment will always match the shard width.
func NewSegment ¶ added in v1.22.5
func NewSegment(data *roaring.Bitmap, shard uint64, writable bool) RowSegment
func (*RowSegment) ClearBit ¶
func (s *RowSegment) ClearBit(i uint64) (changed bool)
ClearBit clears the i-th column of the row.
func (*RowSegment) Columns ¶
func (s *RowSegment) Columns() []uint64
Columns returns a list of all columns set in the segment.
func (*RowSegment) Count ¶
func (s *RowSegment) Count() uint64
Count returns the number of set columns in the row.
func (*RowSegment) Data ¶ added in v1.22.7
func (s *RowSegment) Data() *roaring.Bitmap
func (*RowSegment) Difference ¶
func (s *RowSegment) Difference(others ...*RowSegment) *RowSegment
Difference returns the diff of s and other.
func (*RowSegment) Freeze ¶
func (s *RowSegment) Freeze()
func (*RowSegment) Intersect ¶
func (s *RowSegment) Intersect(other *RowSegment) *RowSegment
Intersect returns the itersection of s and other.
func (*RowSegment) IntersectionCount ¶
func (s *RowSegment) IntersectionCount(other *RowSegment) uint64
IntersectionCount returns the number of intersections between s and other.
func (*RowSegment) InvalidateCount ¶
func (s *RowSegment) InvalidateCount()
InvalidateCount updates the cached count in the row.
func (*RowSegment) Merge ¶
func (s *RowSegment) Merge(other *RowSegment)
Merge adds chunks from other to s. Chunks in s are overwritten if they exist in other.
func (*RowSegment) RangeColumns ¶ added in v1.22.8
func (s *RowSegment) RangeColumns(f func(uint64) error) error
func (*RowSegment) SetBit ¶
func (s *RowSegment) SetBit(i uint64) (changed bool)
SetBit sets the i-th column of the row.
func (*RowSegment) Shard ¶
func (s *RowSegment) Shard() uint64
func (*RowSegment) ShardColumns ¶
func (s *RowSegment) ShardColumns() []int64
Columns returns a list of all columns set in the segment, normalized from 0-shardwidth-1
func (*RowSegment) Shift ¶
func (s *RowSegment) Shift() (*RowSegment, error)
Shift returns s shifted by 1 bit.
func (*RowSegment) Union ¶
func (s *RowSegment) Union(others ...*RowSegment) *RowSegment
Union returns the bitwise union of s and other.
func (*RowSegment) Xor ¶
func (s *RowSegment) Xor(other *RowSegment) *RowSegment
Xor returns the xor of s and other.
type Table ¶
type Table struct { Headers []*ColumnInfo Rows []RowValue }