mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
900d74a560
commit
160034bda3
3 changed files with 15 additions and 7 deletions
|
@ -95,7 +95,7 @@ func (br *blockResult) clone() *blockResult {
|
|||
|
||||
// initFromNeededColumns initializes br from brSrc, by copying only the given neededColumns for rows identified by set bits at bm.
|
||||
//
|
||||
// The br valid until brSrc is reset or bm is updated.
|
||||
// The br valid until brSrc or bm is updated.
|
||||
func (br *blockResult) initFromNeededColumns(brSrc *blockResult, bm *bitmap, neededColumns []string) {
|
||||
br.reset()
|
||||
|
||||
|
@ -106,6 +106,11 @@ func (br *blockResult) initFromNeededColumns(brSrc *blockResult, bm *bitmap, nee
|
|||
})
|
||||
br.timestamps = dstTimestamps
|
||||
|
||||
if len(br.timestamps) == 0 {
|
||||
// There is no need in initializing columns for zero rows.
|
||||
return
|
||||
}
|
||||
|
||||
for _, neededColumn := range neededColumns {
|
||||
cSrc := brSrc.getColumnByName(neededColumn)
|
||||
|
||||
|
@ -1277,6 +1282,9 @@ func (br *blockResult) areSameColumns(columnNames []string) bool {
|
|||
}
|
||||
|
||||
func (br *blockResult) getColumnByName(columnName string) *blockResultColumn {
|
||||
if columnName == "" {
|
||||
columnName = "_msg"
|
||||
}
|
||||
for _, c := range br.getColumns() {
|
||||
if c.name == columnName {
|
||||
return c
|
||||
|
|
|
@ -32,8 +32,8 @@ func (fp *filterPhrase) String() string {
|
|||
return quoteFieldNameIfNeeded(fp.fieldName) + quoteTokenIfNeeded(fp.phrase)
|
||||
}
|
||||
|
||||
func (fp *filterPhrase) updateNeededFields(neededColumns fieldsSet) {
|
||||
neededColumns.add(fp.fieldName)
|
||||
func (fp *filterPhrase) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.add(fp.fieldName)
|
||||
}
|
||||
|
||||
func (fp *filterPhrase) getTokens() []string {
|
||||
|
|
|
@ -523,16 +523,16 @@ func parsePipeStats(lex *lexer) (*pipeStats, error) {
|
|||
}
|
||||
f.f = sf
|
||||
|
||||
neededFields := newFieldsSet()
|
||||
f.f.updateNeededFields(neededFields)
|
||||
f.neededFieldsForFunc = neededFields.getAll()
|
||||
|
||||
if lex.isKeyword("if") {
|
||||
iff, err := parseIfFilter(lex)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot parse 'if' filter for %s: %w", sf, err)
|
||||
}
|
||||
f.iff = iff
|
||||
|
||||
neededFields := newFieldsSet()
|
||||
iff.updateNeededFields(neededFields)
|
||||
f.neededFieldsForFunc = neededFields.getAll()
|
||||
}
|
||||
|
||||
resultName, err := parseResultName(lex)
|
||||
|
|
Loading…
Reference in a new issue