diff --git a/quesma/model/expr_string_renderer.go b/quesma/model/expr_string_renderer.go index e7b578270..a93e2bf97 100644 --- a/quesma/model/expr_string_renderer.go +++ b/quesma/model/expr_string_renderer.go @@ -75,22 +75,6 @@ func (v *renderer) VisitLiteral(l LiteralExpr) interface{} { } } -func (v *renderer) VisitTuple(t TupleExpr) interface{} { - switch len(t.Exprs) { - case 0: - logger.WarnWithThrottling("VisitTuple", "TupleExpr with no expressions") - return "()" - case 1: - return t.Exprs[0].Accept(v) - default: - args := make([]string, len(t.Exprs)) - for i, arg := range t.Exprs { - args[i] = arg.Accept(v).(string) - } - return fmt.Sprintf("(%s)", strings.Join(args, ",")) - } -} - func (v *renderer) VisitTuple(t TupleExpr) interface{} { switch len(t.Exprs) { case 0: diff --git a/quesma/testdata/requests.go b/quesma/testdata/requests.go index b9c5500b1..573d74217 100644 --- a/quesma/testdata/requests.go +++ b/quesma/testdata/requests.go @@ -1014,10 +1014,10 @@ var TestsSearch = []SearchTestCase{ }, "track_total_hits": true }`, - []string{`("type"='task' AND "task.enabled" IN (true,54,'abc','abc\'s'))`}, + []string{`("type"='task' AND "task.enabled" IN tuple(true, 54, 'abc', 'abc\'s'))`}, model.ListAllFields, []string{ - `SELECT "message" FROM ` + TableName + ` WHERE ("type"='task' AND "task.enabled" IN (true,54,'abc','abc\\'s')) LIMIT 10`, + `SELECT "message" FROM ` + TableName + ` WHERE ("type"='task' AND "task.enabled" IN tuple(true, 54, 'abc', 'abc\\'s')) LIMIT 10`, `SELECT count(*) AS "column_0" FROM ` + TableName, }, []string{}, @@ -2196,13 +2196,13 @@ var TestsSearch = []SearchTestCase{ }, "track_total_hits": false }`, - []string{`("cliIP" IN ('2601:204:c503:c240:9c41:5531:ad94:4d90','50.116.43.98','75.246.0.64') AND ("@timestamp">=fromUnixTimestamp64Milli(1715817600000) AND "@timestamp"<=fromUnixTimestamp64Milli(1715990399000)))`}, + []string{`("cliIP" IN tuple('2601:204:c503:c240:9c41:5531:ad94:4d90', '50.116.43.98', '75.246.0.64') AND ("@timestamp">=fromUnixTimestamp64Milli(1715817600000) AND "@timestamp"<=fromUnixTimestamp64Milli(1715990399000)))`}, model.ListAllFields, //[]model.Query{withLimit(justSimplestWhere(`("cliIP" IN ('2601:204:c503:c240:9c41:5531:ad94:4d90','50.116.43.98','75.246.0.64') AND ("@timestamp">=parseDateTime64BestEffort('2024-05-16T00:00:00') AND "@timestamp"<=parseDateTime64BestEffort('2024-05-17T23:59:59')))`), 1)}, []string{ `SELECT "message" ` + `FROM ` + TableName + ` ` + - `WHERE ("cliIP" IN ('2601:204:c503:c240:9c41:5531:ad94:4d90','50.116.43.98','75.246.0.64') ` + + `WHERE ("cliIP" IN tuple('2601:204:c503:c240:9c41:5531:ad94:4d90', '50.116.43.98', '75.246.0.64') ` + `AND ("@timestamp">=fromUnixTimestamp64Milli(1715817600000) AND "@timestamp"<=fromUnixTimestamp64Milli(1715990399000))) ` + `LIMIT 1`, },