(t *testing.T)
| 1225 | } |
| 1226 | |
| 1227 | func TestBackendBlockSelectAll(t *testing.T) { |
| 1228 | var ( |
| 1229 | ctx = context.Background() |
| 1230 | numTraces = 250 |
| 1231 | traces = make([]*Trace, 0, numTraces) |
| 1232 | wantTraceIdx = rand.Intn(numTraces) |
| 1233 | wantTraceID = test.ValidTraceID(nil) |
| 1234 | wantTrace = fullyPopulatedTestTrace(wantTraceID) |
| 1235 | dc = test.MakeDedicatedColumns() |
| 1236 | dcm = dedicatedColumnsToColumnMapping(dc) |
| 1237 | ) |
| 1238 | |
| 1239 | // TODO - This strips unsupported attributes types for now. Revisit when |
| 1240 | // add support for arrays/kvlists in the fetch layer. |
| 1241 | trimForSelectAll(wantTrace) |
| 1242 | |
| 1243 | for i := 0; i < numTraces; i++ { |
| 1244 | if i == wantTraceIdx { |
| 1245 | traces = append(traces, wantTrace) |
| 1246 | continue |
| 1247 | } |
| 1248 | |
| 1249 | id := test.ValidTraceID(nil) |
| 1250 | tr, _ := traceToParquet(&backend.BlockMeta{}, id, test.MakeTrace(1, id), nil) |
| 1251 | traces = append(traces, tr) |
| 1252 | } |
| 1253 | |
| 1254 | b := makeBackendBlockWithTraces(t, traces) |
| 1255 | |
| 1256 | _, eval, _, _, req, err := traceql.Compile("{}") |
| 1257 | require.NoError(t, err) |
| 1258 | req.SecondPass = func(inSS *traceql.Spanset) ([]*traceql.Spanset, error) { return eval([]*traceql.Spanset{inSS}) } |
| 1259 | req.SecondPassSelectAll = true |
| 1260 | |
| 1261 | resp, err := b.Fetch(ctx, *req, common.DefaultSearchOptions()) |
| 1262 | require.NoError(t, err) |
| 1263 | defer resp.Results.Close() |
| 1264 | |
| 1265 | // This is a dump of all spans in the fully-populated test trace |
| 1266 | wantSS := flattenForSelectAll(wantTrace, dcm) |
| 1267 | |
| 1268 | for { |
| 1269 | // Seek to our desired trace |
| 1270 | ss, err := resp.Results.Next(ctx) |
| 1271 | require.NoError(t, err) |
| 1272 | if ss == nil { |
| 1273 | break |
| 1274 | } |
| 1275 | if !bytes.Equal(ss.TraceID, wantTraceID) { |
| 1276 | continue |
| 1277 | } |
| 1278 | |
| 1279 | // Cleanup found data for comparison |
| 1280 | // equal will fail on the rownum mismatches. this is an internal detail to the |
| 1281 | // fetch layer. just wipe them out here |
| 1282 | ss.ReleaseFn = nil |
| 1283 | ss.ServiceStats = nil |
| 1284 | for _, sp := range ss.Spans { |
nothing calls this directly
no test coverage detected