Repository: sql-formatter-org/sql-formatter (ts)

Issue:
[FORMATTING] Named arguments in BigQuery
**Input data**

Which SQL and options did you provide as input?

```sql
SELECT MAKE_INTERVAL(1, day=>2, minute => 3)
```

**Expected Output**

```sql
SELECT
  MAKE_INTERVAL(1, day => 2, minute => 3)
```

**Actual Output**

```sql
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](https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#double_for_json) and [Geography functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/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.

Pull request description:
Support named arguments for BigQuery
resolved #602 

Patch:
diff --git a/src/languages/bigquery/bigquery.formatter.ts b/src/languages/bigquery/bigquery.formatter.ts
index aef53d84..a3908130 100644
--- a/src/languages/bigquery/bigquery.formatter.ts
+++ b/src/languages/bigquery/bigquery.formatter.ts
@@ -180,7 +180,7 @@ export const bigquery: DialectOptions = {
     paramTypes: { positional: true, named: ['@'], quoted: ['@'] },
     variableTypes: [{ regex: String.raw`@@\w+` }],
     lineCommentTypes: ['--', '#'],
-    operators: ['&', '|', '^', '~', '>>', '<<', '||'],
+    operators: ['&', '|', '^', '~', '>>', '<<', '||', '=>'],
     postProcess,
   },
   formatOptions: {


Test patch:
diff --git a/test/bigquery.test.ts b/test/bigquery.test.ts
index 461a69b7..7df745ae 100644
--- a/test/bigquery.test.ts
+++ b/test/bigquery.test.ts
@@ -55,7 +55,7 @@ describe('BigQueryFormatter', () => {
     'EXCEPT DISTINCT',
     'INTERSECT DISTINCT',
   ]);
-  supportsOperators(format, ['&', '|', '^', '~', '>>', '<<', '||']);
+  supportsOperators(format, ['&', '|', '^', '~', '>>', '<<', '||', '=>']);
   supportsIsDistinctFrom(format);
   supportsParams(format, { positional: true, named: ['@'], quoted: ['@``'] });
   supportsWindow(format);
@@ -242,6 +242,17 @@ describe('BigQueryFormatter', () => {
     `);
   });
 
+  it('supports named arguments', () => {
+    expect(
+      format(`
+      SELECT MAKE_INTERVAL(1, day=>2, minute => 3)
+      `)
+    ).toBe(dedent`
+      SELECT
+        MAKE_INTERVAL(1, day => 2, minute => 3)
+    `);
+  });
+
   // Issue #279
   describe('supports FROM clause operators:', () => {
     it('UNNEST operator', () => {