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

Function TestNewRegexInPredicate

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

Source from the content-addressed store, hash-verified

126}
127
128func TestNewRegexInPredicate(t *testing.T) {
129 testCases := []predicateTestCase{
130 {
131 testName: "all chunks/pages/values inspected",
132 predicate: func() Predicate {
133 pred, err := NewRegexInPredicate([]string{"a.*"})
134 require.NoError(t, err)
135
136 return pred
137 }(),
138 keptChunks: 1,
139 keptPages: 1,
140 keptValues: 2,
141 writeData: func(w *parquet.Writer) { //nolint:all
142 require.NoError(t, w.Write(&testDictString{"abc"})) // kept
143 require.NoError(t, w.Write(&testDictString{"acd"})) // kept
144 require.NoError(t, w.Write(&testDictString{"cde"})) // skipped
145 },
146 },
147 {
148 testName: "dictionary in the page header allows for skipping a column chunk",
149 predicate: func() Predicate {
150 pred, err := NewRegexInPredicate([]string{"x.*"})
151 require.NoError(t, err)
152
153 return pred
154 }(), // Not present in any values
155 keptChunks: 0,
156 keptPages: 0,
157 keptValues: 0,
158 writeData: func(w *parquet.Writer) { //nolint:all
159 require.NoError(t, w.Write(&testDictString{"abc"}))
160 require.NoError(t, w.Write(&testDictString{"abc"}))
161 },
162 },
163 }
164
165 for _, tC := range testCases {
166 t.Run(tC.testName, func(t *testing.T) {
167 testPredicate(t, tC)
168 })
169 }
170}
171
172func TestNewStringNotInPredicate(t *testing.T) {
173 testCases := []predicateTestCase{

Callers

nothing calls this directly

Calls 4

NewRegexInPredicateFunction · 0.85
testPredicateFunction · 0.85
WriteMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected