Skip to content

Commit 85ee523

Browse files
committed
[editor] Extend the reference repository with Spark SQL details for UDFs and keywords
1 parent 7984015 commit 85ee523

File tree

6 files changed

+3618
-11
lines changed

6 files changed

+3618
-11
lines changed

desktop/core/src/desktop/js/ko/components/assist/ko.rightAssistPanel.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,11 @@ class RightAssistPanel {
121121
this.functionsTabAvailable = ko.pureComputed(
122122
() =>
123123
this.connector() &&
124-
(this.connector().dialect === 'hive' ||
124+
(this.connector().dialect === 'flink' ||
125+
this.connector().dialect === 'hive' ||
125126
this.connector().dialect === 'impala' ||
126127
this.connector().dialect === 'pig' ||
127-
this.connector().dialect === 'flink')
128+
this.connector().dialect === 'sparksql')
128129
);
129130
this.langRefTabAvailable = ko.pureComputed(
130131
() =>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Licensed to Cloudera, Inc. under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. Cloudera, Inc. licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
export const RESERVED_WORDS: Set<string> = new Set([
18+
'ALL',
19+
'AND',
20+
'AS',
21+
'ASC',
22+
'BIGINT',
23+
'BY',
24+
'CASE',
25+
'COLUMN',
26+
'COLUMNS',
27+
'CROSS',
28+
'DATABASE',
29+
'DESC',
30+
'DIRECTORY',
31+
'DISTINCT',
32+
'EXTENDED',
33+
'FUNCTION',
34+
'ELSE',
35+
'END',
36+
'EXISTS',
37+
'FALSE',
38+
'FROM',
39+
'FULL',
40+
'GROUP',
41+
'HAVING',
42+
'IF',
43+
'IN',
44+
'INTO',
45+
'JOIN',
46+
'LEFT',
47+
'LIKE',
48+
'LIMIT',
49+
'LOCAL',
50+
'NOT',
51+
'NULL',
52+
'ON',
53+
'OPTION',
54+
'OR',
55+
'ORDER',
56+
'OUTER',
57+
'PARTITION',
58+
'REGEXP',
59+
'RIGHT',
60+
'RLIKE',
61+
'ROLE',
62+
'SELECT',
63+
'SEMI',
64+
'TABLE',
65+
'THEN',
66+
'TRUE',
67+
'TRUNCATE',
68+
'UNION',
69+
'WHEN',
70+
'WHERE',
71+
'WITH',
72+
'MAP',
73+
'OVERWRITE',
74+
'QUERY',
75+
'USER'
76+
]);
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
// Licensed to Cloudera, Inc. under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. Cloudera, Inc. licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
import { TypeConversion } from 'sql/reference/types';
18+
19+
export const TYPE_CONVERSION: TypeConversion = {
20+
BOOLEAN: {
21+
BOOLEAN: true,
22+
TIMESTAMP: false,
23+
TINYINT: false,
24+
SMALLINT: false,
25+
INT: false,
26+
BIGINT: false,
27+
DOUBLE: false,
28+
REAL: false,
29+
DECIMAL: false,
30+
FLOAT: false,
31+
NUMBER: false,
32+
CHAR: false,
33+
VARCHAR: false,
34+
STRING: false,
35+
T: true
36+
},
37+
TIMESTAMP: {
38+
BOOLEAN: false,
39+
TIMESTAMP: true,
40+
TINYINT: false,
41+
SMALLINT: false,
42+
INT: false,
43+
BIGINT: false,
44+
DOUBLE: false,
45+
REAL: false,
46+
DECIMAL: false,
47+
FLOAT: false,
48+
NUMBER: false,
49+
CHAR: false,
50+
VARCHAR: false,
51+
STRING: true,
52+
T: true
53+
},
54+
TINYINT: {
55+
BOOLEAN: false,
56+
TIMESTAMP: false,
57+
TINYINT: true,
58+
SMALLINT: false,
59+
INT: false,
60+
BIGINT: false,
61+
DOUBLE: false,
62+
REAL: false,
63+
DECIMAL: false,
64+
FLOAT: false,
65+
NUMBER: true,
66+
CHAR: false,
67+
VARCHAR: false,
68+
STRING: false,
69+
T: true
70+
},
71+
SMALLINT: {
72+
BOOLEAN: false,
73+
TIMESTAMP: false,
74+
TINYINT: true,
75+
SMALLINT: true,
76+
INT: false,
77+
BIGINT: false,
78+
DOUBLE: false,
79+
REAL: false,
80+
DECIMAL: false,
81+
FLOAT: false,
82+
NUMBER: true,
83+
CHAR: false,
84+
VARCHAR: false,
85+
STRING: false,
86+
T: true
87+
},
88+
INT: {
89+
BOOLEAN: false,
90+
TIMESTAMP: false,
91+
TINYINT: true,
92+
SMALLINT: true,
93+
INT: true,
94+
BIGINT: false,
95+
DOUBLE: false,
96+
REAL: false,
97+
DECIMAL: false,
98+
FLOAT: false,
99+
NUMBER: true,
100+
CHAR: false,
101+
VARCHAR: false,
102+
STRING: false,
103+
T: true
104+
},
105+
BIGINT: {
106+
BOOLEAN: false,
107+
TIMESTAMP: false,
108+
TINYINT: true,
109+
SMALLINT: true,
110+
INT: true,
111+
BIGINT: true,
112+
DOUBLE: false,
113+
REAL: false,
114+
DECIMAL: false,
115+
FLOAT: false,
116+
NUMBER: true,
117+
CHAR: false,
118+
VARCHAR: false,
119+
STRING: false,
120+
T: true
121+
},
122+
DOUBLE: {
123+
BOOLEAN: false,
124+
TIMESTAMP: false,
125+
TINYINT: true,
126+
SMALLINT: true,
127+
INT: true,
128+
BIGINT: true,
129+
DOUBLE: true,
130+
REAL: true,
131+
DECIMAL: false,
132+
FLOAT: true,
133+
NUMBER: true,
134+
CHAR: false,
135+
VARCHAR: false,
136+
STRING: false,
137+
T: true
138+
},
139+
REAL: {
140+
BOOLEAN: false,
141+
TIMESTAMP: false,
142+
TINYINT: true,
143+
SMALLINT: true,
144+
INT: true,
145+
BIGINT: true,
146+
DOUBLE: true,
147+
REAL: true,
148+
DECIMAL: false,
149+
FLOAT: true,
150+
NUMBER: true,
151+
CHAR: false,
152+
VARCHAR: false,
153+
STRING: false,
154+
T: true
155+
},
156+
DECIMAL: {
157+
BOOLEAN: false,
158+
TIMESTAMP: false,
159+
TINYINT: true,
160+
SMALLINT: true,
161+
INT: true,
162+
BIGINT: true,
163+
DOUBLE: true,
164+
REAL: true,
165+
DECIMAL: true,
166+
FLOAT: true,
167+
NUMBER: true,
168+
CHAR: false,
169+
VARCHAR: false,
170+
STRING: false,
171+
T: true
172+
},
173+
FLOAT: {
174+
BOOLEAN: false,
175+
TIMESTAMP: false,
176+
TINYINT: true,
177+
SMALLINT: true,
178+
INT: true,
179+
BIGINT: true,
180+
DOUBLE: false,
181+
REAL: false,
182+
DECIMAL: false,
183+
FLOAT: true,
184+
NUMBER: true,
185+
CHAR: false,
186+
VARCHAR: false,
187+
STRING: false,
188+
T: true
189+
},
190+
NUMBER: {
191+
BOOLEAN: false,
192+
TIMESTAMP: false,
193+
TINYINT: true,
194+
SMALLINT: true,
195+
INT: true,
196+
BIGINT: true,
197+
DOUBLE: true,
198+
REAL: true,
199+
DECIMAL: true,
200+
FLOAT: true,
201+
NUMBER: true,
202+
CHAR: false,
203+
VARCHAR: false,
204+
STRING: false,
205+
T: true
206+
},
207+
CHAR: {
208+
BOOLEAN: false,
209+
TIMESTAMP: false,
210+
TINYINT: false,
211+
SMALLINT: false,
212+
INT: false,
213+
BIGINT: false,
214+
DOUBLE: false,
215+
REAL: false,
216+
DECIMAL: false,
217+
FLOAT: false,
218+
NUMBER: false,
219+
CHAR: true,
220+
VARCHAR: false,
221+
STRING: false,
222+
T: true
223+
},
224+
VARCHAR: {
225+
BOOLEAN: false,
226+
TIMESTAMP: false,
227+
TINYINT: false,
228+
SMALLINT: false,
229+
INT: false,
230+
BIGINT: false,
231+
DOUBLE: false,
232+
REAL: false,
233+
DECIMAL: false,
234+
FLOAT: false,
235+
NUMBER: false,
236+
CHAR: true,
237+
VARCHAR: true,
238+
STRING: false,
239+
T: true
240+
},
241+
STRING: {
242+
BOOLEAN: false,
243+
TIMESTAMP: true,
244+
TINYINT: false,
245+
SMALLINT: false,
246+
INT: false,
247+
BIGINT: false,
248+
DOUBLE: false,
249+
REAL: false,
250+
DECIMAL: false,
251+
FLOAT: false,
252+
NUMBER: false,
253+
CHAR: true,
254+
VARCHAR: false,
255+
STRING: true,
256+
T: true
257+
},
258+
T: {
259+
BOOLEAN: true,
260+
TIMESTAMP: true,
261+
TINYINT: true,
262+
SMALLINT: true,
263+
INT: true,
264+
BIGINT: true,
265+
DOUBLE: true,
266+
REAL: true,
267+
DECIMAL: true,
268+
FLOAT: true,
269+
NUMBER: true,
270+
CHAR: true,
271+
VARCHAR: true,
272+
STRING: true,
273+
T: true
274+
}
275+
};

0 commit comments

Comments
 (0)