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

Function TestIntInPredicate

pkg/parquetquery/predicates_test.go:389–429  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

387}
388
389func TestIntInPredicate(t *testing.T) {
390 testCases := []predicateTestCase{
391 {
392 testName: "all chunks/pages/values inspected",
393 predicate: func() Predicate {
394 var p Predicate = NewIntInPredicate([]int64{1, 3})
395 return p
396 }(),
397 keptChunks: 1,
398 keptPages: 1,
399 keptValues: 2,
400 writeData: func(w *parquet.Writer) { //nolint:all
401 require.NoError(t, w.Write(&testInt{1})) // kept
402 require.NoError(t, w.Write(&testInt{2})) // skipped
403 require.NoError(t, w.Write(&testInt{3})) // kept
404 require.NoError(t, w.Write(&testInt{10})) // skipped
405 },
406 },
407 {
408 testName: "dictionary allows skipping a column chunk when no ints match",
409 predicate: func() Predicate {
410 var p Predicate = NewIntInPredicate([]int64{0, 4, 100})
411 return p
412 }(),
413 keptChunks: 0,
414 keptPages: 0,
415 keptValues: 0,
416 writeData: func(w *parquet.Writer) { //nolint:all
417 require.NoError(t, w.Write(&testInt{1}))
418 require.NoError(t, w.Write(&testInt{2}))
419 require.NoError(t, w.Write(&testInt{3}))
420 },
421 },
422 }
423
424 for _, tC := range testCases {
425 t.Run(tC.testName, func(t *testing.T) {
426 testPredicate(t, tC)
427 })
428 }
429}
430
431func TestIntNotInPredicate(t *testing.T) {
432 testCases := []predicateTestCase{

Callers

nothing calls this directly

Calls 4

NewIntInPredicateFunction · 0.85
testPredicateFunction · 0.85
WriteMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected