MCPcopy
hub / github.com/grafana/tempo / TestLeftJoinUp

Function TestLeftJoinUp

pkg/parquetquery/iters_test.go:441–494  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

439}
440
441func TestLeftJoinUp(t *testing.T) {
442 // Defined at level 0
443 iter1 := &testIterator{rows: []IteratorResult{
444 testResult("x", "A", 1),
445 testResult("x", "B", 2),
446 }}
447
448 // Defined at level 1
449 iter2 := &testIterator{rows: []IteratorResult{
450 testResult("y", "A", 1, 0),
451 testResult("y", "B", 1, 1),
452 testResult("y", "C", 2, 0),
453 }}
454
455 expected := []IteratorResult{
456 {
457 RowNumber: rn(1),
458 OtherEntries: []struct {
459 Key string
460 Value interface{}
461 }{
462 {Key: "x", Value: "A"},
463 {Key: "y", Value: "A"},
464 {Key: "y", Value: "B"},
465 },
466 },
467 {
468 RowNumber: rn(2),
469 OtherEntries: []struct {
470 Key string
471 Value interface{}
472 }{
473 {Key: "x", Value: "B"},
474 {Key: "y", Value: "C"},
475 },
476 },
477 }
478
479 got := []IteratorResult{}
480
481 j, err := NewLeftJoinIterator(0, []Iterator{iter1, iter2}, nil, nil)
482 require.NoError(t, err)
483
484 for {
485 res, err := j.Next()
486 require.NoError(t, err)
487 if res == nil {
488 break
489 }
490 got = append(got, clone(res))
491 }
492
493 require.Equal(t, expected, got)
494}
495
496func TestLeftJoinDown(t *testing.T) {
497 iter1DefLevel := 2

Callers

nothing calls this directly

Calls 6

NextMethod · 0.95
testResultFunction · 0.85
rnFunction · 0.85
NewLeftJoinIteratorFunction · 0.85
cloneFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected