promql/engine.go
func (ev *evaluator) vectorSelector(node *VectorSelector, ts int64) Vector {
	checkForSeriesSetExpansion(ev.ctx, node)

	var (
		vec = make(Vector, 0, len(node.series))
	)

	it := storage.NewBuffer(durationMilliseconds(LookbackDelta))
	for i, s := range node.series {
		it.Reset(s.Iterator())

		t, v, ok := ev.vectorSelectorSingle(it, node, ts)
		if ok {
			vec = append(vec, Sample{
				Metric: node.series[i].Labels(),
				Point:  Point{V: v, T: t},
			})
			ev.currentSamples++
		}

		if ev.currentSamples >= ev.maxSamples {
			ev.error(ErrTooManySamples(env))
		}
	}
	return vec
}
func (ev *evaluator) vectorSelector(node *VectorSelector, ts int64) Vector {
	checkForSeriesSetExpansion(ev.ctx, node)

	var (
		vec = make(Vector, 0, len(node.series))
	)

	it := storage.NewBuffer(durationMilliseconds(LookbackDelta))
	for i, s := range node.series {
		it.Reset(s.Iterator())

		t, v, ok := ev.vectorSelectorSingle(it, node, ts)
		if ok {
			vec = append(vec, Sample{
				Metric: node.series[i].Labels(),
				Point:  Point{V: v, T: t},
			})
			ev.currentSamples++
		}

		if ev.currentSamples >= ev.maxSamples {
			ev.error(ErrTooManySamples(env))
		}
	}
	return vec
}
func ( ev * evaluator ) vectorSelector ( node * VectorSelector , ts int64 ) Vector { checkForSeriesSetExpansion ( ev . ctx , node ) var ( vec = make ( Vector , 0 , len ( node . series ) ) ) it := storage . NewBuffer ( durationMilliseconds ( LookbackDelta ) ) for i , s := range node . series { it . Reset ( s . Iterator ( ) ) t , v , ok := ev . vectorSelectorSingle ( it , node , ts ) if ok { vec = append ( vec , Sample { Metric : node . series [ i ] . Labels ( ) , Point : Point { V : v , T : t } , } ) ev . currentSamples ++ } if ev . currentSamples >= ev . maxSamples { ev . error ( ErrTooManySamples ( env ) ) } } return vec }
// vectorSelector evaluates a *VectorSelector expression.
vectorSelector evaluates a * VectorSelector expression .