Skip to content

Commit

Permalink
Fixing nil rhs branch in InfixOp (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelewski authored May 24, 2024
1 parent 7494707 commit 526e176
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions quesma/queryparser/query_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package queryparser
import (
"encoding/json"
"fmt"
"github.com/k0kubun/pp"
"github.com/relvacode/iso8601"
"mitmproxy/quesma/clickhouse"
"mitmproxy/quesma/logger"
"mitmproxy/quesma/model"
Expand All @@ -16,6 +14,9 @@ import (
"strconv"
"strings"
"unicode"

"github.com/k0kubun/pp"
"github.com/relvacode/iso8601"
)

type QueryMap = map[string]interface{}
Expand Down Expand Up @@ -555,7 +556,9 @@ func (cw *ClickhouseQueryTranslator) parseMatch(queryMap QueryMap, matchPhrase b
cw.AddTokenToHighlight(vUnNested)

// so far we assume that only strings can be ORed here
return model.NewSimpleQuery(model.NewSimpleStatement(strconv.Quote(fieldName)+" == "+sprint(vUnNested)), true)
statement := model.NewSimpleStatement(strconv.Quote(fieldName) + " == " + sprint(vUnNested))
statement.WhereStatement = wc.NewInfixOp(wc.NewColumnRef(fieldName), "==", wc.NewLiteral(sprint(vUnNested)))
return model.NewSimpleQuery(statement, true)
}

// unreachable unless something really weird happens
Expand Down

0 comments on commit 526e176

Please sign in to comment.