(makeIter makeIterFn, resourceIter parquetquery.Iterator, conds []traceql.Condition, start, end uint64, allConditions bool, selectAll bool)
| 1942 | } |
| 1943 | |
| 1944 | func createTraceIterator(makeIter makeIterFn, resourceIter parquetquery.Iterator, conds []traceql.Condition, start, end uint64, allConditions bool, selectAll bool) (parquetquery.Iterator, error) { |
| 1945 | iters := make([]parquetquery.Iterator, 0, 3) |
| 1946 | |
| 1947 | // add conditional iterators first. this way if someone searches for { traceDuration > 1s && span.foo = "bar"} the query will |
| 1948 | // be sped up by searching for traceDuration first. note that we can only set the predicates if all conditions is true. |
| 1949 | // otherwise we just pass the info up to the engine to make a choice |
| 1950 | for _, cond := range conds { |
| 1951 | switch cond.Attribute.Intrinsic { |
| 1952 | case traceql.IntrinsicTraceID: |
| 1953 | pred, err := createBytesPredicate(cond.Op, cond.Operands, false) |
| 1954 | if err != nil { |
| 1955 | return nil, err |
| 1956 | } |
| 1957 | iters = append(iters, makeIter(columnPathTraceID, pred, columnPathTraceID)) |
| 1958 | case traceql.IntrinsicTraceDuration: |
| 1959 | pred, err := createDurationPredicate(cond.Op, cond.Operands) |
| 1960 | if err != nil { |
| 1961 | return nil, err |
| 1962 | } |
| 1963 | iters = append(iters, makeIter(columnPathDurationNanos, pred, columnPathDurationNanos)) |
| 1964 | case traceql.IntrinsicTraceStartTime: |
| 1965 | if start == 0 && end == 0 { |
| 1966 | iters = append(iters, makeIter(columnPathStartTimeUnixNano, nil, columnPathStartTimeUnixNano)) |
| 1967 | } |
| 1968 | case traceql.IntrinsicTraceRootSpan: |
| 1969 | pred, err := createStringPredicate(cond.Op, cond.Operands) |
| 1970 | if err != nil { |
| 1971 | return nil, err |
| 1972 | } |
| 1973 | iters = append(iters, makeIter(columnPathRootSpanName, pred, columnPathRootSpanName)) |
| 1974 | case traceql.IntrinsicTraceRootService: |
| 1975 | pred, err := createStringPredicate(cond.Op, cond.Operands) |
| 1976 | if err != nil { |
| 1977 | return nil, err |
| 1978 | } |
| 1979 | iters = append(iters, makeIter(columnPathRootServiceName, pred, columnPathRootServiceName)) |
| 1980 | } |
| 1981 | } |
| 1982 | |
| 1983 | if selectAll { |
| 1984 | for intrins, entry := range intrinsicColumnLookups { |
| 1985 | if entry.scope != intrinsicScopeTrace { |
| 1986 | continue |
| 1987 | } |
| 1988 | // These intrinsics aren't included in select all because I say so. |
| 1989 | switch intrins { |
| 1990 | case traceql.IntrinsicTraceStartTime, |
| 1991 | traceql.IntrinsicServiceStats: |
| 1992 | continue |
| 1993 | } |
| 1994 | iters = append(iters, makeIter(entry.columnPath, nil, entry.columnPath)) |
| 1995 | } |
| 1996 | } |
| 1997 | |
| 1998 | var required []parquetquery.Iterator |
| 1999 | |
| 2000 | // This is an optimization for when all of the conditions must be met. |
| 2001 | // We simply move all iterators into the required list. |
no test coverage detected