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

[FORMATTING] Missing support for Snowflake lambda operator #789

Closed
datarttu opened this issue Oct 21, 2024 · 4 comments
Closed

[FORMATTING] Missing support for Snowflake lambda operator #789

datarttu opened this issue Oct 21, 2024 · 4 comments
Labels

Comments

@datarttu
Copy link

-> operator in Snowflake SQL dialect is currently formatted into - >. See Snowflake Lambda expressions for background.

Input data

Which SQL and options did you provide as input?

SELECT FILTER(some_array_of_objects_with_int_value, a -> a:value >= 50) AS "Filter >= 50";

Expected Output

SELECT
  FILTER (
    some_array_of_objects_with_int_value,
    a -> a:value >= 50
  ) AS "Filter >= 50";

Actual Output

SELECT
  FILTER (
    some_array_of_objects_with_int_value,
    a - > a:value >= 50
  ) AS "Filter >= 50";

Usage

  • How are you calling / using the library? - SQL Formatter VSCode / format-on-save
  • What SQL language(s) does this apply to? - Snowflake SQL
  • Which SQL Formatter version are you using? - SQL Formatter VSCode v4.1.2 which uses sql-formatter v15.4.3
@datarttu datarttu added the bug label Oct 21, 2024
@datarttu
Copy link
Author

Could this be fixed with an addition to supported operators and related test(s)?

// https://docs.snowflake.com/en/user-guide/querying-semistructured#lambda-expressions
'->'

Unfortunately I don't currently have Node / ts environment set up to test my suggestion locally, but I'm happy to help in any way I can.

@nene
Copy link
Collaborator

nene commented Oct 21, 2024

Thanks for reporting. Yes, that would have been the fix to make.

@nene nene closed this as completed in 5d377ac Oct 21, 2024
@nene
Copy link
Collaborator

nene commented Oct 21, 2024

Released the fix in sql-formatter 15.4.5 and vscode plugin 4.1.3.

@datarttu
Copy link
Author

Works like a charm. Thank you so much! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants