From 5b13f6eb0e6b947904bc58c335037eb5b1c40408 Mon Sep 17 00:00:00 2001 From: Andrey Karpov Date: Thu, 14 Nov 2024 20:27:26 +0000 Subject: [PATCH] wip --- tempodb/encoding/vparquet4/block_traceql.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tempodb/encoding/vparquet4/block_traceql.go b/tempodb/encoding/vparquet4/block_traceql.go index f67fc272e36..772cfb73063 100644 --- a/tempodb/encoding/vparquet4/block_traceql.go +++ b/tempodb/encoding/vparquet4/block_traceql.go @@ -1896,7 +1896,7 @@ func createSpanIterator(makeIter makeIterFn, innerIterators []parquetquery.Itera continue case traceql.IntrinsicDuration: - pred, err := createIntPredicate(cond.Op, cond.Operands) + pred, err := createNumericPredicate(cond.Op, cond.Operands) if err != nil { return nil, err } @@ -2496,6 +2496,19 @@ func createBytesPredicate(op traceql.Operator, operands traceql.Operands, isSpan } } +func createNumericPredicate(op traceql.Operator, operands traceql.Operands) (parquetquery.Predicate, error) { + if op == traceql.OpNone { + return nil, nil + } + + if operands[0].Type == traceql.TypeFloat { + // The column is already indexed as int, so we need to convert the float to int + operands = traceql.Operands{traceql.NewStaticInt(int(operands[0].Float()))} + } + + return createIntPredicate(op, operands) +} + func createIntPredicate(op traceql.Operator, operands traceql.Operands) (parquetquery.Predicate, error) { if op == traceql.OpNone { return nil, nil