aggregations

package
v0.0.0-...-3e93ff8 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: AGPL-3.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAggAvgToTimechartRunningStats

func AddAggAvgToTimechartRunningStats(m *structs.MeasureAggregator, allConvertedMeasureOps *[]*structs.MeasureAggregator, allReverseIndex *[]int, colToIdx map[string][]int, idx int)

func AddAggCountToTimechartRunningStats

func AddAggCountToTimechartRunningStats(m *structs.MeasureAggregator, allConvertedMeasureOps *[]*structs.MeasureAggregator, allReverseIndex *[]int, colToIdx map[string][]int, idx int)

func AddMeasureAggInRunningStatsForAvg

func AddMeasureAggInRunningStatsForAvg(m *structs.MeasureAggregator, allConvertedMeasureOps *[]*structs.MeasureAggregator, allReverseIndex *[]int, colToIdx map[string][]int, idx int) (int, error)

func AddMeasureAggInRunningStatsForCount

func AddMeasureAggInRunningStatsForCount(m *structs.MeasureAggregator, allConvertedMeasureOps *[]*structs.MeasureAggregator, allReverseIndex *[]int, colToIdx map[string][]int, idx int) (int, error)

func AddMeasureAggInRunningStatsForRange

func AddMeasureAggInRunningStatsForRange(m *structs.MeasureAggregator, allConvertedMeasureOps *[]*structs.MeasureAggregator, allReverseIndex *[]int, colToIdx map[string][]int, idx int) (int, error)

Record the index of range() in runningStats; the index is idx To calculate the range(), we need both the min() and max(), which require two columns to store them Since it is the runningStats not the stats for results, we can use one extra col to store the min/max idx stores the result of min, and idx+1 stores the result of max.

func AddMeasureAggInRunningStatsForValuesOrCardinality

func AddMeasureAggInRunningStatsForValuesOrCardinality(m *structs.MeasureAggregator, allConvertedMeasureOps *[]*structs.MeasureAggregator, allReverseIndex *[]int, colToIdx map[string][]int, idx int) (int, error)

func CheckGroupByColValsAgainstLimit

func CheckGroupByColValsAgainstLimit(timechart *structs.TimechartExpr, groupByColValCnt map[string]int, groupValScoreMap map[string]*utils.CValueEnclosure, measureOperations []*structs.MeasureAggregator) map[string]bool

Timechart will only display N highest/lowest scoring distinct values of the split-by field For Single agg, the score is based on the sum of the values in the aggregation. Therefore, we can only know groupByColVal's ranking after processing all the runningStats For multiple aggs, the score is based on the freq of the field. Which means we can rank groupByColVal at this time.

func ComputeAggEvalForAvg

func ComputeAggEvalForAvg(measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, measureResults map[string]utils.CValueEnclosure, runningEvalStats map[string]interface{}) error

func ComputeAggEvalForCardinality

func ComputeAggEvalForCardinality(measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, measureResults map[string]utils.CValueEnclosure, runningEvalStats map[string]interface{}) error

func ComputeAggEvalForCount

func ComputeAggEvalForCount(measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, measureResults map[string]utils.CValueEnclosure) error

func ComputeAggEvalForMinOrMax

func ComputeAggEvalForMinOrMax(measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, measureResults map[string]utils.CValueEnclosure, isMin bool) error

func ComputeAggEvalForRange

func ComputeAggEvalForRange(measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, measureResults map[string]utils.CValueEnclosure, runningEvalStats map[string]interface{}) error

func ComputeAggEvalForSum

func ComputeAggEvalForSum(measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, measureResults map[string]utils.CValueEnclosure) error

func ComputeAggEvalForValues

func ComputeAggEvalForValues(measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, measureResults map[string]utils.CValueEnclosure, strSet map[string]struct{}) error

func DetermineAggColUsage

func DetermineAggColUsage(measureAgg *structs.MeasureAggregator, aggCols map[string]bool, aggColUsage map[string]utils.AggColUsageMode, valuesUsage map[string]bool)

Determine if cols used by eval statements or not

func FindTimeRangeBucket

func FindTimeRangeBucket(timePoints []uint64, timestamp uint64, intervalMillis uint64) uint64

Find correct time range bucket for timestamp

func GenerateTimeRangeBuckets

func GenerateTimeRangeBuckets(timeHistogram *structs.TimeBucket) []uint64

func GetIntervalInMillis

func GetIntervalInMillis(num int, timeUnit utils.TimeUnit) uint64

func InitTimeBucket

func InitTimeBucket(num int, timeUnit utils.TimeUnit, byField string, limitExpr *structs.LimitExpr, measureAggLength int) *structs.TimeBucket

func InitialScoreMap

func InitialScoreMap(timechart *structs.TimechartExpr, groupByColValCnt map[string]int) map[string]*utils.CValueEnclosure

Initial score map for single agg: the score is based on the sum of the values in the aggregation

func IsOtherCol

func IsOtherCol(valIsInLimit map[string]bool, groupByColVal string) bool

func IsRankBySum

func IsRankBySum(timechart *structs.TimechartExpr) bool

func MergeMap

func MergeMap(groupByColValCnt map[string]int, toMerge map[string]int)

func MergeVal

func MergeVal(eVal *utils.CValueEnclosure, eValToMerge utils.CValueEnclosure, hll *hyperloglog.Sketch, hllToMerge *hyperloglog.Sketch,
	strSet map[string]struct{}, strSetToMerge map[string]struct{}, aggFunc utils.AggregateFunctions, useAdditionForMerge bool)

For numeric agg(not include dc), we can simply use addition to merge them For string values, it depends on the aggregation function

func PostQueryBucketCleaning

func PostQueryBucketCleaning(nodeResult *structs.NodeResult, post *structs.QueryAggregators, recs map[string]map[string]interface{},
	recordIndexInFinal map[string]int, finalCols map[string]bool, numTotalSegments uint64, finishesSegment bool) *structs.NodeResult

Function to clean up results based on input query aggregations. This will make sure all buckets respect the minCount & is returned in a sorted order

func ShouldAddRes

func ShouldAddRes(timechart *structs.TimechartExpr, tmLimitResult *structs.TMLimitResult, index int, eVal utils.CValueEnclosure,
	hllToMerge *hyperloglog.Sketch, strSetToMerge map[string]struct{}, aggFunc utils.AggregateFunctions, groupByColVal string, isOtherCol bool) bool

func SortTimechartRes

func SortTimechartRes(timechart *structs.TimechartExpr, results *[]*structs.BucketResult)

Types

This section is empty.

Jump to

Keyboard shortcuts

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