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
#1527 implemented a fix for transpiling SEQUENCE to Presto, so we now wrap SEQUENCE in an UNNEST call if used as a source. But there's an edge case left, where if we original SEQUENCE has an alias, that alias is not translated properly to the Presto code.
Code snippet
>>> import sqlglot
>>> sqlglot.__version__
'12.3.0'
>>> sqlglot.transpile("SELECT * FROM t CROSS JOIN GENERATE_SERIES(2, 4) s", read="postgres", write="presto")[0]
'SELECT * FROM t CROSS JOIN UNNEST(SEQUENCE(2, 4)) AS s'
The unnest requires a tuple (?) alias, so we need s to be _u(s) (like in #1495). Thus the transpiled SQL here should be
SELECT * FROM t CROSS JOIN UNNEST(SEQUENCE(2, 4)) AS _u(s)
The text was updated successfully, but these errors were encountered:
#1527 implemented a fix for transpiling SEQUENCE to Presto, so we now wrap SEQUENCE in an UNNEST call if used as a source. But there's an edge case left, where if we original SEQUENCE has an alias, that alias is not translated properly to the Presto code.
Code snippet
The unnest requires a tuple (?) alias, so we need
s
to be_u(s)
(like in #1495). Thus the transpiled SQL here should beThe text was updated successfully, but these errors were encountered: