mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
ee30c1f81b
commit
ede41d2039
2 changed files with 19 additions and 1 deletions
|
@ -1382,9 +1382,21 @@ func TestQueryGetNeededColumns(t *testing.T) {
|
||||||
f(`* | sort by (f1) | sort by (f2,f3 desc) desc | fields f4 | rm f1,f2,f5`, `f1,f2,f3,f4`, ``)
|
f(`* | sort by (f1) | sort by (f2,f3 desc) desc | fields f4 | rm f1,f2,f5`, `f1,f2,f3,f4`, ``)
|
||||||
|
|
||||||
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2`, `f1,f2,f3,f4`, ``)
|
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2`, `f1,f2,f3,f4`, ``)
|
||||||
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2 | fields f1`, ``, ``)
|
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2 | fields f5,f6`, ``, ``)
|
||||||
|
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2 | fields f1,f5`, `f1`, ``)
|
||||||
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2 | fields r1`, `f1,f2`, ``)
|
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2 | fields r1`, `f1,f2`, ``)
|
||||||
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2 | fields r2,r3`, `f1,f3,f4`, ``)
|
f(`* | stats by(f1) count(f2) r1, count(f3,f4) r2 | fields r2,r3`, `f1,f3,f4`, ``)
|
||||||
|
f(`_time:5m | stats by(_time:day) count() r1 | stats values(_time) r2`, `_time`, ``)
|
||||||
|
f(`* | stats count(f1) r1 | stats count() r1`, ``, ``)
|
||||||
|
f(`* | stats count(f1) r1 | stats count() r2`, ``, ``)
|
||||||
|
f(`* | stats count(f1) r1 | stats count(r1) r2`, `f1`, ``)
|
||||||
|
f(`* | stats count(f1) r1 | stats count(f1) r2`, ``, ``)
|
||||||
|
f(`* | stats count(f1) r1 | stats count(f1,r1) r1`, `f1`, ``)
|
||||||
|
f(`* | stats count(f1,f2) r1 | stats count(f2) r1, count(r1) r2`, `f1,f2`, ``)
|
||||||
|
f(`* | stats count(f1,f2) r1 | stats count(f2) r1, count(r1) r2 | fields r1`, ``, ``)
|
||||||
|
f(`* | stats count(f1,f2) r1 | stats count(f2) r1, count(r1) r2 | fields r2`, `f1,f2`, ``)
|
||||||
|
f(`* | stats by(f3,f4) count(f1,f2) r1 | stats count(f2) r1, count(r1) r2 | fields r2`, `f1,f2,f3,f4`, ``)
|
||||||
|
f(`* | stats by(f3,f4) count(f1,f2) r1 | stats count(f3) r1, count(r1) r2 | fields r1`, `f3,f4`, ``)
|
||||||
|
|
||||||
f(`* | rm f1, f2`, `*`, `f1,f2`)
|
f(`* | rm f1, f2`, `*`, `f1,f2`)
|
||||||
f(`* | rm f1, f2 | mv f2 f3`, `*`, `f1,f2,f3`)
|
f(`* | rm f1, f2 | mv f2 f3`, `*`, `f1,f2,f3`)
|
||||||
|
|
|
@ -92,6 +92,12 @@ func (ps *pipeStats) updateNeededFields(neededFields, unneededFields fieldsSet)
|
||||||
byFields[i] = bf.name
|
byFields[i] = bf.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, f := range byFields {
|
||||||
|
if neededFieldsOrig.contains(f) && !unneededFields.contains(f) {
|
||||||
|
neededFields.addAll(byFields)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for i, resultName := range ps.resultNames {
|
for i, resultName := range ps.resultNames {
|
||||||
if neededFieldsOrig.contains(resultName) && !unneededFields.contains(resultName) {
|
if neededFieldsOrig.contains(resultName) && !unneededFields.contains(resultName) {
|
||||||
funcFields := ps.funcs[i].neededFields()
|
funcFields := ps.funcs[i].neededFields()
|
||||||
|
|
Loading…
Reference in a new issue