Skip to content

Commit

Permalink
Don't coalesce closeTime when checking against null
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarzee committed Dec 10, 2024
1 parent f2d52ed commit 2ad2ef6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions common/persistence/visibility/store/sql/query_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,19 +670,27 @@ func (c *QueryConverter) convertIsExpr(exprRef *sqlparser.Expr) error {
if !ok {
return query.NewConverterError("`%s` is not an 'IS' expression", sqlparser.String(*exprRef))
}
_, err := c.convertColName(&expr.Expr)
if err != nil {
return err
}

switch expr.Operator {
case sqlparser.IsNullStr, sqlparser.IsNotNullStr:
// no-op
// mostly no-op

// skip closeTime to avoid coalesce
saAlias := strings.ReplaceAll(sqlparser.String(expr), "`", "")
if saAlias == searchattribute.CloseTime {
return nil
}
default:
return query.NewConverterError(
"%s: 'IS' operator can only be used with 'NULL' or 'NOT NULL'",
query.InvalidExpressionErrMessage,
)
}

_, err := c.convertColName(&expr.Expr)
if err != nil {
return err
}
return nil
}

Expand Down

0 comments on commit 2ad2ef6

Please sign in to comment.