aggregations

package
v0.0.0-...-36b006e Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: AGPL-3.0 Imports: 22 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 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 ComputeAggEvalForList

func ComputeAggEvalForList(measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, measureResults map[string]utils.CValueEnclosure, runningEvalStats map[string]interface{}) 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, runningEvalStats map[string]interface{}) error

func CreateCValueFromColValue

func CreateCValueFromColValue(colValue interface{}) utils.CValueEnclosure

func CreateCValueFromValueExpression

func CreateCValueFromValueExpression(measureAgg *structs.MeasureAggregator, fieldToValue map[string]utils.CValueEnclosure, colValue utils.CValueEnclosure) (utils.CValueEnclosure, bool)

func DetermineAggColUsage

func DetermineAggColUsage(measureAgg *structs.MeasureAggregator, aggCols map[string]bool, aggColUsage map[string]utils.AggColUsageMode, valuesUsage map[string]bool, listUsage 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 GetBucketKey

func GetBucketKey(record map[string]interface{}, groupByRequest *structs.GroupByRequest) (string, error)

func GetFloatValueAfterEvaluation

func GetFloatValueAfterEvaluation(measureAgg *structs.MeasureAggregator, fieldToValue map[string]utils.CValueEnclosure) (float64, string, bool, error)

func GetIntervalInMillis

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

func GetNoWindowMinMax

func GetNoWindowMinMax(e1 utils.CValueEnclosure, e2 utils.CValueEnclosure, isMin bool) (utils.CValueEnclosure, error)

Incoming value e2 has to have float or string dtype

func GetOrderedRecs

func GetOrderedRecs(recs map[string]map[string]interface{}, recordIndexInFinal map[string]int) ([]string, error)

func InitGenEvent

func InitGenEvent(aggs *structs.QueryAggregators)

func InitRangeStat

func InitRangeStat() *structs.RangeStat

func InitRunningStreamStatsResults

func InitRunningStreamStatsResults(measureFunc utils.AggregateFunctions) *structs.RunningStreamStatsResults

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 *putils.GobbableHll, hllToMerge *putils.GobbableHll,
	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 PerformAggEvalForCardinality

func PerformAggEvalForCardinality(measureAgg *structs.MeasureAggregator, strSet map[string]struct{}, fieldToValue map[string]utils.CValueEnclosure) (float64, error)

Always pass a non-nil strSet when using this function

func PerformAggEvalForList

func PerformAggEvalForList(measureAgg *structs.MeasureAggregator, currentList []string, fieldToValue map[string]utils.CValueEnclosure) ([]string, error)

func PerformEvalAggForAvg

func PerformEvalAggForAvg(measureAgg *structs.MeasureAggregator, count uint64, currResultExists bool, currAvgStat structs.AvgStat, fieldToValue map[string]utils.CValueEnclosure) (structs.AvgStat, error)

func PerformEvalAggForCount

func PerformEvalAggForCount(measureAgg *structs.MeasureAggregator, count uint64, currResultExists bool, currResult utils.CValueEnclosure, fieldToValue map[string]utils.CValueEnclosure) (utils.CValueEnclosure, error)

func PerformEvalAggForMinOrMax

func PerformEvalAggForMinOrMax(measureAgg *structs.MeasureAggregator, currResultExists bool, currResult utils.CValueEnclosure, fieldToValue map[string]utils.CValueEnclosure, isMin bool) (utils.CValueEnclosure, error)

func PerformEvalAggForRange

func PerformEvalAggForRange(measureAgg *structs.MeasureAggregator, currResultExists bool, currRangeStat structs.RangeStat, fieldToValue map[string]utils.CValueEnclosure) (structs.RangeStat, error)

func PerformEvalAggForSum

func PerformEvalAggForSum(measureAgg *structs.MeasureAggregator, count uint64, currResultExists bool, currResult utils.CValueEnclosure, fieldToValue map[string]utils.CValueEnclosure) (utils.CValueEnclosure, error)

func PerformGenTimes

func PerformGenTimes(aggs *structs.QueryAggregators) error

func PerformInputLookup

func PerformInputLookup(aggs *structs.QueryAggregators) error

func PerformNoWindowStreamStatsOnSingleFunc

func PerformNoWindowStreamStatsOnSingleFunc(ssOption *structs.StreamStatsOptions, ssResults *structs.RunningStreamStatsResults,
	measureAgg *structs.MeasureAggregator, colValue utils.CValueEnclosure, include bool) (utils.CValueEnclosure, bool, error)

func PerformStreamStatOnSingleRecord

func PerformStreamStatOnSingleRecord(nodeResult *structs.NodeResult, agg *structs.QueryAggregators, currIndex int, currentBucketKey string, record map[string]interface{}, measureAggs []*structs.MeasureAggregator, numPrevSegmentProcessedRecords uint64, timeInMilli uint64, timeSort bool, timeSortAsc bool) (int, uint64, string, error)

func PerformStreamStats

func PerformStreamStats(nodeResult *structs.NodeResult, agg *structs.QueryAggregators, recs map[string]map[string]interface{}, recordIndexInFinal map[string]int, finalCols map[string]bool, finishesSegment bool, timeSort bool, timeSortAsc bool) error

func PerformStreamStatsOnRawRecord

func PerformStreamStatsOnRawRecord(nodeResult *structs.NodeResult, agg *structs.QueryAggregators, recs map[string]map[string]interface{}, recordIndexInFinal map[string]int, finalCols map[string]bool, finishesSegment bool, timeSort bool, timeSortAsc bool) error

func PerformStreamStatsOnSingleFunc

func PerformStreamStatsOnSingleFunc(currIndex int, bucketKey string, ssOption *structs.StreamStatsOptions, measureFuncIndex int,
	measureAgg *structs.MeasureAggregator, record map[string]interface{}, timestamp uint64, timeSortAsc bool) (utils.CValueEnclosure, bool, error)

func PerformWindowStreamStatsOnSingleFunc

func PerformWindowStreamStatsOnSingleFunc(currIndex int, ssOption *structs.StreamStatsOptions, ssResults *structs.RunningStreamStatsResults,
	windowSize int, measureAgg *structs.MeasureAggregator, colValue utils.CValueEnclosure, timestamp uint64,
	timeSortAsc bool, include bool) (utils.CValueEnclosure, bool, error)

func PopulateFieldToValueFromSegStats

func PopulateFieldToValueFromSegStats(fields []string, measureAgg *structs.MeasureAggregator, sstMap map[string]*structs.SegStats, fieldToValue map[string]utils.CValueEnclosure, i int) error

func PopulateGeneratedRecords

func PopulateGeneratedRecords(genEvent *structs.GenerateEvent, recs map[string]map[string]interface{}, recordIndexInFinal map[string]int, finalCols map[string]bool, offset int) error

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 SetGeneratedCols

func SetGeneratedCols(genEvent *structs.GenerateEvent, genCols []string)

func SetupMeasureAgg

func SetupMeasureAgg(measureAgg *structs.MeasureAggregator, allConvertedMeasureOps *[]*structs.MeasureAggregator, measureFunc utils.AggregateFunctions, allReverseIndex *[]int, colToIdx map[string][]int, idx int) (int, error)

func ShouldAddRes

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

func SortTimechartRes

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

func UpdateRangeStat

func UpdateRangeStat(floatValue float64, rangeStat *structs.RangeStat)

Types

This section is empty.

Jump to

Keyboard shortcuts

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