From 7653da82f084886791075f8a71b7c3de3c165087 Mon Sep 17 00:00:00 2001 From: Brian Holmes Date: Tue, 19 Dec 2023 10:21:44 -0500 Subject: [PATCH] remove temp filters on the runtime side --- runtime/queries/metricsview.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/runtime/queries/metricsview.go b/runtime/queries/metricsview.go index a762a891567..a8ddc324031 100644 --- a/runtime/queries/metricsview.go +++ b/runtime/queries/metricsview.go @@ -551,19 +551,25 @@ func convertFilterToExpression(filter *runtimev1.MetricsViewFilter) *runtimev1.E if len(filter.Include) > 0 { var includeExprs []*runtimev1.Expression for _, cond := range filter.Include { - domExpr := convertDimensionFilterToExpression(cond, false) - if domExpr != nil { - includeExprs = append(includeExprs, domExpr) + if len(cond.In) > 0 { + domExpr := convertDimensionFilterToExpression(cond, false) + if domExpr != nil { + includeExprs = append(includeExprs, domExpr) + } } } - exprs = append(exprs, expressionpb.Or(includeExprs)) + if len(includeExprs) > 0 { + exprs = append(exprs, expressionpb.Or(includeExprs)) + } } if len(filter.Exclude) > 0 { for _, cond := range filter.Exclude { - domExpr := convertDimensionFilterToExpression(cond, true) - if domExpr != nil { - exprs = append(exprs, domExpr) + if len(cond.In) > 0 { + domExpr := convertDimensionFilterToExpression(cond, true) + if domExpr != nil { + exprs = append(exprs, domExpr) + } } } } @@ -588,7 +594,7 @@ func convertDimensionFilterToExpression(cond *runtimev1.MetricsViewFilter_Cond, } else { inExpr = expressionpb.In(expressionpb.Identifier(cond.Name), inExprs) } - } + var likeExpr *runtimev1.Expression if len(cond.Like) == 1 { @@ -625,6 +631,7 @@ func convertDimensionFilterToExpression(cond *runtimev1.MetricsViewFilter_Cond, } else if likeExpr != nil { return likeExpr } + } return nil }