rows

package module
v1.22.5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

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

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

func AddBSI(x, y BSIData) BSIData

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 ColumnInfo struct {
	Name     string
	DataType DataType
}

type DataType

type DataType byte
const (
	String DataType = 1 + iota
	Int64
	Float64
	Timestamp
)

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 NewRow

func NewRow(columns ...uint64) *Row

NewRow returns a new instance of Row.

func NewRowFromBitmap

func NewRowFromBitmap(b *roaring.Bitmap) *Row

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

func NewRowFromRoaring(data []byte) *Row

NewRowFromRoaring parses a roaring data file as a row, dividing it into bitmaps and rowSegments based on shard width.

func (*Row) Any

func (r *Row) Any() bool

Any returns true if row contains any bits.

func (*Row) Clone

func (r *Row) Clone() (clone *Row)

func (*Row) Columns

func (r *Row) Columns() []uint64

Columns returns the columns in r as a slice of ints.

func (*Row) Count

func (r *Row) Count() uint64

Count returns the number of columns in the row.

func (*Row) Difference

func (r *Row) Difference(others ...*Row) *Row

Difference returns the diff of r and other.

func (*Row) Freeze

func (r *Row) Freeze()

func (*Row) Hash

func (r *Row) Hash() uint64

Hash calculate checksum code be useful in block hash join

func (*Row) Includes

func (r *Row) Includes(col uint64) bool

Includes returns true if the row contains the given column.

func (*Row) Intersect

func (r *Row) Intersect(other *Row) *Row

Intersect returns the itersection of r and other.

func (*Row) IsEmpty

func (r *Row) IsEmpty() bool

IsEmpty returns true if the row doesn't contain any set bits.

func (*Row) MarshalJSON

func (r *Row) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON-encoded byte slice of r.

func (*Row) Merge

func (r *Row) Merge(other *Row)

Merge merges data from other into r.

func (*Row) Roaring

func (r *Row) Roaring() []byte

Roaring returns the row treated as a unified roaring bitmap.

func (*Row) SetBit

func (r *Row) SetBit(i uint64) (changed bool)

SetBit sets the i-th column of the row.

func (*Row) ShardColumns

func (r *Row) ShardColumns() []int64

func (*Row) Shift

func (r *Row) Shift(n int64) (*Row, error)

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.

func (*Row) ToRows

func (r *Row) ToRows(callback func(*RowResult) error) error

func (*Row) ToTable

func (r *Row) ToTable() (*Table, error)

func (*Row) Union

func (r *Row) Union(others ...*Row) *Row

Union returns the bitwise union of r and other.

func (*Row) Xor

func (r *Row) Xor(other *Row) *Row

Xor returns the xor of r and other.

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) 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) 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 RowValue

type RowValue []Value

type Table

type Table struct {
	Headers []*ColumnInfo
	Rows    []RowValue
}

func RowsToTable

func RowsToTable(tr ToRowser, n int) (*Table, error)

type ToRowser

type ToRowser interface {
	ToRows(func(*RowResult) error) error
}

type Value

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

func IntValue

func IntValue(v uint64) Value

func StringValue

func StringValue(s string) Value

func (Value) Float64

func (v Value) Float64() float64

func (Value) Int

func (v Value) Int() uint64

func (Value) String

func (v Value) String() string

func (Value) Time

func (v Value) Time() time.Time

Jump to

Keyboard shortcuts

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