@hdnax/sqlingo.js 0.0.4 → 0.1.0

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.
Files changed (245) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +8 -14
  3. package/README.npm.md +8 -14
  4. package/README.repo.md +1 -2
  5. package/dist/chunk-2YNOERAO.cjs +2 -0
  6. package/dist/chunk-2YNOERAO.cjs.map +1 -0
  7. package/dist/chunk-2Z3O2CFM.cjs +19 -0
  8. package/dist/chunk-2Z3O2CFM.cjs.map +1 -0
  9. package/dist/chunk-4ZMKB6PV.cjs +2 -0
  10. package/dist/chunk-4ZMKB6PV.cjs.map +1 -0
  11. package/dist/chunk-53OWF4GG.js +2 -0
  12. package/dist/chunk-53OWF4GG.js.map +1 -0
  13. package/dist/chunk-C4CLTVOW.cjs +2 -0
  14. package/dist/chunk-C4CLTVOW.cjs.map +1 -0
  15. package/dist/chunk-DOKMTZYO.cjs +4 -0
  16. package/dist/chunk-DOKMTZYO.cjs.map +1 -0
  17. package/dist/chunk-FCGUTI7Y.js +2 -0
  18. package/dist/chunk-FCGUTI7Y.js.map +1 -0
  19. package/dist/chunk-IPCIXWCY.js +2 -0
  20. package/dist/chunk-IPCIXWCY.js.map +1 -0
  21. package/dist/chunk-KCNOE4DZ.js +19 -0
  22. package/dist/chunk-KCNOE4DZ.js.map +1 -0
  23. package/dist/chunk-NRJHX2GZ.js +2 -0
  24. package/dist/chunk-NRJHX2GZ.js.map +1 -0
  25. package/dist/chunk-O2J5RKBN.js +2 -0
  26. package/dist/chunk-O2J5RKBN.js.map +1 -0
  27. package/dist/chunk-PXUASP5I.js +2 -0
  28. package/dist/chunk-PXUASP5I.js.map +1 -0
  29. package/dist/chunk-R7C3ZHVK.cjs +2 -0
  30. package/dist/chunk-R7C3ZHVK.cjs.map +1 -0
  31. package/dist/chunk-UHWHUDLE.cjs +2 -0
  32. package/dist/chunk-UHWHUDLE.cjs.map +1 -0
  33. package/dist/chunk-WRNYJ54A.cjs +2 -0
  34. package/dist/chunk-WRNYJ54A.cjs.map +1 -0
  35. package/dist/chunk-XZQFOICX.cjs +3 -0
  36. package/dist/chunk-XZQFOICX.cjs.map +1 -0
  37. package/dist/chunk-YLOQRUXC.js +2 -0
  38. package/dist/chunk-YLOQRUXC.js.map +1 -0
  39. package/dist/chunk-YSS2WVCM.cjs +2 -0
  40. package/dist/chunk-YSS2WVCM.cjs.map +1 -0
  41. package/dist/chunk-Z5V6VOIN.js +3 -0
  42. package/dist/chunk-Z5V6VOIN.js.map +1 -0
  43. package/dist/chunk-ZBFGQPJR.js +4 -0
  44. package/dist/chunk-ZBFGQPJR.js.map +1 -0
  45. package/dist/dialects/athena.cjs +2 -0
  46. package/dist/dialects/athena.cjs.map +1 -0
  47. package/dist/dialects/athena.d.cts +66 -0
  48. package/dist/dialects/athena.d.ts +66 -0
  49. package/dist/dialects/athena.js +2 -0
  50. package/dist/dialects/athena.js.map +1 -0
  51. package/dist/dialects/bigquery.cjs +3 -0
  52. package/dist/dialects/bigquery.cjs.map +1 -0
  53. package/dist/dialects/bigquery.d.cts +651 -0
  54. package/dist/dialects/bigquery.d.ts +651 -0
  55. package/dist/dialects/bigquery.js +3 -0
  56. package/dist/dialects/bigquery.js.map +1 -0
  57. package/dist/dialects/clickhouse.cjs +2 -0
  58. package/dist/dialects/clickhouse.cjs.map +1 -0
  59. package/dist/dialects/clickhouse.d.cts +634 -0
  60. package/dist/dialects/clickhouse.d.ts +634 -0
  61. package/dist/dialects/clickhouse.js +2 -0
  62. package/dist/dialects/clickhouse.js.map +1 -0
  63. package/dist/dialects/databricks.cjs +2 -0
  64. package/dist/dialects/databricks.cjs.map +1 -0
  65. package/dist/dialects/databricks.d.cts +484 -0
  66. package/dist/dialects/databricks.d.ts +484 -0
  67. package/dist/dialects/databricks.js +2 -0
  68. package/dist/dialects/databricks.js.map +1 -0
  69. package/dist/dialects/doris.cjs +2 -0
  70. package/dist/dialects/doris.cjs.map +1 -0
  71. package/dist/dialects/doris.d.cts +484 -0
  72. package/dist/dialects/doris.d.ts +484 -0
  73. package/dist/dialects/doris.js +2 -0
  74. package/dist/dialects/doris.js.map +1 -0
  75. package/dist/dialects/dremio.cjs +2 -0
  76. package/dist/dialects/dremio.cjs.map +1 -0
  77. package/dist/dialects/dremio.d.cts +522 -0
  78. package/dist/dialects/dremio.d.ts +522 -0
  79. package/dist/dialects/dremio.js +2 -0
  80. package/dist/dialects/dremio.js.map +1 -0
  81. package/dist/dialects/drill.cjs +2 -0
  82. package/dist/dialects/drill.cjs.map +1 -0
  83. package/dist/dialects/drill.d.cts +512 -0
  84. package/dist/dialects/drill.d.ts +512 -0
  85. package/dist/dialects/drill.js +2 -0
  86. package/dist/dialects/drill.js.map +1 -0
  87. package/dist/dialects/druid.cjs +2 -0
  88. package/dist/dialects/druid.cjs.map +1 -0
  89. package/dist/dialects/druid.d.cts +17 -0
  90. package/dist/dialects/druid.d.ts +17 -0
  91. package/dist/dialects/druid.js +2 -0
  92. package/dist/dialects/druid.js.map +1 -0
  93. package/dist/dialects/duckdb.cjs +86 -0
  94. package/dist/dialects/duckdb.cjs.map +1 -0
  95. package/dist/dialects/duckdb.d.cts +756 -0
  96. package/dist/dialects/duckdb.d.ts +756 -0
  97. package/dist/dialects/duckdb.js +86 -0
  98. package/dist/dialects/duckdb.js.map +1 -0
  99. package/dist/dialects/dune.cjs +2 -0
  100. package/dist/dialects/dune.cjs.map +1 -0
  101. package/dist/dialects/dune.d.cts +21 -0
  102. package/dist/dialects/dune.d.ts +21 -0
  103. package/dist/dialects/dune.js +2 -0
  104. package/dist/dialects/dune.js.map +1 -0
  105. package/dist/dialects/exasol.cjs +2 -0
  106. package/dist/dialects/exasol.cjs.map +1 -0
  107. package/dist/dialects/exasol.d.cts +507 -0
  108. package/dist/dialects/exasol.d.ts +507 -0
  109. package/dist/dialects/exasol.js +2 -0
  110. package/dist/dialects/exasol.js.map +1 -0
  111. package/dist/dialects/fabric.cjs +2 -0
  112. package/dist/dialects/fabric.cjs.map +1 -0
  113. package/dist/dialects/fabric.d.cts +463 -0
  114. package/dist/dialects/fabric.d.ts +463 -0
  115. package/dist/dialects/fabric.js +2 -0
  116. package/dist/dialects/fabric.js.map +1 -0
  117. package/dist/dialects/hive.cjs +2 -0
  118. package/dist/dialects/hive.cjs.map +1 -0
  119. package/dist/dialects/hive.d.cts +585 -0
  120. package/dist/dialects/hive.d.ts +585 -0
  121. package/dist/dialects/hive.js +2 -0
  122. package/dist/dialects/hive.js.map +1 -0
  123. package/dist/dialects/materialize.cjs +2 -0
  124. package/dist/dialects/materialize.cjs.map +1 -0
  125. package/dist/dialects/materialize.d.cts +890 -0
  126. package/dist/dialects/materialize.d.ts +890 -0
  127. package/dist/dialects/materialize.js +2 -0
  128. package/dist/dialects/materialize.js.map +1 -0
  129. package/dist/dialects/mysql.cjs +2 -0
  130. package/dist/dialects/mysql.cjs.map +1 -0
  131. package/dist/dialects/mysql.d.cts +292 -0
  132. package/dist/dialects/mysql.d.ts +292 -0
  133. package/dist/dialects/mysql.js +2 -0
  134. package/dist/dialects/mysql.js.map +1 -0
  135. package/dist/dialects/oracle.cjs +2 -0
  136. package/dist/dialects/oracle.cjs.map +1 -0
  137. package/dist/dialects/oracle.d.cts +539 -0
  138. package/dist/dialects/oracle.d.ts +539 -0
  139. package/dist/dialects/oracle.js +2 -0
  140. package/dist/dialects/oracle.js.map +1 -0
  141. package/dist/dialects/postgres.cjs +2 -0
  142. package/dist/dialects/postgres.cjs.map +1 -0
  143. package/dist/dialects/postgres.d.cts +587 -0
  144. package/dist/dialects/postgres.d.ts +587 -0
  145. package/dist/dialects/postgres.js +2 -0
  146. package/dist/dialects/postgres.js.map +1 -0
  147. package/dist/dialects/presto.cjs +2 -0
  148. package/dist/dialects/presto.cjs.map +1 -0
  149. package/dist/dialects/presto.d.cts +173 -0
  150. package/dist/dialects/presto.d.ts +173 -0
  151. package/dist/dialects/presto.js +2 -0
  152. package/dist/dialects/presto.js.map +1 -0
  153. package/dist/dialects/prql.cjs +2 -0
  154. package/dist/dialects/prql.cjs.map +1 -0
  155. package/dist/dialects/prql.d.cts +496 -0
  156. package/dist/dialects/prql.d.ts +496 -0
  157. package/dist/dialects/prql.js +2 -0
  158. package/dist/dialects/prql.js.map +1 -0
  159. package/dist/dialects/redshift.cjs +2 -0
  160. package/dist/dialects/redshift.cjs.map +1 -0
  161. package/dist/dialects/redshift.d.cts +132 -0
  162. package/dist/dialects/redshift.d.ts +132 -0
  163. package/dist/dialects/redshift.js +2 -0
  164. package/dist/dialects/redshift.js.map +1 -0
  165. package/dist/dialects/risingwave.cjs +2 -0
  166. package/dist/dialects/risingwave.cjs.map +1 -0
  167. package/dist/dialects/risingwave.d.cts +478 -0
  168. package/dist/dialects/risingwave.d.ts +478 -0
  169. package/dist/dialects/risingwave.js +2 -0
  170. package/dist/dialects/risingwave.js.map +1 -0
  171. package/dist/dialects/singlestore.cjs +2 -0
  172. package/dist/dialects/singlestore.cjs.map +1 -0
  173. package/dist/dialects/singlestore.d.cts +73 -0
  174. package/dist/dialects/singlestore.d.ts +73 -0
  175. package/dist/dialects/singlestore.js +2 -0
  176. package/dist/dialects/singlestore.js.map +1 -0
  177. package/dist/dialects/snowflake.cjs +3 -0
  178. package/dist/dialects/snowflake.cjs.map +1 -0
  179. package/dist/dialects/snowflake.d.cts +320 -0
  180. package/dist/dialects/snowflake.d.ts +320 -0
  181. package/dist/dialects/snowflake.js +3 -0
  182. package/dist/dialects/snowflake.js.map +1 -0
  183. package/dist/dialects/solr.cjs +2 -0
  184. package/dist/dialects/solr.cjs.map +1 -0
  185. package/dist/dialects/solr.d.cts +458 -0
  186. package/dist/dialects/solr.d.ts +458 -0
  187. package/dist/dialects/solr.js +2 -0
  188. package/dist/dialects/solr.js.map +1 -0
  189. package/dist/dialects/spark.cjs +2 -0
  190. package/dist/dialects/spark.cjs.map +1 -0
  191. package/dist/dialects/spark.d.cts +484 -0
  192. package/dist/dialects/spark.d.ts +484 -0
  193. package/dist/dialects/spark.js +2 -0
  194. package/dist/dialects/spark.js.map +1 -0
  195. package/dist/dialects/spark2.cjs +2 -0
  196. package/dist/dialects/spark2.cjs.map +1 -0
  197. package/dist/dialects/spark2.d.cts +486 -0
  198. package/dist/dialects/spark2.d.ts +486 -0
  199. package/dist/dialects/spark2.js +2 -0
  200. package/dist/dialects/spark2.js.map +1 -0
  201. package/dist/dialects/sqlite.cjs +2 -0
  202. package/dist/dialects/sqlite.cjs.map +1 -0
  203. package/dist/dialects/sqlite.d.cts +510 -0
  204. package/dist/dialects/sqlite.d.ts +510 -0
  205. package/dist/dialects/sqlite.js +2 -0
  206. package/dist/dialects/sqlite.js.map +1 -0
  207. package/dist/dialects/starrocks.cjs +2 -0
  208. package/dist/dialects/starrocks.cjs.map +1 -0
  209. package/dist/dialects/starrocks.d.cts +518 -0
  210. package/dist/dialects/starrocks.d.ts +518 -0
  211. package/dist/dialects/starrocks.js +2 -0
  212. package/dist/dialects/starrocks.js.map +1 -0
  213. package/dist/dialects/tableau.cjs +2 -0
  214. package/dist/dialects/tableau.cjs.map +1 -0
  215. package/dist/dialects/tableau.d.cts +466 -0
  216. package/dist/dialects/tableau.d.ts +466 -0
  217. package/dist/dialects/tableau.js +2 -0
  218. package/dist/dialects/tableau.js.map +1 -0
  219. package/dist/dialects/teradata.cjs +2 -0
  220. package/dist/dialects/teradata.cjs.map +1 -0
  221. package/dist/dialects/teradata.d.cts +539 -0
  222. package/dist/dialects/teradata.d.ts +539 -0
  223. package/dist/dialects/teradata.js +2 -0
  224. package/dist/dialects/teradata.js.map +1 -0
  225. package/dist/dialects/trino.cjs +2 -0
  226. package/dist/dialects/trino.cjs.map +1 -0
  227. package/dist/dialects/trino.d.cts +465 -0
  228. package/dist/dialects/trino.d.ts +465 -0
  229. package/dist/dialects/trino.js +2 -0
  230. package/dist/dialects/trino.js.map +1 -0
  231. package/dist/dialects/tsql.cjs +2 -0
  232. package/dist/dialects/tsql.cjs.map +1 -0
  233. package/dist/dialects/tsql.d.cts +703 -0
  234. package/dist/dialects/tsql.d.ts +703 -0
  235. package/dist/dialects/tsql.js +2 -0
  236. package/dist/dialects/tsql.js.map +1 -0
  237. package/dist/index.cjs +5 -25
  238. package/dist/index.cjs.map +1 -1
  239. package/dist/index.d.cts +3 -14178
  240. package/dist/index.d.ts +3 -14178
  241. package/dist/index.js +5 -25
  242. package/dist/index.js.map +1 -1
  243. package/dist/tokens-VcMD09XM.d.cts +15805 -0
  244. package/dist/tokens-VcMD09XM.d.ts +15805 -0
  245. package/package.json +171 -5
