mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
c4b68956fe
commit
46bfdf6796
4 changed files with 30 additions and 14 deletions
|
@ -27,9 +27,13 @@ func (sm *statsFieldsMax) String() string {
|
|||
}
|
||||
|
||||
func (sm *statsFieldsMax) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.add(sm.srcField)
|
||||
if len(sm.resultFields) == 0 {
|
||||
neededFields.add("*")
|
||||
} else {
|
||||
neededFields.addFields(sm.resultFields)
|
||||
}
|
||||
neededFields.add(sm.srcField)
|
||||
}
|
||||
|
||||
func (sm *statsFieldsMax) newStatsProcessor() (statsProcessor, int) {
|
||||
smp := &statsFieldsMaxProcessor{
|
||||
|
|
|
@ -27,9 +27,13 @@ func (sm *statsFieldsMin) String() string {
|
|||
}
|
||||
|
||||
func (sm *statsFieldsMin) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.add(sm.srcField)
|
||||
if len(sm.resultFields) == 0 {
|
||||
neededFields.add("*")
|
||||
} else {
|
||||
neededFields.addFields(sm.resultFields)
|
||||
}
|
||||
neededFields.add(sm.srcField)
|
||||
}
|
||||
|
||||
func (sm *statsFieldsMin) newStatsProcessor() (statsProcessor, int) {
|
||||
smp := &statsFieldsMinProcessor{
|
||||
|
|
|
@ -12,10 +12,12 @@ import (
|
|||
|
||||
type statsMax struct {
|
||||
fields []string
|
||||
containsStar bool
|
||||
}
|
||||
|
||||
func (sm *statsMax) String() string {
|
||||
if len(sm.fields) == 0 {
|
||||
return "max(*)"
|
||||
}
|
||||
return "max(" + fieldNamesString(sm.fields) + ")"
|
||||
}
|
||||
|
||||
|
@ -39,7 +41,7 @@ type statsMaxProcessor struct {
|
|||
func (smp *statsMaxProcessor) updateStatsForAllRows(br *blockResult) int {
|
||||
maxLen := len(smp.max)
|
||||
|
||||
if smp.sm.containsStar {
|
||||
if len(smp.sm.fields) == 0 {
|
||||
// Find the minimum value across all the columns
|
||||
for _, c := range br.getColumns() {
|
||||
smp.updateStateForColumn(br, c)
|
||||
|
@ -58,7 +60,7 @@ func (smp *statsMaxProcessor) updateStatsForAllRows(br *blockResult) int {
|
|||
func (smp *statsMaxProcessor) updateStatsForRow(br *blockResult, rowIdx int) int {
|
||||
maxLen := len(smp.max)
|
||||
|
||||
if smp.sm.containsStar {
|
||||
if len(smp.sm.fields) == 0 {
|
||||
// Find the minimum value across all the fields for the given row
|
||||
for _, c := range br.getColumns() {
|
||||
v := c.getValueAtRow(br, rowIdx)
|
||||
|
@ -170,9 +172,11 @@ func parseStatsMax(lex *lexer) (*statsMax, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if slices.Contains(fields, "*") {
|
||||
fields = nil
|
||||
}
|
||||
sm := &statsMax{
|
||||
fields: fields,
|
||||
containsStar: slices.Contains(fields, "*"),
|
||||
}
|
||||
return sm, nil
|
||||
}
|
||||
|
|
|
@ -12,10 +12,12 @@ import (
|
|||
|
||||
type statsMin struct {
|
||||
fields []string
|
||||
containsStar bool
|
||||
}
|
||||
|
||||
func (sm *statsMin) String() string {
|
||||
if len(sm.fields) == 0 {
|
||||
return "min(*)"
|
||||
}
|
||||
return "min(" + fieldNamesString(sm.fields) + ")"
|
||||
}
|
||||
|
||||
|
@ -39,7 +41,7 @@ type statsMinProcessor struct {
|
|||
func (smp *statsMinProcessor) updateStatsForAllRows(br *blockResult) int {
|
||||
minLen := len(smp.min)
|
||||
|
||||
if smp.sm.containsStar {
|
||||
if len(smp.sm.fields) == 0 {
|
||||
// Find the minimum value across all the columns
|
||||
for _, c := range br.getColumns() {
|
||||
smp.updateStateForColumn(br, c)
|
||||
|
@ -58,7 +60,7 @@ func (smp *statsMinProcessor) updateStatsForAllRows(br *blockResult) int {
|
|||
func (smp *statsMinProcessor) updateStatsForRow(br *blockResult, rowIdx int) int {
|
||||
minLen := len(smp.min)
|
||||
|
||||
if smp.sm.containsStar {
|
||||
if len(smp.sm.fields) == 0 {
|
||||
// Find the minimum value across all the fields for the given row
|
||||
for _, c := range br.getColumns() {
|
||||
v := c.getValueAtRow(br, rowIdx)
|
||||
|
@ -170,9 +172,11 @@ func parseStatsMin(lex *lexer) (*statsMin, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if slices.Contains(fields, "*") {
|
||||
fields = nil
|
||||
}
|
||||
sm := &statsMin{
|
||||
fields: fields,
|
||||
containsStar: slices.Contains(fields, "*"),
|
||||
}
|
||||
return sm, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue