KeepGroup applies resource-level data and filtering to the spans yielded from the span-level iterators. It updates the spans in-place in the OtherEntries slice. Creation of the spanset is delayed until the traceCollector.
(res *parquetquery.IteratorResult)
| 3427 | // the span-level iterators. It updates the spans in-place in the OtherEntries slice. |
| 3428 | // Creation of the spanset is delayed until the traceCollector. |
| 3429 | func (c *batchCollector) KeepGroup(res *parquetquery.IteratorResult) bool { |
| 3430 | // First pass over spans and attributes from the AttributeCollector |
| 3431 | spans := res.OtherEntries[:0] |
| 3432 | c.resAttrs = c.resAttrs[:0] |
| 3433 | |
| 3434 | for _, kv := range res.OtherEntries { |
| 3435 | switch v := kv.Value.(type) { |
| 3436 | case *span: |
| 3437 | spans = append(spans, kv) |
| 3438 | case traceql.Static: |
| 3439 | c.resAttrs = append(c.resAttrs, attrVal{newResAttr(kv.Key), v}) |
| 3440 | } |
| 3441 | } |
| 3442 | res.OtherEntries = spans |
| 3443 | |
| 3444 | // Throw out batches without any candidate spans |
| 3445 | if len(res.OtherEntries) == 0 { |
| 3446 | return false |
| 3447 | } |
| 3448 | |
| 3449 | // Gather Attributes from dedicated resource-level columns |
| 3450 | for _, e := range res.Entries { |
| 3451 | switch e.Value.Kind() { |
| 3452 | case parquet.Int64: |
| 3453 | c.resAttrs = append(c.resAttrs, attrVal{newResAttr(e.Key), traceql.NewStaticInt(int(e.Value.Int64()))}) |
| 3454 | case parquet.ByteArray: |
| 3455 | c.resAttrs = append(c.resAttrs, attrVal{newResAttr(e.Key), traceql.NewStaticString(unsafeToString(e.Value.Bytes()))}) |
| 3456 | default: |
| 3457 | // This is a null value, indicating the attribute doesn't exist |
| 3458 | if e.Value.IsNull() { |
| 3459 | c.resAttrs = append(c.resAttrs, attrVal{newResAttr(e.Key), traceql.NewStaticString("nil")}) |
| 3460 | } |
| 3461 | } |
| 3462 | } |
| 3463 | |
| 3464 | if c.minAttributes > 0 { |
| 3465 | if len(c.resAttrs) < c.minAttributes { |
| 3466 | return false |
| 3467 | } |
| 3468 | } |
| 3469 | |
| 3470 | // Second pass. Update and further filter the spans |
| 3471 | if len(c.resAttrs) > 0 || c.requireAtLeastOneMatchOverall { |
| 3472 | mightFilter := c.requireAtLeastOneMatchOverall |
| 3473 | |
| 3474 | // If we might filter, then rebuild the slice of kept |
| 3475 | // spans, in place with the same underlying buffer. |
| 3476 | // If not filtering, then skip this work. |
| 3477 | var spans []struct { |
| 3478 | Key string |
| 3479 | Value interface{} |
| 3480 | } |
| 3481 | if mightFilter { |
| 3482 | spans = res.OtherEntries[:0] |
| 3483 | } |
| 3484 | |
| 3485 | for _, e := range res.OtherEntries { |
| 3486 | span, ok := e.Value.(*span) |
nothing calls this directly
no test coverage detected