@@ -0,0 +1,484 @@
1
+ import { d as Dialects, l as TokenType, av as JsonPathTokenizer, E as Expression, c as Dialect, i as Parser, be as CurrentDateExpr, G as Generator, bf as ColumnDefExpr, bg as GeneratedAsIdentityColumnConstraintExpr, bh as JsonPathExpr, bi as UniformExpr, $ as DataTypeExprKind } from '../tokens-VcMD09XM.js';
2
+ import { Spark } from './spark.js';
3
+ import './spark2.js';
4
+ import './hive.js';
5
+
6
+ declare class DatabricksJsonPathTokenizer extends JsonPathTokenizer {
7
+ static get IDENTIFIERS(): string[];
8
+ }
9
+ declare class DatabricksTokenizer extends Spark.Tokenizer {
10
+ static get ORIGINAL_KEYWORDS(): Record<string, TokenType>;
11
+ }
12
+ declare class DatabricksParser extends Spark.Parser {
13
+ static get ID_VAR_TOKENS(): Set<TokenType>;
14
+ static get NO_PAREN_FUNCTIONS(): {
15
+ lParen?: typeof Expression | undefined;
16
+ rParen?: typeof Expression | undefined;
17
+ lBracket?: typeof Expression | undefined;
18
+ rBracket?: typeof Expression | undefined;
19
+ lBrace?: typeof Expression | undefined;
20
+ rBrace?: typeof Expression | undefined;
21
+ comma?: typeof Expression | undefined;
22
+ dot?: typeof Expression | undefined;
23
+ dash?: typeof Expression | undefined;
24
+ plus?: typeof Expression | undefined;
25
+ colon?: typeof Expression | undefined;
26
+ dotcolon?: typeof Expression | undefined;
27
+ dcolon?: typeof Expression | undefined;
28
+ dcolondollar?: typeof Expression | undefined;
29
+ dcolonpercent?: typeof Expression | undefined;
30
+ dcolonqmark?: typeof Expression | undefined;
31
+ dqmark?: typeof Expression | undefined;
32
+ semicolon?: typeof Expression | undefined;
33
+ star?: typeof Expression | undefined;
34
+ backslash?: typeof Expression | undefined;
35
+ slash?: typeof Expression | undefined;
36
+ lt?: typeof Expression | undefined;
37
+ lte?: typeof Expression | undefined;
38
+ gt?: typeof Expression | undefined;
39
+ gte?: typeof Expression | undefined;
40
+ not?: typeof Expression | undefined;
41
+ eq?: typeof Expression | undefined;
42
+ neq?: typeof Expression | undefined;
43
+ nullsafeEq?: typeof Expression | undefined;
44
+ colonEq?: typeof Expression | undefined;
45
+ colonGt?: typeof Expression | undefined;
46
+ ncolonGt?: typeof Expression | undefined;
47
+ and?: typeof Expression | undefined;
48
+ or?: typeof Expression | undefined;
49
+ amp?: typeof Expression | undefined;
50
+ dpipe?: typeof Expression | undefined;
51
+ pipeGt?: typeof Expression | undefined;
52
+ pipe?: typeof Expression | undefined;
53
+ pipeSlash?: typeof Expression | undefined;
54
+ dpipeSlash?: typeof Expression | undefined;
55
+ caret?: typeof Expression | undefined;
56
+ caretAt?: typeof Expression | undefined;
57
+ tilde?: typeof Expression | undefined;
58
+ arrow?: typeof Expression | undefined;
59
+ darrow?: typeof Expression | undefined;
60
+ farrow?: typeof Expression | undefined;
61
+ hash?: typeof Expression | undefined;
62
+ hashArrow?: typeof Expression | undefined;
63
+ dhashArrow?: typeof Expression | undefined;
64
+ lrArrow?: typeof Expression | undefined;
65
+ dat?: typeof Expression | undefined;
66
+ ltAt?: typeof Expression | undefined;
67
+ atGt?: typeof Expression | undefined;
68
+ dollar?: typeof Expression | undefined;
69
+ parameter?: typeof Expression | undefined;
70
+ session?: typeof Expression | undefined;
71
+ sessionParameter?: typeof Expression | undefined;
72
+ sessionUser?: typeof Expression | undefined;
73
+ damp?: typeof Expression | undefined;
74
+ ampLt?: typeof Expression | undefined;
75
+ ampGt?: typeof Expression | undefined;
76
+ adjacent?: typeof Expression | undefined;
77
+ xor?: typeof Expression | undefined;
78
+ dstar?: typeof Expression | undefined;
79
+ qmarkAmp?: typeof Expression | undefined;
80
+ qmarkPipe?: typeof Expression | undefined;
81
+ hashDash?: typeof Expression | undefined;
82
+ exclamation?: typeof Expression | undefined;
83
+ uriStart?: typeof Expression | undefined;
84
+ blockStart?: typeof Expression | undefined;
85
+ blockEnd?: typeof Expression | undefined;
86
+ space?: typeof Expression | undefined;
87
+ break?: typeof Expression | undefined;
88
+ string?: typeof Expression | undefined;
89
+ number?: typeof Expression | undefined;
90
+ identifier?: typeof Expression | undefined;
91
+ database?: typeof Expression | undefined;
92
+ column?: typeof Expression | undefined;
93
+ columnDef?: typeof Expression | undefined;
94
+ schema?: typeof Expression | undefined;
95
+ table?: typeof Expression | undefined;
96
+ warehouse?: typeof Expression | undefined;
97
+ stage?: typeof Expression | undefined;
98
+ streamlit?: typeof Expression | undefined;
99
+ var?: typeof Expression | undefined;
100
+ bitString?: typeof Expression | undefined;
101
+ hexString?: typeof Expression | undefined;
102
+ byteString?: typeof Expression | undefined;
103
+ nationalString?: typeof Expression | undefined;
104
+ rawString?: typeof Expression | undefined;
105
+ heredocString?: typeof Expression | undefined;
106
+ unicodeString?: typeof Expression | undefined;
107
+ bit?: typeof Expression | undefined;
108
+ boolean?: typeof Expression | undefined;
109
+ tinyint?: typeof Expression | undefined;
110
+ utinyint?: typeof Expression | undefined;
111
+ smallint?: typeof Expression | undefined;
112
+ usmallint?: typeof Expression | undefined;
113
+ mediumint?: typeof Expression | undefined;
114
+ umediumint?: typeof Expression | undefined;
115
+ int?: typeof Expression | undefined;
116
+ uint?: typeof Expression | undefined;
117
+ bigint?: typeof Expression | undefined;
118
+ ubigint?: typeof Expression | undefined;
119
+ bignum?: typeof Expression | undefined;
120
+ int128?: typeof Expression | undefined;
121
+ uint128?: typeof Expression | undefined;
122
+ int256?: typeof Expression | undefined;
123
+ uint256?: typeof Expression | undefined;
124
+ float?: typeof Expression | undefined;
125
+ double?: typeof Expression | undefined;
126
+ udouble?: typeof Expression | undefined;
127
+ decimal?: typeof Expression | undefined;
128
+ decimal32?: typeof Expression | undefined;
129
+ decimal64?: typeof Expression | undefined;
130
+ decimal128?: typeof Expression | undefined;
131
+ decimal256?: typeof Expression | undefined;
132
+ decfloat?: typeof Expression | undefined;
133
+ udecimal?: typeof Expression | undefined;
134
+ bigdecimal?: typeof Expression | undefined;
135
+ char?: typeof Expression | undefined;
136
+ nchar?: typeof Expression | undefined;
137
+ varchar?: typeof Expression | undefined;
138
+ nvarchar?: typeof Expression | undefined;
139
+ bpchar?: typeof Expression | undefined;
140
+ text?: typeof Expression | undefined;
141
+ mediumtext?: typeof Expression | undefined;
142
+ longtext?: typeof Expression | undefined;
143
+ blob?: typeof Expression | undefined;
144
+ mediumblob?: typeof Expression | undefined;
145
+ longblob?: typeof Expression | undefined;
146
+ tinyblob?: typeof Expression | undefined;
147
+ tinytext?: typeof Expression | undefined;
148
+ name?: typeof Expression | undefined;
149
+ binary?: typeof Expression | undefined;
150
+ varbinary?: typeof Expression | undefined;
151
+ json?: typeof Expression | undefined;
152
+ jsonb?: typeof Expression | undefined;
153
+ time?: typeof Expression | undefined;
154
+ timetz?: typeof Expression | undefined;
155
+ timeNs?: typeof Expression | undefined;
156
+ timestamp?: typeof Expression | undefined;
157
+ timestamptz?: typeof Expression | undefined;
158
+ timestampltz?: typeof Expression | undefined;
159
+ timestampntz?: typeof Expression | undefined;
160
+ timestampS?: typeof Expression | undefined;
161
+ timestampMs?: typeof Expression | undefined;
162
+ timestampNs?: typeof Expression | undefined;
163
+ datetime?: typeof Expression | undefined;
164
+ datetime2?: typeof Expression | undefined;
165
+ datetime64?: typeof Expression | undefined;
166
+ smalldatetime?: typeof Expression | undefined;
167
+ date?: typeof Expression | undefined;
168
+ date32?: typeof Expression | undefined;
169
+ int4range?: typeof Expression | undefined;
170
+ int4multirange?: typeof Expression | undefined;
171
+ int8range?: typeof Expression | undefined;
172
+ int8multirange?: typeof Expression | undefined;
173
+ numrange?: typeof Expression | undefined;
174
+ nummultirange?: typeof Expression | undefined;
175
+ tsrange?: typeof Expression | undefined;
176
+ tsmultirange?: typeof Expression | undefined;
177
+ tstzrange?: typeof Expression | undefined;
178
+ tstzmultirange?: typeof Expression | undefined;
179
+ daterange?: typeof Expression | undefined;
180
+ datemultirange?: typeof Expression | undefined;
181
+ uuid?: typeof Expression | undefined;
182
+ geography?: typeof Expression | undefined;
183
+ geographypoint?: typeof Expression | undefined;
184
+ nullable?: typeof Expression | undefined;
185
+ geometry?: typeof Expression | undefined;
186
+ point?: typeof Expression | undefined;
187
+ ring?: typeof Expression | undefined;
188
+ linestring?: typeof Expression | undefined;
189
+ localtime?: typeof Expression | undefined;
190
+ localtimestamp?: typeof Expression | undefined;
191
+ systimestamp?: typeof Expression | undefined;
192
+ multilinestring?: typeof Expression | undefined;
193
+ polygon?: typeof Expression | undefined;
194
+ multipolygon?: typeof Expression | undefined;
195
+ hllsketch?: typeof Expression | undefined;
196
+ hstore?: typeof Expression | undefined;
197
+ super?: typeof Expression | undefined;
198
+ serial?: typeof Expression | undefined;
199
+ smallserial?: typeof Expression | undefined;
200
+ bigserial?: typeof Expression | undefined;
201
+ xml?: typeof Expression | undefined;
202
+ year?: typeof Expression | undefined;
203
+ userdefined?: typeof Expression | undefined;
204
+ money?: typeof Expression | undefined;
205
+ smallmoney?: typeof Expression | undefined;
206
+ rowversion?: typeof Expression | undefined;
207
+ image?: typeof Expression | undefined;
208
+ variant?: typeof Expression | undefined;
209
+ object?: typeof Expression | undefined;
210
+ inet?: typeof Expression | undefined;
211
+ ipaddress?: typeof Expression | undefined;
212
+ ipprefix?: typeof Expression | undefined;
213
+ ipv4?: typeof Expression | undefined;
214
+ ipv6?: typeof Expression | undefined;
215
+ enum?: typeof Expression | undefined;
216
+ enum8?: typeof Expression | undefined;
217
+ enum16?: typeof Expression | undefined;
218
+ fixedstring?: typeof Expression | undefined;
219
+ lowcardinality?: typeof Expression | undefined;
220
+ nested?: typeof Expression | undefined;
221
+ aggregatefunction?: typeof Expression | undefined;
222
+ simpleaggregatefunction?: typeof Expression | undefined;
223
+ tdigest?: typeof Expression | undefined;
224
+ unknown?: typeof Expression | undefined;
225
+ vector?: typeof Expression | undefined;
226
+ dynamic?: typeof Expression | undefined;
227
+ void?: typeof Expression | undefined;
228
+ alias?: typeof Expression | undefined;
229
+ alter?: typeof Expression | undefined;
230
+ all?: typeof Expression | undefined;
231
+ anti?: typeof Expression | undefined;
232
+ any?: typeof Expression | undefined;
233
+ apply?: typeof Expression | undefined;
234
+ array?: typeof Expression | undefined;
235
+ asc?: typeof Expression | undefined;
236
+ asof?: typeof Expression | undefined;
237
+ attach?: typeof Expression | undefined;
238
+ autoIncrement?: typeof Expression | undefined;
239
+ begin?: typeof Expression | undefined;
240
+ between?: typeof Expression | undefined;
241
+ bulkCollectInto?: typeof Expression | undefined;
242
+ cache?: typeof Expression | undefined;
243
+ case?: typeof Expression | undefined;
244
+ characterSet?: typeof Expression | undefined;
245
+ clusterBy?: typeof Expression | undefined;
246
+ collate?: typeof Expression | undefined;
247
+ command?: typeof Expression | undefined;
248
+ comment?: typeof Expression | undefined;
249
+ commit?: typeof Expression | undefined;
250
+ connectBy?: typeof Expression | undefined;
251
+ constraint?: typeof Expression | undefined;
252
+ copy?: typeof Expression | undefined;
253
+ create?: typeof Expression | undefined;
254
+ cross?: typeof Expression | undefined;
255
+ cube?: typeof Expression | undefined;
256
+ currentDate?: typeof Expression | undefined;
257
+ currentDatetime?: typeof Expression | undefined;
258
+ currentSchema?: typeof Expression | undefined;
259
+ currentTime?: typeof Expression | undefined;
260
+ currentTimestamp?: typeof Expression | undefined;
261
+ currentUser?: typeof Expression | undefined;
262
+ currentRole?: typeof Expression | undefined;
263
+ currentCatalog?: typeof Expression | undefined;
264
+ declare?: typeof Expression | undefined;
265
+ default?: typeof Expression | undefined;
266
+ delete?: typeof Expression | undefined;
267
+ desc?: typeof Expression | undefined;
268
+ describe?: typeof Expression | undefined;
269
+ detach?: typeof Expression | undefined;
270
+ dictionary?: typeof Expression | undefined;
271
+ distinct?: typeof Expression | undefined;
272
+ distributeBy?: typeof Expression | undefined;
273
+ div?: typeof Expression | undefined;
274
+ drop?: typeof Expression | undefined;
275
+ else?: typeof Expression | undefined;
276
+ end?: typeof Expression | undefined;
277
+ escape?: typeof Expression | undefined;
278
+ except?: typeof Expression | undefined;
279
+ execute?: typeof Expression | undefined;
280
+ exists?: typeof Expression | undefined;
281
+ false?: typeof Expression | undefined;
282
+ fetch?: typeof Expression | undefined;
283
+ file?: typeof Expression | undefined;
284
+ fileFormat?: typeof Expression | undefined;
285
+ filter?: typeof Expression | undefined;
286
+ final?: typeof Expression | undefined;
287
+ first?: typeof Expression | undefined;
288
+ for?: typeof Expression | undefined;
289
+ force?: typeof Expression | undefined;
290
+ foreignKey?: typeof Expression | undefined;
291
+ format?: typeof Expression | undefined;
292
+ from?: typeof Expression | undefined;
293
+ full?: typeof Expression | undefined;
294
+ function?: typeof Expression | undefined;
295
+ get?: typeof Expression | undefined;
296
+ glob?: typeof Expression | undefined;
297
+ global?: typeof Expression | undefined;
298
+ grant?: typeof Expression | undefined;
299
+ groupBy?: typeof Expression | undefined;
300
+ groupingSets?: typeof Expression | undefined;
301
+ having?: typeof Expression | undefined;
302
+ hint?: typeof Expression | undefined;
303
+ ignore?: typeof Expression | undefined;
304
+ ilike?: typeof Expression | undefined;
305
+ in?: typeof Expression | undefined;
306
+ index?: typeof Expression | undefined;
307
+ indexedBy?: typeof Expression | undefined;
308
+ inner?: typeof Expression | undefined;
309
+ insert?: typeof Expression | undefined;
310
+ install?: typeof Expression | undefined;
311
+ intersect?: typeof Expression | undefined;
312
+ interval?: typeof Expression | undefined;
313
+ into?: typeof Expression | undefined;
314
+ introducer?: typeof Expression | undefined;
315
+ irlike?: typeof Expression | undefined;
316
+ is?: typeof Expression | undefined;
317
+ isnull?: typeof Expression | undefined;
318
+ join?: typeof Expression | undefined;
319
+ joinMarker?: typeof Expression | undefined;
320
+ keep?: typeof Expression | undefined;
321
+ key?: typeof Expression | undefined;
322
+ kill?: typeof Expression | undefined;
323
+ language?: typeof Expression | undefined;
324
+ lateral?: typeof Expression | undefined;
325
+ left?: typeof Expression | undefined;
326
+ like?: typeof Expression | undefined;
327
+ limit?: typeof Expression | undefined;
328
+ list?: typeof Expression | undefined;
329
+ load?: typeof Expression | undefined;
330
+ lock?: typeof Expression | undefined;
331
+ map?: typeof Expression | undefined;
332
+ match?: typeof Expression | undefined;
333
+ matchCondition?: typeof Expression | undefined;
334
+ matchRecognize?: typeof Expression | undefined;
335
+ memberOf?: typeof Expression | undefined;
336
+ merge?: typeof Expression | undefined;
337
+ mod?: typeof Expression | undefined;
338
+ model?: typeof Expression | undefined;
339
+ natural?: typeof Expression | undefined;
340
+ next?: typeof Expression | undefined;
341
+ nothing?: typeof Expression | undefined;
342
+ notnull?: typeof Expression | undefined;
343
+ null?: typeof Expression | undefined;
344
+ objectIdentifier?: typeof Expression | undefined;
345
+ offset?: typeof Expression | undefined;
346
+ on?: typeof Expression | undefined;
347
+ only?: typeof Expression | undefined;
348
+ operator?: typeof Expression | undefined;
349
+ orderBy?: typeof Expression | undefined;
350
+ orderSiblingsBy?: typeof Expression | undefined;
351
+ ordered?: typeof Expression | undefined;
352
+ ordinality?: typeof Expression | undefined;
353
+ out?: typeof Expression | undefined;
354
+ inout?: typeof Expression | undefined;
355
+ outer?: typeof Expression | undefined;
356
+ over?: typeof Expression | undefined;
357
+ overlaps?: typeof Expression | undefined;
358
+ overwrite?: typeof Expression | undefined;
359
+ partition?: typeof Expression | undefined;
360
+ partitionBy?: typeof Expression | undefined;
361
+ percent?: typeof Expression | undefined;
362
+ pivot?: typeof Expression | undefined;
363
+ placeholder?: typeof Expression | undefined;
364
+ positional?: typeof Expression | undefined;
365
+ pragma?: typeof Expression | undefined;
366
+ prewhere?: typeof Expression | undefined;
367
+ primaryKey?: typeof Expression | undefined;
368
+ procedure?: typeof Expression | undefined;
369
+ properties?: typeof Expression | undefined;
370
+ pseudoType?: typeof Expression | undefined;
371
+ put?: typeof Expression | undefined;
372
+ qualify?: typeof Expression | undefined;
373
+ quote?: typeof Expression | undefined;
374
+ qdcolon?: typeof Expression | undefined;
375
+ range?: typeof Expression | undefined;
376
+ recursive?: typeof Expression | undefined;
377
+ refresh?: typeof Expression | undefined;
378
+ rename?: typeof Expression | undefined;
379
+ replace?: typeof Expression | undefined;
380
+ returning?: typeof Expression | undefined;
381
+ revoke?: typeof Expression | undefined;
382
+ references?: typeof Expression | undefined;
383
+ right?: typeof Expression | undefined;
384
+ rlike?: typeof Expression | undefined;
385
+ rollback?: typeof Expression | undefined;
386
+ rollup?: typeof Expression | undefined;
387
+ row?: typeof Expression | undefined;
388
+ rows?: typeof Expression | undefined;
389
+ select?: typeof Expression | undefined;
390
+ semi?: typeof Expression | undefined;
391
+ separator?: typeof Expression | undefined;
392
+ sequence?: typeof Expression | undefined;
393
+ serdeProperties?: typeof Expression | undefined;
394
+ set?: typeof Expression | undefined;
395
+ settings?: typeof Expression | undefined;
396
+ show?: typeof Expression | undefined;
397
+ similarTo?: typeof Expression | undefined;
398
+ some?: typeof Expression | undefined;
399
+ sortBy?: typeof Expression | undefined;
400
+ soundsLike?: typeof Expression | undefined;
401
+ startWith?: typeof Expression | undefined;
402
+ storageIntegration?: typeof Expression | undefined;
403
+ straightJoin?: typeof Expression | undefined;
404
+ struct?: typeof Expression | undefined;
405
+ summarize?: typeof Expression | undefined;
406
+ tableSample?: typeof Expression | undefined;
407
+ tag?: typeof Expression | undefined;
408
+ temporary?: typeof Expression | undefined;
409
+ top?: typeof Expression | undefined;
410
+ then?: typeof Expression | undefined;
411
+ true?: typeof Expression | undefined;
412
+ truncate?: typeof Expression | undefined;
413
+ uncache?: typeof Expression | undefined;
414
+ union?: typeof Expression | undefined;
415
+ unnest?: typeof Expression | undefined;
416
+ unpivot?: typeof Expression | undefined;
417
+ update?: typeof Expression | undefined;
418
+ use?: typeof Expression | undefined;
419
+ using?: typeof Expression | undefined;
420
+ values?: typeof Expression | undefined;
421
+ variadic?: typeof Expression | undefined;
422
+ view?: typeof Expression | undefined;
423
+ semanticView?: typeof Expression | undefined;
424
+ volatile?: typeof Expression | undefined;
425
+ when?: typeof Expression | undefined;
426
+ where?: typeof Expression | undefined;
427
+ window?: typeof Expression | undefined;
428
+ with?: typeof Expression | undefined;
429
+ unique?: typeof Expression | undefined;
430
+ utcDate?: typeof Expression | undefined;
431
+ utcTime?: typeof Expression | undefined;
432
+ utcTimestamp?: typeof Expression | undefined;
433
+ versionSnapshot?: typeof Expression | undefined;
434
+ timestampSnapshot?: typeof Expression | undefined;
435
+ option?: typeof Expression | undefined;
436
+ sink?: typeof Expression | undefined;
437
+ source?: typeof Expression | undefined;
438
+ analyze?: typeof Expression | undefined;
439
+ namespace?: typeof Expression | undefined;
440
+ export?: typeof Expression | undefined;
441
+ hiveTokenStream?: typeof Expression | undefined;
442
+ };
443
+ static LOG_DEFAULTS_TO_LN: boolean;
444
+ static STRICT_CAST: boolean;
445
+ static COLON_IS_VARIANT_EXTRACT: boolean;
446
+ static get FUNCTIONS(): Record<string, (args: Expression[], options: {
447
+ dialect: Dialect;
448
+ }) => Expression>;
449
+ static get NO_PAREN_FUNCTION_PARSERS(): Partial<Record<string, (this: Parser) => Expression | undefined>>;
450
+ static get FACTOR(): Partial<Record<TokenType, typeof Expression>>;
451
+ static get COLUMN_OPERATORS(): Partial<Record<TokenType, undefined | ((this: Parser, this_?: Expression, to?: Expression) => Expression)>>;
452
+ parseCurdate(): CurrentDateExpr;
453
+ static get TABLE_ALIAS_TOKENS(): Set<TokenType>;
454
+ }
455
+ declare class DatabricksGenerator extends Spark.Generator {
456
+ static TRY_SUPPORTED: boolean;
457
+ static SUPPORTS_UESCAPE: boolean;
458
+ static TABLESAMPLE_SEED_KEYWORD: string;
459
+ static COPY_PARAMS_ARE_WRAPPED: boolean;
460
+ static COPY_PARAMS_EQ_REQUIRED: boolean;
461
+ static JSON_PATH_SINGLE_QUOTE_ESCAPE: boolean;
462
+ static QUOTE_JSON_PATH: boolean;
463
+ static PARSE_JSON_NAME: "PARSE_JSON";
464
+ static get TYPE_MAPPING(): Map<string, string>;
465
+ static get ORIGINAL_TRANSFORMS(): Map<typeof Expression, (this: Generator, e: any) => string>;
466
+ columnDefSql(expression: ColumnDefExpr, options?: {
467
+ sep?: string;
468
+ }): string;
469
+ generatedAsIdentityColumnConstraintSql(expression: GeneratedAsIdentityColumnConstraintExpr): string;
470
+ jsonPathSql(expression: JsonPathExpr): string;
471
+ uniformSql(expression: UniformExpr): string;
472
+ }
473
+ declare class Databricks extends Spark {
474
+ static DIALECT_NAME: Dialects;
475
+ static SAFE_DIVISION: boolean;
476
+ static COPY_PARAMS_ARE_CSV: boolean;
477
+ static Tokenizer: typeof DatabricksTokenizer;
478
+ static JsonPathTokenizer: typeof DatabricksJsonPathTokenizer;
479
+ static Parser: typeof DatabricksParser;
480
+ static Generator: typeof DatabricksGenerator;
481
+ static get COERCES_TO(): Map<DataTypeExprKind, Set<DataTypeExprKind>>;
482
+ }
483
+
484
+ export { Databricks };
@@ -0,0 +1,2 @@
1
+ import{a as i}from"../chunk-53OWF4GG.js";import"../chunk-YLOQRUXC.js";import"../chunk-Z5V6VOIN.js";import"../chunk-ZBFGQPJR.js";import{$c as K,$f as J,$g as W,Ah as j,Bh as v,Ca as F,Cg as B,Dh as X,Kp as it,Lk as z,Mo as tt,Mp as l,Pc as q,Pl as Z,Po as et,Qe as w,Qf as V,Qp as ot,Qq as pt,So as nt,Wd as G,Wl as k,Wo as rt,Xo as st,Yg as Q,Z as U,a,ac as T,b as O,bn as m,c as R,ca as N,d as s,fh as g,in as b,je as Y,lh as H,op as Et,p as D,r as E,sq as h,uh as C,uj as d,wj as $,xh as c,za as I}from"../chunk-KCNOE4DZ.js";function Tt(A){let S=this.sql(A,"this"),t=this.sql(A,"expression");return`${S}:${t}`}var At,St,P,_=class extends(St=tt,At=[E],St){static get IDENTIFIERS(){return["`",'"']}};P=a(St),s(P,10,"IDENTIFIERS",At,_),O(P,_),R(P,3,_);var ut,at,L,x=class extends(at=i.Tokenizer,ut=[E],at){static get ORIGINAL_KEYWORDS(){return{...i.Tokenizer.KEYWORDS,VOID:"void"}}};L=a(at),s(L,10,"ORIGINAL_KEYWORDS",ut,x),O(L,x),R(L,3,x);var Ot,Rt,_t,xt,lt,Nt,Ct,ct,p,n=class extends(ct=i.Parser,Ct=[E],Nt=[E],lt=[E],xt=[E],_t=[E],Rt=[E],Ot=[E],ct){static get ID_VAR_TOKENS(){return new Set([...I.ID_VAR_TOKENS,"sessionUser","straightJoin"])}static get NO_PAREN_FUNCTIONS(){let t={...i.Parser.NO_PAREN_FUNCTIONS};return delete t.localtime,delete t.localtimestamp,t}static get FUNCTIONS(){return{...i.Parser.FUNCTIONS,GETDATE:t=>g.fromArgList(t),DATEADD:l(C),DATE_ADD:l(C),DATEDIFF:l(c),DATE_DIFF:l(c),NOW:t=>g.fromArgList(t),TO_DATE:it(Z,{dialect:"databricks"}),UNIFORM:t=>new k({this:N(t,0),expression:N(t,1),seed:N(t,2)})}}static get NO_PAREN_FUNCTION_PARSERS(){return{...i.Parser.NO_PAREN_FUNCTION_PARSERS,CURDATE:function(){return this.parseCurdate()}}}static get FACTOR(){return{...i.Parser.FACTOR,colon:d}}static get COLUMN_OPERATORS(){return{...I.COLUMN_OPERATORS,qdcolon:function(t,e){return this.expression(m,{this:t,to:e})}}}parseCurdate(){return this.match("lParen")&&this.matchRParen(),this.expression(W)}static get TABLE_ALIAS_TOKENS(){return new Set([...i.Parser.TABLE_ALIAS_TOKENS,"straightJoin"])}};p=a(ct),s(p,10,"ID_VAR_TOKENS",Ct,n),s(p,10,"NO_PAREN_FUNCTIONS",Nt,n),s(p,10,"FUNCTIONS",lt,n),s(p,10,"NO_PAREN_FUNCTION_PARSERS",xt,n),s(p,10,"FACTOR",_t,n),s(p,10,"COLUMN_OPERATORS",Rt,n),s(p,10,"TABLE_ALIAS_TOKENS",Ot,n),O(p,n),R(p,3,n),n.LOG_DEFAULTS_TO_LN=!0,n.STRICT_CAST=!0,n.COLON_IS_VARIANT_EXTRACT=!0;var ft,It,gt,f,r=class extends(gt=i.Generator,It=[E],ft=[E],gt){static get TYPE_MAPPING(){return new Map([...i.Generator.TYPE_MAPPING,["null","VOID"]])}static get ORIGINAL_TRANSFORMS(){let t=new Map([...i.Generator.TRANSFORMS,[Q,()=>"CURRENT_VERSION()"],[C,h("DATEADD")],[c,h("DATEDIFF")],[J,function(e){return this.func("CONVERT_TIMEZONE",[e.args.sourceTz,e.args.targetTz,e.args.timestamp])}],[j,function(e){return this.func("TIMESTAMPADD",[e.args.unit,e.args.expression,e.args.this])}],[v,function(e){return this.func("TIMESTAMPADD",[e.args.unit,new w({this:e.args.expression,expression:K.number(-1)}),e.args.this])}],[X,ot()],[b,pt],[G,et([nt,rt,st])],[d,function(e){return Tt.call(this,e)}],[$,function(e){return Tt.call(this,e)}],[Y,()=>""],[V,function(e){return e.args.isNumeric?this.castSql(new B({this:e.args.this,to:new T({this:"STRING"})})):this.functionFallbackSql(e)}],[H,()=>"CURRENT_CATALOG()"]]);return t.delete(z),t.delete(m),t}columnDefSql(t,e={}){let{sep:u=" "}=e,ht=t.find(q),M=t.kind;return ht&&M instanceof T&&T.INTEGER_TYPES.has(M.args.this)&&t.setArgKey("kind",T.build("bigint")),super.columnDefSql(t,{sep:u})}generatedAsIdentityColumnConstraintSql(t){return t.setArgKey("this",!0),super.generatedAsIdentityColumnConstraintSql(t)}jsonPathSql(t){return t.setArgKey("escape",void 0),super.jsonPathSql(t)}uniformSql(t){let e=t.args.gen,u=t.args.seed;return e&&(u=D(e.args.this,F,"string")),this.func("UNIFORM",[t.args.this,t.args.expression,u])}};f=a(gt),s(f,10,"TYPE_MAPPING",It,r),s(f,10,"ORIGINAL_TRANSFORMS",ft,r),O(f,r),R(f,3,r),r.TRY_SUPPORTED=!1,r.SUPPORTS_UESCAPE=!1,r.TABLESAMPLE_SEED_KEYWORD="REPEATABLE",r.COPY_PARAMS_ARE_WRAPPED=!1,r.COPY_PARAMS_EQ_REQUIRED=!0,r.JSON_PATH_SINGLE_QUOTE_ESCAPE=!1,r.QUOTE_JSON_PATH=!1,r.PARSE_JSON_NAME="PARSE_JSON";var dt,mt,y,o=class extends(mt=i,dt=[E],mt){static get COERCES_TO(){let t=new Map(U.COERCES_TO);for(let e of T.TEXT_TYPES){let u=new Set([...t.get(e)||[],...T.NUMERIC_TYPES,...T.TEMPORAL_TYPES,"binary","boolean","interval"]);t.set(e,u)}return t}};y=a(mt),s(y,10,"COERCES_TO",dt,o),O(y,o),R(y,3,o),o.DIALECT_NAME="databricks",o.SAFE_DIVISION=!1,o.COPY_PARAMS_ARE_CSV=!1,o.Tokenizer=x,o.JsonPathTokenizer=_,o.Parser=n,o.Generator=r;Et.register("databricks",o);export{o as Databricks};
2
+ //# sourceMappingURL=databricks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/dialects/databricks.ts"],"sourcesContent":["import type {\n Generator,\n} from '../generator';\nimport {\n Parser,\n} from '../parser';\nimport {\n TokenType,\n} from '../tokens';\nimport type {\n ColumnDefExpr,\n JsonPathExpr,\n} from '../expressions';\nimport {\n JsonExtractScalarExpr,\n Expression,\n JsonPathRootExpr,\n GroupConcatExpr,\n JsonExtractExpr,\n DataTypeExpr,\n DataTypeExprKind,\n CurrentTimestampExpr,\n DateAddExpr,\n DateDiffExpr,\n TsOrDsToDateExpr,\n UniformExpr,\n CurrentDateExpr,\n TryCastExpr,\n CurrentVersionExpr,\n DatetimeAddExpr,\n DatetimeSubExpr,\n MulExpr,\n DatetimeTruncExpr,\n SelectExpr,\n ConvertTimezoneExpr,\n ToCharExpr,\n CastExpr,\n CurrentCatalogExpr,\n GeneratedAsIdentityColumnConstraintExpr,\n RegexpLikeExpr,\n LiteralExpr,\n} from '../expressions';\nimport {\n seqGet,\n} from '../helper';\nimport {\n TypeAnnotator,\n} from '../optimizer';\nimport {\n JsonPathTokenizer,\n} from '../jsonpath';\nimport {\n anyToExists, eliminateDistinctOn, preprocess, unnestToExplode,\n} from '../transforms';\nimport {\n cache, narrowInstanceOf,\n} from '../port_internals';\nimport {\n Spark,\n} from './spark';\nimport {\n dateDeltaSql,\n buildDateDelta,\n buildFormattedTime,\n Dialect, Dialects,\n timestampTruncSql,\n groupConcatSql,\n} from './dialect';\n\nfunction jsonExtractSql (this: Generator, expression: JsonExtractExpr | JsonExtractScalarExpr): string {\n const thisSql = this.sql(expression, 'this');\n const exprSql = this.sql(expression, 'expression');\n return `${thisSql}:${exprSql}`;\n}\n\nclass DatabricksJsonPathTokenizer extends JsonPathTokenizer {\n @cache\n static get IDENTIFIERS () {\n return [\n '`',\n '\"',\n ];\n }\n}\n\nclass DatabricksTokenizer extends Spark.Tokenizer {\n @cache\n static get ORIGINAL_KEYWORDS (): Record<string, TokenType> {\n return {\n ...Spark.Tokenizer.KEYWORDS,\n VOID: TokenType.VOID,\n };\n }\n}\n\nclass DatabricksParser extends Spark.Parser {\n @cache\n static get ID_VAR_TOKENS (): Set<TokenType> {\n return new Set([\n ...Parser.ID_VAR_TOKENS,\n TokenType.SESSION_USER,\n TokenType.STRAIGHT_JOIN,\n ]);\n }\n\n // port from _Dialect metaclass logic\n @cache\n static get NO_PAREN_FUNCTIONS () {\n const noParenFunctions = {\n ...Spark.Parser.NO_PAREN_FUNCTIONS,\n };\n delete noParenFunctions[TokenType.LOCALTIME];\n delete noParenFunctions[TokenType.LOCALTIMESTAMP];\n return noParenFunctions;\n }\n\n static LOG_DEFAULTS_TO_LN = true;\n static STRICT_CAST = true;\n static COLON_IS_VARIANT_EXTRACT = true;\n\n @cache\n static get FUNCTIONS (): Record<string, (args: Expression[], options: {dialect: Dialect}) => Expression> {\n return {\n ...Spark.Parser.FUNCTIONS,\n GETDATE: (args: unknown[]) => CurrentTimestampExpr.fromArgList(args),\n DATEADD: buildDateDelta(DateAddExpr),\n DATE_ADD: buildDateDelta(DateAddExpr),\n DATEDIFF: buildDateDelta(DateDiffExpr),\n DATE_DIFF: buildDateDelta(DateDiffExpr),\n NOW: (args: unknown[]) => CurrentTimestampExpr.fromArgList(args),\n TO_DATE: buildFormattedTime(TsOrDsToDateExpr, {\n dialect: Dialects.DATABRICKS,\n }),\n UNIFORM: (args: Expression[]) => new UniformExpr({\n this: seqGet(args, 0),\n expression: seqGet(args, 1),\n seed: seqGet(args, 2),\n }),\n };\n }\n\n @cache\n static get NO_PAREN_FUNCTION_PARSERS (): Partial<Record<string, (this: Parser) => Expression | undefined>> {\n return {\n ...Spark.Parser.NO_PAREN_FUNCTION_PARSERS,\n CURDATE: function (this: Parser) {\n return (this as DatabricksParser).parseCurdate();\n },\n };\n }\n\n @cache\n static get FACTOR (): Partial<Record<TokenType, typeof Expression>> {\n return {\n ...Spark.Parser.FACTOR,\n [TokenType.COLON]: JsonExtractExpr,\n };\n }\n\n @cache\n static get COLUMN_OPERATORS (): Partial<Record<TokenType, undefined | ((this: Parser, this_?: Expression, to?: Expression) => Expression)>> {\n return {\n ...Parser.COLUMN_OPERATORS,\n [TokenType.QDCOLON]: function (this: Parser, thisNode?: Expression, to?: Expression) {\n return this.expression(TryCastExpr, {\n this: thisNode,\n to: to,\n });\n },\n };\n }\n\n parseCurdate (): CurrentDateExpr {\n if (this.match(TokenType.L_PAREN)) {\n this.matchRParen();\n }\n return this.expression(CurrentDateExpr);\n }\n\n // port from _Dialect metaclass logic\n @cache\n static get TABLE_ALIAS_TOKENS (): Set<TokenType> {\n return new Set([\n ...Spark.Parser.TABLE_ALIAS_TOKENS,\n TokenType.STRAIGHT_JOIN,\n ]);\n }\n}\nclass DatabricksGenerator extends Spark.Generator {\n // port from _Dialect metaclass logic\n static TRY_SUPPORTED = false;\n // port from _Dialect metaclass logic\n static SUPPORTS_UESCAPE = false;\n static TABLESAMPLE_SEED_KEYWORD = 'REPEATABLE';\n static COPY_PARAMS_ARE_WRAPPED = false;\n static COPY_PARAMS_EQ_REQUIRED = true;\n static JSON_PATH_SINGLE_QUOTE_ESCAPE = false;\n static QUOTE_JSON_PATH = false;\n static PARSE_JSON_NAME = 'PARSE_JSON' as const;\n\n @cache\n static get TYPE_MAPPING () {\n return new Map([\n ...Spark.Generator.TYPE_MAPPING,\n [\n DataTypeExprKind.NULL,\n 'VOID',\n ],\n ]);\n }\n\n @cache\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n static get ORIGINAL_TRANSFORMS (): Map<typeof Expression, (this: Generator, e: any) => string> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const transforms = new Map<typeof Expression, (this: Generator, e: any) => string>([\n ...Spark.Generator.TRANSFORMS,\n [\n CurrentVersionExpr,\n () => 'CURRENT_VERSION()',\n ],\n [\n DateAddExpr,\n dateDeltaSql('DATEADD'),\n ],\n [\n DateDiffExpr,\n dateDeltaSql('DATEDIFF'),\n ],\n [\n ConvertTimezoneExpr,\n function (this: Generator, e: ConvertTimezoneExpr) {\n return this.func('CONVERT_TIMEZONE', [\n e.args.sourceTz,\n e.args.targetTz,\n e.args.timestamp,\n ]);\n },\n ],\n [\n DatetimeAddExpr,\n function (this: Generator, e) {\n return this.func('TIMESTAMPADD', [\n e.args.unit,\n e.args.expression,\n e.args.this,\n ]);\n },\n ],\n [\n DatetimeSubExpr,\n function (this: Generator, e) {\n return this.func('TIMESTAMPADD', [\n e.args.unit,\n new MulExpr({\n this: e.args.expression,\n expression: LiteralExpr.number(-1),\n }),\n e.args.this,\n ]);\n },\n ],\n [\n DatetimeTruncExpr,\n timestampTruncSql(),\n ],\n [\n GroupConcatExpr,\n groupConcatSql,\n ],\n [\n SelectExpr,\n preprocess([\n eliminateDistinctOn,\n unnestToExplode,\n anyToExists,\n ]),\n ],\n [\n JsonExtractExpr,\n function (this: Generator, e) {\n return jsonExtractSql.call(this, e);\n },\n ],\n [\n JsonExtractScalarExpr,\n function (this: Generator, e) {\n return jsonExtractSql.call(this, e);\n },\n ],\n [\n JsonPathRootExpr,\n () => '',\n ],\n [\n ToCharExpr,\n function (this: Generator, e: ToCharExpr) {\n return e.args.isNumeric\n ? this.castSql(new CastExpr({\n this: e.args.this,\n to: new DataTypeExpr({\n this: 'STRING',\n }),\n }))\n : this.functionFallbackSql(e);\n },\n ],\n [\n CurrentCatalogExpr,\n () => 'CURRENT_CATALOG()',\n ],\n ]);\n\n transforms.delete(RegexpLikeExpr);\n transforms.delete(TryCastExpr);\n\n return transforms;\n }\n\n columnDefSql (expression: ColumnDefExpr, options: {sep?: string} = {}): string {\n const {\n sep = ' ',\n } = options;\n const constraint = expression.find(GeneratedAsIdentityColumnConstraintExpr);\n const kind = expression.kind;\n\n if (\n constraint\n && kind instanceof DataTypeExpr\n && DataTypeExpr.INTEGER_TYPES.has(kind.args.this as DataTypeExprKind)\n ) {\n // only BIGINT generated identity constraints are supported\n expression.setArgKey('kind', DataTypeExpr.build('bigint'));\n }\n\n return super.columnDefSql(expression, {\n sep,\n });\n }\n\n generatedAsIdentityColumnConstraintSql (expression: GeneratedAsIdentityColumnConstraintExpr): string {\n expression.setArgKey('this', true); // trigger ALWAYS in super class\n return super.generatedAsIdentityColumnConstraintSql(expression);\n }\n\n jsonPathSql (expression: JsonPathExpr): string {\n expression.setArgKey('escape', undefined);\n return super.jsonPathSql(expression);\n }\n\n uniformSql (expression: UniformExpr): string {\n const gen = expression.args.gen;\n let seed: Expression | string | undefined = expression.args.seed;\n\n // From Snowflake UNIFORM(min, max, gen) as RANDOM(), RANDOM(seed), or constant value -> Extract seed\n if (gen) {\n seed = narrowInstanceOf(gen.args.this, Expression, 'string');\n }\n\n return this.func('UNIFORM', [\n expression.args.this,\n expression.args.expression,\n seed,\n ]);\n }\n}\n\nexport class Databricks extends Spark {\n static DIALECT_NAME = Dialects.DATABRICKS;\n static SAFE_DIVISION = false;\n static COPY_PARAMS_ARE_CSV = false;\n\n static Tokenizer = DatabricksTokenizer;\n static JsonPathTokenizer = DatabricksJsonPathTokenizer;\n static Parser = DatabricksParser;\n static Generator = DatabricksGenerator;\n\n @cache\n static get COERCES_TO (): Map<DataTypeExprKind, Set<DataTypeExprKind>> {\n const coercionMap = new Map(TypeAnnotator.COERCES_TO);\n\n for (const textType of DataTypeExpr.TEXT_TYPES) {\n const types = new Set([\n ...(coercionMap.get(textType) || [\n ]),\n ...DataTypeExpr.NUMERIC_TYPES,\n ...DataTypeExpr.TEMPORAL_TYPES,\n DataTypeExprKind.BINARY,\n DataTypeExprKind.BOOLEAN,\n DataTypeExprKind.INTERVAL,\n ] as DataTypeExprKind[]);\n coercionMap.set(textType, types);\n }\n return coercionMap;\n }\n}\n\nDialect.register(Dialects.DATABRICKS, Databricks);\n"],"mappings":"+gBAqEA,SAASA,GAAiCC,EAA6D,CACrG,IAAMC,EAAU,KAAK,IAAID,EAAY,MAAM,EACrCE,EAAU,KAAK,IAAIF,EAAY,YAAY,EACjD,MAAO,GAAGC,CAAO,IAAIC,CAAO,EAC9B,CAzEA,IAAAC,GAAAC,GAAAC,EA2EMC,EAAN,cAA0CF,GAAAG,GACxCJ,GAAA,CAACK,GADuCJ,GAAkB,CAE1D,WAAW,aAAe,CACxB,MAAO,CACL,IACA,GACF,CACF,CACF,EARAC,EAAAI,EAAAL,IAEEM,EAAAL,EAAA,GAAW,cADXF,GADIG,GAANK,EAAAN,EAAMC,GAANM,EAAAP,EAAA,EAAMC,GA3EN,IAAAO,GAAAT,GAAAC,EAqFMS,EAAN,cAAkCV,GAAAW,EAAM,UACtCF,GAAA,CAACL,GAD+BJ,GAAgB,CAEhD,WAAW,mBAAgD,CACzD,MAAO,CACL,GAAGW,EAAM,UAAU,SACnB,WACF,CACF,CACF,EARAV,EAAAI,EAAAL,IAEEM,EAAAL,EAAA,GAAW,oBADXQ,GADIC,GAANH,EAAAN,EAAMS,GAANF,EAAAP,EAAA,EAAMS,GArFN,IAAAE,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAlB,GAAAC,EA+FMkB,EAAN,cAA+BnB,GAAAW,EAAM,OACnCO,GAAA,CAACd,GAUDa,GAAA,CA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,GAFZA,EAGJ,oBAAsB,GAHlBA,EAKJ,UAAY/D,EALR+D,EAMJ,kBAAoBvE,EANhBuE,EAOJ,OAAStD,EAPLsD,EAQJ,UAAYnC,EAsBrBwC,GAAQ,sBAA8BL,CAAU","names":["jsonExtractSql","expression","thisSql","exprSql","_IDENTIFIERS_dec","_a","_init","DatabricksJsonPathTokenizer","JsonPathTokenizer","cache","__decoratorStart","__decorateElement","__decoratorMetadata","__runInitializers","_ORIGINAL_KEYWORDS_dec","DatabricksTokenizer","Spark","_TABLE_ALIAS_TOKENS_dec","_COLUMN_OPERATORS_dec","_FACTOR_dec","_NO_PAREN_FUNCTION_PARSERS_dec","_FUNCTIONS_dec","_NO_PAREN_FUNCTIONS_dec","_ID_VAR_TOKENS_dec","DatabricksParser","Parser","noParenFunctions","args","CurrentTimestampExpr","buildDateDelta","DateAddExpr","DateDiffExpr","buildFormattedTime","TsOrDsToDateExpr","UniformExpr","seqGet","JsonExtractExpr","thisNode","to","TryCastExpr","CurrentDateExpr","_ORIGINAL_TRANSFORMS_dec","_TYPE_MAPPING_dec","DatabricksGenerator","transforms","CurrentVersionExpr","dateDeltaSql","ConvertTimezoneExpr","DatetimeAddExpr","DatetimeSubExpr","MulExpr","LiteralExpr","DatetimeTruncExpr","timestampTruncSql","GroupConcatExpr","groupConcatSql","SelectExpr","preprocess","eliminateDistinctOn","unnestToExplode","anyToExists","JsonExtractScalarExpr","JsonPathRootExpr","ToCharExpr","CastExpr","DataTypeExpr","CurrentCatalogExpr","RegexpLikeExpr","options","sep","constraint","GeneratedAsIdentityColumnConstraintExpr","kind","gen","seed","narrowInstanceOf","Expression","_COERCES_TO_dec","Databricks","coercionMap","TypeAnnotator","textType","types","Dialect"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkR7C3ZHVKcjs = require('../chunk-R7C3ZHVK.cjs');var _chunk2Z3O2CFMcjs = require('../chunk-2Z3O2CFM.cjs');function _e(l){return this.func(l instanceof _chunk2Z3O2CFMcjs.Vm?"LAG":"LEAD",[l.args.this,_nullishCoalesce(l.args.offset, () => (_chunk2Z3O2CFMcjs.$c.number(1))),_nullishCoalesce(l.args.default, () => (_chunk2Z3O2CFMcjs.Bo.call(void 0, )))])}function we(l){let m=_chunk2Z3O2CFMcjs.ca.call(void 0, l,0),e=_chunk2Z3O2CFMcjs.ca.call(void 0, l,1),t=a=>{if(!(a instanceof _chunk2Z3O2CFMcjs.$c&&a.isString))return!1;let T=a.args.this;return!/\d/.test(_nullishCoalesce(T, () => ("")))},[r,s]=t(m)?[m,e]:[e,m];return new (0, _chunk2Z3O2CFMcjs.bi)({this:s,unit:r})}var k=class extends _chunkR7C3ZHVKcjs.j.Tokenizer{},Se,ye,Pe,Re,Ae,Oe,h,u=class extends(Oe=_chunkR7C3ZHVKcjs.j.Parser,Ae=[_chunk2Z3O2CFMcjs.r],Re=[_chunk2Z3O2CFMcjs.r],Pe=[_chunk2Z3O2CFMcjs.r],ye=[_chunk2Z3O2CFMcjs.r],Se=[_chunk2Z3O2CFMcjs.r],Oe){static get ID_VAR_TOKENS(){return new Set([..._chunk2Z3O2CFMcjs.za.ID_VAR_TOKENS,"sessionUser","currentCatalog"])}static get NO_PAREN_FUNCTIONS(){let e={..._chunkR7C3ZHVKcjs.j.Parser.NO_PAREN_FUNCTIONS};return delete e.currentDate,delete e.localtime,delete e.localtimestamp,e}static get FUNCTIONS(){return{..._chunkR7C3ZHVKcjs.j.Parser.FUNCTIONS,COLLECT_SET:e=>_chunk2Z3O2CFMcjs.Om.fromArgList(e),DATE_TRUNC:we,L2_DISTANCE:e=>_chunk2Z3O2CFMcjs.qf.fromArgList(e),MONTHS_ADD:e=>_chunk2Z3O2CFMcjs.mk.fromArgList(e),REGEXP:e=>_chunk2Z3O2CFMcjs.Lk.fromArgList(e),TO_DATE:e=>_chunk2Z3O2CFMcjs.Pl.fromArgList(e)}}static get FUNCTION_PARSERS(){let e={..._chunkR7C3ZHVKcjs.j.Parser.FUNCTION_PARSERS};return delete e.GROUP_CONCAT,e}static get PROPERTY_PARSERS(){return{..._chunkR7C3ZHVKcjs.j.Parser.PROPERTY_PARSERS,PROPERTIES:function(){return this.parseWrappedProperties()},UNIQUE:function(){return this.parseCompositeKeyProperty(_chunk2Z3O2CFMcjs.Bd)},KEY:function(){return this.parseCompositeKeyProperty(_chunk2Z3O2CFMcjs.Bd)},BUILD:function(){return this.parseBuildProperty()},REFRESH:function(){return this.parseRefreshProperty()}}}parsePartitionProperty(){let e=super.parsePartitionProperty();if(!e)return this.parsePartitionedBy();if(e instanceof _chunk2Z3O2CFMcjs.Hb)return e;this.matchLParen();let t;return this.matchTextSeq("FROM",{advance:!1})&&(t=this.parseCsv(()=>this.parsePartitioningGranularityDynamic())),this.matchRParen(),this.expression(_chunk2Z3O2CFMcjs.xd,{partitionExpressions:e,createExpressions:t})}parsePartitioningGranularityDynamic(){this.matchTextSeq("FROM");let e=this.parseWrapped(()=>this.parseString());this.matchTextSeq("TO");let t=this.parseWrapped(()=>this.parseString());this.matchTextSeq("INTERVAL");let r=this.parseNumber(),s=this.parseVar({anyToken:!0}),a=this.expression(_chunk2Z3O2CFMcjs.fe,{this:r,unit:s});return this.expression(_chunk2Z3O2CFMcjs.Ib,{start:e,end:t,every:a})}parsePartitionRangeValue(){let e=super.parsePartitionRangeValue();if(e instanceof _chunk2Z3O2CFMcjs.ub)return e;this.matchTextSeq("VALUES");let t=e;this.match("lBracket");let r=this.parseWrappedCsv(()=>this.parseExpression());this.match("rBracket"),this.match("rParen");let s=this.expression(_chunk2Z3O2CFMcjs.vb,{this:t,expressions:r});return this.expression(_chunk2Z3O2CFMcjs.ub,{expressions:[s]})}parseBuildProperty(){return this.expression(_chunk2Z3O2CFMcjs.bd,{this:this.parseVar({upper:!0})})}parseRefreshProperty(){let e=this.parseVar({upper:!0});this.match("on");let t=this.matchTexts(["MANUAL","COMMIT","SCHEDULE"])?_optionalChain([this, 'access', _2 => _2.prev, 'optionalAccess', _3 => _3.text, 'access', _4 => _4.toUpperCase, 'call', _5 => _5()]):void 0,r=this.matchTextSeq("EVERY")?this.parseNumber():void 0,s=r?this.parseVar({anyToken:!0}):void 0,a=this.matchTextSeq("STARTS")?this.parseString():void 0;return this.expression(_chunk2Z3O2CFMcjs.Ad,{method:e,kind:t,every:r,unit:s,starts:a})}};h=_chunk2Z3O2CFMcjs.a.call(void 0, Oe),_chunk2Z3O2CFMcjs.d.call(void 0, h,10,"ID_VAR_TOKENS",Ae,u),_chunk2Z3O2CFMcjs.d.call(void 0, h,10,"NO_PAREN_FUNCTIONS",Re,u),_chunk2Z3O2CFMcjs.d.call(void 0, h,10,"FUNCTIONS",Pe,u),_chunk2Z3O2CFMcjs.d.call(void 0, h,10,"FUNCTION_PARSERS",ye,u),_chunk2Z3O2CFMcjs.d.call(void 0, h,10,"PROPERTY_PARSERS",Se,u),_chunk2Z3O2CFMcjs.b.call(void 0, h,u),_chunk2Z3O2CFMcjs.c.call(void 0, h,3,u);var Ie,Ne,be,Me,Ce,Le,ve,Ue,E,n=class extends(Ue=_chunkR7C3ZHVKcjs.j.Generator,ve=[_chunk2Z3O2CFMcjs.r],Le=[_chunk2Z3O2CFMcjs.r],Ce=[_chunk2Z3O2CFMcjs.r],Me=[_chunk2Z3O2CFMcjs.r],be=[_chunk2Z3O2CFMcjs.r],Ne=[_chunk2Z3O2CFMcjs.r],Ie=[_chunk2Z3O2CFMcjs.r],Ue){static get AFTER_HAVING_MODIFIER_TRANSFORMS(){let e=new Map(super.AFTER_HAVING_MODIFIER_TRANSFORMS);return["cluster","distribute","sort"].forEach(t=>e.delete(t)),e}static get TYPE_MAPPING(){return new Map([..._chunkR7C3ZHVKcjs.j.Generator.TYPE_MAPPING,["text","STRING"],["timestamp","DATETIME"],["timestamptz","DATETIME"]])}static get PROPERTIES_LOCATION(){return new Map([..._chunkR7C3ZHVKcjs.j.Generator.PROPERTIES_LOCATION,[_chunk2Z3O2CFMcjs.Bd,"postSchema"],[_chunk2Z3O2CFMcjs.ud,"postSchema"],[_chunk2Z3O2CFMcjs.bd,"postSchema"]])}static get CAST_MAPPING(){return{}}static get TIMESTAMP_FUNC_TYPES(){return new Set}static get ORIGINAL_TRANSFORMS(){return new Map([..._chunkR7C3ZHVKcjs.j.Generator.TRANSFORMS,[_chunk2Z3O2CFMcjs.mk,_chunk2Z3O2CFMcjs.pp.call(void 0, "MONTHS_ADD")],[_chunk2Z3O2CFMcjs.Lm,_chunk2Z3O2CFMcjs.qp],[_chunk2Z3O2CFMcjs.vm,_chunk2Z3O2CFMcjs.pp.call(void 0, "MAX_BY")],[_chunk2Z3O2CFMcjs.wm,_chunk2Z3O2CFMcjs.pp.call(void 0, "MIN_BY")],[_chunk2Z3O2CFMcjs.Nm,_chunk2Z3O2CFMcjs.pp.call(void 0, "COLLECT_LIST")],[_chunk2Z3O2CFMcjs.qg,_chunk2Z3O2CFMcjs.pp.call(void 0, "ARRAY_JOIN")],[_chunk2Z3O2CFMcjs.Om,_chunk2Z3O2CFMcjs.pp.call(void 0, "COLLECT_SET")],[_chunk2Z3O2CFMcjs.$g,function(){return this.func("CURRENT_DATE",[])}],[_chunk2Z3O2CFMcjs.fh,function(){return this.func("NOW",[])}],[_chunk2Z3O2CFMcjs.yh,function(t){return this.func("DATE_TRUNC",[t.args.this,_chunk2Z3O2CFMcjs.uq.call(void 0, t)])}],[_chunk2Z3O2CFMcjs.qf,_chunk2Z3O2CFMcjs.pp.call(void 0, "L2_DISTANCE")],[_chunk2Z3O2CFMcjs.in,function(t){return this.func("GROUP_CONCAT",[t.args.this,_nullishCoalesce(t.args.separator, () => (_chunk2Z3O2CFMcjs.$c.string(",")))])}],[_chunk2Z3O2CFMcjs.wj,function(t){return this.func("JSON_EXTRACT",[t.args.this,t.args.expression])}],[_chunk2Z3O2CFMcjs.Vm,_e],[_chunk2Z3O2CFMcjs.Wm,_e],[_chunk2Z3O2CFMcjs.Vj,_chunk2Z3O2CFMcjs.pp.call(void 0, "ARRAY_MAP")],[_chunk2Z3O2CFMcjs.Hb,function(t){return this.propertySql(t)}],[_chunk2Z3O2CFMcjs.Lk,_chunk2Z3O2CFMcjs.pp.call(void 0, "REGEXP")],[_chunk2Z3O2CFMcjs.Pk,_chunk2Z3O2CFMcjs.pp.call(void 0, "SPLIT_BY_STRING")],[_chunk2Z3O2CFMcjs.Dd,function(t){return this.nakedProperty(t)}],[_chunk2Z3O2CFMcjs.nl,_chunk2Z3O2CFMcjs.pp.call(void 0, "SPLIT_BY_STRING")],[_chunk2Z3O2CFMcjs.vg,_chunk2Z3O2CFMcjs.pp.call(void 0, "SPLIT_BY_STRING")],[_chunk2Z3O2CFMcjs.yl,function(t){return this.func("UNIX_TIMESTAMP",[t.args.this,this.formatTime(t)])}],[_chunk2Z3O2CFMcjs.Jl,_chunk2Z3O2CFMcjs.pp.call(void 0, "TO_DATE")],[_chunk2Z3O2CFMcjs.Nl,function(t){return this.func("DATE_ADD",[t.args.this,t.args.expression])}],[_chunk2Z3O2CFMcjs.Pl,function(t){return this.func("TO_DATE",[t.args.this])}],[_chunk2Z3O2CFMcjs.Il,_chunk2Z3O2CFMcjs.pp.call(void 0, "UNIX_TIMESTAMP")],[_chunk2Z3O2CFMcjs.bi,function(t){return this.func("DATE_TRUNC",[t.args.this,_chunk2Z3O2CFMcjs.uq.call(void 0, t)])}],[_chunk2Z3O2CFMcjs.Yl,function(t){return this.func("FROM_UNIXTIME",[t.args.this,_chunk2Z3O2CFMcjs.Lp.call(void 0, "doris").call(this,t)])}],[_chunk2Z3O2CFMcjs.Zl,_chunk2Z3O2CFMcjs.pp.call(void 0, "FROM_UNIXTIME")]])}static get RESERVED_KEYWORDS(){return new Set(["account_lock","account_unlock","add","adddate","admin","after","agg_state","aggregate","alias","all","alter","analyze","analyzed","and","anti","append","array","array_range","as","asc","at","authors","auto","auto_increment","backend","backends","backup","begin","belong","between","bigint","bin","binary","binlog","bitand","bitmap","bitmap_union","bitor","bitxor","blob","boolean","brief","broker","buckets","build","builtin","bulk","by","cached","call","cancel","case","cast","catalog","catalogs","chain","char","character","charset","check","clean","cluster","clusters","collate","collation","collect","column","columns","comment","commit","committed","compact","complete","config","connection","connection_id","consistent","constraint","constraints","convert","copy","count","create","creation","cron","cross","cube","current","current_catalog","current_date","current_time","current_timestamp","current_user","data","database","databases","date","date_add","date_ceil","date_diff","date_floor","date_sub","dateadd","datediff","datetime","datetimev2","datev2","datetimev1","datev1","day","days_add","days_sub","decimal","decimalv2","decimalv3","decommission","default","deferred","delete","demand","desc","describe","diagnose","disk","distinct","distinctpc","distinctpcsa","distributed","distribution","div","do","doris_internal_table_id","double","drop","dropp","dual","duplicate","dynamic","else","enable","encryptkey","encryptkeys","end","ends","engine","engines","enter","errors","events","every","except","exclude","execute","exists","expired","explain","export","extended","external","extract","failed_login_attempts","false","fast","feature","fields","file","filter","first","float","follower","following","for","foreign","force","format","free","from","frontend","frontends","full","function","functions","generic","global","grant","grants","graph","group","grouping","groups","hash","having","hdfs","help","histogram","hll","hll_union","hostname","hour","hub","identified","if","ignore","immediate","in","incremental","index","indexes","infile","inner","insert","install","int","integer","intermediate","intersect","interval","into","inverted","ipv4","ipv6","is","is_not_null_pred","is_null_pred","isnull","isolation","job","jobs","join","json","jsonb","key","keys","kill","label","largeint","last","lateral","ldap","ldap_admin_password","left","less","level","like","limit","lines","link","list","load","local","localtime","localtimestamp","location","lock","logical","low_priority","manual","map","match","match_all","match_any","match_phrase","match_phrase_edge","match_phrase_prefix","match_regexp","materialized","max","maxvalue","memo","merge","migrate","migrations","min","minus","minute","modify","month","mtmv","name","names","natural","negative","never","next","ngram_bf","no","non_nullable","not","null","nulls","observer","of","offset","on","only","open","optimized","or","order","outer","outfile","over","overwrite","parameter","parsed","partition","partitions","password","password_expire","password_history","password_lock_time","password_reuse","path","pause","percent","period","permissive","physical","plan","process","plugin","plugins","policy","preceding","prepare","primary","proc","procedure","processlist","profile","properties","property","quantile_state","quantile_union","query","quota","random","range","read","real","rebalance","recover","recycle","refresh","references","regexp","release","rename","repair","repeatable","replace","replace_if_not_null","replica","repositories","repository","resource","resources","restore","restrictive","resume","returns","revoke","rewritten","right","rlike","role","roles","rollback","rollup","routine","row","rows","s3","sample","schedule","scheduler","schema","schemas","second","select","semi","sequence","serializable","session","set","sets","shape","show","signed","skew","smallint","snapshot","soname","split","sql_block_rule","start","starts","stats","status","stop","storage","stream","streaming","string","struct","subdate","sum","superuser","switch","sync","system","table","tables","tablesample","tablet","tablets","task","tasks","temporary","terminated","text","than","then","time","timestamp","timestampadd","timestampdiff","tinyint","to","transaction","trash","tree","triggers","trim","true","truncate","type","type_cast","types","unbounded","uncommitted","uninstall","union","unique","unlock","unsigned","update","use","user","using","value","values","varchar","variables","variant","vault","verbose","version","view","warnings","week","when","where","whitelist","with","work","workload","write","xor","year"])}uniqueKeyPropertySql(e,t={}){let{prefix:r="UNIQUE KEY"}=t,s=e.findAncestor(_chunk2Z3O2CFMcjs.Ja);return s&&_optionalChain([s, 'access', _6 => _6.args, 'access', _7 => _7.properties, 'optionalAccess', _8 => _8.find, 'call', _9 => _9(_chunk2Z3O2CFMcjs.rd)])&&(r="KEY"),super.uniqueKeyPropertySql(e,{prefix:r})}partitionRangeSql(e){let t=this.sql(e,"this"),r=e.args.expressions||[];if(r.length!==1){let s;return 0<r.length&&Array.isArray(r[0])?s=r.map(a=>`(${a.map(T=>this.sql(T)).join(", ")})`).join(", "):s=r.map(a=>`(${this.sql(a)})`).join(", "),`PARTITION ${t} VALUES [${s})`}return`PARTITION ${t} VALUES LESS THAN (${this.sql(r[0])})`}partitionByRangePropertyDynamicSql(e){let t=this.sql(e,"start"),r=this.sql(e,"end"),s=e.args.every,a="";if(s){let T=this.sql(s,"this"),ke=this.sql(s,"unit");a=`INTERVAL ${T} ${ke}`}return`FROM (${t}) TO (${r}) ${a}`.trim()}partitionedByPropertySql(e){let t=e.args.this;return t instanceof _chunk2Z3O2CFMcjs.Vb?`PARTITION BY (${this.expressions(t,{flat:!0})})`:`PARTITION BY (${this.sql(t)})`}tableSql(e,t={}){let{sep:r=" AS "}=t,s=e.findAncestor(_chunk2Z3O2CFMcjs.Vd,_chunk2Z3O2CFMcjs.fb,_chunk2Z3O2CFMcjs.Wd);return s&&!(s instanceof _chunk2Z3O2CFMcjs.Wd)&&(r=" "),super.tableSql(e,{sep:r})}};E=_chunk2Z3O2CFMcjs.a.call(void 0, Ue),_chunk2Z3O2CFMcjs.d.call(void 0, E,10,"AFTER_HAVING_MODIFIER_TRANSFORMS",ve,n),_chunk2Z3O2CFMcjs.d.call(void 0, E,10,"TYPE_MAPPING",Le,n),_chunk2Z3O2CFMcjs.d.call(void 0, E,10,"PROPERTIES_LOCATION",Ce,n),_chunk2Z3O2CFMcjs.d.call(void 0, E,10,"CAST_MAPPING",Me,n),_chunk2Z3O2CFMcjs.d.call(void 0, E,10,"TIMESTAMP_FUNC_TYPES",be,n),_chunk2Z3O2CFMcjs.d.call(void 0, E,10,"ORIGINAL_TRANSFORMS",Ne,n),_chunk2Z3O2CFMcjs.d.call(void 0, E,10,"RESERVED_KEYWORDS",Ie,n),_chunk2Z3O2CFMcjs.b.call(void 0, E,n),_chunk2Z3O2CFMcjs.c.call(void 0, E,3,n),n.SUPPORTS_DECODE_CASE=!1,n.TRY_SUPPORTED=!1,n.SUPPORTS_UESCAPE=!1,n.LAST_DAY_SUPPORTS_DATE_PART=!1,n.VARCHAR_REQUIRES_SIZE=!1,n.WITH_PROPERTIES_PREFIX="PROPERTIES",n.RENAME_TABLE_WITH_DB=!1,n.UPDATE_STATEMENT_SUPPORTS_FROM=!0;var d=class extends _chunkR7C3ZHVKcjs.j{};d.DIALECT_NAME="doris",d.DATE_FORMAT="'yyyy-MM-dd'",d.DATEINT_FORMAT="'yyyyMMdd'",d.TIME_FORMAT="'yyyy-MM-dd HH:mm:ss'",d.Tokenizer=k,d.Parser=u,d.Generator=n;_chunk2Z3O2CFMcjs.op.register("doris",d);exports.Doris = d; exports.DorisTokenizer = k;
2
+ //# sourceMappingURL=doris.cjs.map