@jacobknightley/fabric-format 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +196 -0
- package/dist/cell-formatter.d.ts +75 -0
- package/dist/cell-formatter.js +144 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +435 -0
- package/dist/formatters/index.d.ts +19 -0
- package/dist/formatters/index.js +76 -0
- package/dist/formatters/python/config.d.ts +33 -0
- package/dist/formatters/python/config.js +29 -0
- package/dist/formatters/python/index.d.ts +7 -0
- package/dist/formatters/python/index.js +13 -0
- package/dist/formatters/python/python-formatter.d.ts +51 -0
- package/dist/formatters/python/python-formatter.js +180 -0
- package/dist/formatters/sparksql/constants.d.ts +16 -0
- package/dist/formatters/sparksql/constants.js +16 -0
- package/dist/formatters/sparksql/fmt-detector.d.ts +65 -0
- package/dist/formatters/sparksql/fmt-detector.js +84 -0
- package/dist/formatters/sparksql/formatter.d.ts +24 -0
- package/dist/formatters/sparksql/formatter.js +1276 -0
- package/dist/formatters/sparksql/formatting-context.d.ts +154 -0
- package/dist/formatters/sparksql/formatting-context.js +363 -0
- package/dist/formatters/sparksql/generated/SqlBaseLexer.d.ts +529 -0
- package/dist/formatters/sparksql/generated/SqlBaseLexer.js +2609 -0
- package/dist/formatters/sparksql/generated/SqlBaseParser.d.ts +8195 -0
- package/dist/formatters/sparksql/generated/SqlBaseParser.js +48793 -0
- package/dist/formatters/sparksql/generated/SqlBaseParserListener.d.ts +910 -0
- package/dist/formatters/sparksql/generated/SqlBaseParserListener.js +2730 -0
- package/dist/formatters/sparksql/generated/SqlBaseParserVisitor.d.ts +456 -0
- package/dist/formatters/sparksql/generated/SqlBaseParserVisitor.js +1822 -0
- package/dist/formatters/sparksql/generated/builtinFunctions.d.ts +8 -0
- package/dist/formatters/sparksql/generated/builtinFunctions.js +510 -0
- package/dist/formatters/sparksql/index.d.ts +11 -0
- package/dist/formatters/sparksql/index.js +22 -0
- package/dist/formatters/sparksql/output-builder.d.ts +89 -0
- package/dist/formatters/sparksql/output-builder.js +191 -0
- package/dist/formatters/sparksql/parse-tree-analyzer.d.ts +264 -0
- package/dist/formatters/sparksql/parse-tree-analyzer.js +1956 -0
- package/dist/formatters/sparksql/sql-formatter.d.ts +25 -0
- package/dist/formatters/sparksql/sql-formatter.js +56 -0
- package/dist/formatters/sparksql/token-utils.d.ts +68 -0
- package/dist/formatters/sparksql/token-utils.js +155 -0
- package/dist/formatters/sparksql/types.d.ts +264 -0
- package/dist/formatters/sparksql/types.js +7 -0
- package/dist/formatters/types.d.ts +57 -0
- package/dist/formatters/types.js +7 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +41 -0
- package/dist/notebook-formatter.d.ts +107 -0
- package/dist/notebook-formatter.js +424 -0
- package/package.json +63 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated list of Spark SQL built-in functions.
|
|
3
|
+
* Source: https://raw.githubusercontent.com/apache/spark/master/sql/core/src/test/resources/sql-functions/sql-expression-schema.md
|
|
4
|
+
* Generated from sql-expression-schema.md by ExpressionsSchemaSuite
|
|
5
|
+
*
|
|
6
|
+
* DO NOT EDIT - regenerate with: python scripts/build_antlr_js.py
|
|
7
|
+
*/
|
|
8
|
+
export declare const SPARK_BUILTIN_FUNCTIONS: ReadonlySet<string>;
|
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated list of Spark SQL built-in functions.
|
|
3
|
+
* Source: https://raw.githubusercontent.com/apache/spark/master/sql/core/src/test/resources/sql-functions/sql-expression-schema.md
|
|
4
|
+
* Generated from sql-expression-schema.md by ExpressionsSchemaSuite
|
|
5
|
+
*
|
|
6
|
+
* DO NOT EDIT - regenerate with: python scripts/build_antlr_js.py
|
|
7
|
+
*/
|
|
8
|
+
export const SPARK_BUILTIN_FUNCTIONS = new Set([
|
|
9
|
+
"abs",
|
|
10
|
+
"acos",
|
|
11
|
+
"acosh",
|
|
12
|
+
"add_months",
|
|
13
|
+
"aes_decrypt",
|
|
14
|
+
"aes_encrypt",
|
|
15
|
+
"aggregate",
|
|
16
|
+
"and",
|
|
17
|
+
"any",
|
|
18
|
+
"any_value",
|
|
19
|
+
"approx_count_distinct",
|
|
20
|
+
"approx_percentile",
|
|
21
|
+
"approx_top_k",
|
|
22
|
+
"approx_top_k_accumulate",
|
|
23
|
+
"approx_top_k_combine",
|
|
24
|
+
"approx_top_k_estimate",
|
|
25
|
+
"array",
|
|
26
|
+
"array_agg",
|
|
27
|
+
"array_append",
|
|
28
|
+
"array_compact",
|
|
29
|
+
"array_contains",
|
|
30
|
+
"array_distinct",
|
|
31
|
+
"array_except",
|
|
32
|
+
"array_insert",
|
|
33
|
+
"array_intersect",
|
|
34
|
+
"array_join",
|
|
35
|
+
"array_max",
|
|
36
|
+
"array_min",
|
|
37
|
+
"array_position",
|
|
38
|
+
"array_prepend",
|
|
39
|
+
"array_remove",
|
|
40
|
+
"array_repeat",
|
|
41
|
+
"array_size",
|
|
42
|
+
"array_sort",
|
|
43
|
+
"array_union",
|
|
44
|
+
"arrays_overlap",
|
|
45
|
+
"arrays_zip",
|
|
46
|
+
"ascii",
|
|
47
|
+
"asin",
|
|
48
|
+
"asinh",
|
|
49
|
+
"assert_true",
|
|
50
|
+
"atan",
|
|
51
|
+
"atan2",
|
|
52
|
+
"atanh",
|
|
53
|
+
"avg",
|
|
54
|
+
"base64",
|
|
55
|
+
"between",
|
|
56
|
+
"bigint",
|
|
57
|
+
"bin",
|
|
58
|
+
"binary",
|
|
59
|
+
"bit_and",
|
|
60
|
+
"bit_count",
|
|
61
|
+
"bit_get",
|
|
62
|
+
"bit_length",
|
|
63
|
+
"bit_or",
|
|
64
|
+
"bit_xor",
|
|
65
|
+
"bitmap_and_agg",
|
|
66
|
+
"bitmap_bit_position",
|
|
67
|
+
"bitmap_bucket_number",
|
|
68
|
+
"bitmap_construct_agg",
|
|
69
|
+
"bitmap_count",
|
|
70
|
+
"bitmap_or_agg",
|
|
71
|
+
"bool_and",
|
|
72
|
+
"bool_or",
|
|
73
|
+
"boolean",
|
|
74
|
+
"bround",
|
|
75
|
+
"btrim",
|
|
76
|
+
"cardinality",
|
|
77
|
+
"cast",
|
|
78
|
+
"cbrt",
|
|
79
|
+
"ceil",
|
|
80
|
+
"ceiling",
|
|
81
|
+
"char",
|
|
82
|
+
"char_length",
|
|
83
|
+
"character_length",
|
|
84
|
+
"chr",
|
|
85
|
+
"coalesce",
|
|
86
|
+
"collate",
|
|
87
|
+
"collation",
|
|
88
|
+
"collect_list",
|
|
89
|
+
"collect_set",
|
|
90
|
+
"concat",
|
|
91
|
+
"concat_ws",
|
|
92
|
+
"contains",
|
|
93
|
+
"conv",
|
|
94
|
+
"convert_timezone",
|
|
95
|
+
"corr",
|
|
96
|
+
"cos",
|
|
97
|
+
"cosh",
|
|
98
|
+
"cot",
|
|
99
|
+
"count",
|
|
100
|
+
"count_if",
|
|
101
|
+
"count_min_sketch",
|
|
102
|
+
"covar_pop",
|
|
103
|
+
"covar_samp",
|
|
104
|
+
"crc32",
|
|
105
|
+
"csc",
|
|
106
|
+
"cume_dist",
|
|
107
|
+
"curdate",
|
|
108
|
+
"current_catalog",
|
|
109
|
+
"current_database",
|
|
110
|
+
"current_date",
|
|
111
|
+
"current_schema",
|
|
112
|
+
"current_time",
|
|
113
|
+
"current_timestamp",
|
|
114
|
+
"current_timezone",
|
|
115
|
+
"current_user",
|
|
116
|
+
"date",
|
|
117
|
+
"date_add",
|
|
118
|
+
"date_diff",
|
|
119
|
+
"date_format",
|
|
120
|
+
"date_from_unix_date",
|
|
121
|
+
"date_part",
|
|
122
|
+
"date_sub",
|
|
123
|
+
"date_trunc",
|
|
124
|
+
"dateadd",
|
|
125
|
+
"datediff",
|
|
126
|
+
"datepart",
|
|
127
|
+
"day",
|
|
128
|
+
"dayname",
|
|
129
|
+
"dayofmonth",
|
|
130
|
+
"dayofweek",
|
|
131
|
+
"dayofyear",
|
|
132
|
+
"decimal",
|
|
133
|
+
"decode",
|
|
134
|
+
"degrees",
|
|
135
|
+
"dense_rank",
|
|
136
|
+
"div",
|
|
137
|
+
"double",
|
|
138
|
+
"e",
|
|
139
|
+
"element_at",
|
|
140
|
+
"elt",
|
|
141
|
+
"encode",
|
|
142
|
+
"endswith",
|
|
143
|
+
"equal_null",
|
|
144
|
+
"every",
|
|
145
|
+
"exists",
|
|
146
|
+
"exp",
|
|
147
|
+
"explode",
|
|
148
|
+
"explode_outer",
|
|
149
|
+
"expm1",
|
|
150
|
+
"extract",
|
|
151
|
+
"factorial",
|
|
152
|
+
"filter",
|
|
153
|
+
"find_in_set",
|
|
154
|
+
"first",
|
|
155
|
+
"first_value",
|
|
156
|
+
"flatten",
|
|
157
|
+
"float",
|
|
158
|
+
"floor",
|
|
159
|
+
"forall",
|
|
160
|
+
"format_number",
|
|
161
|
+
"format_string",
|
|
162
|
+
"from_csv",
|
|
163
|
+
"from_json",
|
|
164
|
+
"from_unixtime",
|
|
165
|
+
"from_utc_timestamp",
|
|
166
|
+
"from_xml",
|
|
167
|
+
"get",
|
|
168
|
+
"get_json_object",
|
|
169
|
+
"getbit",
|
|
170
|
+
"greatest",
|
|
171
|
+
"grouping",
|
|
172
|
+
"grouping_id",
|
|
173
|
+
"hash",
|
|
174
|
+
"hex",
|
|
175
|
+
"histogram_numeric",
|
|
176
|
+
"hll_sketch_agg",
|
|
177
|
+
"hll_sketch_estimate",
|
|
178
|
+
"hll_union",
|
|
179
|
+
"hll_union_agg",
|
|
180
|
+
"hour",
|
|
181
|
+
"hypot",
|
|
182
|
+
"if",
|
|
183
|
+
"ifnull",
|
|
184
|
+
"ilike",
|
|
185
|
+
"in",
|
|
186
|
+
"initcap",
|
|
187
|
+
"inline",
|
|
188
|
+
"inline_outer",
|
|
189
|
+
"input_file_block_length",
|
|
190
|
+
"input_file_block_start",
|
|
191
|
+
"input_file_name",
|
|
192
|
+
"instr",
|
|
193
|
+
"int",
|
|
194
|
+
"is_valid_utf8",
|
|
195
|
+
"is_variant_null",
|
|
196
|
+
"isnan",
|
|
197
|
+
"isnotnull",
|
|
198
|
+
"isnull",
|
|
199
|
+
"java_method",
|
|
200
|
+
"json_array_length",
|
|
201
|
+
"json_object_keys",
|
|
202
|
+
"json_tuple",
|
|
203
|
+
"kll_sketch_agg_bigint",
|
|
204
|
+
"kll_sketch_agg_double",
|
|
205
|
+
"kll_sketch_agg_float",
|
|
206
|
+
"kll_sketch_get_n_bigint",
|
|
207
|
+
"kll_sketch_get_n_double",
|
|
208
|
+
"kll_sketch_get_n_float",
|
|
209
|
+
"kll_sketch_get_quantile_bigint",
|
|
210
|
+
"kll_sketch_get_quantile_double",
|
|
211
|
+
"kll_sketch_get_quantile_float",
|
|
212
|
+
"kll_sketch_get_rank_bigint",
|
|
213
|
+
"kll_sketch_get_rank_double",
|
|
214
|
+
"kll_sketch_get_rank_float",
|
|
215
|
+
"kll_sketch_merge_bigint",
|
|
216
|
+
"kll_sketch_merge_double",
|
|
217
|
+
"kll_sketch_merge_float",
|
|
218
|
+
"kll_sketch_to_string_bigint",
|
|
219
|
+
"kll_sketch_to_string_double",
|
|
220
|
+
"kll_sketch_to_string_float",
|
|
221
|
+
"kurtosis",
|
|
222
|
+
"lag",
|
|
223
|
+
"last",
|
|
224
|
+
"last_day",
|
|
225
|
+
"last_value",
|
|
226
|
+
"lcase",
|
|
227
|
+
"lead",
|
|
228
|
+
"least",
|
|
229
|
+
"left",
|
|
230
|
+
"len",
|
|
231
|
+
"length",
|
|
232
|
+
"levenshtein",
|
|
233
|
+
"like",
|
|
234
|
+
"listagg",
|
|
235
|
+
"ln",
|
|
236
|
+
"localtimestamp",
|
|
237
|
+
"locate",
|
|
238
|
+
"log",
|
|
239
|
+
"log10",
|
|
240
|
+
"log1p",
|
|
241
|
+
"log2",
|
|
242
|
+
"lower",
|
|
243
|
+
"lpad",
|
|
244
|
+
"ltrim",
|
|
245
|
+
"luhn_check",
|
|
246
|
+
"make_date",
|
|
247
|
+
"make_dt_interval",
|
|
248
|
+
"make_interval",
|
|
249
|
+
"make_time",
|
|
250
|
+
"make_timestamp",
|
|
251
|
+
"make_timestamp_ltz",
|
|
252
|
+
"make_timestamp_ntz",
|
|
253
|
+
"make_valid_utf8",
|
|
254
|
+
"make_ym_interval",
|
|
255
|
+
"map",
|
|
256
|
+
"map_concat",
|
|
257
|
+
"map_contains_key",
|
|
258
|
+
"map_entries",
|
|
259
|
+
"map_filter",
|
|
260
|
+
"map_from_arrays",
|
|
261
|
+
"map_from_entries",
|
|
262
|
+
"map_keys",
|
|
263
|
+
"map_values",
|
|
264
|
+
"map_zip_with",
|
|
265
|
+
"mask",
|
|
266
|
+
"max",
|
|
267
|
+
"max_by",
|
|
268
|
+
"md5",
|
|
269
|
+
"mean",
|
|
270
|
+
"median",
|
|
271
|
+
"min",
|
|
272
|
+
"min_by",
|
|
273
|
+
"minute",
|
|
274
|
+
"mod",
|
|
275
|
+
"mode",
|
|
276
|
+
"monotonically_increasing_id",
|
|
277
|
+
"month",
|
|
278
|
+
"monthname",
|
|
279
|
+
"months_between",
|
|
280
|
+
"named_struct",
|
|
281
|
+
"nanvl",
|
|
282
|
+
"negative",
|
|
283
|
+
"next_day",
|
|
284
|
+
"not",
|
|
285
|
+
"now",
|
|
286
|
+
"nth_value",
|
|
287
|
+
"ntile",
|
|
288
|
+
"nullif",
|
|
289
|
+
"nullifzero",
|
|
290
|
+
"nvl",
|
|
291
|
+
"nvl2",
|
|
292
|
+
"octet_length",
|
|
293
|
+
"or",
|
|
294
|
+
"overlay",
|
|
295
|
+
"parse_json",
|
|
296
|
+
"parse_url",
|
|
297
|
+
"percent_rank",
|
|
298
|
+
"percentile",
|
|
299
|
+
"percentile_approx",
|
|
300
|
+
"percentile_cont",
|
|
301
|
+
"percentile_disc",
|
|
302
|
+
"pi",
|
|
303
|
+
"pmod",
|
|
304
|
+
"posexplode",
|
|
305
|
+
"posexplode_outer",
|
|
306
|
+
"position",
|
|
307
|
+
"positive",
|
|
308
|
+
"pow",
|
|
309
|
+
"power",
|
|
310
|
+
"printf",
|
|
311
|
+
"quarter",
|
|
312
|
+
"quote",
|
|
313
|
+
"radians",
|
|
314
|
+
"raise_error",
|
|
315
|
+
"rand",
|
|
316
|
+
"randn",
|
|
317
|
+
"random",
|
|
318
|
+
"randstr",
|
|
319
|
+
"rank",
|
|
320
|
+
"reduce",
|
|
321
|
+
"reflect",
|
|
322
|
+
"regexp",
|
|
323
|
+
"regexp_count",
|
|
324
|
+
"regexp_extract",
|
|
325
|
+
"regexp_extract_all",
|
|
326
|
+
"regexp_instr",
|
|
327
|
+
"regexp_like",
|
|
328
|
+
"regexp_replace",
|
|
329
|
+
"regexp_substr",
|
|
330
|
+
"regr_avgx",
|
|
331
|
+
"regr_avgy",
|
|
332
|
+
"regr_count",
|
|
333
|
+
"regr_intercept",
|
|
334
|
+
"regr_r2",
|
|
335
|
+
"regr_slope",
|
|
336
|
+
"regr_sxx",
|
|
337
|
+
"regr_sxy",
|
|
338
|
+
"regr_syy",
|
|
339
|
+
"repeat",
|
|
340
|
+
"replace",
|
|
341
|
+
"reverse",
|
|
342
|
+
"right",
|
|
343
|
+
"rint",
|
|
344
|
+
"rlike",
|
|
345
|
+
"round",
|
|
346
|
+
"row_number",
|
|
347
|
+
"rpad",
|
|
348
|
+
"rtrim",
|
|
349
|
+
"schema_of_csv",
|
|
350
|
+
"schema_of_json",
|
|
351
|
+
"schema_of_variant",
|
|
352
|
+
"schema_of_variant_agg",
|
|
353
|
+
"schema_of_xml",
|
|
354
|
+
"sec",
|
|
355
|
+
"second",
|
|
356
|
+
"sentences",
|
|
357
|
+
"sequence",
|
|
358
|
+
"session_user",
|
|
359
|
+
"session_window",
|
|
360
|
+
"sha",
|
|
361
|
+
"sha1",
|
|
362
|
+
"sha2",
|
|
363
|
+
"shiftleft",
|
|
364
|
+
"shiftright",
|
|
365
|
+
"shiftrightunsigned",
|
|
366
|
+
"shuffle",
|
|
367
|
+
"sign",
|
|
368
|
+
"signum",
|
|
369
|
+
"sin",
|
|
370
|
+
"sinh",
|
|
371
|
+
"size",
|
|
372
|
+
"skewness",
|
|
373
|
+
"slice",
|
|
374
|
+
"smallint",
|
|
375
|
+
"some",
|
|
376
|
+
"sort_array",
|
|
377
|
+
"soundex",
|
|
378
|
+
"space",
|
|
379
|
+
"spark_partition_id",
|
|
380
|
+
"split",
|
|
381
|
+
"split_part",
|
|
382
|
+
"sqrt",
|
|
383
|
+
"st_asbinary",
|
|
384
|
+
"st_geogfromwkb",
|
|
385
|
+
"st_geomfromwkb",
|
|
386
|
+
"st_setsrid",
|
|
387
|
+
"st_srid",
|
|
388
|
+
"stack",
|
|
389
|
+
"startswith",
|
|
390
|
+
"std",
|
|
391
|
+
"stddev",
|
|
392
|
+
"stddev_pop",
|
|
393
|
+
"stddev_samp",
|
|
394
|
+
"str_to_map",
|
|
395
|
+
"string",
|
|
396
|
+
"string_agg",
|
|
397
|
+
"struct",
|
|
398
|
+
"substr",
|
|
399
|
+
"substring",
|
|
400
|
+
"substring_index",
|
|
401
|
+
"sum",
|
|
402
|
+
"tan",
|
|
403
|
+
"tanh",
|
|
404
|
+
"theta_difference",
|
|
405
|
+
"theta_intersection",
|
|
406
|
+
"theta_intersection_agg",
|
|
407
|
+
"theta_sketch_agg",
|
|
408
|
+
"theta_sketch_estimate",
|
|
409
|
+
"theta_union",
|
|
410
|
+
"theta_union_agg",
|
|
411
|
+
"time",
|
|
412
|
+
"time_diff",
|
|
413
|
+
"time_from_micros",
|
|
414
|
+
"time_from_millis",
|
|
415
|
+
"time_from_seconds",
|
|
416
|
+
"time_to_micros",
|
|
417
|
+
"time_to_millis",
|
|
418
|
+
"time_to_seconds",
|
|
419
|
+
"time_trunc",
|
|
420
|
+
"timestamp",
|
|
421
|
+
"timestamp_micros",
|
|
422
|
+
"timestamp_millis",
|
|
423
|
+
"timestamp_seconds",
|
|
424
|
+
"tinyint",
|
|
425
|
+
"to_binary",
|
|
426
|
+
"to_char",
|
|
427
|
+
"to_csv",
|
|
428
|
+
"to_date",
|
|
429
|
+
"to_json",
|
|
430
|
+
"to_number",
|
|
431
|
+
"to_time",
|
|
432
|
+
"to_timestamp",
|
|
433
|
+
"to_timestamp_ltz",
|
|
434
|
+
"to_timestamp_ntz",
|
|
435
|
+
"to_unix_timestamp",
|
|
436
|
+
"to_utc_timestamp",
|
|
437
|
+
"to_varchar",
|
|
438
|
+
"to_variant_object",
|
|
439
|
+
"to_xml",
|
|
440
|
+
"transform",
|
|
441
|
+
"transform_keys",
|
|
442
|
+
"transform_values",
|
|
443
|
+
"translate",
|
|
444
|
+
"trim",
|
|
445
|
+
"trunc",
|
|
446
|
+
"try_add",
|
|
447
|
+
"try_aes_decrypt",
|
|
448
|
+
"try_avg",
|
|
449
|
+
"try_divide",
|
|
450
|
+
"try_element_at",
|
|
451
|
+
"try_make_interval",
|
|
452
|
+
"try_make_timestamp",
|
|
453
|
+
"try_make_timestamp_ltz",
|
|
454
|
+
"try_make_timestamp_ntz",
|
|
455
|
+
"try_mod",
|
|
456
|
+
"try_multiply",
|
|
457
|
+
"try_parse_json",
|
|
458
|
+
"try_parse_url",
|
|
459
|
+
"try_reflect",
|
|
460
|
+
"try_subtract",
|
|
461
|
+
"try_sum",
|
|
462
|
+
"try_to_binary",
|
|
463
|
+
"try_to_date",
|
|
464
|
+
"try_to_number",
|
|
465
|
+
"try_to_time",
|
|
466
|
+
"try_to_timestamp",
|
|
467
|
+
"try_url_decode",
|
|
468
|
+
"try_validate_utf8",
|
|
469
|
+
"try_variant_get",
|
|
470
|
+
"typeof",
|
|
471
|
+
"ucase",
|
|
472
|
+
"unbase64",
|
|
473
|
+
"unhex",
|
|
474
|
+
"uniform",
|
|
475
|
+
"unix_date",
|
|
476
|
+
"unix_micros",
|
|
477
|
+
"unix_millis",
|
|
478
|
+
"unix_seconds",
|
|
479
|
+
"unix_timestamp",
|
|
480
|
+
"upper",
|
|
481
|
+
"url_decode",
|
|
482
|
+
"url_encode",
|
|
483
|
+
"user",
|
|
484
|
+
"uuid",
|
|
485
|
+
"validate_utf8",
|
|
486
|
+
"var_pop",
|
|
487
|
+
"var_samp",
|
|
488
|
+
"variance",
|
|
489
|
+
"variant_get",
|
|
490
|
+
"version",
|
|
491
|
+
"weekday",
|
|
492
|
+
"weekofyear",
|
|
493
|
+
"when",
|
|
494
|
+
"width_bucket",
|
|
495
|
+
"window",
|
|
496
|
+
"window_time",
|
|
497
|
+
"xpath",
|
|
498
|
+
"xpath_boolean",
|
|
499
|
+
"xpath_double",
|
|
500
|
+
"xpath_float",
|
|
501
|
+
"xpath_int",
|
|
502
|
+
"xpath_long",
|
|
503
|
+
"xpath_number",
|
|
504
|
+
"xpath_short",
|
|
505
|
+
"xpath_string",
|
|
506
|
+
"xxhash64",
|
|
507
|
+
"year",
|
|
508
|
+
"zeroifnull",
|
|
509
|
+
"zip_with",
|
|
510
|
+
]);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spark SQL Formatter - Module Exports
|
|
3
|
+
*
|
|
4
|
+
* This is the 100% grammar-driven SQL formatter for Apache Spark SQL.
|
|
5
|
+
* All modules in this directory work together to format SQL.
|
|
6
|
+
*/
|
|
7
|
+
export { formatSql, needsFormatting } from './formatter.js';
|
|
8
|
+
export { SqlFormatter, getSqlFormatter, isSqlCode } from './sql-formatter.js';
|
|
9
|
+
export { hasFormatOff, detectCollapseDirectives, hasCollapseDirective, isFmtInlineComment, type FormatDirectiveInfo, type ForceInlineRange, } from './fmt-detector.js';
|
|
10
|
+
export { MAX_LINE_WIDTH } from './constants.js';
|
|
11
|
+
export type { AnalyzerResult, FormattingState, MultiArgFunctionInfo, WindowDefInfo, TokenContext, PendingComment, ExpandedFunction, ExpandedWindow, ExpandedPivot, PivotInfo, InListInfo, SimpleQueryInfo, NestedFunctionInfo, } from './types.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spark SQL Formatter - Module Exports
|
|
3
|
+
*
|
|
4
|
+
* This is the 100% grammar-driven SQL formatter for Apache Spark SQL.
|
|
5
|
+
* All modules in this directory work together to format SQL.
|
|
6
|
+
*/
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// PUBLIC API
|
|
9
|
+
// ============================================================================
|
|
10
|
+
export { formatSql, needsFormatting } from './formatter.js';
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// FORMATTER CLASS (LanguageFormatter interface)
|
|
13
|
+
// ============================================================================
|
|
14
|
+
export { SqlFormatter, getSqlFormatter, isSqlCode } from './sql-formatter.js';
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// FORMAT DIRECTIVES
|
|
17
|
+
// ============================================================================
|
|
18
|
+
export { hasFormatOff, detectCollapseDirectives, hasCollapseDirective, isFmtInlineComment, } from './fmt-detector.js';
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// CONSTANTS
|
|
21
|
+
// ============================================================================
|
|
22
|
+
export { MAX_LINE_WIDTH } from './constants.js';
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Builder - Token Output and Column Tracking
|
|
3
|
+
*
|
|
4
|
+
* This module handles the construction of the formatted output string.
|
|
5
|
+
* It tracks column position for line-width decisions and provides
|
|
6
|
+
* utilities for spacing and newline insertion.
|
|
7
|
+
*/
|
|
8
|
+
import type { PendingComment } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Builds the formatted output string with column tracking.
|
|
11
|
+
*/
|
|
12
|
+
export declare class OutputBuilder {
|
|
13
|
+
private output;
|
|
14
|
+
private currentColumn;
|
|
15
|
+
/**
|
|
16
|
+
* Push text to output and update column tracking.
|
|
17
|
+
*/
|
|
18
|
+
push(text: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get the current column position.
|
|
21
|
+
*/
|
|
22
|
+
getColumn(): number;
|
|
23
|
+
/**
|
|
24
|
+
* Get the last character that was output.
|
|
25
|
+
*/
|
|
26
|
+
getLastChar(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Check if output is empty.
|
|
29
|
+
*/
|
|
30
|
+
isEmpty(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if the last output ends with a newline.
|
|
33
|
+
*/
|
|
34
|
+
endsWithNewline(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Get the final formatted string.
|
|
37
|
+
*/
|
|
38
|
+
toString(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Update column tracking based on text content.
|
|
41
|
+
*/
|
|
42
|
+
private updateColumn;
|
|
43
|
+
/**
|
|
44
|
+
* Add a space if needed before the next token.
|
|
45
|
+
*/
|
|
46
|
+
addSpaceIfNeeded(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Ensure we're at the start of a new line.
|
|
49
|
+
*/
|
|
50
|
+
ensureNewline(): void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Outputs pending comments with proper formatting.
|
|
54
|
+
*/
|
|
55
|
+
export declare function outputComments(builder: OutputBuilder, comments: PendingComment[], addSpaceBefore?: boolean): {
|
|
56
|
+
outputAny: boolean;
|
|
57
|
+
lastWasMultilineBlock: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Determines if a space should be skipped before the current token.
|
|
61
|
+
*/
|
|
62
|
+
export declare function shouldSkipSpace(builder: OutputBuilder, text: string, context: {
|
|
63
|
+
prevWasFunctionName: boolean;
|
|
64
|
+
prevWasBuiltInFunctionKeyword: boolean;
|
|
65
|
+
insideParens: number;
|
|
66
|
+
justOutputCommaFirstStyle: boolean;
|
|
67
|
+
justOutputMultiArgFunctionNewline: boolean;
|
|
68
|
+
justOutputWindowNewline: boolean;
|
|
69
|
+
justOutputInListWrapNewline: boolean;
|
|
70
|
+
afterWhereKeyword: boolean;
|
|
71
|
+
afterHavingKeyword: boolean;
|
|
72
|
+
prevTokenWasUnaryOperator: boolean;
|
|
73
|
+
currentTokenIsUnaryOperator: boolean;
|
|
74
|
+
isLateralViewComma: boolean;
|
|
75
|
+
prevIsDoubleColon: boolean;
|
|
76
|
+
prevTokenText: string;
|
|
77
|
+
currentTokenIsStringLiteral: boolean;
|
|
78
|
+
prevWasDotToken: boolean;
|
|
79
|
+
complexTypeDepth: number;
|
|
80
|
+
}): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Determines if a comma-space should be added.
|
|
83
|
+
*/
|
|
84
|
+
export declare function shouldAddCommaSpace(builder: OutputBuilder, insideParens: number, justOutputCommaFirstStyle: boolean): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Format hint content: uppercase hint names, preserve table names.
|
|
87
|
+
* Example: "broadcast(t1), merge(t2)" → "BROADCAST(t1), MERGE(t2)"
|
|
88
|
+
*/
|
|
89
|
+
export declare function formatHintContent(content: string): string;
|