(op traceql.Operator, operands traceql.Operands)
| 2849 | } |
| 2850 | |
| 2851 | func createIntPredicate(op traceql.Operator, operands traceql.Operands) (parquetquery.Predicate, error) { |
| 2852 | if pred, handled := createExistencePredicate(op); handled { |
| 2853 | return pred, nil |
| 2854 | } |
| 2855 | |
| 2856 | if len(operands) == 0 { |
| 2857 | return nil, fmt.Errorf("operands cannot be empty") |
| 2858 | } |
| 2859 | |
| 2860 | var i int64 |
| 2861 | switch operands[0].Type { |
| 2862 | case traceql.TypeInt: |
| 2863 | n, _ := operands[0].Int() |
| 2864 | i = int64(n) |
| 2865 | case traceql.TypeDuration: |
| 2866 | d, _ := operands[0].Duration() |
| 2867 | i = d.Nanoseconds() |
| 2868 | case traceql.TypeStatus: |
| 2869 | st, _ := operands[0].Status() |
| 2870 | i = int64(StatusCodeMapping[st.String()]) |
| 2871 | case traceql.TypeKind: |
| 2872 | k, _ := operands[0].Kind() |
| 2873 | i = int64(KindMapping[k.String()]) |
| 2874 | case traceql.TypeIntArray: |
| 2875 | ints, _ := operands[0].Int64Array() |
| 2876 | |
| 2877 | switch op { |
| 2878 | case traceql.OpEqual, traceql.OpIn: |
| 2879 | return parquetquery.NewIntInPredicate(ints), nil |
| 2880 | case traceql.OpNotEqual, traceql.OpNotIn: |
| 2881 | return parquetquery.NewIntNotInPredicate(ints), nil |
| 2882 | default: |
| 2883 | return nil, fmt.Errorf("operator not supported for int arrays: %+v", op) |
| 2884 | } |
| 2885 | default: |
| 2886 | return nil, fmt.Errorf("operand is not int, int array, duration, status or kind: %s", operands[0].EncodeToString(false)) |
| 2887 | } |
| 2888 | |
| 2889 | switch op { |
| 2890 | case traceql.OpEqual: |
| 2891 | return parquetquery.NewIntEqualPredicate(i), nil |
| 2892 | case traceql.OpNotEqual: |
| 2893 | return parquetquery.NewIntNotEqualPredicate(i), nil |
| 2894 | case traceql.OpGreater: |
| 2895 | return parquetquery.NewIntGreaterPredicate(i), nil |
| 2896 | case traceql.OpGreaterEqual: |
| 2897 | return parquetquery.NewIntGreaterEqualPredicate(i), nil |
| 2898 | case traceql.OpLess: |
| 2899 | return parquetquery.NewIntLessPredicate(i), nil |
| 2900 | case traceql.OpLessEqual: |
| 2901 | return parquetquery.NewIntLessEqualPredicate(i), nil |
| 2902 | default: |
| 2903 | return nil, fmt.Errorf("operator not supported for integers: %+v", op) |
| 2904 | } |
| 2905 | } |
| 2906 | |
| 2907 | func createFloatPredicate(op traceql.Operator, operands traceql.Operands) (parquetquery.Predicate, error) { |
| 2908 | if pred, handled := createExistencePredicate(op); handled { |
no test coverage detected