Skip to content

Commit b8bf279

Browse files
committed
Only support simple WINDOW clause in Spark
1 parent d1101f5 commit b8bf279

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

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 = [

test/spark.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import supportsStrings from './features/strings';
1414
import supportsArrayAndMapAccessors from './features/arrayAndMapAccessors';
1515
import supportsComments from './features/comments';
1616
import supportsIdentifiers from './features/identifiers';
17-
import supportsWindow from './features/window';
1817

1918
describe('SparkFormatter', () => {
2019
const language = 'spark';
@@ -50,7 +49,22 @@ describe('SparkFormatter', () => {
5049
'NATURAL SEMI JOIN',
5150
],
5251
});
53-
supportsWindow(format);
52+
53+
it('formats basic WINDOW clause', () => {
54+
const result = format(`SELECT * FROM tbl WINDOW win1, WINDOW win2, WINDOW win3;`);
55+
expect(result).toBe(dedent`
56+
SELECT
57+
*
58+
FROM
59+
tbl
60+
WINDOW
61+
win1,
62+
WINDOW
63+
win2,
64+
WINDOW
65+
win3;
66+
`);
67+
});
5468

5569
it('formats window function and end as inline', () => {
5670
const result = format(

0 commit comments

Comments
 (0)