mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
bddc715c0c
commit
c38d3dab4d
20 changed files with 27 additions and 27 deletions
|
@ -37,13 +37,13 @@ func (fs fieldsSet) getAll() []string {
|
|||
return a
|
||||
}
|
||||
|
||||
func (fs fieldsSet) addAll(fields []string) {
|
||||
func (fs fieldsSet) addFields(fields []string) {
|
||||
for _, f := range fields {
|
||||
fs.add(f)
|
||||
}
|
||||
}
|
||||
|
||||
func (fs fieldsSet) removeAll(fields []string) {
|
||||
func (fs fieldsSet) removeFields(fields []string) {
|
||||
for _, f := range fields {
|
||||
fs.remove(f)
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ func TestFieldsSet(t *testing.T) {
|
|||
t.Fatalf("fs must be empty")
|
||||
}
|
||||
|
||||
// verify addAll, getAll, removeAll
|
||||
fs.addAll([]string{"foo", "bar", "_msg"})
|
||||
// verify addFields, removeFields, getAll
|
||||
fs.addFields([]string{"foo", "bar", "_msg"})
|
||||
if !fs.contains("foo") || !fs.contains("bar") || !fs.contains("_msg") {
|
||||
t.Fatalf("fs must contain foo, bar and _msg")
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ func TestFieldsSet(t *testing.T) {
|
|||
if !reflect.DeepEqual(a, []string{"_msg", "bar", "foo"}) {
|
||||
t.Fatalf("unexpected result from getAll(); got %q; want %q", a, []string{"_msg", "bar", "foo"})
|
||||
}
|
||||
fs.removeAll([]string{"bar", "baz", "_msg"})
|
||||
fs.removeFields([]string{"bar", "baz", "_msg"})
|
||||
if fs.contains("bar") || fs.contains("baz") || fs.contains("_msg") {
|
||||
t.Fatalf("fs mustn't contain bar, baz and _msg")
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ func TestFieldsSet(t *testing.T) {
|
|||
}
|
||||
|
||||
// verify clone
|
||||
fs.addAll([]string{"foo", "bar", "baz"})
|
||||
fs.addFields([]string{"foo", "bar", "baz"})
|
||||
fsStr := fs.String()
|
||||
fsCopy := fs.clone()
|
||||
fsCopyStr := fsCopy.String()
|
||||
|
|
|
@ -40,7 +40,7 @@ func (pc *pipeCopy) updateNeededFields(neededFields, unneededFields fieldsSet) {
|
|||
}
|
||||
if neededFields.contains("*") {
|
||||
// update only unneeded fields
|
||||
unneededFields.addAll(pc.dstFields)
|
||||
unneededFields.addFields(pc.dstFields)
|
||||
for i, srcField := range pc.srcFields {
|
||||
if neededSrcFields[i] {
|
||||
unneededFields.remove(srcField)
|
||||
|
@ -48,7 +48,7 @@ func (pc *pipeCopy) updateNeededFields(neededFields, unneededFields fieldsSet) {
|
|||
}
|
||||
} else {
|
||||
// update only needed fields and reset unneeded fields
|
||||
neededFields.removeAll(pc.dstFields)
|
||||
neededFields.removeFields(pc.dstFields)
|
||||
for i, srcField := range pc.srcFields {
|
||||
if neededSrcFields[i] {
|
||||
neededFields.add(srcField)
|
||||
|
|
|
@ -75,7 +75,7 @@ func assertNeededFields(t *testing.T, nfs, unfs fieldsSet, neededFieldsExpected,
|
|||
func newTestFieldsSet(fields string) fieldsSet {
|
||||
fs := newFieldsSet()
|
||||
if fields != "" {
|
||||
fs.addAll(strings.Split(fields, ","))
|
||||
fs.addFields(strings.Split(fields, ","))
|
||||
}
|
||||
return fs
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@ func (pd *pipeDelete) String() string {
|
|||
func (pd *pipeDelete) updateNeededFields(neededFields, unneededFields fieldsSet) {
|
||||
if neededFields.contains("*") {
|
||||
// update only unneeded fields
|
||||
unneededFields.addAll(pd.fields)
|
||||
unneededFields.addFields(pd.fields)
|
||||
} else {
|
||||
// update only needed fields
|
||||
neededFields.removeAll(pd.fields)
|
||||
neededFields.removeFields(pd.fields)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ func (pf *pipeFields) updateNeededFields(neededFields, unneededFields fieldsSet)
|
|||
if neededFields.contains("*") {
|
||||
// subtract unneeded fields from pf.fields
|
||||
neededFields.reset()
|
||||
neededFields.addAll(pf.fields)
|
||||
neededFields.addFields(pf.fields)
|
||||
for _, f := range unneededFields.getAll() {
|
||||
neededFields.remove(f)
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ func (pr *pipeRename) updateNeededFields(neededFields, unneededFields fieldsSet)
|
|||
}
|
||||
if neededFields.contains("*") {
|
||||
// update only unneeded fields
|
||||
unneededFields.addAll(pr.dstFields)
|
||||
unneededFields.addFields(pr.dstFields)
|
||||
for i, srcField := range pr.srcFields {
|
||||
if neededSrcFields[i] {
|
||||
unneededFields.remove(srcField)
|
||||
|
@ -50,7 +50,7 @@ func (pr *pipeRename) updateNeededFields(neededFields, unneededFields fieldsSet)
|
|||
}
|
||||
} else {
|
||||
// update only needed fields and reset unneeded fields
|
||||
neededFields.removeAll(pr.dstFields)
|
||||
neededFields.removeFields(pr.dstFields)
|
||||
for i, srcField := range pr.srcFields {
|
||||
if neededSrcFields[i] {
|
||||
neededFields.add(srcField)
|
||||
|
|
|
@ -40,7 +40,7 @@ func (pu *pipeUniq) updateNeededFields(neededFields, unneededFields fieldsSet) {
|
|||
if len(pu.byFields) == 0 {
|
||||
neededFields.add("*")
|
||||
} else {
|
||||
neededFields.addAll(pu.byFields)
|
||||
neededFields.addFields(pu.byFields)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ func (sa *statsAvg) String() string {
|
|||
}
|
||||
|
||||
func (sa *statsAvg) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(sa.fields)
|
||||
neededFields.addFields(sa.fields)
|
||||
}
|
||||
|
||||
func (sa *statsAvg) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -22,7 +22,7 @@ func (sc *statsCount) updateNeededFields(neededFields fieldsSet) {
|
|||
// There is no need in fetching any columns for count(*) - the number of matching rows can be calculated as len(blockResult.timestamps)
|
||||
return
|
||||
}
|
||||
neededFields.addAll(sc.fields)
|
||||
neededFields.addFields(sc.fields)
|
||||
}
|
||||
|
||||
func (sc *statsCount) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -18,7 +18,7 @@ func (sc *statsCountEmpty) String() string {
|
|||
}
|
||||
|
||||
func (sc *statsCountEmpty) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(sc.fields)
|
||||
neededFields.addFields(sc.fields)
|
||||
}
|
||||
|
||||
func (sc *statsCountEmpty) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -25,7 +25,7 @@ func (su *statsCountUniq) String() string {
|
|||
}
|
||||
|
||||
func (su *statsCountUniq) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(su.fields)
|
||||
neededFields.addFields(su.fields)
|
||||
}
|
||||
|
||||
func (su *statsCountUniq) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -20,7 +20,7 @@ func (sm *statsMax) String() string {
|
|||
}
|
||||
|
||||
func (sm *statsMax) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(sm.fields)
|
||||
neededFields.addFields(sm.fields)
|
||||
}
|
||||
|
||||
func (sm *statsMax) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -15,7 +15,7 @@ func (sm *statsMedian) String() string {
|
|||
}
|
||||
|
||||
func (sm *statsMedian) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(sm.fields)
|
||||
neededFields.addFields(sm.fields)
|
||||
}
|
||||
|
||||
func (sm *statsMedian) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -20,7 +20,7 @@ func (sm *statsMin) String() string {
|
|||
}
|
||||
|
||||
func (sm *statsMin) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(sm.fields)
|
||||
neededFields.addFields(sm.fields)
|
||||
}
|
||||
|
||||
func (sm *statsMin) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -25,7 +25,7 @@ func (sq *statsQuantile) String() string {
|
|||
}
|
||||
|
||||
func (sq *statsQuantile) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(sq.fields)
|
||||
neededFields.addFields(sq.fields)
|
||||
}
|
||||
|
||||
func (sq *statsQuantile) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -17,7 +17,7 @@ func (ss *statsSum) String() string {
|
|||
}
|
||||
|
||||
func (ss *statsSum) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(ss.fields)
|
||||
neededFields.addFields(ss.fields)
|
||||
}
|
||||
|
||||
func (ss *statsSum) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -16,7 +16,7 @@ func (ss *statsSumLen) String() string {
|
|||
}
|
||||
|
||||
func (ss *statsSumLen) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(ss.fields)
|
||||
neededFields.addFields(ss.fields)
|
||||
}
|
||||
|
||||
func (ss *statsSumLen) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -25,7 +25,7 @@ func (su *statsUniqValues) String() string {
|
|||
}
|
||||
|
||||
func (su *statsUniqValues) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(su.fields)
|
||||
neededFields.addFields(su.fields)
|
||||
}
|
||||
|
||||
func (su *statsUniqValues) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
|
@ -22,7 +22,7 @@ func (sv *statsValues) String() string {
|
|||
}
|
||||
|
||||
func (sv *statsValues) updateNeededFields(neededFields fieldsSet) {
|
||||
neededFields.addAll(sv.fields)
|
||||
neededFields.addFields(sv.fields)
|
||||
}
|
||||
|
||||
func (sv *statsValues) newStatsProcessor() (statsProcessor, int) {
|
||||
|
|
Loading…
Reference in a new issue