Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Trino dialect doesn't handle array functions that use an arrow "->". #1302

Open
1 task
ademille opened this issue Feb 6, 2025 · 3 comments
Open
1 task
Labels
bug Something isn't working

Comments

@ademille
Copy link

ademille commented Feb 6, 2025

What happened?

When formatting valid Trino SQL that has an ascii arrow "->", the formatter will insert a space, making the SQL invalid.
Source:

SELECT array_sort(ARRAY[3, 2, 5, 1, 2], (x, y) -> IF(x < y, 1, IF(x = y, 0, -1)));

Formatted with Trino dialect:

SELECT
    array_sort(ARRAY[3, 2, 5, 1, 2], (X, Y) - > IF (x < y, 1, IF (x = y, 0, - 1)));

Notice that the arrow now has a space between the '-' and '>' characters.

Arrows in Trino SQL should not be modified.

Version

No response

Checked in Playground

@ademille ademille added the bug Something isn't working label Feb 6, 2025
@ademille
Copy link
Author

ademille commented Feb 6, 2025

The Athena dialect handles the "->" correctly. Since "Athena" is just an AWS version of Trino, is there really a need for both dialects?

@benfdking
Copy link
Collaborator

benfdking commented Feb 8, 2025

Hey,

I just fixed the formatting for this. It still doesn't parse the query correctly, but it does format it now correctly. Just pushing a new build.

@ademille
Copy link
Author

Great. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants