mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
a941bdcdbd
commit
0850e13eb3
1 changed files with 14 additions and 7 deletions
|
@ -111,6 +111,9 @@ func parsePipes(lex *lexer) ([]pipe, error) {
|
|||
type fieldsPipe struct {
|
||||
// fields contains list of fields to fetch
|
||||
fields []string
|
||||
|
||||
// whether fields contains star
|
||||
containsStar bool
|
||||
}
|
||||
|
||||
func (fp *fieldsPipe) String() string {
|
||||
|
@ -133,7 +136,7 @@ type fieldsPipeProcessor struct {
|
|||
}
|
||||
|
||||
func (fpp *fieldsPipeProcessor) writeBlock(workerID uint, timestamps []int64, columns []BlockColumn) {
|
||||
if slices.Contains(fpp.fp.fields, "*") || areSameBlockColumns(columns, fpp.fp.fields) {
|
||||
if fpp.fp.containsStar || areSameBlockColumns(columns, fpp.fp.fields) {
|
||||
// Fast path - there is no need in additional transformations before writing the block to ppBase.
|
||||
fpp.ppBase.writeBlock(workerID, timestamps, columns)
|
||||
return
|
||||
|
@ -176,6 +179,7 @@ func parseFieldsPipe(lex *lexer) (*fieldsPipe, error) {
|
|||
case lex.isKeyword("|", ")", ""):
|
||||
fp := &fieldsPipe{
|
||||
fields: fields,
|
||||
containsStar: slices.Contains(fields, "*"),
|
||||
}
|
||||
return fp, nil
|
||||
case lex.isKeyword(","):
|
||||
|
@ -552,6 +556,8 @@ func parseStatsFunc(lex *lexer) (statsFunc, error) {
|
|||
|
||||
type statsFuncCount struct {
|
||||
fields []string
|
||||
containsStar bool
|
||||
|
||||
resultName string
|
||||
}
|
||||
|
||||
|
@ -578,7 +584,7 @@ type statsFuncCountProcessor struct {
|
|||
|
||||
func (sfcp *statsFuncCountProcessor) updateStatsForAllRows(timestamps []int64, columns []BlockColumn) int {
|
||||
fields := sfcp.sfc.fields
|
||||
if len(fields) == 0 || slices.Contains(fields, "*") {
|
||||
if len(fields) == 0 || sfcp.sfc.containsStar {
|
||||
// Fast path - count all the columns.
|
||||
sfcp.rowsCount += uint64(len(timestamps))
|
||||
return 0
|
||||
|
@ -608,7 +614,7 @@ func (sfcp *statsFuncCountProcessor) updateStatsForAllRows(timestamps []int64, c
|
|||
|
||||
func (sfcp *statsFuncCountProcessor) updateStatsForRow(_ []int64, columns []BlockColumn, rowIdx int) int {
|
||||
fields := sfcp.sfc.fields
|
||||
if len(fields) == 0 || slices.Contains(fields, "*") {
|
||||
if len(fields) == 0 || sfcp.sfc.containsStar {
|
||||
// Fast path - count the given column
|
||||
sfcp.rowsCount++
|
||||
return 0
|
||||
|
@ -815,6 +821,7 @@ func parseStatsFuncCount(lex *lexer) (*statsFuncCount, error) {
|
|||
}
|
||||
sfc := &statsFuncCount{
|
||||
fields: fields,
|
||||
containsStar: slices.Contains(fields, "*"),
|
||||
resultName: resultName,
|
||||
}
|
||||
return sfc, nil
|
||||
|
|
Loading…
Reference in a new issue