Skip to content

[PLAT-54] filter open mode for reports #7683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
minor refactor
  • Loading branch information
pjain1 committed Jul 29, 2025
commit 1363a0100ba364921c88468003efeeae148d4726
3 changes: 1 addition & 2 deletions runtime/metricsview/query_expression_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func ExpressionToProto(expr *Expression) *runtimev1.Expression {
}

res := &runtimev1.Expression{}

if expr.Name != "" {
res.Expression = &runtimev1.Expression_Ident{Ident: expr.Name}
} else if expr.Value != nil {
Expand All @@ -89,6 +88,7 @@ func ExpressionToProto(expr *Expression) *runtimev1.Expression {
// If we can't convert the value, return nil
return nil
}

res.Expression = &runtimev1.Expression_Val{Val: val}
} else if expr.Condition != nil {
var op runtimev1.Operation
Expand Down Expand Up @@ -120,7 +120,6 @@ func ExpressionToProto(expr *Expression) *runtimev1.Expression {
case OperatorNilike:
op = runtimev1.Operation_OPERATION_NLIKE
}

exprs := make([]*runtimev1.Expression, 0, len(expr.Condition.Expressions))
for _, e := range expr.Condition.Expressions {
protoExpr := ExpressionToProto(e)
Expand Down
12 changes: 6 additions & 6 deletions runtime/queries/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,23 +302,23 @@ func rowFilterJSON(where *runtimev1.Expression, whereSQL string, filter *runtime
}
where = convertFilterToExpression(filter)
}
var whereExp *runtimev1.Expression
var whereSQLExp *runtimev1.Expression
if whereSQL != "" {
mvExp, err := metricssqlparser.ParseSQLFilter(whereSQL)
if err != nil {
return "", fmt.Errorf("invalid where SQL: %w", err)
}
whereExp = metricsview.ExpressionToProto(mvExp)
whereSQLExp = metricsview.ExpressionToProto(mvExp)
}

if whereExp != nil && where != nil {
if whereSQLExp != nil && where != nil {
where = &runtimev1.Expression{
Expression: &runtimev1.Expression_Cond{
Cond: &runtimev1.Condition{
Op: runtimev1.Operation_OPERATION_AND,
Exprs: []*runtimev1.Expression{
{
Expression: whereExp.Expression,
Expression: whereSQLExp.Expression,
},
{
Expression: where.Expression,
Expand All @@ -327,8 +327,8 @@ func rowFilterJSON(where *runtimev1.Expression, whereSQL string, filter *runtime
},
},
}
} else if whereExp != nil {
where = whereExp
} else if whereSQLExp != nil {
where = whereSQLExp
}

b, err := protojson.Marshal(where)
Expand Down
Loading