You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When transpiling a trino db query that contains both an offset and a limit, both values get swapped despite the fact that Trino throws an error if offset comes after limit and not before.
Running this: sqlglot.transpile("SELECT a, b FROM test OFFSET 2 LIMIT 1", read="trino", write="trino") (offset in the correct location i.e. before limit)
Gives: 'SELECT a, b FROM test LIMIT 1 OFFSET 2' as output (limit and offset swapped)
And trino fails to run the new query with the error below:
Query 20230611_033140_00021_2zk4n failed: line 1:31: mismatched input 'OFFSET'. Expecting: <EOF>
SELECT a, b FROM test LIMIT 1 OFFSET 2
Basically, I'm trying to set the 'from' clause in an existing trino query using sqlglot.parse_one(query).from_("test_location").sql(dialect="trino"), but the OFFSET and LIMIT are swapped in the result.
The text was updated successfully, but these errors were encountered:
When transpiling a trino db query that contains both an offset and a limit, both values get swapped despite the fact that Trino throws an error if offset comes after limit and not before.
Running this:
sqlglot.transpile("SELECT a, b FROM test OFFSET 2 LIMIT 1", read="trino", write="trino")
(offset in the correct location i.e. before limit)Gives:
'SELECT a, b FROM test LIMIT 1 OFFSET 2'
as output (limit and offset swapped)And trino fails to run the new query with the error below:
Basically, I'm trying to set the 'from' clause in an existing trino query using
sqlglot.parse_one(query).from_("test_location").sql(dialect="trino")
, but the OFFSET and LIMIT are swapped in the result.The text was updated successfully, but these errors were encountered: