(op traceql.Operator, operands traceql.Operands)
| 2288 | } |
| 2289 | |
| 2290 | func createIntPredicate(op traceql.Operator, operands traceql.Operands) (parquetquery.Predicate, error) { |
| 2291 | if pred, handled := createExistencePredicate(op); handled { |
| 2292 | return pred, nil |
| 2293 | } |
| 2294 | |
| 2295 | if len(operands) == 0 { |
| 2296 | return nil, fmt.Errorf("operands cannot be empty") |
| 2297 | } |
| 2298 | |
| 2299 | var i int64 |
| 2300 | switch operands[0].Type { |
| 2301 | case traceql.TypeInt: |
| 2302 | n, _ := operands[0].Int() |
| 2303 | i = int64(n) |
| 2304 | case traceql.TypeDuration: |
| 2305 | d, _ := operands[0].Duration() |
| 2306 | i = d.Nanoseconds() |
| 2307 | case traceql.TypeStatus: |
| 2308 | st, _ := operands[0].Status() |
| 2309 | i = int64(StatusCodeMapping[st.String()]) |
| 2310 | case traceql.TypeKind: |
| 2311 | k, _ := operands[0].Kind() |
| 2312 | i = int64(KindMapping[k.String()]) |
| 2313 | case traceql.TypeIntArray: |
| 2314 | ints, _ := operands[0].Int64Array() |
| 2315 | |
| 2316 | switch op { |
| 2317 | case traceql.OpEqual, traceql.OpIn: |
| 2318 | return parquetquery.NewIntInPredicate(ints), nil |
| 2319 | case traceql.OpNotEqual, traceql.OpNotIn: |
| 2320 | return parquetquery.NewIntNotInPredicate(ints), nil |
| 2321 | default: |
| 2322 | return nil, fmt.Errorf("operator not supported for int arrays: %+v", op) |
| 2323 | } |
| 2324 | default: |
| 2325 | return nil, fmt.Errorf("operand is not int, int array, duration, status or kind: %s", operands[0].EncodeToString(false)) |
| 2326 | } |
| 2327 | |
| 2328 | switch op { |
| 2329 | case traceql.OpEqual: |
| 2330 | return parquetquery.NewIntEqualPredicate(i), nil |
| 2331 | case traceql.OpNotEqual: |
| 2332 | return parquetquery.NewIntNotEqualPredicate(i), nil |
| 2333 | case traceql.OpGreater: |
| 2334 | return parquetquery.NewIntGreaterPredicate(i), nil |
| 2335 | case traceql.OpGreaterEqual: |
| 2336 | return parquetquery.NewIntGreaterEqualPredicate(i), nil |
| 2337 | case traceql.OpLess: |
| 2338 | return parquetquery.NewIntLessPredicate(i), nil |
| 2339 | case traceql.OpLessEqual: |
| 2340 | return parquetquery.NewIntLessEqualPredicate(i), nil |
| 2341 | default: |
| 2342 | return nil, fmt.Errorf("operator not supported for integers: %+v", op) |
| 2343 | } |
| 2344 | } |
| 2345 | |
| 2346 | func createFloatPredicate(op traceql.Operator, operands traceql.Operands) (parquetquery.Predicate, error) { |
| 2347 | if pred, handled := createExistencePredicate(op); handled { |
no test coverage detected