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] Named arguments in BigQuery #602

Closed
pokutuna opened this issue May 20, 2023 · 1 comment · Fixed by #603
Closed

[FORMATTING] Named arguments in BigQuery #602

pokutuna opened this issue May 20, 2023 · 1 comment · Fixed by #603
Labels

Comments

@pokutuna
Copy link
Contributor

pokutuna commented May 20, 2023

Input data

Which SQL and options did you provide as input?

SELECT MAKE_INTERVAL(1, day=>2, minute => 3)

Expected Output

SELECT
  MAKE_INTERVAL(1, day => 2, minute => 3)

Actual Output

SELECT
  MAKE_INTERVAL(1, day = > 2, minute = > 3)

Usage

  • How are you calling / using the library?
    • $ npx -p sql-formatter@12.2.0 sql-formatter -l bigquery file.sql
  • What SQL language(s) does this apply to?
    • BigQuery
  • Which SQL Formatter version are you using?
    • 12.2.0 (latest)

BigQuery supports named arguments in several functions.
https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-reference#named_arguments

Named arguments are sometimes used in JSON functions and Geography functions.

Reading at the PostgreSQL implementation, it is not difficult to just add it to operators, so I'll try to PR it.
If the operator should work only in the function call, reject it.

@nene
Copy link
Collaborator

nene commented May 21, 2023

Thanks for the PR. I've release sql-formatter 12.2.1 with the fix. 💯

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

Successfully merging a pull request may close this issue.

2 participants