Skip to content

Commit ad0afb3

Browse files
authored
Merge PR #311: Add support for WINDOW clause
2 parents 0592b01 + b8bf279 commit ad0afb3

19 files changed

+87
-14
lines changed

src/languages/bigquery.formatter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ const reservedCommands = [
696696
'ORDER BY',
697697
'QUALIFY',
698698
'WINDOW',
699+
'PARTITION BY',
699700
'LIMIT',
700701
'OFFSET',
701702
'WITH',

src/languages/hive.formatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ const reservedCommands = [
572572
'VALUES',
573573
'WHERE',
574574
'WITH',
575+
'WINDOW',
576+
'PARTITION BY',
575577

576578
// newline keywords
577579
'STORED AS',

src/languages/mysql.formatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,8 @@ const reservedCommands = [
12741274
'OFFSET',
12751275
'ORDER BY',
12761276
'WHERE',
1277+
'WINDOW',
1278+
'PARTITION BY',
12771279
];
12781280

12791281
const reservedBinaryCommands = [

src/languages/n1ql.formatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ const reservedCommands = [
472472
'VALUES',
473473
'WHERE',
474474
'WITH',
475+
'WINDOW',
476+
'PARTITION BY',
475477
];
476478

477479
const reservedBinaryCommands = [

src/languages/postgresql.formatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,8 @@ const reservedCommands = [
15801580
'ORDER BY',
15811581
'WHERE',
15821582
'WITH',
1583+
'WINDOW',
1584+
'PARTITION BY',
15831585
];
15841586

15851587
const reservedBinaryCommands = [

src/languages/spark.formatter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,6 @@ const reservedCommands = [
665665
'WITH',
666666
'CLUSTER BY',
667667
'DISTRIBUTE BY',
668-
'PARTITION BY', // verify
669668
'GROUP BY',
670669
'HAVING',
671670
'VALUES',
@@ -711,7 +710,7 @@ const reservedCommands = [
711710
'INSERT',
712711
'LATERAL VIEW',
713712
'UPDATE',
714-
'WINDOW', // verify
713+
'WINDOW',
715714
];
716715

717716
const reservedBinaryCommands = [

src/languages/sql.formatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ const reservedCommands = [
347347
'VALUES',
348348
'WHERE',
349349
'WITH',
350+
'WINDOW',
351+
'PARTITION BY',
350352
];
351353

352354
const reservedBinaryCommands = [

src/languages/sqlite.formatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ const reservedCommands = [
239239
'VALUES',
240240
'WHERE',
241241
'WITH',
242+
'WINDOW',
243+
'PARTITION BY',
242244
];
243245

244246
const reservedBinaryCommands = [

src/languages/tsql.formatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,8 @@ const reservedCommands = [
11891189
'VALUES',
11901190
'WHERE',
11911191
'WITH',
1192+
'WINDOW',
1193+
'PARTITION BY',
11921194
];
11931195

11941196
const reservedBinaryCommands = [

test/bigquery.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import supportsDeleteFrom from './features/deleteFrom';
1515
import supportsComments from './features/comments';
1616
import supportsIdentifiers from './features/identifiers';
1717
import supportsParams from './options/param';
18+
import supportsWindow from './features/window';
1819

1920
describe('BigQueryFormatter', () => {
2021
const language = 'bigquery';
@@ -32,6 +33,7 @@ describe('BigQueryFormatter', () => {
3233
supportsJoin(format, { without: ['NATURAL JOIN'] });
3334
supportsOperators(format, BigQueryFormatter.operators);
3435
supportsParams(format, { positional: true, named: ['@'], quoted: ['@``'] });
36+
supportsWindow(format);
3537

3638
// Note: BigQuery supports single dashes inside identifiers, so my-ident would be
3739
// detected as identifier, while other SQL dialects would detect it as

0 commit comments

Comments
 (0)