cube2222 / octosql

OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.
Mozilla Public License 2.0
4.75k stars 202 forks source link

[BUG] operator should be changed when `in` with single value #272

Open xqbumu opened 2 years ago

xqbumu commented 2 years ago

example sql:

select * from events where id in (1)

the id's right expr type change to logical.Constant

https://github.com/cube2222/octosql/blob/main/parser/parser.go#L642-L644

https://github.com/cube2222/octosql/blob/main/parser/parser.go#L832-L863

so, maybe we should change the operator to sqlparser.EqualStr after L862

    if operator == sqlparser.InStr {
        switch rightParsed.(type) {
        case *logical.Constant:
            operator = sqlparser.EqualStr
        }
    }