testPredicate by writing data and then iterating the column. The data model must contain a single column.
(t *testing.T, tc predicateTestCase)
| 307 | // testPredicate by writing data and then iterating the column. |
| 308 | // The data model must contain a single column. |
| 309 | func testPredicate(t *testing.T, tc predicateTestCase) { |
| 310 | t.Helper() |
| 311 | buf := new(bytes.Buffer) |
| 312 | w := parquet.NewWriter(buf) |
| 313 | tc.writeData(w) |
| 314 | w.Flush() |
| 315 | w.Close() |
| 316 | |
| 317 | file := bytes.NewReader(buf.Bytes()) |
| 318 | r, err := parquet.OpenFile(file, int64(buf.Len())) |
| 319 | require.NoError(t, err) |
| 320 | |
| 321 | p := InstrumentedPredicate{Pred: tc.predicate} |
| 322 | |
| 323 | i := NewSyncIterator(context.TODO(), r.RowGroups(), 0, SyncIteratorOptPredicate(&p)) |
| 324 | for { |
| 325 | res, err := i.Next() |
| 326 | require.NoError(t, err) |
| 327 | if res == nil { |
| 328 | break |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | require.Equal(t, tc.keptChunks, int(p.KeptColumnChunks), "keptChunks") |
| 333 | require.Equal(t, tc.keptPages, int(p.KeptPages), "keptPages") |
| 334 | require.Equal(t, tc.keptValues, int(p.KeptValues), "keptValues") |
| 335 | } |
| 336 | |
| 337 | func BenchmarkSubstringPredicate(b *testing.B) { |
| 338 | p := NewSubstringPredicate("abc") |
no test coverage detected