Documentation ¶
Index ¶
- func CompareRowNumbers(upToDefinitionLevel int, a, b RowNumber) int
- func GetColumnIndexByPath(pf *pq.File, s string) (index, depth int)
- func HasColumn(pf *pq.File, s string) bool
- type ColumnIterator
- type GroupPredicate
- type InstrumentedPredicate
- type IntBetweenPredicate
- type Iterator
- type IteratorResult
- type JoinIterator
- type KeyValueGroupPredicate
- type Predicate
- type RowNumber
- type StringInPredicate
- type SubstringPredicate
- type UnionIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareRowNumbers ¶
CompareRowNumbers compares the sequences of row numbers in a and b for partial equality, descending from top-level through the given definition level. For example, definition level 1 means that row numbers are compared at two levels of nesting, the top-level and 1 level of nesting below.
Types ¶
type ColumnIterator ¶
type ColumnIterator struct {
// contains filtered or unexported fields
}
ColumnIterator asynchronously iterates through the given row groups and column. Applies the optional predicate to each chunk, page, and value. Results are read by calling Next() until it returns nil.
func NewColumnIterator ¶
func (*ColumnIterator) Close ¶
func (c *ColumnIterator) Close()
func (*ColumnIterator) Next ¶
func (c *ColumnIterator) Next() *IteratorResult
Next returns the next matching value from the iterator. Returns nil when finished.
func (*ColumnIterator) SeekTo ¶
func (c *ColumnIterator) SeekTo(to RowNumber, d int) *IteratorResult
SeekTo moves this iterator to the next result that is greater than or equal to the given row number (and based on the given definition level)
type GroupPredicate ¶
type GroupPredicate interface {
KeepGroup(*IteratorResult) bool
}
type InstrumentedPredicate ¶
type InstrumentedPredicate struct { InspectedColumnChunks atomic.Int64 InspectedPages atomic.Int64 InspectedValues atomic.Int64 KeptColumnChunks atomic.Int64 KeptPages atomic.Int64 KeptValues atomic.Int64 // contains filtered or unexported fields }
func (*InstrumentedPredicate) KeepColumnChunk ¶
func (p *InstrumentedPredicate) KeepColumnChunk(c pq.ColumnChunk) bool
type IntBetweenPredicate ¶
type IntBetweenPredicate struct {
// contains filtered or unexported fields
}
IntBetweenPredicate checks for int between the bounds [min,max] inclusive
func NewIntBetweenPredicate ¶
func NewIntBetweenPredicate(min, max int64) *IntBetweenPredicate
func (*IntBetweenPredicate) KeepColumnChunk ¶
func (p *IntBetweenPredicate) KeepColumnChunk(c pq.ColumnChunk) bool
type Iterator ¶
type Iterator interface { // Next returns nil when done Next() *IteratorResult // Like Next but skips over results until reading >= the given location SeekTo(t RowNumber, definitionLevel int) *IteratorResult Close() }
iterator - Every iterator follows this interface and can be composed.
type IteratorResult ¶
type IteratorResult struct { RowNumber RowNumber Entries []struct { // contains filtered or unexported fields } }
IteratorResult is a row of data with a row number and named columns of data. Internally it has an unstructured list for efficient collection. The ToMap() function can be used to make inspection easier.
func (*IteratorResult) Append ¶
func (r *IteratorResult) Append(rr *IteratorResult)
func (*IteratorResult) AppendValue ¶
func (r *IteratorResult) AppendValue(k string, v pq.Value)
func (*IteratorResult) Columns ¶
Columns gets the values for each named column. The order of returned values matches the order of names given. This is more efficient than converting to a map.
func (*IteratorResult) Reset ¶
func (r *IteratorResult) Reset()
type JoinIterator ¶
type JoinIterator struct {
// contains filtered or unexported fields
}
JoinIterator joins two or more iterators for matches at the given definition level. I.e. joining at definitionLevel=0 means that each iterator must produce a result within the same root node.
func NewJoinIterator ¶
func NewJoinIterator(definitionLevel int, iters []Iterator, pred GroupPredicate) *JoinIterator
func (*JoinIterator) Close ¶
func (j *JoinIterator) Close()
func (*JoinIterator) Next ¶
func (j *JoinIterator) Next() *IteratorResult
func (*JoinIterator) SeekTo ¶
func (j *JoinIterator) SeekTo(t RowNumber, d int) *IteratorResult
type KeyValueGroupPredicate ¶
type KeyValueGroupPredicate struct {
// contains filtered or unexported fields
}
KeyValueGroupPredicate takes key/value pairs and checks if the group contains all of them. This is the only predicate/iterator that is knowledgable about our trace or search contents. I'd like to change that and make it generic, but it's quite complex and not figured it out yet.
func NewKeyValueGroupPredicate ¶
func NewKeyValueGroupPredicate(keys, values []string) *KeyValueGroupPredicate
func (*KeyValueGroupPredicate) KeepGroup ¶
func (a *KeyValueGroupPredicate) KeepGroup(group *IteratorResult) bool
KeepGroup checks if the given group contains all of the requested key/value pairs.
type Predicate ¶
type Predicate interface { KeepColumnChunk(cc pq.ColumnChunk) bool KeepPage(page pq.Page) bool KeepValue(pq.Value) bool }
Predicate is a pushdown predicate that can be applied at the chunk, page, and value levels.
func NewStringInPredicate ¶
type RowNumber ¶
type RowNumber [6]int64
RowNumber is the sequence of row numbers uniquely identifying a value in a tree of nested columns, starting at the top-level and including another row number for each level of nesting. -1 is a placeholder for undefined at lower levels. RowNumbers can be compared for full equality using the == operator, or can be compared partially, looking for equal lineages down to a certain level. For example given the following tree, the row numbers would be:
A 0, -1, -1 B 0, 0, -1 C 0, 1, -1 D 0, 1, 0 E 0, 2, -1
Currently supports 6 levels of nesting which should be enough for anybody. :)
func EmptyRowNumber ¶
func EmptyRowNumber() RowNumber
EmptyRowNumber creates an empty invalid row number.
func MaxRowNumber ¶
func MaxRowNumber() RowNumber
MaxRowNumber is a helper that represents the maximum(-ish) representable value.
func TruncateRowNumber ¶
func (*RowNumber) Next ¶
Next increments and resets the row numbers according to the given repetition and definition levels. Examples from the Dremel whitepaper: https://storage.googleapis.com/pub-tools-public-publication-data/pdf/36632.pdf Name.Language.Country value | r | d | expected RowNumber -------|---|---|-------------------
| | | { -1, -1, -1, -1 } <-- starting position
us | 0 | 3 | { 0, 0, 0, 0 } null | 2 | 2 | { 0, 0, 1, -1 } null | 1 | 1 | { 0, 1, -1, -1 } gb | 1 | 3 | { 0, 2, 0, 0 } null | 0 | 1 | { 1, 0, -1, -1 }
type StringInPredicate ¶
type StringInPredicate struct {
// contains filtered or unexported fields
}
StringInPredicate checks for any of the given strings.
func (*StringInPredicate) KeepColumnChunk ¶
func (p *StringInPredicate) KeepColumnChunk(cc pq.ColumnChunk) bool
type SubstringPredicate ¶
type SubstringPredicate struct {
// contains filtered or unexported fields
}
func NewSubstringPredicate ¶
func NewSubstringPredicate(substring string) *SubstringPredicate
func (*SubstringPredicate) KeepColumnChunk ¶
func (p *SubstringPredicate) KeepColumnChunk(_ pq.ColumnChunk) bool
type UnionIterator ¶
type UnionIterator struct {
// contains filtered or unexported fields
}
UnionIterator produces all results for all given iterators. When iterators align to the same row, based on the configured definition level, then the results are returned together. Else the next matching iterator is returned.
func NewUnionIterator ¶
func NewUnionIterator(definitionLevel int, iters []Iterator, pred GroupPredicate) *UnionIterator
func (*UnionIterator) Close ¶
func (u *UnionIterator) Close()
func (*UnionIterator) Next ¶
func (u *UnionIterator) Next() *IteratorResult
func (*UnionIterator) SeekTo ¶
func (u *UnionIterator) SeekTo(t RowNumber, d int) *IteratorResult