sqlingo 0.12.3 → 0.13.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 (261) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/chunk-356JLMO7.cjs +2 -0
  3. package/dist/{chunk-UJEHXXRU.cjs.map → chunk-356JLMO7.cjs.map} +1 -1
  4. package/dist/chunk-5FV5MKDV.js +2 -0
  5. package/dist/chunk-5FV5MKDV.js.map +1 -0
  6. package/dist/chunk-7ABGIEYA.cjs +2 -0
  7. package/dist/{chunk-F4H5GNAS.cjs.map → chunk-7ABGIEYA.cjs.map} +1 -1
  8. package/dist/{chunk-ZZAKTBZ2.js → chunk-7WQP5O6G.js} +2 -2
  9. package/dist/{chunk-FZMXAQA2.js → chunk-ALKBKC3F.js} +2 -2
  10. package/dist/chunk-ALKBKC3F.js.map +1 -0
  11. package/dist/{chunk-AZNXXBMF.js → chunk-AS5Z4OUJ.js} +2 -2
  12. package/dist/{chunk-MBDFVUXG.js → chunk-BRG36BOL.js} +2 -2
  13. package/dist/chunk-CT665EUF.cjs +2 -0
  14. package/dist/chunk-CT665EUF.cjs.map +1 -0
  15. package/dist/chunk-D5E56FXA.cjs +2 -0
  16. package/dist/{chunk-2IDNLTQG.cjs.map → chunk-D5E56FXA.cjs.map} +1 -1
  17. package/dist/chunk-D65LQHTJ.js +2 -0
  18. package/dist/chunk-D65LQHTJ.js.map +1 -0
  19. package/dist/chunk-DBVEOYC3.cjs +2 -0
  20. package/dist/{chunk-5YRYCTSB.cjs.map → chunk-DBVEOYC3.cjs.map} +1 -1
  21. package/dist/chunk-E4WQOMI7.cjs +19 -0
  22. package/dist/chunk-E4WQOMI7.cjs.map +1 -0
  23. package/dist/chunk-EFZ26WHO.js +3 -0
  24. package/dist/chunk-EFZ26WHO.js.map +1 -0
  25. package/dist/{chunk-GXH2FNJU.js → chunk-EI7USPOS.js} +2 -2
  26. package/dist/chunk-EWS2XPJA.cjs +2 -0
  27. package/dist/{chunk-OE3QVFQR.cjs.map → chunk-EWS2XPJA.cjs.map} +1 -1
  28. package/dist/chunk-GEUMLY2I.js +19 -0
  29. package/dist/chunk-GEUMLY2I.js.map +1 -0
  30. package/dist/chunk-HTVZUH7B.cjs +2 -0
  31. package/dist/{chunk-IBAFRN67.cjs.map → chunk-HTVZUH7B.cjs.map} +1 -1
  32. package/dist/chunk-KSSCIAWI.cjs +3 -0
  33. package/dist/chunk-KSSCIAWI.cjs.map +1 -0
  34. package/dist/{chunk-XV77F2MB.js → chunk-L2R2F5EJ.js} +2 -2
  35. package/dist/{chunk-4UJWN7AG.js → chunk-M2CBQKC3.js} +2 -2
  36. package/dist/{chunk-P6YCSUUX.js → chunk-MSMEPN6I.js} +2 -2
  37. package/dist/chunk-PHPGL3PR.cjs +2 -0
  38. package/dist/{chunk-7SURY7NK.cjs.map → chunk-PHPGL3PR.cjs.map} +1 -1
  39. package/dist/{chunk-ABH3VZG7.cjs → chunk-QAY6RF27.cjs} +2 -2
  40. package/dist/chunk-QAY6RF27.cjs.map +1 -0
  41. package/dist/chunk-R4QDEMWU.cjs +4 -0
  42. package/dist/{chunk-ARZB6LLO.cjs.map → chunk-R4QDEMWU.cjs.map} +1 -1
  43. package/dist/chunk-RY3JPZIG.cjs +2 -0
  44. package/dist/{chunk-AOD6F6HV.cjs.map → chunk-RY3JPZIG.cjs.map} +1 -1
  45. package/dist/{chunk-CELHDVUC.js → chunk-SJQB46KP.js} +2 -2
  46. package/dist/chunk-SNVGSSAZ.js +2 -0
  47. package/dist/chunk-SNVGSSAZ.js.map +1 -0
  48. package/dist/chunk-TFPTW7R7.cjs +2 -0
  49. package/dist/{chunk-O2VXK4BJ.cjs.map → chunk-TFPTW7R7.cjs.map} +1 -1
  50. package/dist/chunk-UB32I4UF.cjs +2 -0
  51. package/dist/{chunk-J73GN7VK.cjs.map → chunk-UB32I4UF.cjs.map} +1 -1
  52. package/dist/chunk-V46IKB2U.cjs +2 -0
  53. package/dist/{chunk-KKH43SVW.cjs.map → chunk-V46IKB2U.cjs.map} +1 -1
  54. package/dist/chunk-VFTECXBU.cjs +2 -0
  55. package/dist/chunk-VFTECXBU.cjs.map +1 -0
  56. package/dist/chunk-VG54UEKA.cjs +2 -0
  57. package/dist/{chunk-HMVTAVD4.cjs.map → chunk-VG54UEKA.cjs.map} +1 -1
  58. package/dist/chunk-VNXLKSB2.cjs +2 -0
  59. package/dist/chunk-VNXLKSB2.cjs.map +1 -0
  60. package/dist/{chunk-SR5T64DP.js → chunk-VPSZVDXD.js} +2 -2
  61. package/dist/{chunk-YIVRRRRB.js → chunk-VVLBJ6M3.js} +2 -2
  62. package/dist/{chunk-GEM5ED3Q.js → chunk-XUYRCNVI.js} +2 -2
  63. package/dist/{chunk-YOTDZ46J.js → chunk-YXQY6QCK.js} +2 -2
  64. package/dist/{chunk-T3LZIXXV.js → chunk-ZNM23HXY.js} +2 -2
  65. package/dist/dialects/athena.cjs +1 -1
  66. package/dist/dialects/athena.d.cts +1 -1
  67. package/dist/dialects/athena.d.ts +1 -1
  68. package/dist/dialects/athena.js +1 -1
  69. package/dist/dialects/bigquery.cjs +2 -2
  70. package/dist/dialects/bigquery.cjs.map +1 -1
  71. package/dist/dialects/bigquery.d.cts +4 -1
  72. package/dist/dialects/bigquery.d.ts +4 -1
  73. package/dist/dialects/bigquery.js +2 -2
  74. package/dist/dialects/bigquery.js.map +1 -1
  75. package/dist/dialects/clickhouse.cjs +1 -1
  76. package/dist/dialects/clickhouse.d.cts +1 -1
  77. package/dist/dialects/clickhouse.d.ts +1 -1
  78. package/dist/dialects/clickhouse.js +1 -1
  79. package/dist/dialects/databricks.cjs +1 -1
  80. package/dist/dialects/databricks.cjs.map +1 -1
  81. package/dist/dialects/databricks.d.cts +2 -1
  82. package/dist/dialects/databricks.d.ts +2 -1
  83. package/dist/dialects/databricks.js +1 -1
  84. package/dist/dialects/databricks.js.map +1 -1
  85. package/dist/dialects/doris.cjs +1 -1
  86. package/dist/dialects/doris.d.cts +1 -1
  87. package/dist/dialects/doris.d.ts +1 -1
  88. package/dist/dialects/doris.js +1 -1
  89. package/dist/dialects/dremio.cjs +1 -1
  90. package/dist/dialects/dremio.d.cts +1 -1
  91. package/dist/dialects/dremio.d.ts +1 -1
  92. package/dist/dialects/dremio.js +1 -1
  93. package/dist/dialects/drill.cjs +1 -1
  94. package/dist/dialects/drill.d.cts +1 -1
  95. package/dist/dialects/drill.d.ts +1 -1
  96. package/dist/dialects/drill.js +1 -1
  97. package/dist/dialects/druid.cjs +1 -1
  98. package/dist/dialects/druid.d.cts +1 -1
  99. package/dist/dialects/druid.d.ts +1 -1
  100. package/dist/dialects/druid.js +1 -1
  101. package/dist/dialects/duckdb.cjs +14 -14
  102. package/dist/dialects/duckdb.cjs.map +1 -1
  103. package/dist/dialects/duckdb.d.cts +12 -5
  104. package/dist/dialects/duckdb.d.ts +12 -5
  105. package/dist/dialects/duckdb.js +5 -5
  106. package/dist/dialects/duckdb.js.map +1 -1
  107. package/dist/dialects/dune.cjs +1 -1
  108. package/dist/dialects/dune.d.cts +1 -1
  109. package/dist/dialects/dune.d.ts +1 -1
  110. package/dist/dialects/dune.js +1 -1
  111. package/dist/dialects/exasol.cjs +1 -1
  112. package/dist/dialects/exasol.d.cts +1 -1
  113. package/dist/dialects/exasol.d.ts +1 -1
  114. package/dist/dialects/exasol.js +1 -1
  115. package/dist/dialects/fabric.cjs +1 -1
  116. package/dist/dialects/fabric.d.cts +1 -1
  117. package/dist/dialects/fabric.d.ts +1 -1
  118. package/dist/dialects/fabric.js +1 -1
  119. package/dist/dialects/hive.cjs +1 -1
  120. package/dist/dialects/hive.d.cts +3 -2
  121. package/dist/dialects/hive.d.ts +3 -2
  122. package/dist/dialects/hive.js +1 -1
  123. package/dist/dialects/materialize.cjs +1 -1
  124. package/dist/dialects/materialize.d.cts +1 -1
  125. package/dist/dialects/materialize.d.ts +1 -1
  126. package/dist/dialects/materialize.js +1 -1
  127. package/dist/dialects/mysql.cjs +1 -1
  128. package/dist/dialects/mysql.d.cts +1 -1
  129. package/dist/dialects/mysql.d.ts +1 -1
  130. package/dist/dialects/mysql.js +1 -1
  131. package/dist/dialects/oracle.cjs +1 -1
  132. package/dist/dialects/oracle.cjs.map +1 -1
  133. package/dist/dialects/oracle.d.cts +1 -1
  134. package/dist/dialects/oracle.d.ts +1 -1
  135. package/dist/dialects/oracle.js +1 -1
  136. package/dist/dialects/oracle.js.map +1 -1
  137. package/dist/dialects/postgres.cjs +1 -1
  138. package/dist/dialects/postgres.d.cts +2 -1
  139. package/dist/dialects/postgres.d.ts +2 -1
  140. package/dist/dialects/postgres.js +1 -1
  141. package/dist/dialects/presto.cjs +1 -1
  142. package/dist/dialects/presto.d.cts +1 -1
  143. package/dist/dialects/presto.d.ts +1 -1
  144. package/dist/dialects/presto.js +1 -1
  145. package/dist/dialects/prql.cjs +1 -1
  146. package/dist/dialects/prql.d.cts +1 -1
  147. package/dist/dialects/prql.d.ts +1 -1
  148. package/dist/dialects/prql.js +1 -1
  149. package/dist/dialects/redshift.cjs +1 -1
  150. package/dist/dialects/redshift.d.cts +1 -1
  151. package/dist/dialects/redshift.d.ts +1 -1
  152. package/dist/dialects/redshift.js +1 -1
  153. package/dist/dialects/risingwave.cjs +1 -1
  154. package/dist/dialects/risingwave.d.cts +1 -1
  155. package/dist/dialects/risingwave.d.ts +1 -1
  156. package/dist/dialects/risingwave.js +1 -1
  157. package/dist/dialects/singlestore.cjs +1 -1
  158. package/dist/dialects/singlestore.d.cts +1 -1
  159. package/dist/dialects/singlestore.d.ts +1 -1
  160. package/dist/dialects/singlestore.js +1 -1
  161. package/dist/dialects/snowflake.cjs +2 -2
  162. package/dist/dialects/snowflake.cjs.map +1 -1
  163. package/dist/dialects/snowflake.d.cts +6 -1
  164. package/dist/dialects/snowflake.d.ts +6 -1
  165. package/dist/dialects/snowflake.js +2 -2
  166. package/dist/dialects/snowflake.js.map +1 -1
  167. package/dist/dialects/solr.cjs +1 -1
  168. package/dist/dialects/solr.d.cts +1 -1
  169. package/dist/dialects/solr.d.ts +1 -1
  170. package/dist/dialects/solr.js +1 -1
  171. package/dist/dialects/spark.cjs +1 -1
  172. package/dist/dialects/spark.d.cts +1 -1
  173. package/dist/dialects/spark.d.ts +1 -1
  174. package/dist/dialects/spark.js +1 -1
  175. package/dist/dialects/spark2.cjs +1 -1
  176. package/dist/dialects/spark2.d.cts +1 -1
  177. package/dist/dialects/spark2.d.ts +1 -1
  178. package/dist/dialects/spark2.js +1 -1
  179. package/dist/dialects/sqlite.cjs +1 -1
  180. package/dist/dialects/sqlite.cjs.map +1 -1
  181. package/dist/dialects/sqlite.d.cts +4 -1
  182. package/dist/dialects/sqlite.d.ts +4 -1
  183. package/dist/dialects/sqlite.js +1 -1
  184. package/dist/dialects/sqlite.js.map +1 -1
  185. package/dist/dialects/starrocks.cjs +1 -1
  186. package/dist/dialects/starrocks.d.cts +1 -1
  187. package/dist/dialects/starrocks.d.ts +1 -1
  188. package/dist/dialects/starrocks.js +1 -1
  189. package/dist/dialects/tableau.cjs +1 -1
  190. package/dist/dialects/tableau.d.cts +1 -1
  191. package/dist/dialects/tableau.d.ts +1 -1
  192. package/dist/dialects/tableau.js +1 -1
  193. package/dist/dialects/teradata.cjs +1 -1
  194. package/dist/dialects/teradata.d.cts +1 -1
  195. package/dist/dialects/teradata.d.ts +1 -1
  196. package/dist/dialects/teradata.js +1 -1
  197. package/dist/dialects/trino.cjs +1 -1
  198. package/dist/dialects/trino.d.cts +1 -1
  199. package/dist/dialects/trino.d.ts +1 -1
  200. package/dist/dialects/trino.js +1 -1
  201. package/dist/dialects/tsql.cjs +1 -1
  202. package/dist/dialects/tsql.d.cts +6 -2
  203. package/dist/dialects/tsql.d.ts +6 -2
  204. package/dist/dialects/tsql.js +1 -1
  205. package/dist/index.cjs +5 -5
  206. package/dist/index.cjs.map +1 -1
  207. package/dist/index.d.cts +2 -2
  208. package/dist/index.d.ts +2 -2
  209. package/dist/index.js +2 -2
  210. package/dist/index.js.map +1 -1
  211. package/dist/{tokens-DQmh7u9L.d.ts → tokens-yBn2lPR7.d.cts} +181 -3
  212. package/dist/{tokens-DQmh7u9L.d.cts → tokens-yBn2lPR7.d.ts} +181 -3
  213. package/package.json +5 -5
  214. package/dist/chunk-2IDNLTQG.cjs +0 -2
  215. package/dist/chunk-5YRYCTSB.cjs +0 -2
  216. package/dist/chunk-7SURY7NK.cjs +0 -2
  217. package/dist/chunk-ABH3VZG7.cjs.map +0 -1
  218. package/dist/chunk-AOD6F6HV.cjs +0 -2
  219. package/dist/chunk-ARZB6LLO.cjs +0 -4
  220. package/dist/chunk-C72OQ3YO.cjs +0 -19
  221. package/dist/chunk-C72OQ3YO.cjs.map +0 -1
  222. package/dist/chunk-D62XDRDA.cjs +0 -3
  223. package/dist/chunk-D62XDRDA.cjs.map +0 -1
  224. package/dist/chunk-F4H5GNAS.cjs +0 -2
  225. package/dist/chunk-FHZLNMGS.js +0 -2
  226. package/dist/chunk-FHZLNMGS.js.map +0 -1
  227. package/dist/chunk-FZMXAQA2.js.map +0 -1
  228. package/dist/chunk-HMVTAVD4.cjs +0 -2
  229. package/dist/chunk-IBAFRN67.cjs +0 -2
  230. package/dist/chunk-J73GN7VK.cjs +0 -2
  231. package/dist/chunk-KKH43SVW.cjs +0 -2
  232. package/dist/chunk-LD7YHVMH.cjs +0 -2
  233. package/dist/chunk-LD7YHVMH.cjs.map +0 -1
  234. package/dist/chunk-NNPDC7K7.js +0 -19
  235. package/dist/chunk-NNPDC7K7.js.map +0 -1
  236. package/dist/chunk-O2VXK4BJ.cjs +0 -2
  237. package/dist/chunk-OE3QVFQR.cjs +0 -2
  238. package/dist/chunk-PIPS5SYM.js +0 -2
  239. package/dist/chunk-PIPS5SYM.js.map +0 -1
  240. package/dist/chunk-PKVBRYCO.js +0 -3
  241. package/dist/chunk-PKVBRYCO.js.map +0 -1
  242. package/dist/chunk-UJEHXXRU.cjs +0 -2
  243. package/dist/chunk-UXK7PGJ3.cjs +0 -2
  244. package/dist/chunk-UXK7PGJ3.cjs.map +0 -1
  245. package/dist/chunk-YODZ2FBS.cjs +0 -2
  246. package/dist/chunk-YODZ2FBS.cjs.map +0 -1
  247. package/dist/chunk-YQ22ZDIZ.js +0 -2
  248. package/dist/chunk-YQ22ZDIZ.js.map +0 -1
  249. /package/dist/{chunk-ZZAKTBZ2.js.map → chunk-7WQP5O6G.js.map} +0 -0
  250. /package/dist/{chunk-AZNXXBMF.js.map → chunk-AS5Z4OUJ.js.map} +0 -0
  251. /package/dist/{chunk-MBDFVUXG.js.map → chunk-BRG36BOL.js.map} +0 -0
  252. /package/dist/{chunk-GXH2FNJU.js.map → chunk-EI7USPOS.js.map} +0 -0
  253. /package/dist/{chunk-XV77F2MB.js.map → chunk-L2R2F5EJ.js.map} +0 -0
  254. /package/dist/{chunk-4UJWN7AG.js.map → chunk-M2CBQKC3.js.map} +0 -0
  255. /package/dist/{chunk-P6YCSUUX.js.map → chunk-MSMEPN6I.js.map} +0 -0
  256. /package/dist/{chunk-CELHDVUC.js.map → chunk-SJQB46KP.js.map} +0 -0
  257. /package/dist/{chunk-SR5T64DP.js.map → chunk-VPSZVDXD.js.map} +0 -0
  258. /package/dist/{chunk-YIVRRRRB.js.map → chunk-VVLBJ6M3.js.map} +0 -0
  259. /package/dist/{chunk-GEM5ED3Q.js.map → chunk-XUYRCNVI.js.map} +0 -0
  260. /package/dist/{chunk-YOTDZ46J.js.map → chunk-YXQY6QCK.js.map} +0 -0
  261. /package/dist/{chunk-T3LZIXXV.js.map → chunk-ZNM23HXY.js.map} +0 -0
@@ -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 _chunkVG54UEKAcjs = require('./chunk-VG54UEKA.cjs');var _chunkE4WQOMI7cjs = require('./chunk-E4WQOMI7.cjs');function X(E,r,a){let e=[];for(let i of r){let s=E.args[i];if(s){let F=Array.isArray(s)?s:[s];e.push(..._chunkE4WQOMI7cjs.r.call(void 0, F,_chunkE4WQOMI7cjs.xb))}}let t,p=!1;for(let i of e)if(i.isType("unknown"))p=!0;else if(i.isType(a)){p=!1,t=a;break}else{let s=i.type;t=_chunkE4WQOMI7cjs.o.call(void 0, s,_chunkE4WQOMI7cjs.pe)?s:void 0}return this.setType(E,p?"unknown":t),E}_chunkE4WQOMI7cjs.a.call(void 0, X,"annotateBySimilarArgs");var H,A;H=[_chunkE4WQOMI7cjs.s];var o=class o{static get EXPRESSION_METADATA(){let r=new Map(_chunkVG54UEKAcjs.a.EXPRESSION_METADATA),a=_chunkE4WQOMI7cjs.a.call(void 0, (e,t)=>{for(let p of e)r.set(p,t)},"extend");return a([_chunkE4WQOMI7cjs.mk,_chunkE4WQOMI7cjs.Aq],{returns:"double"}),a([_chunkE4WQOMI7cjs.Qo,_chunkE4WQOMI7cjs.Bp],{returns:"varchar"}),r.set(_chunkE4WQOMI7cjs.bq,{returns:"date"}),r.set(_chunkE4WQOMI7cjs.Qr,{returns:"date"}),r.set(_chunkE4WQOMI7cjs.lu,{annotator:_chunkE4WQOMI7cjs.a.call(void 0, (e,t)=>e.annotateByArgs(t,["this"],{array:_nullishCoalesce(_optionalChain([t, 'access', _ => _.args, 'access', _2 => _2.quantile, 'optionalAccess', _3 => _3.isType, 'optionalCall', _4 => _4("array")]), () => (!1))}),"annotator")}),r.set(_chunkE4WQOMI7cjs.Qe,{returns:"timestamp"}),r.set(_chunkE4WQOMI7cjs.mm,{annotator:_chunkE4WQOMI7cjs.a.call(void 0, (e,t)=>X.call(e,t,["expressions"],"text"),"annotator")}),r.set(_chunkE4WQOMI7cjs.Qo,{returns:"varchar"}),r.set(_chunkE4WQOMI7cjs.ps,{returns:"date"}),r.set(_chunkE4WQOMI7cjs.dl,{annotator:_chunkE4WQOMI7cjs.a.call(void 0, (e,t)=>X.call(e,t,["this","fillPattern"],"text"),"annotator")}),a([_chunkE4WQOMI7cjs.Jl,_chunkE4WQOMI7cjs.pr],{annotator:_chunkE4WQOMI7cjs.a.call(void 0, (e,t)=>e.annotateByArgs(t,["this"]),"annotator")}),r}};A=_chunkE4WQOMI7cjs.b.call(void 0, null),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"EXPRESSION_METADATA",H,o),_chunkE4WQOMI7cjs.c.call(void 0, A,o),_chunkE4WQOMI7cjs.d.call(void 0, A,3,o),_chunkE4WQOMI7cjs.a.call(void 0, o,"Spark2Typing");var b=o;exports.a = b;
2
+ //# sourceMappingURL=chunk-HTVZUH7B.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-IBAFRN67.cjs","../src/typing/spark2.ts"],"names":["annotateBySimilarArgs","expression","args","targetType","expressions","arg","argExpr","list","filterInstanceOf","Expression","lastDatatype","hasUnknown","expr","exprType","isInstanceOf","DataTypeExpr","__name","_EXPRESSION_METADATA_dec","_init","cache","_Spark2Typing","map","HiveTyping","extend","types","data","type","Atan2Expr","RandnExpr","FormatExpr","RightExpr","AddMonthsExpr","TsOrDsAddExpr","ApproxQuantileExpr","s","e","AtTimeZoneExpr","ConcatExpr","NextDayExpr","PadExpr","ArrayFilterExpr","SubstringExpr","__decoratorStart","__decorateElement","__decoratorMetadata","__runInitializers","Spark2Typing"],"mappings":"AAAA,yuBAAwC,wDAAkN,SCuCjPA,CAAAA,CAEPC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACY,CACZ,IAAMC,CAAAA,CAA4B,CAAC,CAAA,CAEnC,GAAA,CAAA,IAAWC,EAAAA,GAAOH,CAAAA,CAAM,CACtB,IAAMI,CAAAA,CAAWL,CAAAA,CAAW,IAAA,CAAiCI,CAAG,CAAA,CAEhE,EAAA,CAAIC,CAAAA,CAAS,CACX,IAAMC,CAAAA,CAAO,KAAA,CAAM,OAAA,CAAQD,CAAO,CAAA,CAC9BA,CAAAA,CACA,CAACA,CAAO,CAAA,CAEZF,CAAAA,CAAY,IAAA,CAAK,GAAGI,iCAAAA,CAAiBD,CAAME,oBAAU,CAAC,CACxD,CACF,CAEA,IAAIC,CAAAA,CACAC,CAAAA,CAAa,CAAA,CAAA,CAEjB,GAAA,CAAA,IAAWC,EAAAA,GAAQR,CAAAA,CACjB,EAAA,CAAIQ,CAAAA,CAAK,MAAA,CAAA,SAA+B,CAAA,CACtCD,CAAAA,CAAa,CAAA,CAAA,CAAA,KAAA,EAAA,CACJC,CAAAA,CAAK,MAAA,CAAOT,CAAU,CAAA,CAAG,CAClCQ,CAAAA,CAAa,CAAA,CAAA,CACbD,CAAAA,CAAeP,CAAAA,CACf,KACF,CAAA,IAAO,CACL,IAAMU,CAAAA,CAAWD,CAAAA,CAAK,IAAA,CAEtBF,CAAAA,CAAeI,iCAAAA,CAAaD,CAAUE,oBAAY,CAAA,CAAIF,CAAAA,CAAW,KAAA,CACnE,CAGF,OAAA,IAAA,CAAK,OAAA,CACHZ,CAAAA,CACAU,CAAAA,CAAAA,SAAAA,CAAwCD,CAC1C,CAAA,CAEOT,CACT,CA3CSe,iCAAAA,CAAAhB,CAAA,uBAAA,CAAA,CAvCT,IAAAiB,CAAAA,CAAAC,CAAAA,CAqFED,CAAAA,CAAA,CAACE,mBAAAA,CAAAA,CADI,IAAMC,CAAAA,CAAN,MAAMA,CAAa,CAExB,OAAA,IAAW,mBAAA,CAAA,CAA2C,CAEpD,IAAMC,CAAAA,CAA0B,IAAI,GAAA,CAAIC,mBAAAA,CAAW,mBAAmB,CAAA,CAEhEC,CAAAA,CAASP,iCAAAA,CAACQ,CAAAA,CAA8BC,CAAAA,CAAAA,EAAkC,CAC9E,GAAA,CAAA,IAAWC,EAAAA,GAAQF,CAAAA,CAAOH,CAAAA,CAAI,GAAA,CAAIK,CAAAA,CAAMD,CAAI,CAC9C,CAAA,CAFe,QAAA,CAAA,CAIf,OAAAF,CAAAA,CAAO,CACLI,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,OAAA,CAAA,QACF,CAAC,CAAA,CAEDL,CAAAA,CAAO,CACLM,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,OAAA,CAAA,SACF,CAAC,CAAA,CAEDT,CAAAA,CAAI,GAAA,CAAIU,oBAAAA,CAAe,CACrB,OAAA,CAAA,MACF,CAAC,CAAA,CACDV,CAAAA,CAAI,GAAA,CAAIW,oBAAAA,CAAe,CACrB,OAAA,CAAA,MACF,CAAC,CAAA,CACDX,CAAAA,CAAI,GAAA,CAAIY,oBAAAA,CAAoB,CAC1B,SAAA,CAAWjB,iCAAAA,CAACkB,CAAAA,CAAkBC,CAAAA,CAAAA,EAA0BD,CAAAA,CAAE,cAAA,CAAeC,CAAAA,CAAG,CAAC,MAAM,CAAA,CAAG,CACpF,KAAA,kCAAQA,CAAAA,mBAAE,IAAA,qBAAK,QAAA,6BAAyB,MAAA,0BAAA,CAAA,OAA+B,GAAA,SAAK,CAAA,GAC9E,CAAC,CAAA,CAFU,WAAA,CAGb,CAAC,CAAA,CACDd,CAAAA,CAAI,GAAA,CAAIe,oBAAAA,CAAgB,CACtB,OAAA,CAAA,WACF,CAAC,CAAA,CACDf,CAAAA,CAAI,GAAA,CAAIgB,oBAAAA,CAAY,CAClB,SAAA,CAAWrB,iCAAAA,CAACkB,CAAAA,CAAkBC,CAAAA,CAAAA,EAAkBnC,CAAAA,CAAsB,IAAA,CAAKkC,CAAAA,CAAGC,CAAAA,CAAG,CAAC,aAAa,CAAA,CAAA,MAAwB,CAAA,CAA5G,WAAA,CACb,CAAC,CAAA,CAEDd,CAAAA,CAAI,GAAA,CAAIQ,oBAAAA,CAAY,CAClB,OAAA,CAAA,SACF,CAAC,CAAA,CAEDR,CAAAA,CAAI,GAAA,CAAIiB,oBAAAA,CAAa,CACnB,OAAA,CAAA,MACF,CAAC,CAAA,CACDjB,CAAAA,CAAI,GAAA,CAAIkB,oBAAAA,CAAS,CACf,SAAA,CAAWvB,iCAAAA,CAACkB,CAAAA,CAAkBC,CAAAA,CAAAA,EAAenC,CAAAA,CAAsB,IAAA,CAAKkC,CAAAA,CAAGC,CAAAA,CAAG,CAC5E,MAAA,CACA,aACF,CAAA,CAAA,MAAwB,CAAA,CAHb,WAAA,CAIb,CAAC,CAAA,CAEDZ,CAAAA,CAAO,CACLiB,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,SAAA,CAAWzB,iCAAAA,CAACkB,CAAAA,CAAkBC,CAAAA,CAAAA,EAAkBD,CAAAA,CAAE,cAAA,CAAeC,CAAAA,CAAG,CAAC,MAAM,CAAC,CAAA,CAAjE,WAAA,CACb,CAAC,CAAA,CAEMd,CACT,CACF,CAAA,CAjEOH,CAAAA,CAAAwB,iCAAAA,IAAA,CAAA,CAELC,iCAAAA,CAAAzB,CAAA,EAAA,CAAW,qBAAA,CADXD,CAAAA,CADWG,CAAAA,CAAAA,CAANwB,iCAAAA,CAAA1B,CAAME,CAAAA,CAAAA,CAANyB,iCAAAA,CAAA3B,CAAA,CAAA,CAAME,CAAAA,CAAAA,CAAaJ,iCAAAA,CAAAI,CAAA,cAAA,CAAA,CAAnB,IAAM0B,CAAAA,CAAN1B,CAAAA,CAAAA,cAAAA","file":"/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-IBAFRN67.cjs","sourcesContent":[null,"import {\n Expression,\n DataTypeExpr,\n AddMonthsExpr,\n TsOrDsAddExpr,\n ApproxQuantileExpr,\n Atan2Expr,\n AtTimeZoneExpr,\n NextDayExpr,\n RandnExpr,\n FormatExpr,\n RightExpr,\n ArrayFilterExpr,\n ConcatExpr,\n PadExpr,\n SubstringExpr,\n} from '../expressions/expressions';\nimport {\n DataTypeExprKind,\n} from '../expressions/types';\nimport {\n cache,\n isInstanceOf, filterInstanceOf,\n} from '../port_internals';\nimport type {\n TypeAnnotator,\n} from '../optimizer';\nimport {\n HiveTyping,\n} from './hive';\nimport type {\n ExpressionMetadata,\n} from './dialect';\n\n/**\n * Infers the type of the expression according to the following rules:\n * - If all args are of the same type OR any arg is of targetType, the expr is inferred as such\n * - If any arg is of UNKNOWN type and none of targetType, the expr is inferred as UNKNOWN\n */\nfunction annotateBySimilarArgs (\n this: TypeAnnotator,\n expression: Expression,\n args: Iterable<string>,\n targetType: DataTypeExprKind | DataTypeExpr,\n): Expression {\n const expressions: Expression[] = [];\n\n for (const arg of args) {\n const argExpr = (expression.args as Record<string, unknown>)[arg];\n\n if (argExpr) {\n const list = Array.isArray(argExpr)\n ? argExpr\n : [argExpr];\n\n expressions.push(...filterInstanceOf(list, Expression));\n }\n }\n\n let lastDatatype: DataTypeExprKind | DataTypeExpr | undefined;\n let hasUnknown = false;\n\n for (const expr of expressions) {\n if (expr.isType(DataTypeExprKind.UNKNOWN)) {\n hasUnknown = true;\n } else if (expr.isType(targetType)) {\n hasUnknown = false;\n lastDatatype = targetType;\n break;\n } else {\n const exprType = expr.type;\n\n lastDatatype = isInstanceOf(exprType, DataTypeExpr) ? exprType : undefined;\n }\n }\n\n this.setType(\n expression,\n hasUnknown ? DataTypeExprKind.UNKNOWN : lastDatatype,\n );\n\n return expression;\n}\n\nexport class Spark2Typing {\n @cache\n static get EXPRESSION_METADATA (): ExpressionMetadata {\n // Clone the Hive base metadata to apply Spark-specific overrides\n const map: ExpressionMetadata = new Map(HiveTyping.EXPRESSION_METADATA);\n\n const extend = (types: (typeof Expression)[], data: Record<string, unknown>) => {\n for (const type of types) map.set(type, data);\n };\n\n extend([\n Atan2Expr,\n RandnExpr,\n ], {\n returns: DataTypeExprKind.DOUBLE,\n });\n\n extend([\n FormatExpr,\n RightExpr,\n ], {\n returns: DataTypeExprKind.VARCHAR,\n });\n\n map.set(AddMonthsExpr, {\n returns: DataTypeExprKind.DATE,\n });\n map.set(TsOrDsAddExpr, {\n returns: DataTypeExprKind.DATE,\n });\n map.set(ApproxQuantileExpr, {\n annotator: (s: TypeAnnotator, e: ApproxQuantileExpr) => s.annotateByArgs(e, ['this'], {\n array: (e.args.quantile as Expression)?.isType?.(DataTypeExprKind.ARRAY) ?? false,\n }),\n });\n map.set(AtTimeZoneExpr, {\n returns: DataTypeExprKind.TIMESTAMP,\n });\n map.set(ConcatExpr, {\n annotator: (s: TypeAnnotator, e: ConcatExpr) => annotateBySimilarArgs.call(s, e, ['expressions'], DataTypeExprKind.TEXT),\n });\n\n map.set(FormatExpr, {\n returns: DataTypeExprKind.VARCHAR,\n });\n\n map.set(NextDayExpr, {\n returns: DataTypeExprKind.DATE,\n });\n map.set(PadExpr, {\n annotator: (s: TypeAnnotator, e: PadExpr) => annotateBySimilarArgs.call(s, e, [\n 'this',\n 'fillPattern',\n ], DataTypeExprKind.TEXT),\n });\n\n extend([\n ArrayFilterExpr,\n SubstringExpr,\n ], {\n annotator: (s: TypeAnnotator, e: Expression) => s.annotateByArgs(e, ['this']),\n });\n\n return map;\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-HTVZUH7B.cjs","../src/typing/spark2.ts"],"names":["annotateBySimilarArgs","expression","args","targetType","expressions","arg","argExpr","list","filterInstanceOf","Expression","lastDatatype","hasUnknown","expr","exprType","isInstanceOf","DataTypeExpr","__name","_EXPRESSION_METADATA_dec","_init","cache","_Spark2Typing","map","HiveTyping","extend","types","data","type","Atan2Expr","RandnExpr","FormatExpr","RightExpr","AddMonthsExpr","TsOrDsAddExpr","ApproxQuantileExpr","s","e","AtTimeZoneExpr","ConcatExpr","NextDayExpr","PadExpr","ArrayFilterExpr","SubstringExpr","__decoratorStart","__decorateElement","__decoratorMetadata","__runInitializers","Spark2Typing"],"mappings":"AAAA,yuBAAwC,wDAAkN,SCuCjPA,CAAAA,CAEPC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACY,CACZ,IAAMC,CAAAA,CAA4B,CAAC,CAAA,CAEnC,GAAA,CAAA,IAAWC,EAAAA,GAAOH,CAAAA,CAAM,CACtB,IAAMI,CAAAA,CAAWL,CAAAA,CAAW,IAAA,CAAiCI,CAAG,CAAA,CAEhE,EAAA,CAAIC,CAAAA,CAAS,CACX,IAAMC,CAAAA,CAAO,KAAA,CAAM,OAAA,CAAQD,CAAO,CAAA,CAC9BA,CAAAA,CACA,CAACA,CAAO,CAAA,CAEZF,CAAAA,CAAY,IAAA,CAAK,GAAGI,iCAAAA,CAAiBD,CAAME,oBAAU,CAAC,CACxD,CACF,CAEA,IAAIC,CAAAA,CACAC,CAAAA,CAAa,CAAA,CAAA,CAEjB,GAAA,CAAA,IAAWC,EAAAA,GAAQR,CAAAA,CACjB,EAAA,CAAIQ,CAAAA,CAAK,MAAA,CAAA,SAA+B,CAAA,CACtCD,CAAAA,CAAa,CAAA,CAAA,CAAA,KAAA,EAAA,CACJC,CAAAA,CAAK,MAAA,CAAOT,CAAU,CAAA,CAAG,CAClCQ,CAAAA,CAAa,CAAA,CAAA,CACbD,CAAAA,CAAeP,CAAAA,CACf,KACF,CAAA,IAAO,CACL,IAAMU,CAAAA,CAAWD,CAAAA,CAAK,IAAA,CAEtBF,CAAAA,CAAeI,iCAAAA,CAAaD,CAAUE,oBAAY,CAAA,CAAIF,CAAAA,CAAW,KAAA,CACnE,CAGF,OAAA,IAAA,CAAK,OAAA,CACHZ,CAAAA,CACAU,CAAAA,CAAAA,SAAAA,CAAwCD,CAC1C,CAAA,CAEOT,CACT,CA3CSe,iCAAAA,CAAAhB,CAAA,uBAAA,CAAA,CAvCT,IAAAiB,CAAAA,CAAAC,CAAAA,CAqFED,CAAAA,CAAA,CAACE,mBAAAA,CAAAA,CADI,IAAMC,CAAAA,CAAN,MAAMA,CAAa,CAExB,OAAA,IAAW,mBAAA,CAAA,CAA2C,CAEpD,IAAMC,CAAAA,CAA0B,IAAI,GAAA,CAAIC,mBAAAA,CAAW,mBAAmB,CAAA,CAEhEC,CAAAA,CAASP,iCAAAA,CAACQ,CAAAA,CAA8BC,CAAAA,CAAAA,EAAkC,CAC9E,GAAA,CAAA,IAAWC,EAAAA,GAAQF,CAAAA,CAAOH,CAAAA,CAAI,GAAA,CAAIK,CAAAA,CAAMD,CAAI,CAC9C,CAAA,CAFe,QAAA,CAAA,CAIf,OAAAF,CAAAA,CAAO,CACLI,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,OAAA,CAAA,QACF,CAAC,CAAA,CAEDL,CAAAA,CAAO,CACLM,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,OAAA,CAAA,SACF,CAAC,CAAA,CAEDT,CAAAA,CAAI,GAAA,CAAIU,oBAAAA,CAAe,CACrB,OAAA,CAAA,MACF,CAAC,CAAA,CACDV,CAAAA,CAAI,GAAA,CAAIW,oBAAAA,CAAe,CACrB,OAAA,CAAA,MACF,CAAC,CAAA,CACDX,CAAAA,CAAI,GAAA,CAAIY,oBAAAA,CAAoB,CAC1B,SAAA,CAAWjB,iCAAAA,CAACkB,CAAAA,CAAkBC,CAAAA,CAAAA,EAA0BD,CAAAA,CAAE,cAAA,CAAeC,CAAAA,CAAG,CAAC,MAAM,CAAA,CAAG,CACpF,KAAA,kCAAQA,CAAAA,mBAAE,IAAA,qBAAK,QAAA,6BAAyB,MAAA,0BAAA,CAAA,OAA+B,GAAA,SAAK,CAAA,GAC9E,CAAC,CAAA,CAFU,WAAA,CAGb,CAAC,CAAA,CACDd,CAAAA,CAAI,GAAA,CAAIe,oBAAAA,CAAgB,CACtB,OAAA,CAAA,WACF,CAAC,CAAA,CACDf,CAAAA,CAAI,GAAA,CAAIgB,oBAAAA,CAAY,CAClB,SAAA,CAAWrB,iCAAAA,CAACkB,CAAAA,CAAkBC,CAAAA,CAAAA,EAAkBnC,CAAAA,CAAsB,IAAA,CAAKkC,CAAAA,CAAGC,CAAAA,CAAG,CAAC,aAAa,CAAA,CAAA,MAAwB,CAAA,CAA5G,WAAA,CACb,CAAC,CAAA,CAEDd,CAAAA,CAAI,GAAA,CAAIQ,oBAAAA,CAAY,CAClB,OAAA,CAAA,SACF,CAAC,CAAA,CAEDR,CAAAA,CAAI,GAAA,CAAIiB,oBAAAA,CAAa,CACnB,OAAA,CAAA,MACF,CAAC,CAAA,CACDjB,CAAAA,CAAI,GAAA,CAAIkB,oBAAAA,CAAS,CACf,SAAA,CAAWvB,iCAAAA,CAACkB,CAAAA,CAAkBC,CAAAA,CAAAA,EAAenC,CAAAA,CAAsB,IAAA,CAAKkC,CAAAA,CAAGC,CAAAA,CAAG,CAC5E,MAAA,CACA,aACF,CAAA,CAAA,MAAwB,CAAA,CAHb,WAAA,CAIb,CAAC,CAAA,CAEDZ,CAAAA,CAAO,CACLiB,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,SAAA,CAAWzB,iCAAAA,CAACkB,CAAAA,CAAkBC,CAAAA,CAAAA,EAAkBD,CAAAA,CAAE,cAAA,CAAeC,CAAAA,CAAG,CAAC,MAAM,CAAC,CAAA,CAAjE,WAAA,CACb,CAAC,CAAA,CAEMd,CACT,CACF,CAAA,CAjEOH,CAAAA,CAAAwB,iCAAAA,IAAA,CAAA,CAELC,iCAAAA,CAAAzB,CAAA,EAAA,CAAW,qBAAA,CADXD,CAAAA,CADWG,CAAAA,CAAAA,CAANwB,iCAAAA,CAAA1B,CAAME,CAAAA,CAAAA,CAANyB,iCAAAA,CAAA3B,CAAA,CAAA,CAAME,CAAAA,CAAAA,CAAaJ,iCAAAA,CAAAI,CAAA,cAAA,CAAA,CAAnB,IAAM0B,CAAAA,CAAN1B,CAAAA,CAAAA,cAAAA","file":"/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-HTVZUH7B.cjs","sourcesContent":[null,"import {\n Expression,\n DataTypeExpr,\n AddMonthsExpr,\n TsOrDsAddExpr,\n ApproxQuantileExpr,\n Atan2Expr,\n AtTimeZoneExpr,\n NextDayExpr,\n RandnExpr,\n FormatExpr,\n RightExpr,\n ArrayFilterExpr,\n ConcatExpr,\n PadExpr,\n SubstringExpr,\n} from '../expressions/expressions';\nimport {\n DataTypeExprKind,\n} from '../expressions/types';\nimport {\n cache,\n isInstanceOf, filterInstanceOf,\n} from '../port_internals';\nimport type {\n TypeAnnotator,\n} from '../optimizer';\nimport {\n HiveTyping,\n} from './hive';\nimport type {\n ExpressionMetadata,\n} from './dialect';\n\n/**\n * Infers the type of the expression according to the following rules:\n * - If all args are of the same type OR any arg is of targetType, the expr is inferred as such\n * - If any arg is of UNKNOWN type and none of targetType, the expr is inferred as UNKNOWN\n */\nfunction annotateBySimilarArgs (\n this: TypeAnnotator,\n expression: Expression,\n args: Iterable<string>,\n targetType: DataTypeExprKind | DataTypeExpr,\n): Expression {\n const expressions: Expression[] = [];\n\n for (const arg of args) {\n const argExpr = (expression.args as Record<string, unknown>)[arg];\n\n if (argExpr) {\n const list = Array.isArray(argExpr)\n ? argExpr\n : [argExpr];\n\n expressions.push(...filterInstanceOf(list, Expression));\n }\n }\n\n let lastDatatype: DataTypeExprKind | DataTypeExpr | undefined;\n let hasUnknown = false;\n\n for (const expr of expressions) {\n if (expr.isType(DataTypeExprKind.UNKNOWN)) {\n hasUnknown = true;\n } else if (expr.isType(targetType)) {\n hasUnknown = false;\n lastDatatype = targetType;\n break;\n } else {\n const exprType = expr.type;\n\n lastDatatype = isInstanceOf(exprType, DataTypeExpr) ? exprType : undefined;\n }\n }\n\n this.setType(\n expression,\n hasUnknown ? DataTypeExprKind.UNKNOWN : lastDatatype,\n );\n\n return expression;\n}\n\nexport class Spark2Typing {\n @cache\n static get EXPRESSION_METADATA (): ExpressionMetadata {\n // Clone the Hive base metadata to apply Spark-specific overrides\n const map: ExpressionMetadata = new Map(HiveTyping.EXPRESSION_METADATA);\n\n const extend = (types: (typeof Expression)[], data: Record<string, unknown>) => {\n for (const type of types) map.set(type, data);\n };\n\n extend([\n Atan2Expr,\n RandnExpr,\n ], {\n returns: DataTypeExprKind.DOUBLE,\n });\n\n extend([\n FormatExpr,\n RightExpr,\n ], {\n returns: DataTypeExprKind.VARCHAR,\n });\n\n map.set(AddMonthsExpr, {\n returns: DataTypeExprKind.DATE,\n });\n map.set(TsOrDsAddExpr, {\n returns: DataTypeExprKind.DATE,\n });\n map.set(ApproxQuantileExpr, {\n annotator: (s: TypeAnnotator, e: ApproxQuantileExpr) => s.annotateByArgs(e, ['this'], {\n array: (e.args.quantile as Expression)?.isType?.(DataTypeExprKind.ARRAY) ?? false,\n }),\n });\n map.set(AtTimeZoneExpr, {\n returns: DataTypeExprKind.TIMESTAMP,\n });\n map.set(ConcatExpr, {\n annotator: (s: TypeAnnotator, e: ConcatExpr) => annotateBySimilarArgs.call(s, e, ['expressions'], DataTypeExprKind.TEXT),\n });\n\n map.set(FormatExpr, {\n returns: DataTypeExprKind.VARCHAR,\n });\n\n map.set(NextDayExpr, {\n returns: DataTypeExprKind.DATE,\n });\n map.set(PadExpr, {\n annotator: (s: TypeAnnotator, e: PadExpr) => annotateBySimilarArgs.call(s, e, [\n 'this',\n 'fillPattern',\n ], DataTypeExprKind.TEXT),\n });\n\n extend([\n ArrayFilterExpr,\n SubstringExpr,\n ], {\n annotator: (s: TypeAnnotator, e: Expression) => s.annotateByArgs(e, ['this']),\n });\n\n return map;\n }\n}\n"]}
@@ -0,0 +1,3 @@
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 _chunkVG54UEKAcjs = require('./chunk-VG54UEKA.cjs');var _chunkE4WQOMI7cjs = require('./chunk-E4WQOMI7.cjs');var ge={YEAR:["ADD_MONTHS",12],MONTH:["ADD_MONTHS",1],QUARTER:["ADD_MONTHS",3],WEEK:["DATE_ADD",7],DAY:["DATE_ADD",1]},Ce={MILLISECOND:" * 1000",SECOND:"",MINUTE:" / 60",HOUR:" / 3600"},_e=new Set(["YEAR","QUARTER","MONTH"]);function yt(e){if(e instanceof _chunkE4WQOMI7cjs.Qr&&!e.args.unit)return this.func("DATE_ADD",[e.args.this,e.args.expression]);let n=e.text("unit").toUpperCase(),[t,r]=ge[n]||["DATE_ADD",1];e instanceof _chunkE4WQOMI7cjs._m&&(r*=-1);let s=e.args.expression;if(s instanceof _chunkE4WQOMI7cjs.tg){let E=s.isNumber?parseFloat(_nullishCoalesce(s.args.this, () => ("0"))):parseInt(_nullishCoalesce(s.args.this, () => ("0")));s=_chunkE4WQOMI7cjs.tg.number(E*r)}else r!==1&&(s=new (0, _chunkE4WQOMI7cjs.Tj)({this:s,expression:_chunkE4WQOMI7cjs.tg.number(r)}));return this.func(t,[e.args.this,s])}_chunkE4WQOMI7cjs.a.call(void 0, yt,"addDateSql");function js(e){let n=e.text("unit").toUpperCase(),t=Ce[n];if(t!==void 0){let D=this.sql(e,"this"),X=this.sql(e,"expression"),q=`UNIX_TIMESTAMP(${D}) - UNIX_TIMESTAMP(${X})`;return t?`(${q})${t}`:q}let r=_e.has(n),s=r?"MONTHS_BETWEEN":"DATEDIFF",E=_optionalChain([ge, 'access', _2 => _2[n], 'optionalAccess', _3 => _3[1]])||1,h=1<E?` / ${E}`:"",l=`${s}(${this.formatArgs([e.args.this,e.args.expression])})`;return(r||h)&&(l=`CAST(${l}${h} AS INT)`),l}_chunkE4WQOMI7cjs.a.call(void 0, js,"dateDiffSql");function ye(e){let n=e.args.this;if(n&&_chunkE4WQOMI7cjs.Yw.call(void 0, n)){if(n.args.this instanceof _chunkE4WQOMI7cjs.tg&&n.args.this.isString){let t=_chunkE4WQOMI7cjs.tg.string(`[${n.args.this.args.this}]`),r=this.func("FROM_JSON",[t,this.func("SCHEMA_OF_JSON",[t])]),s=this.func("TO_JSON",[r]);return this.func("REGEXP_EXTRACT",[s,"'^.(.*).$'","1"])}return this.sql(n)}return this.func("TO_JSON",[n,e.args.options])}_chunkE4WQOMI7cjs.a.call(void 0, ye,"jsonFormatSql");function Le(e){return e.args.expression&&this.unsupported("Unsupported arg 'expression' for ArraySort"),this.func("SORT_ARRAY",[e.args.this])}_chunkE4WQOMI7cjs.a.call(void 0, Le,"arraySortSql");function Ue(e){return this.func("UNIX_TIMESTAMP",[e.args.this,_chunkE4WQOMI7cjs.vw.call(void 0, "hive").call(this,e)])}_chunkE4WQOMI7cjs.a.call(void 0, Ue,"strToUnixSql");function Fe(e){let n=this.sql(e,"this"),t=e.args.scale;return t===void 0||t.toValue()===_chunkE4WQOMI7cjs.bs.SECONDS.toValue()?_chunkE4WQOMI7cjs._v.call(void 0, "FROM_UNIXTIME").call(this,e):`FROM_UNIXTIME(${n} / POW(10, ${t}))`}_chunkE4WQOMI7cjs.a.call(void 0, Fe,"unixToTimeSql");function qe(e){let n=this.sql(e,"this"),t=this.formatTime(e);return t!=null&&![O.TIME_FORMAT,O.DATE_FORMAT].includes(t)&&(n=`FROM_UNIXTIME(UNIX_TIMESTAMP(${n}, ${t}))`),`CAST(${n} AS DATE)`}_chunkE4WQOMI7cjs.a.call(void 0, qe,"strToDateSql");function we(e){let n=this.sql(e,"this"),t=this.formatTime(e);return t!=null&&![O.TIME_FORMAT,O.DATE_FORMAT].includes(t)&&(n=`FROM_UNIXTIME(UNIX_TIMESTAMP(${n}, ${t}))`),`CAST(${n} AS TIMESTAMP)`}_chunkE4WQOMI7cjs.a.call(void 0, we,"strToTimeSql");function Ge(e){let n=this.formatTime(e);return n&&![O.TIME_FORMAT,O.DATE_FORMAT].includes(n)?this.func("TO_DATE",[e.args.this,n]):e.parent instanceof _chunkE4WQOMI7cjs.xb&&this._constructor.TS_OR_DS_EXPRESSIONS.has(e.parent._constructor)?this.sql(e,"this"):this.func("TO_DATE",[e.args.this])}_chunkE4WQOMI7cjs.a.call(void 0, Ge,"toDateSql");function $(e){return n=>{let t=new e({this:_chunkE4WQOMI7cjs.Sa.call(void 0, n,0)});return _chunkE4WQOMI7cjs.Sa.call(void 0, n,1)instanceof _chunkE4WQOMI7cjs.Mi&&_optionalChain([_chunkE4WQOMI7cjs.Sa.call(void 0, n,1), 'optionalAccess', _4 => _4.args, 'access', _5 => _5.this])===!0?new (0, _chunkE4WQOMI7cjs.We)({this:t}):t}}_chunkE4WQOMI7cjs.a.call(void 0, $,"buildWithIgnoreNulls");function Be(e){let n=_chunkE4WQOMI7cjs.uw.call(void 0, _chunkE4WQOMI7cjs.Tr,{dialect:"hive"})(e);return n.setArgKey("safe",!0),n}_chunkE4WQOMI7cjs.a.call(void 0, Be,"buildToDate");function Ye(e){let n=_chunkE4WQOMI7cjs.Sa.call(void 0, e,1);return n&&(n=n.mul(-1)),new (0, _chunkE4WQOMI7cjs.Qr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, e,0),expression:n,unit:_chunkE4WQOMI7cjs.av.call(void 0, "DAY")})}_chunkE4WQOMI7cjs.a.call(void 0, Ye,"buildDateAdd");var zs,vs,Lt,y=class y extends(vs=_chunkE4WQOMI7cjs.tv,zs=[_chunkE4WQOMI7cjs.s],vs){static get VAR_TOKENS(){return new Set([..._chunkE4WQOMI7cjs.tv.VAR_TOKENS,"dash"])}};Lt=_chunkE4WQOMI7cjs.b.call(void 0, vs),_chunkE4WQOMI7cjs.e.call(void 0, Lt,10,"VAR_TOKENS",zs,y),_chunkE4WQOMI7cjs.c.call(void 0, Lt,y),_chunkE4WQOMI7cjs.d.call(void 0, Lt,3,y),_chunkE4WQOMI7cjs.a.call(void 0, y,"HiveJsonPathTokenizer");var Ut=y,te,re,se,ee,ne,ie,ae,m,x=class x extends(ae=_chunkE4WQOMI7cjs.Gx,ie=[_chunkE4WQOMI7cjs.s],ne=[_chunkE4WQOMI7cjs.s],ee=[_chunkE4WQOMI7cjs.s],se=[_chunkE4WQOMI7cjs.s],re=[_chunkE4WQOMI7cjs.s],te=[_chunkE4WQOMI7cjs.s],ae){static get QUOTES(){return["'",'"']}static get IDENTIFIERS(){return["`"]}static get STRING_ESCAPES(){return["\\"]}static get SINGLE_TOKENS(){return{..._chunkE4WQOMI7cjs.Gx.SINGLE_TOKENS,$:"parameter"}}static get ORIGINAL_KEYWORDS(){return{..._chunkE4WQOMI7cjs.Gx.KEYWORDS,"ADD ARCHIVE":"command","ADD ARCHIVES":"command","ADD FILE":"command","ADD FILES":"command","ADD JAR":"command","ADD JARS":"command",MINUS:"except","MSCK REPAIR":"command",REFRESH:"refresh","TIMESTAMP AS OF":"timestampSnapshot","VERSION AS OF":"versionSnapshot",SERDEPROPERTIES:"serdeProperties"}}static get NUMERIC_LITERALS(){return{L:"BIGINT",S:"SMALLINT",Y:"TINYINT",D:"DOUBLE",F:"FLOAT",BD:"DECIMAL"}}};m=_chunkE4WQOMI7cjs.b.call(void 0, ae),_chunkE4WQOMI7cjs.e.call(void 0, m,10,"QUOTES",ie,x),_chunkE4WQOMI7cjs.e.call(void 0, m,10,"IDENTIFIERS",ne,x),_chunkE4WQOMI7cjs.e.call(void 0, m,10,"STRING_ESCAPES",ee,x),_chunkE4WQOMI7cjs.e.call(void 0, m,10,"SINGLE_TOKENS",se,x),_chunkE4WQOMI7cjs.e.call(void 0, m,10,"ORIGINAL_KEYWORDS",re,x),_chunkE4WQOMI7cjs.e.call(void 0, m,10,"NUMERIC_LITERALS",te,x),_chunkE4WQOMI7cjs.c.call(void 0, m,x),_chunkE4WQOMI7cjs.d.call(void 0, m,3,x),_chunkE4WQOMI7cjs.a.call(void 0, x,"HiveTokenizer");var Ft=x,Ee,oe,pe,Te,ue,Se,ce,le,he,N,c=class c extends(he=_chunkE4WQOMI7cjs.pb,le=[_chunkE4WQOMI7cjs.s],ce=[_chunkE4WQOMI7cjs.s],Se=[_chunkE4WQOMI7cjs.s],ue=[_chunkE4WQOMI7cjs.s],Te=[_chunkE4WQOMI7cjs.s],pe=[_chunkE4WQOMI7cjs.s],oe=[_chunkE4WQOMI7cjs.s],Ee=[_chunkE4WQOMI7cjs.s],he){static get ID_VAR_TOKENS(){return new Set([..._chunkE4WQOMI7cjs.pb.ID_VAR_TOKENS,"sessionUser","currentCatalog","straightJoin"])}static get NO_PAREN_FUNCTIONS(){let t={..._chunkE4WQOMI7cjs.pb.NO_PAREN_FUNCTIONS};return delete t.currentTime,delete t.localtime,delete t.localtimestamp,t}static get FUNCTION_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.FUNCTION_PARSERS,PERCENTILE:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseQuantileFunction(_chunkE4WQOMI7cjs.Lt)},"PERCENTILE"),PERCENTILE_APPROX:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseQuantileFunction(_chunkE4WQOMI7cjs.lu)},"PERCENTILE_APPROX")}}static get FUNCTIONS(){return{..._chunkE4WQOMI7cjs.pb.FUNCTIONS,ADD_MONTHS:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Qr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0),expression:_chunkE4WQOMI7cjs.Sa.call(void 0, t,1),unit:_chunkE4WQOMI7cjs.av.call(void 0, "MONTH")}),"ADD_MONTHS"),BASE64:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.io.fromArgList(t),"BASE64"),COLLECT_LIST:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Xs)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0),nullsExcluded:!0}),"COLLECT_LIST"),COLLECT_SET:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Ys.fromArgList(t),"COLLECT_SET"),DATE_ADD:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Qr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0),expression:_chunkE4WQOMI7cjs.Sa.call(void 0, t,1),unit:new (0, _chunkE4WQOMI7cjs.ce)({this:"DAY"})}),"DATE_ADD"),DATE_FORMAT:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.uw.call(void 0, _chunkE4WQOMI7cjs.Jr,{dialect:"hive"})([new (0, _chunkE4WQOMI7cjs.Nr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)}),_chunkE4WQOMI7cjs.Sa.call(void 0, t,1)]),"DATE_FORMAT"),DATE_SUB:Ye,DATEDIFF:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.$m)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)}),expression:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,1)})}),"DATEDIFF"),DAY:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Rn)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"DAY"),FIRST:$(_chunkE4WQOMI7cjs.ft),FIRST_VALUE:$(_chunkE4WQOMI7cjs.ht),FROM_UNIXTIME:_chunkE4WQOMI7cjs.uw.call(void 0, _chunkE4WQOMI7cjs.as,{dialect:"hive",defaultValue:!0}),GET_JSON_OBJECT:_chunkE4WQOMI7cjs.a.call(void 0, (t,{dialect:r})=>new (0, _chunkE4WQOMI7cjs.lp)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0),expression:r.toJsonPath(_chunkE4WQOMI7cjs.Sa.call(void 0, t,1))}),"GET_JSON_OBJECT"),LAST:$(_chunkE4WQOMI7cjs.gt),LAST_VALUE:$(_chunkE4WQOMI7cjs.it),MAP:_chunkE4WQOMI7cjs.a.call(void 0, t=>{if(t.length===1&&t[0].isStar)return new (0, _chunkE4WQOMI7cjs.Up)({this:t[0]});let r=[],s=[];for(let E=0;E<t.length;E+=2)r.push(t[E]),t[E+1]&&s.push(t[E+1]);return new (0, _chunkE4WQOMI7cjs.Vp)({keys:new (0, _chunkE4WQOMI7cjs.Zk)({expressions:r}),values:new (0, _chunkE4WQOMI7cjs.Zk)({expressions:s})})},"MAP"),MONTH:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.$p)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"MONTH"),REGEXP_EXTRACT:_chunkE4WQOMI7cjs.ux.call(void 0, _chunkE4WQOMI7cjs.Hq),REGEXP_EXTRACT_ALL:_chunkE4WQOMI7cjs.ux.call(void 0, _chunkE4WQOMI7cjs.Iq),SEQUENCE:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.rl.fromArgList(t),"SEQUENCE"),SIZE:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Wl.fromArgList(t),"SIZE"),SPLIT:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Oq.fromArgList(t),"SPLIT"),STR_TO_MAP:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Ar)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0),pairDelim:_chunkE4WQOMI7cjs.Sa.call(void 0, t,1)||_chunkE4WQOMI7cjs.tg.string(","),keyValueDelim:_chunkE4WQOMI7cjs.Sa.call(void 0, t,2)||_chunkE4WQOMI7cjs.tg.string(":")}),"STR_TO_MAP"),TO_DATE:Be,TO_JSON:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.op.fromArgList(t),"TO_JSON"),TRUNC:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Fn.fromArgList(t),"TRUNC"),UNBASE64:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.go.fromArgList(t),"UNBASE64"),UNIX_TIMESTAMP:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.uw.call(void 0, _chunkE4WQOMI7cjs.zr,{dialect:"hive",defaultValue:!0})(0<t.length?t:[new (0, _chunkE4WQOMI7cjs.Jm)({})]),"UNIX_TIMESTAMP"),YEAR:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.ts)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"YEAR")}}static get NO_PAREN_FUNCTION_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.NO_PAREN_FUNCTION_PARSERS,TRANSFORM:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseTransform()},"TRANSFORM")}}static get PROPERTY_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.PROPERTY_PARSERS,SERDEPROPERTIES:_chunkE4WQOMI7cjs.a.call(void 0, function(){return new (0, _chunkE4WQOMI7cjs.Rh)({expressions:this.parseWrappedCsv(()=>this.parseProperty())})},"SERDEPROPERTIES"),USING:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseUsingProperty()},"USING")}}static get ALTER_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.ALTER_PARSERS,CHANGE:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseAlterTableChange()},"CHANGE")}}parseTransform(){if(!this.match("lParen",{advance:!1})){this.retreat(this.index-1);return}let t=this.parseWrappedCsv(()=>this.parseLambda()),r=this.parseRowFormat({matchRow:!0}),s;if(this.matchTextSeq("RECORDWRITER")&&(s=this.parseString()),!this.match("using"))return _chunkE4WQOMI7cjs.Vk.fromArgList(t);let E=this.parseString();this.match("alias");let h=this.parseSchema(),l=this.parseRowFormat({matchRow:!0}),D;return this.matchTextSeq("RECORDREADER")&&(D=this.parseString()),this.expression(_chunkE4WQOMI7cjs.Od,{expressions:t,commandScript:E,schema:h,rowFormatBefore:r,recordWriter:s,rowFormatAfter:l,recordReader:D})}parseQuantileFunction(t){let r;this.match("distinct")?r=this.expression(_chunkE4WQOMI7cjs.Te,{expressions:[this.parseLambda()]}):(this.match("all"),r=this.parseLambda());let s=[r];return this.match("comma")&&s.push(...this.parseFunctionArgs()),t.fromArgList(s)}parseTypes(t={}){let{checkFunc:r=!1,schema:s=!1,allowIdentifiers:E=!0}=t,h=super.parseTypes({checkFunc:r,schema:s,allowIdentifiers:E});return h&&!s?h.transform((l,D)=>l instanceof _chunkE4WQOMI7cjs.pe&&l.isType(["char","varchar"])?l.replace(_chunkE4WQOMI7cjs.pe.build("text")):l,{copy:!1}):h}parseUsingProperty(){if(this.matchTexts(["JAR","FILE","ARCHIVE"])){let t=(_nullishCoalesce(_optionalChain([this, 'access', _6 => _6.prev, 'optionalAccess', _7 => _7.text]), () => (""))).toUpperCase();return this.expression(_chunkE4WQOMI7cjs.qi,{this:this.parseString(),kind:t})}return this.parsePropertyAssignment(_chunkE4WQOMI7cjs.Xg)}parseAlterTableChange(){this.match("column");let t=this.parseField({anyToken:!0});if(this.constructor.CHANGE_COLUMN_ALTER_SYNTAX&&this.matchTextSeq("TYPE"))return this.expression(_chunkE4WQOMI7cjs.mc,{this:t,dtype:this.parseTypes({schema:!0})});let r=this.parseField({anyToken:!0}),s=this.parseTypes({schema:!0}),E=this.match("comment")&&this.parseString();return(!t||!r||!s)&&this.raiseError("Expected 'CHANGE COLUMN' to be followed by 'column_name' 'column_name' 'data_type'"),this.expression(_chunkE4WQOMI7cjs.mc,{this:t,renameTo:r,dtype:s,comment:E})}parsePartitionAndOrder(){return[this.matchSet(["partitionBy","distributeBy"])?this.parseCsv(()=>this.parseAssignment()):[],_nullishCoalesce(super.parseOrder({skipOrderToken:this.match("sortBy")}), () => (void 0))]}parseParameter(){this.match("lBrace");let t=this.parseIdentifier()||this.parsePrimaryOrVar(),r=this.match("colon")&&(this.parseIdentifier()||this.parsePrimaryOrVar());return this.match("rBrace"),this.expression(_chunkE4WQOMI7cjs.Ii,{this:t,expression:r})}toPropEq(t,r){if(t.isStar)return t;let s;return t instanceof _chunkE4WQOMI7cjs.Kf?s=_nullishCoalesce(t.args.this, () => (_chunkE4WQOMI7cjs.vu.call(void 0, `col${r+1}`))):s=_chunkE4WQOMI7cjs.vu.call(void 0, `col${r+1}`),this.expression(_chunkE4WQOMI7cjs.Ej,{this:s,expression:t})}static get TABLE_ALIAS_TOKENS(){return new Set([..._chunkE4WQOMI7cjs.pb.TABLE_ALIAS_TOKENS,"straightJoin"])}};N=_chunkE4WQOMI7cjs.b.call(void 0, he),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"ID_VAR_TOKENS",le,c),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"NO_PAREN_FUNCTIONS",ce,c),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"FUNCTION_PARSERS",Se,c),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"FUNCTIONS",ue,c),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"NO_PAREN_FUNCTION_PARSERS",Te,c),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"PROPERTY_PARSERS",pe,c),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"ALTER_PARSERS",oe,c),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"TABLE_ALIAS_TOKENS",Ee,c),_chunkE4WQOMI7cjs.c.call(void 0, N,c),_chunkE4WQOMI7cjs.d.call(void 0, N,3,c),_chunkE4WQOMI7cjs.a.call(void 0, c,"HiveParser"),c.LOG_DEFAULTS_TO_LN=!0,c.STRICT_CAST=!1,c.VALUES_FOLLOWED_BY_PAREN=!1,c.JOINS_HAVE_EQUAL_PRECEDENCE=!0,c.ADD_JOIN_ON_TRUE=!0,c.ALTER_TABLE_PARTITIONS=!0,c.CHANGE_COLUMN_ALTER_SYNTAX=!1;var qt=c,Ae,xe,fe,Re,Ne,Oe,Ie,d,a=class a extends(Ie=_chunkE4WQOMI7cjs.Uv,Oe=[_chunkE4WQOMI7cjs.s],Ne=[_chunkE4WQOMI7cjs.s],Re=[_chunkE4WQOMI7cjs.s],fe=[_chunkE4WQOMI7cjs.s],xe=[_chunkE4WQOMI7cjs.s],Ae=[_chunkE4WQOMI7cjs.s],Ie){static get EXPRESSIONS_WITHOUT_NESTED_CTES(){return new Set([_chunkE4WQOMI7cjs.sg,_chunkE4WQOMI7cjs.Fi,_chunkE4WQOMI7cjs.Gi,_chunkE4WQOMI7cjs.Di])}static get SUPPORTED_JSON_PATH_PARTS(){return new Set([_chunkE4WQOMI7cjs.Zi,_chunkE4WQOMI7cjs.$i,_chunkE4WQOMI7cjs.dj,_chunkE4WQOMI7cjs.fj])}static get TYPE_MAPPING(){return new Map([..._chunkE4WQOMI7cjs.Uv.TYPE_MAPPING,["bit","BOOLEAN"],["blob","BINARY"],["datetime","TIMESTAMP"],["rowversion","BINARY"],["text","STRING"],["time","TIMESTAMP"],["timestampntz","TIMESTAMP"],["timestamptz","TIMESTAMP"],["utinyint","SMALLINT"],["varbinary","BINARY"]])}static get ORIGINAL_TRANSFORMS(){return new Map([..._chunkE4WQOMI7cjs.Uv.TRANSFORMS,[_chunkE4WQOMI7cjs.Gd,_chunkE4WQOMI7cjs.mw],[_chunkE4WQOMI7cjs.ct,_chunkE4WQOMI7cjs._v.call(void 0, "FIRST")],[_chunkE4WQOMI7cjs.Vs,_chunkE4WQOMI7cjs.$v],[_chunkE4WQOMI7cjs.Fs,_chunkE4WQOMI7cjs.$w.call(void 0, "MAX_BY")],[_chunkE4WQOMI7cjs.Gs,_chunkE4WQOMI7cjs.$w.call(void 0, "MIN_BY")],[_chunkE4WQOMI7cjs.Zk,_chunkE4WQOMI7cjs.wv.call(void 0, [_chunkE4WQOMI7cjs.Sv])],[_chunkE4WQOMI7cjs.yl,_chunkE4WQOMI7cjs._v.call(void 0, "CONCAT")],[_chunkE4WQOMI7cjs.Pl,function(r){return this.func("CONCAT_WS",[r.args.expression,r.args.this])}],[_chunkE4WQOMI7cjs.Xl,function(r){return Le.call(this,r)}],[_chunkE4WQOMI7cjs.gc,_chunkE4WQOMI7cjs.gw],[_chunkE4WQOMI7cjs.Ym,function(r){return yt.call(this,r)}],[_chunkE4WQOMI7cjs.$m,function(r){return js.call(this,r)}],[_chunkE4WQOMI7cjs.Nn,_chunkE4WQOMI7cjs.Hw],[_chunkE4WQOMI7cjs._m,function(r){return yt.call(this,r)}],[_chunkE4WQOMI7cjs.Pn,function(r){return`CAST(DATE_FORMAT(${this.sql(r,"this")}, ${O.DATEINT_FORMAT}) AS INT)`}],[_chunkE4WQOMI7cjs.Wn,function(r){return`TO_DATE(CAST(${this.sql(r,"this")} AS STRING), ${O.DATEINT_FORMAT})`}],[_chunkE4WQOMI7cjs._h,function(r){return`STORED BY ${this.sql(r,"this")}`}],[_chunkE4WQOMI7cjs.go,_chunkE4WQOMI7cjs._v.call(void 0, "UNBASE64")],[_chunkE4WQOMI7cjs.rl,_chunkE4WQOMI7cjs.sx],[_chunkE4WQOMI7cjs.to,_chunkE4WQOMI7cjs.sx],[_chunkE4WQOMI7cjs.Ho,_chunkE4WQOMI7cjs.aw.call(void 0, )],[_chunkE4WQOMI7cjs.Kj,_chunkE4WQOMI7cjs.ew],[_chunkE4WQOMI7cjs.Lj,function(r){return this.binary(r,"DIV")}],[_chunkE4WQOMI7cjs.Lo,_chunkE4WQOMI7cjs._v.call(void 0, "ISNAN")],[_chunkE4WQOMI7cjs.jp,function(r){return this.func("GET_JSON_OBJECT",[r.args.this,r.args.expression])}],[_chunkE4WQOMI7cjs.lp,function(r){return this.func("GET_JSON_OBJECT",[r.args.this,r.args.expression])}],[_chunkE4WQOMI7cjs.op,function(r){return ye.call(this,r)}],[_chunkE4WQOMI7cjs.Ap,_chunkE4WQOMI7cjs.Ew],[_chunkE4WQOMI7cjs.Kp,_chunkE4WQOMI7cjs.sw],[_chunkE4WQOMI7cjs.Dt,_chunkE4WQOMI7cjs.Kw],[_chunkE4WQOMI7cjs.Yp,function(r){return this.func("UNHEX",[this.func("MD5",[r.args.this])])}],[_chunkE4WQOMI7cjs.Gt,_chunkE4WQOMI7cjs.Jw],[_chunkE4WQOMI7cjs.qn,function(r){return this.func("MONTHS_BETWEEN",[r.args.this,r.args.expression])}],[_chunkE4WQOMI7cjs.hg,function(r){return r.args.allowNull?"":"NOT NULL"}],[_chunkE4WQOMI7cjs.Vp,_chunkE4WQOMI7cjs.sw],[_chunkE4WQOMI7cjs.Jb,_chunkE4WQOMI7cjs.wv.call(void 0, [_chunkE4WQOMI7cjs.Nv,_chunkE4WQOMI7cjs.Ov,_chunkE4WQOMI7cjs.Pv])],[_chunkE4WQOMI7cjs.Lt,_chunkE4WQOMI7cjs._v.call(void 0, "PERCENTILE")],[_chunkE4WQOMI7cjs.lu,_chunkE4WQOMI7cjs._v.call(void 0, "PERCENTILE_APPROX")],[_chunkE4WQOMI7cjs.Hq,_chunkE4WQOMI7cjs.Qw],[_chunkE4WQOMI7cjs.Iq,_chunkE4WQOMI7cjs.Qw],[_chunkE4WQOMI7cjs.Jq,_chunkE4WQOMI7cjs.Rw],[_chunkE4WQOMI7cjs.Kq,function(r){return this.binary(r,"RLIKE")}],[_chunkE4WQOMI7cjs.Oq,_chunkE4WQOMI7cjs._v.call(void 0, "SPLIT")],[_chunkE4WQOMI7cjs.Bp,_chunkE4WQOMI7cjs.Fw],[_chunkE4WQOMI7cjs.Qh,function(r){return this.nakedProperty(r)}],[_chunkE4WQOMI7cjs.Ys,_chunkE4WQOMI7cjs._v.call(void 0, "COLLECT_SET")],[_chunkE4WQOMI7cjs.mr,function(r){return this.func("SPLIT",[r.args.this,this.func("CONCAT",[_chunkE4WQOMI7cjs.tg.string("\\Q"),r.args.expression,_chunkE4WQOMI7cjs.tg.string("\\E")])])}],[_chunkE4WQOMI7cjs.Fi,_chunkE4WQOMI7cjs.wv.call(void 0, [_chunkE4WQOMI7cjs.Av,_chunkE4WQOMI7cjs.zv,r=>_chunkE4WQOMI7cjs.Dv.call(void 0, r,{unnestUsingArraysZip:!1}),_chunkE4WQOMI7cjs.Ev])],[_chunkE4WQOMI7cjs.ur,function(r){return _chunkE4WQOMI7cjs.nw.call(this,r,{funcName:"LOCATE",supportsPosition:!0})}],[_chunkE4WQOMI7cjs.xr,function(r){return qe.call(this,r)}],[_chunkE4WQOMI7cjs.yr,function(r){return we.call(this,r)}],[_chunkE4WQOMI7cjs.zr,function(r){return Ue.call(this,r)}],[_chunkE4WQOMI7cjs.Fr,_chunkE4WQOMI7cjs.ow],[_chunkE4WQOMI7cjs.Up,_chunkE4WQOMI7cjs._v.call(void 0, "MAP")],[_chunkE4WQOMI7cjs.be,_chunkE4WQOMI7cjs.wv.call(void 0, [_chunkE4WQOMI7cjs.yv])],[_chunkE4WQOMI7cjs.Mr,_chunkE4WQOMI7cjs._v.call(void 0, "TO_DATE")],[_chunkE4WQOMI7cjs.Nr,_chunkE4WQOMI7cjs.Gw],[_chunkE4WQOMI7cjs.Or,_chunkE4WQOMI7cjs._v.call(void 0, "UNIX_TIMESTAMP")],[_chunkE4WQOMI7cjs.Fn,function(r){return this.func("TRUNC",[r.args.this,_chunkE4WQOMI7cjs.dx.call(void 0, r)])}],[_chunkE4WQOMI7cjs.Lr,_chunkE4WQOMI7cjs._v.call(void 0, "UNIX_TIMESTAMP")],[_chunkE4WQOMI7cjs.io,_chunkE4WQOMI7cjs._v.call(void 0, "BASE64")],[_chunkE4WQOMI7cjs.Xr,function(r){return`CAST(SUBSTR(REPLACE(CAST(${this.sql(r,"this")} AS STRING), '-', ''), 1, 8) AS INT)`}],[_chunkE4WQOMI7cjs.Qr,function(r){return yt.call(this,r)}],[_chunkE4WQOMI7cjs.Rr,function(r){return js.call(this,r)}],[_chunkE4WQOMI7cjs.Tr,function(r){return Ge.call(this,r)}],[_chunkE4WQOMI7cjs.lt,_chunkE4WQOMI7cjs.jw],[_chunkE4WQOMI7cjs.Pr,_chunkE4WQOMI7cjs.Mw],[_chunkE4WQOMI7cjs.Zr,_chunkE4WQOMI7cjs._v.call(void 0, "ASCII")],[_chunkE4WQOMI7cjs.as,function(r){return this.func("FROM_UNIXTIME",[r.args.this,_chunkE4WQOMI7cjs.vw.call(void 0, "hive").call(this,r)])}],[_chunkE4WQOMI7cjs.bs,function(r){return Fe.call(this,r)}],[_chunkE4WQOMI7cjs.cs,_chunkE4WQOMI7cjs._v.call(void 0, "FROM_UNIXTIME")],[_chunkE4WQOMI7cjs.zh,function(r){return`PARTITIONED BY ${this.sql(r,"this")}`}],[_chunkE4WQOMI7cjs.Br,_chunkE4WQOMI7cjs._v.call(void 0, "FORMAT_NUMBER")],[_chunkE4WQOMI7cjs.id,function(r){return this.nationalSql(r,{prefix:""})}],[_chunkE4WQOMI7cjs.Tf,function(r){return`(${this.expressions(r,{key:"this",indent:!1})})`}],[_chunkE4WQOMI7cjs.eg,function(r){return`(${this.expressions(r,{key:"this",indent:!1})})`}],[_chunkE4WQOMI7cjs.fg,()=>""],[_chunkE4WQOMI7cjs.xh,()=>""],[_chunkE4WQOMI7cjs.Ah,function(r){return this.func("BUCKET",[r.args.expression,r.args.this])}],[_chunkE4WQOMI7cjs.Bh,function(r){return this.func("TRUNCATE",[r.args.expression,r.args.this])}],[_chunkE4WQOMI7cjs.jg,()=>"PRIMARY KEY"],[_chunkE4WQOMI7cjs.nn,_chunkE4WQOMI7cjs._v.call(void 0, "WEEKOFYEAR")],[_chunkE4WQOMI7cjs.jn,_chunkE4WQOMI7cjs._v.call(void 0, "DAYOFMONTH")],[_chunkE4WQOMI7cjs.hn,_chunkE4WQOMI7cjs._v.call(void 0, "DAYOFWEEK")],[_chunkE4WQOMI7cjs.Gp,function(r){return _chunkE4WQOMI7cjs.Tv.call(this,r,"insCost","delCost","subCost","maxDist"),_chunkE4WQOMI7cjs._v.call(void 0, "LEVENSHTEIN").call(this,r)}]])}static get PROPERTIES_LOCATION(){return new Map([..._chunkE4WQOMI7cjs.Uv.PROPERTIES_LOCATION,[_chunkE4WQOMI7cjs.Xg,"postSchema"],[_chunkE4WQOMI7cjs.zh,"postSchema"],[_chunkE4WQOMI7cjs.ti,"unsupported"],[_chunkE4WQOMI7cjs.ui,"unsupported"]])}static get TS_OR_DS_EXPRESSIONS(){return new Set([_chunkE4WQOMI7cjs.$m,_chunkE4WQOMI7cjs.Rn,_chunkE4WQOMI7cjs.$p,_chunkE4WQOMI7cjs.ts])}ignoreNullsSql(t){let r=t.args.this;return this._constructor.IGNORE_NULLS_FUNCS.some(s=>r instanceof s)?this.func(r._constructor.sqlNames()[0],[r.args.this,_chunkE4WQOMI7cjs.Zu.call(void 0, )]):super.ignoreNullsSql(t)}unnestSql(t){return _chunkE4WQOMI7cjs._v.call(void 0, "EXPLODE").call(this,t)}jsonPathKeySql(t){return t.args.this instanceof _chunkE4WQOMI7cjs.fj?(this.unsupported("Unsupported wildcard in JSONPathKey expression"),""):super.jsonPathKeySql(t)}parameterSql(t){let r=this.sql(t,"this"),s=this.sql(t,"expression"),E=t.parent;return r=s?`${r}:${s}`:r,E instanceof _chunkE4WQOMI7cjs.Bj&&E.parent instanceof _chunkE4WQOMI7cjs.ac?r:`\${${r}}`}schemaSql(t){for(let r of t.findAll(_chunkE4WQOMI7cjs.Fd))r.args.desc===!1&&r.setArgKey("desc",void 0);return super.schemaSql(t)}constraintSql(t){for(let E of Array.from(t.findAll(_chunkE4WQOMI7cjs.Ci)))E.pop();let r=this.sql(t,"this"),s=this.expressions(t,{sep:" ",flat:!0});return`CONSTRAINT ${r} ${s}`}rowFormatSerdePropertySql(t){let r=this.sql(t,"serdeProperties");return r=r?` ${r}`:"",`ROW FORMAT SERDE ${this.sql(t,"this")}${r}`}arrayAggSql(t){return this.func("COLLECT_LIST",[t.args.this instanceof _chunkE4WQOMI7cjs.Cd?t.args.this.args.this:t.args.this])}truncSql(t){return _chunkE4WQOMI7cjs.Tv.call(this,t,"decimals"),this.sql(new (0, _chunkE4WQOMI7cjs.$l)({this:t.args.this,to:_chunkE4WQOMI7cjs.pe.build("bigint")}))}dataTypeSql(t){if(t.isType(_chunkE4WQOMI7cjs.Uv.PARAMETERIZABLE_TEXT_TYPES)&&(!t.args.expressions||t.args.expressions[0].name==="MAX"))t=_nullishCoalesce(_chunkE4WQOMI7cjs.pe.build("text"), () => (t));else if(t.isType("text")&&t.args.expressions)t.setArgKey("this","varchar");else if(t.isType(_chunkE4WQOMI7cjs.pe.TEMPORAL_TYPES))t=_nullishCoalesce(_chunkE4WQOMI7cjs.pe.build(t.args.this), () => (t));else if(t.isType("float")){let r=t.find(_chunkE4WQOMI7cjs.oe);r instanceof _chunkE4WQOMI7cjs.oe&&(t=_nullishCoalesce((parseInt(_nullishCoalesce(_optionalChain([r, 'access', _8 => _8.args, 'access', _9 => _9.this, 'optionalAccess', _10 => _10.args, 'access', _11 => _11.this, 'optionalAccess', _12 => _12.toString, 'call', _13 => _13()]), () => ("0")))<=32?_chunkE4WQOMI7cjs.pe.build("float"):_chunkE4WQOMI7cjs.pe.build("double")), () => (t)))}return super.dataTypeSql(t)}versionSql(t){return super.versionSql(t).replace("FOR ","")}structSql(t){let r=[];return _optionalChain([t, 'access', _14 => _14.args, 'access', _15 => _15.expressions, 'optionalAccess', _16 => _16.forEach, 'call', _17 => _17(s=>{if(s instanceof _chunkE4WQOMI7cjs.Ej){this.unsupported("Hive does not support named structs.");let E=s.args.expression;r.push(E instanceof _chunkE4WQOMI7cjs.xb||typeof E=="string"?E:"")}else r.push(s)})]),this.func("STRUCT",r)}columnDefSql(t,r={}){let{sep:s=" "}=r;return super.columnDefSql(t,{sep:t.parent instanceof _chunkE4WQOMI7cjs.pe&&t.parent.isType("struct")?": ":s})}alterColumnSql(t){let r=this.sql(t,"this"),s=this.sql(t,"renameTo")||r,E=this.sql(t,"dtype"),h=this.sql(t,"comment"),l=h?` COMMENT ${h}`:"",D=this.sql(t,"default"),X=t.args.visible,q=t.args.allowNull,Me=t.args.drop;return(D||Me||X||q)&&this.unsupported("Unsupported CHANGE COLUMN syntax"),E||this.unsupported("CHANGE COLUMN without a type is not supported"),`CHANGE COLUMN ${r} ${s} ${E}${l}`}renameColumnSql(t){return this.unsupported("Cannot rename columns without data type defined in Hive"),""}alterSetSql(t){let r=this.expressions(t,{flat:!0});r=r?` ${r}`:"";let s=this.sql(t,"location");s=s?` LOCATION ${s}`:"";let E=this.expressions(t,{key:"fileFormat",flat:!0,sep:" "});E=E?` FILEFORMAT ${E}`:"";let h=this.sql(t,"serde");h=h?` SERDE ${h}`:"";let l=this.expressions(t,{key:"tag",flat:!0,sep:""});return l=l?` TAGS ${l}`:"",`SET${h}${r}${s}${E}${l}`}serdePropertiesSql(t){let r=t.args.with?"WITH ":"",s=this.expressions(t,{flat:!0});return`${r}SERDEPROPERTIES (${s})`}existsSql(t){return t.args.expression?this.functionFallbackSql(t):super.existsSql(t)}timeToStrSql(t){let r=t.args.this;return r instanceof _chunkE4WQOMI7cjs.Nr&&(r=r.args.this),this.func("DATE_FORMAT",[r,this.formatTime(t)])}fileFormatPropertySql(t){let r;return t.args.this instanceof _chunkE4WQOMI7cjs.Sd?r=this.sql(t,"this"):r=t.name.toUpperCase(),`STORED AS ${r}`}};d=_chunkE4WQOMI7cjs.b.call(void 0, Ie),_chunkE4WQOMI7cjs.e.call(void 0, d,10,"EXPRESSIONS_WITHOUT_NESTED_CTES",Oe,a),_chunkE4WQOMI7cjs.e.call(void 0, d,10,"SUPPORTED_JSON_PATH_PARTS",Ne,a),_chunkE4WQOMI7cjs.e.call(void 0, d,10,"TYPE_MAPPING",Re,a),_chunkE4WQOMI7cjs.e.call(void 0, d,10,"ORIGINAL_TRANSFORMS",fe,a),_chunkE4WQOMI7cjs.e.call(void 0, d,10,"PROPERTIES_LOCATION",xe,a),_chunkE4WQOMI7cjs.e.call(void 0, d,10,"TS_OR_DS_EXPRESSIONS",Ae,a),_chunkE4WQOMI7cjs.c.call(void 0, d,a),_chunkE4WQOMI7cjs.d.call(void 0, d,3,a),_chunkE4WQOMI7cjs.a.call(void 0, a,"HiveGenerator"),a.SUPPORTS_DECODE_CASE=!1,a.SELECT_KINDS=[],a.TRY_SUPPORTED=!1,a.SUPPORTS_UESCAPE=!1,a.LIMIT_FETCH="LIMIT",a.TABLESAMPLE_WITH_METHOD=!1,a.JOIN_HINTS=!1,a.TABLE_HINTS=!1,a.QUERY_HINTS=!1,a.INDEX_ON="ON TABLE",a.EXTRACT_ALLOWS_QUOTES=!1,a.NVL2_SUPPORTED=!1,a.LAST_DAY_SUPPORTS_DATE_PART=!1,a.JSON_PATH_SINGLE_QUOTE_ESCAPE=!0,a.SAFE_JSON_PATH_KEY_RE=/^[_\-a-zA-Z][\-\w]*$/,a.SUPPORTS_TO_NUMBER=!1,a.WITH_PROPERTIES_PREFIX="TBLPROPERTIES",a.PARSE_JSON_NAME=void 0,a.PAD_FILL_PATTERN_IS_REQUIRED=!0,a.SUPPORTS_MEDIAN=!1,a.ARRAY_SIZE_NAME="SIZE",a.ALTER_SET_TYPE="",a.IGNORE_NULLS_FUNCS=[_chunkE4WQOMI7cjs.ft,_chunkE4WQOMI7cjs.gt,_chunkE4WQOMI7cjs.ht,_chunkE4WQOMI7cjs.it];var wt=a,me,de,De,Pe,F,T=class T extends(Pe=_chunkE4WQOMI7cjs.Xv,De=[_chunkE4WQOMI7cjs.s],de=[_chunkE4WQOMI7cjs.s],me=[_chunkE4WQOMI7cjs.s],Pe){static get EXPRESSION_METADATA(){return new Map(_chunkVG54UEKAcjs.a.EXPRESSION_METADATA)}static get COERCES_TO(){let t=new Map(_chunkE4WQOMI7cjs.Na.COERCES_TO);for(let r of[..._chunkE4WQOMI7cjs.pe.NUMERIC_TYPES,..._chunkE4WQOMI7cjs.pe.TEMPORAL_TYPES,"interval"]){let s=_nullishCoalesce(t.get(r), () => (new Set));t.set(r,new Set([...s,..._chunkE4WQOMI7cjs.pe.TEXT_TYPES]))}return t}static get NORMALIZATION_STRATEGY(){return"caseInsensitive"}static get TIME_MAPPING(){return{y:"%Y",Y:"%Y",YYYY:"%Y",yyyy:"%Y",YY:"%y",yy:"%y",MMMM:"%B",MMM:"%b",MM:"%m",M:"%-m",dd:"%d",d:"%-d",HH:"%H",H:"%-H",hh:"%I",h:"%-I",mm:"%M",m:"%-M",ss:"%S",s:"%-S",SSSSSS:"%f",a:"%p",DD:"%j",D:"%-j",E:"%a",EE:"%a",EEE:"%a",EEEE:"%A",z:"%Z",Z:"%z"}}};F=_chunkE4WQOMI7cjs.b.call(void 0, Pe),_chunkE4WQOMI7cjs.e.call(void 0, F,10,"COERCES_TO",De,T),_chunkE4WQOMI7cjs.e.call(void 0, F,10,"NORMALIZATION_STRATEGY",de,T),_chunkE4WQOMI7cjs.e.call(void 0, F,10,"TIME_MAPPING",me,T),_chunkE4WQOMI7cjs.c.call(void 0, F,T),_chunkE4WQOMI7cjs.d.call(void 0, F,3,T),_chunkE4WQOMI7cjs.a.call(void 0, T,"Hive"),T.DIALECT_NAME="hive",T.ALIAS_POST_TABLESAMPLE=!0,T.IDENTIFIERS_CAN_START_WITH_DIGIT=!0,T.SUPPORTS_USER_DEFINED_TYPES=!1,T.JsonPathTokenizer=Ut,T.SAFE_DIVISION=!0,T.ARRAY_AGG_INCLUDES_NULLS=void 0,T.REGEXP_EXTRACT_DEFAULT_GROUP=1,T.ALTER_TABLE_SUPPORTS_CASCADE=!0,T.INITCAP_DEFAULT_DELIMITER_CHARS=`
2
+ \r\f\v`,T.DATE_FORMAT="'yyyy-MM-dd'",T.DATEINT_FORMAT="'yyyyMMdd'",T.TIME_FORMAT="'yyyy-MM-dd HH:mm:ss'",T.Tokenizer=Ft,T.Parser=qt,T.Generator=wt;var O=T;exports.a = $; exports.b = Ut; exports.c = O;
3
+ //# sourceMappingURL=chunk-KSSCIAWI.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-KSSCIAWI.cjs","../src/dialects/hive.ts"],"names":["DATE_DELTA_INTERVAL","TIME_DIFF_FACTOR","DIFF_MONTH_SWITCH","addDateSql","expression","TsOrDsAddExpr","unit","func","multiplier","DateSubExpr","increment","LiteralExpr","value","MulExpr","__name","dateDiffSql","factor","left","right","secDiff","_Hive"],"mappings":"AAAA,yuBAAyC,wDAAonD,IC6NvpDA,EAAAA,CAAwD,CAC5D,IAAA,CAAM,CACJ,YAAA,CACA,EACF,CAAA,CACA,KAAA,CAAO,CACL,YAAA,CACA,CACF,CAAA,CACA,OAAA,CAAS,CACP,YAAA,CACA,CACF,CAAA,CACA,IAAA,CAAM,CACJ,UAAA,CACA,CACF,CAAA,CACA,GAAA,CAAK,CACH,UAAA,CACA,CACF,CACF,CAAA,CAEMC,EAAAA,CAA2C,CAC/C,WAAA,CAAa,SAAA,CACb,MAAA,CAAQ,EAAA,CACR,MAAA,CAAQ,OAAA,CACR,IAAA,CAAM,SACR,CAAA,CAEMC,EAAAA,CAAoB,IAAI,GAAA,CAAI,CAChC,MAAA,CACA,SAAA,CACA,OACF,CAAC,CAAA,CAED,SAASC,EAAAA,CAA6BC,CAAAA,CAA+D,CACnG,EAAA,CAAIA,EAAAA,WAAsBC,oBAAAA,EAAiB,CAACD,CAAAA,CAAW,IAAA,CAAK,IAAA,CAC1D,OAAO,IAAA,CAAK,IAAA,CAAK,UAAA,CAAY,CAC3BA,CAAAA,CAAW,IAAA,CAAK,IAAA,CAChBA,CAAAA,CAAW,IAAA,CAAK,UAClB,CAAC,CAAA,CAGH,IAAME,CAAAA,CAAOF,CAAAA,CAAW,IAAA,CAAK,MAAM,CAAA,CAAE,WAAA,CAAY,CAAA,CAE7C,CAEFG,CAAAA,CACAC,CACF,CAAA,CAAIR,EAAAA,CAAoBM,CAAI,CAAA,EAAK,CAC/B,UAAA,CACA,CACF,CAAA,CAEIF,EAAAA,WAAsBK,oBAAAA,EAAAA,CACxBD,CAAAA,EAAc,CAAA,CAAA,CAAA,CAGhB,IAAIE,CAAAA,CAAYN,CAAAA,CAAW,IAAA,CAAK,UAAA,CAEhC,EAAA,CAAIM,EAAAA,WAAqBC,oBAAAA,CAAa,CACpC,IAAMC,CAAAA,CAAQF,CAAAA,CAAU,QAAA,CAAW,UAAA,kBAAWA,CAAAA,CAAU,IAAA,CAAK,IAAA,SAAQ,KAAG,CAAA,CAAI,QAAA,kBAASA,CAAAA,CAAU,IAAA,CAAK,IAAA,SAAQ,KAAG,CAAA,CAE/GA,CAAAA,CAAYC,oBAAAA,CAAY,MAAA,CAAOC,CAAAA,CAAQJ,CAAU,CACnD,CAAA,KAAWA,CAAAA,GAAe,CAAA,EAAA,CACxBE,CAAAA,CAAY,IAAIG,yBAAAA,CAAQ,CACtB,IAAA,CAAMH,CAAAA,CACN,UAAA,CAAYC,oBAAAA,CAAY,MAAA,CAAOH,CAAU,CAC3C,CAAC,CAAA,CAAA,CAGH,OAAO,IAAA,CAAK,IAAA,CAAKD,CAAAA,CAAM,CACrBH,CAAAA,CAAW,IAAA,CAAK,IAAA,CAChBM,CACF,CAAC,CACH,CAxCSI,iCAAAA,EAAAX,CAAA,YAAA,CAAA,CA0CT,SAASY,EAAAA,CAA8BX,CAAAA,CAAmD,CACxF,IAAME,CAAAA,CAAOF,CAAAA,CAAW,IAAA,CAAK,MAAM,CAAA,CAAE,WAAA,CAAY,CAAA,CAE3CY,CAAAA,CAASf,EAAAA,CAAiBK,CAAI,CAAA,CAEpC,EAAA,CAAIU,CAAAA,GAAW,KAAA,CAAA,CAAW,CACxB,IAAMC,CAAAA,CAAO,IAAA,CAAK,GAAA,CAAIb,CAAAA,CAAY,MAAM,CAAA,CAClCc,CAAAA,CAAQ,IAAA,CAAK,GAAA,CAAId,CAAAA,CAAY,YAAY,CAAA,CACzCe,CAAAA,CAAU,CAAA,eAAA,EAAkBF,CAAI,CAAA,mBAAA,EAAsBC,CAAK,CAAA,CAAA,CAAA,CAEjE,OAAOF,CAAAA,CAAS,CAAA,CAAA,EAAIG,CAAO,CAAA,CAAA,EAAIH,CAAM,CAAA,CAAA;AAw+ClCI,UAAAA","file":"/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-KSSCIAWI.cjs","sourcesContent":[null,"import {\n cache,\n} from '../port_internals';\nimport type {\n AlterSetExpr,\n ColumnDefExpr,\n ConstraintExpr,\n ExistsExpr,\n RowFormatSerdePropertyExpr,\n SchemaExpr,\n StructExpr,\n TruncExpr,\n VersionExpr,\n IdentifierExpr,\n ExpressionValue,\n StarExpr,\n UnnestExpr,\n} from '../expressions';\nimport {\n AlterColumnExpr,\n AnyValueExpr,\n ApproxDistinctExpr,\n ApproxQuantileExpr,\n ArgMaxExpr,\n ArgMinExpr,\n ArrayAggExpr,\n ArrayConcatExpr,\n ArrayExpr,\n ArraySizeExpr,\n ArraySortExpr,\n ArrayToStringExpr,\n ArrayUniqueAggExpr,\n BooleanExpr,\n CastExpr,\n ClusteredColumnConstraintExpr,\n ColumnExpr,\n CreateExpr,\n CurrentTimestampExpr,\n DataTypeExpr,\n DataTypeExprKind,\n DataTypeParamExpr,\n DateAddExpr,\n DateDiffExpr,\n DateStrToDateExpr,\n DateSubExpr,\n DateToDiExpr,\n DayExpr,\n DayOfMonthExpr,\n DayOfWeekExpr,\n DiToDateExpr,\n DistinctExpr,\n EqExpr,\n Expression,\n FileFormatPropertyExpr,\n FirstExpr,\n FirstValueExpr,\n FromBase64Expr,\n GenerateDateArrayExpr,\n GenerateSeriesExpr,\n IfExpr,\n ILikeExpr,\n IgnoreNullsExpr,\n InputOutputFormatExpr,\n InsertExpr,\n IntDivExpr,\n IsNanExpr,\n JsonExtractExpr,\n JsonExtractScalarExpr,\n JsonFormatExpr,\n JsonPathKeyExpr,\n JsonPathRootExpr,\n JsonPathSubscriptExpr,\n JsonPathWildcardExpr,\n LastExpr,\n LastValueExpr,\n LeftExpr,\n LevenshteinExpr,\n LiteralExpr,\n MapExpr,\n MaxExpr,\n Md5DigestExpr,\n MinExpr,\n MonthExpr,\n MonthsBetweenExpr,\n MulExpr,\n NationalExpr,\n NonClusteredColumnConstraintExpr,\n NotForReplicationColumnConstraintExpr,\n NotNullColumnConstraintExpr,\n NumberToStrExpr,\n OnPropertyExpr,\n OrderExpr,\n OrderedExpr,\n ParameterExpr,\n PartitionByTruncateExpr,\n PartitionedByBucketExpr,\n PartitionedByPropertyExpr,\n PrimaryKeyColumnConstraintExpr,\n PropertiesExpr,\n PropertiesLocation,\n PropertyEqExpr,\n PropertyExpr,\n QuantileExpr,\n QueryTransformExpr,\n RegexpExtractAllExpr,\n RegexpExtractExpr,\n RegexpLikeExpr,\n RegexpReplaceExpr,\n RegexpSplitExpr,\n RightExpr,\n SchemaCommentPropertyExpr,\n SelectExpr,\n SerdePropertiesExpr,\n SetItemExpr,\n SetOperationExpr,\n SplitExpr,\n StarMapExpr,\n StorageHandlerPropertyExpr,\n StrToMapExpr,\n StrPositionExpr,\n StrToDateExpr,\n StrToTimeExpr,\n StrToUnixExpr,\n StructExtractExpr,\n SubqueryExpr,\n TableExpr,\n TimeStrToDateExpr,\n TimeStrToTimeExpr,\n TimeStrToUnixExpr,\n TimeToStrExpr,\n TimeToUnixExpr,\n TimestampTruncExpr,\n ToBase64Expr,\n TransformExpr,\n TrimExpr,\n TryCastExpr,\n TsOrDiToDiExpr,\n TsOrDsAddExpr,\n TsOrDsDiffExpr,\n TsOrDsToDateExpr,\n UnicodeExpr,\n UnixToStrExpr,\n UnixToTimeExpr,\n UnixToTimeStrExpr,\n UsingPropertyExpr,\n VarExpr,\n VarMapExpr,\n VolatilePropertyExpr,\n WeekOfYearExpr,\n WithDataPropertyExpr,\n WithExpr,\n YearExpr,\n toIdentifier,\n true_,\n var_,\n} from '../expressions';\nimport {\n Generator, unsupportedArgs,\n} from '../generator';\nimport {\n seqGet,\n} from '../helper';\nimport {\n Parser,\n} from '../parser';\nimport {\n Tokenizer, TokenType,\n} from '../tokens';\nimport {\n JsonPathTokenizer,\n} from '../jsonpath/tokenizer';\nimport {\n anyToExists,\n ctasWithTmpTablesToCreateTmpView,\n eliminateDistinctOn,\n eliminateQualify,\n inheritStructFieldNames,\n moveSchemaColumnsToPartitionedBy,\n preprocess,\n removeUniqueConstraints,\n unnestGenerateSeries,\n unnestToExplode,\n} from '../transforms';\nimport {\n HiveTyping,\n} from '../typing/hive';\nimport {\n TypeAnnotator,\n} from '../optimizer/annotate_types';\nimport {\n approxCountDistinctSql,\n argMaxOrMinNoCount,\n buildFormattedTime,\n buildRegexpExtract,\n dateStrToDateSql,\n Dialect,\n Dialects,\n ifSql,\n isParseJson,\n leftToSubstringSql,\n maxOrGreatest,\n minOrLeast,\n noIlikeSql,\n noRecursiveCteSql,\n noTrycastSql,\n NormalizationStrategy,\n propertySql,\n regexpExtractSql,\n regexpReplaceSql,\n renameFunc,\n rightToSubstringSql,\n sequenceSql,\n strPositionSql,\n structExtractSql,\n timeFormat,\n timeStrToTimeSql,\n trimSql,\n unitToStr,\n varMapSql,\n} from './dialect';\n\nconst DATE_DELTA_INTERVAL: Record<string, [string, number]> = {\n YEAR: [\n 'ADD_MONTHS',\n 12,\n ],\n MONTH: [\n 'ADD_MONTHS',\n 1,\n ],\n QUARTER: [\n 'ADD_MONTHS',\n 3,\n ],\n WEEK: [\n 'DATE_ADD',\n 7,\n ],\n DAY: [\n 'DATE_ADD',\n 1,\n ],\n};\n\nconst TIME_DIFF_FACTOR: Record<string, string> = {\n MILLISECOND: ' * 1000',\n SECOND: '',\n MINUTE: ' / 60',\n HOUR: ' / 3600',\n};\n\nconst DIFF_MONTH_SWITCH = new Set([\n 'YEAR',\n 'QUARTER',\n 'MONTH',\n]);\n\nfunction addDateSql (this: Generator, expression: DateAddExpr | DateSubExpr | TsOrDsAddExpr): string {\n if (expression instanceof TsOrDsAddExpr && !expression.args.unit) {\n return this.func('DATE_ADD', [\n expression.args.this,\n expression.args.expression,\n ]);\n }\n\n const unit = expression.text('unit').toUpperCase();\n\n let [\n\n func,\n multiplier,\n ] = DATE_DELTA_INTERVAL[unit] || [\n 'DATE_ADD',\n 1,\n ];\n\n if (expression instanceof DateSubExpr) {\n multiplier *= -1;\n }\n\n let increment = expression.args.expression;\n\n if (increment instanceof LiteralExpr) {\n const value = increment.isNumber ? parseFloat(increment.args.this ?? '0') : parseInt(increment.args.this ?? '0');\n\n increment = LiteralExpr.number(value * multiplier);\n } else if (multiplier !== 1) {\n increment = new MulExpr({\n this: increment,\n expression: LiteralExpr.number(multiplier),\n });\n }\n\n return this.func(func, [\n expression.args.this,\n increment,\n ]);\n}\n\nfunction dateDiffSql (this: Generator, expression: DateDiffExpr | TsOrDsDiffExpr): string {\n const unit = expression.text('unit').toUpperCase();\n\n const factor = TIME_DIFF_FACTOR[unit];\n\n if (factor !== undefined) {\n const left = this.sql(expression, 'this');\n const right = this.sql(expression, 'expression');\n const secDiff = `UNIX_TIMESTAMP(${left}) - UNIX_TIMESTAMP(${right})`;\n\n return factor ? `(${secDiff})${factor}` : secDiff;\n }\n\n const monthsBetween = DIFF_MONTH_SWITCH.has(unit);\n const sqlFunc = monthsBetween ? 'MONTHS_BETWEEN' : 'DATEDIFF';\n const multiplier = DATE_DELTA_INTERVAL[unit]?.[1] || 1;\n const multiplierSql = 1 < multiplier ? ` / ${multiplier}` : '';\n\n let diffSql = `${sqlFunc}(${this.formatArgs([\n expression.args.this,\n expression.args.expression,\n ])})`;\n\n if (monthsBetween || multiplierSql) {\n diffSql = `CAST(${diffSql}${multiplierSql} AS INT)`;\n }\n\n return diffSql;\n}\n\nfunction jsonFormatSql (this: Generator, expression: JsonFormatExpr): string {\n const thisNode = expression.args.this;\n\n if (thisNode && isParseJson(thisNode)) {\n if (thisNode.args.this instanceof LiteralExpr && thisNode.args.this.isString) {\n const wrappedJson = LiteralExpr.string(`[${thisNode.args.this.args.this}]`);\n\n const fromJson = this.func('FROM_JSON', [\n wrappedJson,\n this.func('SCHEMA_OF_JSON', [wrappedJson]),\n ]);\n const toJson = this.func('TO_JSON', [fromJson]);\n\n return this.func('REGEXP_EXTRACT', [\n toJson,\n '\\'^.(.*).$\\'',\n '1',\n ]);\n }\n\n return this.sql(thisNode);\n }\n\n return this.func('TO_JSON', [\n thisNode,\n expression.args.options,\n ]);\n}\n\nfunction arraySortSql (this: Generator, expression: ArraySortExpr): string {\n if (expression.args.expression) {\n this.unsupported('Unsupported arg \\'expression\\' for ArraySort');\n }\n\n return this.func('SORT_ARRAY', [expression.args.this]);\n}\n\nfunction strToUnixSql (this: Generator, expression: StrToUnixExpr): string {\n return this.func('UNIX_TIMESTAMP', [\n expression.args.this,\n timeFormat('hive').call(this, expression),\n ]);\n}\n\nfunction unixToTimeSql (this: Generator, expression: UnixToTimeExpr): string {\n const timestamp = this.sql(expression, 'this');\n const scale = expression.args.scale;\n\n if (scale === undefined || scale.toValue() === UnixToTimeExpr.SECONDS.toValue()) {\n return renameFunc('FROM_UNIXTIME').call(this, expression);\n }\n\n return `FROM_UNIXTIME(${timestamp} / POW(10, ${scale}))`;\n}\n\nfunction strToDateSql (this: Generator, expression: StrToDateExpr): string {\n let thisSql = this.sql(expression, 'this');\n const timeFormatSql = this.formatTime(expression);\n\n if (timeFormatSql !== null && timeFormatSql !== undefined && ![\n Hive.TIME_FORMAT,\n Hive.DATE_FORMAT,\n ].includes(timeFormatSql)) {\n thisSql = `FROM_UNIXTIME(UNIX_TIMESTAMP(${thisSql}, ${timeFormatSql}))`;\n }\n\n return `CAST(${thisSql} AS DATE)`;\n}\n\nfunction strToTimeSql (this: Generator, expression: StrToTimeExpr): string {\n let thisSql = this.sql(expression, 'this');\n const timeFormatSql = this.formatTime(expression);\n\n if (timeFormatSql !== null && timeFormatSql !== undefined && ![\n Hive.TIME_FORMAT,\n Hive.DATE_FORMAT,\n ].includes(timeFormatSql)) {\n thisSql = `FROM_UNIXTIME(UNIX_TIMESTAMP(${thisSql}, ${timeFormatSql}))`;\n }\n\n return `CAST(${thisSql} AS TIMESTAMP)`;\n}\n\nfunction toDateSql (this: Generator, expression: TsOrDsToDateExpr): string {\n const timeFormatSql = this.formatTime(expression);\n\n if (timeFormatSql && ![\n Hive.TIME_FORMAT,\n Hive.DATE_FORMAT,\n ].includes(timeFormatSql)) {\n return this.func('TO_DATE', [\n expression.args.this,\n timeFormatSql,\n ]);\n }\n\n if (expression.parent instanceof Expression && (this._constructor as typeof HiveGenerator).TS_OR_DS_EXPRESSIONS.has(expression.parent._constructor)) {\n return this.sql(expression, 'this');\n }\n\n return this.func('TO_DATE', [expression.args.this]);\n}\n\nexport function buildWithIgnoreNulls (ExpClass: typeof Expression) {\n return (args: Expression[]) => {\n const thisNode = new ExpClass({\n this: seqGet(args, 0),\n });\n\n if (seqGet(args, 1) instanceof BooleanExpr && seqGet(args, 1)?.args.this === true) {\n return new IgnoreNullsExpr({\n this: thisNode,\n });\n }\n\n return thisNode;\n };\n}\n\nfunction buildToDate (args: Expression[]): TsOrDsToDateExpr {\n const expr = buildFormattedTime(TsOrDsToDateExpr, {\n dialect: 'hive',\n })(args);\n\n expr.setArgKey('safe', true);\n\n return expr;\n}\n\nfunction buildDateAdd (args: Expression[]): TsOrDsAddExpr {\n let expression = seqGet(args, 1);\n\n if (expression) {\n expression = expression.mul(-1);\n }\n\n return new TsOrDsAddExpr({\n this: seqGet(args, 0),\n expression: expression,\n unit: var_('DAY'),\n });\n}\n\nexport class HiveJsonPathTokenizer extends JsonPathTokenizer {\n @cache\n static get VAR_TOKENS (): Set<TokenType> {\n return new Set([\n ...JsonPathTokenizer.VAR_TOKENS,\n TokenType.DASH,\n ]);\n }\n}\n\nclass HiveTokenizer extends Tokenizer {\n @cache\n static get QUOTES () {\n return [\n '\\'',\n '\"',\n ];\n }\n\n @cache\n static get IDENTIFIERS () {\n return ['`'];\n }\n\n @cache\n static get STRING_ESCAPES () {\n return ['\\\\'];\n }\n\n @cache\n static get SINGLE_TOKENS () {\n return {\n ...Tokenizer.SINGLE_TOKENS,\n $: TokenType.PARAMETER,\n };\n }\n\n @cache\n static get ORIGINAL_KEYWORDS (): Record<string, TokenType> {\n return {\n ...Tokenizer.KEYWORDS,\n 'ADD ARCHIVE': TokenType.COMMAND,\n 'ADD ARCHIVES': TokenType.COMMAND,\n 'ADD FILE': TokenType.COMMAND,\n 'ADD FILES': TokenType.COMMAND,\n 'ADD JAR': TokenType.COMMAND,\n 'ADD JARS': TokenType.COMMAND,\n 'MINUS': TokenType.EXCEPT,\n 'MSCK REPAIR': TokenType.COMMAND,\n 'REFRESH': TokenType.REFRESH,\n 'TIMESTAMP AS OF': TokenType.TIMESTAMP_SNAPSHOT,\n 'VERSION AS OF': TokenType.VERSION_SNAPSHOT,\n 'SERDEPROPERTIES': TokenType.SERDE_PROPERTIES,\n };\n }\n\n @cache\n static get NUMERIC_LITERALS () {\n return {\n L: 'BIGINT',\n S: 'SMALLINT',\n Y: 'TINYINT',\n D: 'DOUBLE',\n F: 'FLOAT',\n BD: 'DECIMAL',\n };\n }\n}\n\nclass HiveParser extends 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.CURRENT_CATALOG,\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 ...Parser.NO_PAREN_FUNCTIONS,\n };\n\n delete noParenFunctions[TokenType.CURRENT_TIME];\n delete noParenFunctions[TokenType.LOCALTIME];\n delete noParenFunctions[TokenType.LOCALTIMESTAMP];\n\n return noParenFunctions;\n }\n\n static LOG_DEFAULTS_TO_LN = true;\n static STRICT_CAST = false;\n static VALUES_FOLLOWED_BY_PAREN = false;\n static JOINS_HAVE_EQUAL_PRECEDENCE = true;\n static ADD_JOIN_ON_TRUE = true;\n static ALTER_TABLE_PARTITIONS = true;\n static CHANGE_COLUMN_ALTER_SYNTAX = false;\n\n @cache\n static get FUNCTION_PARSERS (): Partial<Record<string, (this: Parser) => Expression | undefined>> {\n return {\n ...Parser.FUNCTION_PARSERS,\n PERCENTILE: function (this: Parser) {\n return (this as HiveParser).parseQuantileFunction(QuantileExpr);\n },\n PERCENTILE_APPROX: function (this: Parser) {\n return (this as HiveParser).parseQuantileFunction(ApproxQuantileExpr);\n },\n };\n }\n\n @cache\n static get FUNCTIONS (): Record<string, (expression: Expression[], options: {\n dialect: Dialect;\n }) => Expression> {\n return {\n ...Parser.FUNCTIONS,\n ADD_MONTHS: (args: Expression[]): TsOrDsAddExpr => new TsOrDsAddExpr({\n this: seqGet(args, 0),\n expression: seqGet(args, 1),\n unit: var_('MONTH'),\n }),\n BASE64: (args: unknown[]) => ToBase64Expr.fromArgList(args),\n COLLECT_LIST: (args: Expression[]) => new ArrayAggExpr({\n this: seqGet(args, 0),\n nullsExcluded: true,\n }),\n COLLECT_SET: (args: unknown[]) => ArrayUniqueAggExpr.fromArgList(args),\n DATE_ADD: (args: Expression[]) => new TsOrDsAddExpr({\n this: seqGet(args, 0),\n expression: seqGet(args, 1),\n unit: new VarExpr({\n this: 'DAY',\n }),\n }),\n DATE_FORMAT: (args: Expression[]) => buildFormattedTime(TimeToStrExpr, {\n dialect: 'hive',\n })([\n new TimeStrToTimeExpr({\n this: seqGet(args, 0),\n }),\n seqGet(args, 1),\n ]),\n DATE_SUB: buildDateAdd,\n DATEDIFF: (args: Expression[]) => new DateDiffExpr({\n this: new TsOrDsToDateExpr({\n this: seqGet(args, 0),\n }),\n expression: new TsOrDsToDateExpr({\n this: seqGet(args, 1),\n }),\n }),\n DAY: (args: Expression[]) => new DayExpr({\n this: new TsOrDsToDateExpr({\n this: seqGet(args, 0),\n }),\n }),\n FIRST: buildWithIgnoreNulls(FirstExpr),\n FIRST_VALUE: buildWithIgnoreNulls(FirstValueExpr),\n FROM_UNIXTIME: buildFormattedTime(UnixToStrExpr, {\n dialect: 'hive',\n defaultValue: true,\n }),\n GET_JSON_OBJECT: (args: Expression[], {\n dialect,\n }: {\n dialect: Dialect;\n }) => new JsonExtractScalarExpr({\n this: seqGet(args, 0),\n expression: dialect.toJsonPath(seqGet(args, 1)),\n }),\n LAST: buildWithIgnoreNulls(LastExpr),\n LAST_VALUE: buildWithIgnoreNulls(LastValueExpr),\n MAP: (args: Expression[]) => {\n if (args.length === 1 && args[0].isStar) {\n return new StarMapExpr({\n this: args[0],\n });\n }\n const keys: Expression[] = [];\n const values: Expression[] = [];\n\n for (let i = 0; i < args.length; i += 2) {\n keys.push(args[i]);\n if (args[i + 1]) values.push(args[i + 1]);\n }\n\n return new VarMapExpr({\n keys: new ArrayExpr({\n expressions: keys,\n }),\n values: new ArrayExpr({\n expressions: values,\n }),\n });\n },\n MONTH: (args: Expression[]) => new MonthExpr({\n this: new TsOrDsToDateExpr({\n this: seqGet(args, 0),\n }),\n }),\n REGEXP_EXTRACT: buildRegexpExtract(RegexpExtractExpr),\n REGEXP_EXTRACT_ALL: buildRegexpExtract(RegexpExtractAllExpr),\n SEQUENCE: (args: unknown[]) => GenerateSeriesExpr.fromArgList(args),\n SIZE: (args: unknown[]) => ArraySizeExpr.fromArgList(args),\n SPLIT: (args: unknown[]) => RegexpSplitExpr.fromArgList(args),\n STR_TO_MAP: (args: Expression[]) => new StrToMapExpr({\n this: seqGet(args, 0),\n pairDelim: seqGet(args, 1) || LiteralExpr.string(','),\n keyValueDelim: seqGet(args, 2) || LiteralExpr.string(':'),\n }),\n TO_DATE: buildToDate,\n TO_JSON: (args: unknown[]) => JsonFormatExpr.fromArgList(args),\n TRUNC: (args: unknown[]) => TimestampTruncExpr.fromArgList(args),\n UNBASE64: (args: unknown[]) => FromBase64Expr.fromArgList(args),\n UNIX_TIMESTAMP: (args: Expression[]) => buildFormattedTime(StrToUnixExpr, {\n dialect: 'hive',\n defaultValue: true,\n })(\n 0 < args.length\n ? args\n : [new CurrentTimestampExpr({})],\n ),\n YEAR: (args: Expression[]) => new YearExpr({\n this: new TsOrDsToDateExpr({\n this: seqGet(args, 0),\n }),\n }),\n };\n }\n\n @cache\n static get NO_PAREN_FUNCTION_PARSERS (): Partial<Record<string, (this: Parser) => Expression | undefined>> {\n return {\n ...Parser.NO_PAREN_FUNCTION_PARSERS,\n TRANSFORM: function (this: Parser) {\n return (this as HiveParser).parseTransform();\n },\n };\n }\n\n @cache\n static get PROPERTY_PARSERS (): Record<string, (this: Parser, ...args: unknown[]) => Expression | Expression[] | undefined> {\n return {\n ...Parser.PROPERTY_PARSERS,\n SERDEPROPERTIES: function (this: Parser) {\n return new SerdePropertiesExpr({\n expressions: this.parseWrappedCsv(() => this.parseProperty() as Expression | undefined),\n });\n },\n USING: function (this: Parser) {\n return (this as HiveParser).parseUsingProperty();\n },\n };\n }\n\n @cache\n static get ALTER_PARSERS (): Partial<Record<string, (this: Parser) => Expression | Expression[] | undefined>> {\n return {\n ...Parser.ALTER_PARSERS,\n CHANGE: function (this: Parser) {\n return (this as HiveParser).parseAlterTableChange();\n },\n };\n }\n\n parseTransform (): TransformExpr | QueryTransformExpr | undefined {\n if (!this.match(TokenType.L_PAREN, {\n advance: false,\n })) {\n this.retreat(this.index - 1);\n\n return undefined;\n }\n\n const args = this.parseWrappedCsv(() => (this as HiveParser).parseLambda());\n const rowFormatBefore = (this as HiveParser).parseRowFormat({\n matchRow: true,\n });\n\n let recordWriter: string | Expression | undefined = undefined;\n\n if (this.matchTextSeq('RECORDWRITER')) {\n recordWriter = (this as HiveParser).parseString();\n }\n\n if (!this.match(TokenType.USING)) {\n return TransformExpr.fromArgList(args);\n }\n\n const commandScript = (this as HiveParser).parseString();\n\n this.match(TokenType.ALIAS);\n const schema = this.parseSchema();\n\n const rowFormatAfter = (this as HiveParser).parseRowFormat({\n matchRow: true,\n });\n let recordReader: string | Expression | undefined = undefined;\n\n if (this.matchTextSeq('RECORDREADER')) {\n recordReader = (this as HiveParser).parseString();\n }\n\n return this.expression(QueryTransformExpr, {\n expressions: args,\n commandScript: commandScript,\n schema: schema,\n rowFormatBefore: rowFormatBefore,\n recordWriter: recordWriter,\n rowFormatAfter: rowFormatAfter,\n recordReader: recordReader,\n });\n }\n\n parseQuantileFunction (FuncClass: typeof QuantileExpr | typeof ApproxQuantileExpr): QuantileExpr | ApproxQuantileExpr {\n let firstArg: Expression | undefined;\n\n if (this.match(TokenType.DISTINCT)) {\n firstArg = this.expression(DistinctExpr, {\n expressions: [(this as HiveParser).parseLambda()],\n });\n } else {\n this.match(TokenType.ALL);\n firstArg = (this as HiveParser).parseLambda();\n }\n\n const args = [firstArg];\n\n if (this.match(TokenType.COMMA)) {\n args.push(...this.parseFunctionArgs());\n }\n\n return FuncClass.fromArgList(args);\n }\n\n parseTypes (options: {\n checkFunc?: boolean;\n schema?: boolean;\n allowIdentifiers?: boolean;\n } = {}): Expression | undefined {\n const {\n checkFunc = false, schema = false, allowIdentifiers = true,\n } = options;\n const thisNode = super.parseTypes({\n checkFunc,\n schema,\n allowIdentifiers,\n });\n\n if (thisNode && !schema) {\n return thisNode.transform((node: Expression, _opts: Record<string, unknown>): string | Expression | undefined => {\n if (node instanceof DataTypeExpr && node.isType([\n 'char',\n 'varchar',\n ])) {\n return node.replace(DataTypeExpr.build(DataTypeExprKind.TEXT)) as Expression | undefined;\n }\n\n return node;\n }, {\n copy: false,\n });\n }\n\n return thisNode;\n }\n\n parseUsingProperty (): Expression {\n if (this.matchTexts(['JAR', 'FILE', 'ARCHIVE'])) {\n const kind = (this.prev?.text ?? '').toUpperCase();\n return this.expression(UsingPropertyExpr, {\n this: this.parseString(),\n kind,\n });\n }\n\n return this.parsePropertyAssignment(FileFormatPropertyExpr);\n }\n\n parseAlterTableChange (): Expression | undefined {\n this.match(TokenType.COLUMN);\n const thisNode = this.parseField({\n anyToken: true,\n });\n\n if ((this.constructor as typeof HiveParser).CHANGE_COLUMN_ALTER_SYNTAX && this.matchTextSeq('TYPE')) {\n return this.expression(AlterColumnExpr, {\n this: thisNode,\n dtype: this.parseTypes({\n schema: true,\n }),\n });\n }\n\n const columnNew = this.parseField({\n anyToken: true,\n });\n const dtype = this.parseTypes({\n schema: true,\n });\n\n const comment = this.match(TokenType.COMMENT) && (this as HiveParser).parseString();\n\n if (!thisNode || !columnNew || !dtype) {\n this.raiseError('Expected \\'CHANGE COLUMN\\' to be followed by \\'column_name\\' \\'column_name\\' \\'data_type\\'');\n }\n\n return this.expression(AlterColumnExpr, {\n this: thisNode,\n renameTo: columnNew,\n dtype: dtype,\n comment: comment,\n });\n }\n\n parsePartitionAndOrder (): [Expression[], Expression | undefined] {\n return [\n this.matchSet([\n TokenType.PARTITION_BY,\n TokenType.DISTRIBUTE_BY,\n ])\n ? this.parseCsv(() => this.parseAssignment())\n : [],\n super.parseOrder({\n skipOrderToken: this.match(TokenType.SORT_BY),\n }) ?? undefined,\n ];\n }\n\n parseParameter (): ParameterExpr {\n this.match(TokenType.L_BRACE);\n const thisNode = this.parseIdentifier() || (this as HiveParser).parsePrimaryOrVar();\n const expression =\n this.match(TokenType.COLON) && (this.parseIdentifier() || (this as HiveParser).parsePrimaryOrVar());\n\n this.match(TokenType.R_BRACE);\n\n return this.expression(ParameterExpr, {\n this: thisNode,\n expression: expression,\n });\n }\n\n toPropEq (expression: Expression, index: number): Expression {\n if (expression.isStar) {\n return expression;\n }\n\n let key: ExpressionValue<IdentifierExpr | StarExpr>;\n\n if (expression instanceof ColumnExpr) {\n key = expression.args.this ?? toIdentifier(`col${index + 1}`);\n } else {\n key = toIdentifier(`col${index + 1}`);\n }\n\n return this.expression(PropertyEqExpr, {\n this: key,\n expression: expression,\n });\n }\n\n // port from _Dialect metaclass logic\n @cache\n static get TABLE_ALIAS_TOKENS (): Set<TokenType> {\n return new Set([\n ...Parser.TABLE_ALIAS_TOKENS,\n TokenType.STRAIGHT_JOIN,\n ]);\n }\n}\nclass HiveGenerator extends Generator {\n // port from _Dialect metaclass logic\n static SUPPORTS_DECODE_CASE = false;\n // port from _Dialect metaclass logic\n static readonly SELECT_KINDS: string[] = [];\n // port from _Dialect metaclass logic\n static TRY_SUPPORTED = false;\n // port from _Dialect metaclass logic\n static SUPPORTS_UESCAPE = false;\n static LIMIT_FETCH = 'LIMIT';\n static TABLESAMPLE_WITH_METHOD = false;\n static JOIN_HINTS = false;\n static TABLE_HINTS = false;\n static QUERY_HINTS = false;\n static INDEX_ON = 'ON TABLE';\n static EXTRACT_ALLOWS_QUOTES = false;\n static NVL2_SUPPORTED = false;\n static LAST_DAY_SUPPORTS_DATE_PART = false;\n static JSON_PATH_SINGLE_QUOTE_ESCAPE = true;\n static SAFE_JSON_PATH_KEY_RE = /^[_\\-a-zA-Z][\\-\\w]*$/;\n static SUPPORTS_TO_NUMBER = false;\n static WITH_PROPERTIES_PREFIX = 'TBLPROPERTIES';\n static PARSE_JSON_NAME?: string = undefined;\n static PAD_FILL_PATTERN_IS_REQUIRED = true;\n static SUPPORTS_MEDIAN = false;\n static ARRAY_SIZE_NAME = 'SIZE';\n static ALTER_SET_TYPE = '';\n\n @cache\n static get EXPRESSIONS_WITHOUT_NESTED_CTES () {\n return new Set([\n InsertExpr,\n SelectExpr,\n SubqueryExpr,\n SetOperationExpr,\n ]);\n }\n\n @cache\n static get SUPPORTED_JSON_PATH_PARTS (): Set<typeof Expression> {\n return new Set([\n JsonPathKeyExpr,\n JsonPathRootExpr,\n JsonPathSubscriptExpr,\n JsonPathWildcardExpr,\n ]);\n }\n\n @cache\n static get TYPE_MAPPING () {\n return new Map([\n ...Generator.TYPE_MAPPING,\n [\n DataTypeExprKind.BIT,\n 'BOOLEAN',\n ],\n [\n DataTypeExprKind.BLOB,\n 'BINARY',\n ],\n [\n DataTypeExprKind.DATETIME,\n 'TIMESTAMP',\n ],\n [\n DataTypeExprKind.ROWVERSION,\n 'BINARY',\n ],\n [\n DataTypeExprKind.TEXT,\n 'STRING',\n ],\n [\n DataTypeExprKind.TIME,\n 'TIMESTAMP',\n ],\n [\n DataTypeExprKind.TIMESTAMPNTZ,\n 'TIMESTAMP',\n ],\n [\n DataTypeExprKind.TIMESTAMPTZ,\n 'TIMESTAMP',\n ],\n [\n DataTypeExprKind.UTINYINT,\n 'SMALLINT',\n ],\n [\n DataTypeExprKind.VARBINARY,\n 'BINARY',\n ],\n ]);\n }\n\n @cache\n\n static get ORIGINAL_TRANSFORMS (): Map<typeof Expression, (this: Generator, e: any) => string> {\n\n const transforms = new Map<typeof Expression, (this: Generator, e: any) => string>([\n ...Generator.TRANSFORMS,\n [\n PropertyExpr,\n propertySql,\n ],\n [\n AnyValueExpr,\n renameFunc('FIRST'),\n ],\n [\n ApproxDistinctExpr,\n approxCountDistinctSql,\n ],\n [\n ArgMaxExpr,\n argMaxOrMinNoCount('MAX_BY'),\n ],\n [\n ArgMinExpr,\n argMaxOrMinNoCount('MIN_BY'),\n ],\n [\n ArrayExpr,\n preprocess([inheritStructFieldNames]),\n ],\n [\n ArrayConcatExpr,\n renameFunc('CONCAT'),\n ],\n [\n ArrayToStringExpr,\n function (this: Generator, e: ArrayToStringExpr) {\n return this.func('CONCAT_WS', [\n e.args.expression,\n e.args.this,\n ]);\n },\n ],\n [\n ArraySortExpr,\n function (this: Generator, e: ArraySortExpr) {\n return arraySortSql.call(this as HiveGenerator, e);\n },\n ],\n [\n WithExpr,\n noRecursiveCteSql,\n ],\n [\n DateAddExpr,\n function (this: Generator, e: DateAddExpr) {\n return addDateSql.call(this as HiveGenerator, e);\n },\n ],\n [\n DateDiffExpr,\n function (this: Generator, e: DateDiffExpr) {\n return dateDiffSql.call(this as HiveGenerator, e);\n },\n ],\n [\n DateStrToDateExpr,\n dateStrToDateSql,\n ],\n [\n DateSubExpr,\n function (this: Generator, e: DateSubExpr) {\n return addDateSql.call(this as HiveGenerator, e);\n },\n ],\n [\n DateToDiExpr,\n function (this: Generator, e: DateToDiExpr) {\n return `CAST(DATE_FORMAT(${this.sql(e, 'this')}, ${Hive.DATEINT_FORMAT}) AS INT)`;\n },\n ],\n [\n DiToDateExpr,\n function (this: Generator, e: DiToDateExpr) {\n return `TO_DATE(CAST(${this.sql(e, 'this')} AS STRING), ${Hive.DATEINT_FORMAT})`;\n },\n ],\n [\n StorageHandlerPropertyExpr,\n function (this: Generator, e: StorageHandlerPropertyExpr) {\n return `STORED BY ${this.sql(e, 'this')}`;\n },\n ],\n [\n FromBase64Expr,\n renameFunc('UNBASE64'),\n ],\n [\n GenerateSeriesExpr,\n sequenceSql,\n ],\n [\n GenerateDateArrayExpr,\n sequenceSql,\n ],\n [\n IfExpr,\n ifSql(),\n ],\n [\n ILikeExpr,\n noIlikeSql,\n ],\n [\n IntDivExpr,\n function (this: Generator, e: IntDivExpr) {\n return this.binary(e, 'DIV');\n },\n ],\n [\n IsNanExpr,\n renameFunc('ISNAN'),\n ],\n [\n JsonExtractExpr,\n function (this: Generator, e: JsonExtractExpr) {\n return this.func('GET_JSON_OBJECT', [\n e.args.this,\n e.args.expression,\n ]);\n },\n ],\n [\n JsonExtractScalarExpr,\n function (this: Generator, e: JsonExtractScalarExpr) {\n return this.func('GET_JSON_OBJECT', [\n e.args.this,\n e.args.expression,\n ]);\n },\n ],\n [\n JsonFormatExpr,\n function (this: Generator, e: JsonFormatExpr) {\n return jsonFormatSql.call(this as HiveGenerator, e);\n },\n ],\n [\n LeftExpr,\n leftToSubstringSql,\n ],\n [\n MapExpr,\n varMapSql,\n ],\n [\n MaxExpr,\n maxOrGreatest,\n ],\n [\n Md5DigestExpr,\n function (this: Generator, e: Md5DigestExpr) {\n return this.func('UNHEX', [this.func('MD5', [e.args.this])]);\n },\n ],\n [\n MinExpr,\n minOrLeast,\n ],\n [\n MonthsBetweenExpr,\n function (this: Generator, e: MonthsBetweenExpr) {\n return this.func('MONTHS_BETWEEN', [\n e.args.this,\n e.args.expression,\n ]);\n },\n ],\n [\n NotNullColumnConstraintExpr,\n function (this: Generator, e: NotNullColumnConstraintExpr) {\n return e.args.allowNull ? '' : 'NOT NULL';\n },\n ],\n [\n VarMapExpr,\n varMapSql,\n ],\n [\n CreateExpr,\n preprocess([\n removeUniqueConstraints,\n ctasWithTmpTablesToCreateTmpView,\n moveSchemaColumnsToPartitionedBy,\n ]),\n ],\n [\n QuantileExpr,\n renameFunc('PERCENTILE'),\n ],\n [\n ApproxQuantileExpr,\n renameFunc('PERCENTILE_APPROX'),\n ],\n [\n RegexpExtractExpr,\n regexpExtractSql,\n ],\n [\n RegexpExtractAllExpr,\n regexpExtractSql,\n ],\n [\n RegexpReplaceExpr,\n regexpReplaceSql,\n ],\n [\n RegexpLikeExpr,\n function (this: Generator, e: RegexpLikeExpr) {\n return this.binary(e, 'RLIKE');\n },\n ],\n [\n RegexpSplitExpr,\n renameFunc('SPLIT'),\n ],\n [\n RightExpr,\n rightToSubstringSql,\n ],\n [\n SchemaCommentPropertyExpr,\n function (this: Generator, e: SchemaCommentPropertyExpr) {\n return this.nakedProperty(e);\n },\n ],\n [\n ArrayUniqueAggExpr,\n renameFunc('COLLECT_SET'),\n ],\n [\n SplitExpr,\n function (this: Generator, e: SplitExpr) {\n return this.func('SPLIT', [\n e.args.this,\n this.func('CONCAT', [\n LiteralExpr.string('\\\\Q'),\n e.args.expression,\n LiteralExpr.string('\\\\E'),\n ]),\n ]);\n },\n ],\n [\n SelectExpr,\n preprocess([\n eliminateQualify,\n eliminateDistinctOn,\n (e: Expression) => unnestToExplode(e, {\n unnestUsingArraysZip: false,\n }),\n anyToExists,\n ]),\n ],\n [\n StrPositionExpr,\n function (this: Generator, e: StrPositionExpr) {\n return strPositionSql.call(this, e, {\n funcName: 'LOCATE',\n supportsPosition: true,\n });\n },\n ],\n [\n StrToDateExpr,\n function (this: Generator, e: StrToDateExpr) {\n return strToDateSql.call(this as HiveGenerator, e);\n },\n ],\n [\n StrToTimeExpr,\n function (this: Generator, e: StrToTimeExpr) {\n return strToTimeSql.call(this as HiveGenerator, e);\n },\n ],\n [\n StrToUnixExpr,\n function (this: Generator, e: StrToUnixExpr) {\n return strToUnixSql.call(this as HiveGenerator, e);\n },\n ],\n [\n StructExtractExpr,\n structExtractSql,\n ],\n [\n StarMapExpr,\n renameFunc('MAP'),\n ],\n [\n TableExpr,\n preprocess([unnestGenerateSeries]),\n ],\n [\n TimeStrToDateExpr,\n renameFunc('TO_DATE'),\n ],\n [\n TimeStrToTimeExpr,\n timeStrToTimeSql,\n ],\n [\n TimeStrToUnixExpr,\n renameFunc('UNIX_TIMESTAMP'),\n ],\n [\n TimestampTruncExpr,\n function (this: Generator, e: TimestampTruncExpr) {\n return this.func('TRUNC', [\n e.args.this,\n unitToStr(e),\n ]);\n },\n ],\n [\n TimeToUnixExpr,\n renameFunc('UNIX_TIMESTAMP'),\n ],\n [\n ToBase64Expr,\n renameFunc('BASE64'),\n ],\n [\n TsOrDiToDiExpr,\n function (this: Generator, e: TsOrDiToDiExpr) {\n return `CAST(SUBSTR(REPLACE(CAST(${this.sql(e, 'this')} AS STRING), '-', ''), 1, 8) AS INT)`;\n },\n ],\n [\n TsOrDsAddExpr,\n function (this: Generator, e: TsOrDsAddExpr) {\n return addDateSql.call(this as HiveGenerator, e);\n },\n ],\n [\n TsOrDsDiffExpr,\n function (this: Generator, e: TsOrDsDiffExpr) {\n return dateDiffSql.call(this as HiveGenerator, e);\n },\n ],\n [\n TsOrDsToDateExpr,\n function (this: Generator, e: TsOrDsToDateExpr) {\n return toDateSql.call(this as HiveGenerator, e);\n },\n ],\n [\n TryCastExpr,\n noTrycastSql,\n ],\n [\n TrimExpr,\n trimSql,\n ],\n [\n UnicodeExpr,\n renameFunc('ASCII'),\n ],\n [\n UnixToStrExpr,\n function (this: Generator, e: UnixToStrExpr) {\n return this.func('FROM_UNIXTIME', [\n e.args.this,\n timeFormat('hive').call(this, e),\n ]);\n },\n ],\n [\n UnixToTimeExpr,\n function (this: Generator, e: UnixToTimeExpr) {\n return unixToTimeSql.call(this as HiveGenerator, e);\n },\n ],\n [\n UnixToTimeStrExpr,\n renameFunc('FROM_UNIXTIME'),\n ],\n [\n PartitionedByPropertyExpr,\n function (this: Generator, e: PartitionedByPropertyExpr) {\n return `PARTITIONED BY ${this.sql(e, 'this')}`;\n },\n ],\n [\n NumberToStrExpr,\n renameFunc('FORMAT_NUMBER'),\n ],\n [\n NationalExpr,\n function (this: Generator, e: NationalExpr) {\n return this.nationalSql(e, {\n prefix: '',\n });\n },\n ],\n [\n ClusteredColumnConstraintExpr,\n function (this: Generator, e: ClusteredColumnConstraintExpr) {\n return `(${this.expressions(e, {\n key: 'this',\n indent: false,\n })})`;\n },\n ],\n [\n NonClusteredColumnConstraintExpr,\n function (this: Generator, e: NonClusteredColumnConstraintExpr) {\n return `(${this.expressions(e, {\n key: 'this',\n indent: false,\n })})`;\n },\n ],\n [\n NotForReplicationColumnConstraintExpr,\n () => '',\n ],\n [\n OnPropertyExpr,\n () => '',\n ],\n [\n PartitionedByBucketExpr,\n function (this: Generator, e: PartitionedByBucketExpr) {\n return this.func('BUCKET', [\n e.args.expression,\n e.args.this,\n ]);\n },\n ],\n [\n PartitionByTruncateExpr,\n function (this: Generator, e: PartitionByTruncateExpr) {\n return this.func('TRUNCATE', [\n e.args.expression,\n e.args.this,\n ]);\n },\n ],\n [\n PrimaryKeyColumnConstraintExpr,\n () => 'PRIMARY KEY',\n ],\n [\n WeekOfYearExpr,\n renameFunc('WEEKOFYEAR'),\n ],\n [\n DayOfMonthExpr,\n renameFunc('DAYOFMONTH'),\n ],\n [\n DayOfWeekExpr,\n renameFunc('DAYOFWEEK'),\n ],\n [\n LevenshteinExpr,\n function (this: Generator, e: Expression) {\n unsupportedArgs.call(this, e, 'insCost', 'delCost', 'subCost', 'maxDist');\n\n return renameFunc('LEVENSHTEIN').call(this, e);\n },\n ],\n ]);\n\n return transforms;\n }\n\n @cache\n static get PROPERTIES_LOCATION (): Map<typeof Expression, PropertiesLocation> {\n return new Map([\n ...Generator.PROPERTIES_LOCATION,\n [\n FileFormatPropertyExpr,\n PropertiesLocation.POST_SCHEMA,\n ],\n [\n PartitionedByPropertyExpr,\n PropertiesLocation.POST_SCHEMA,\n ],\n [\n VolatilePropertyExpr,\n PropertiesLocation.UNSUPPORTED,\n ],\n [\n WithDataPropertyExpr,\n PropertiesLocation.UNSUPPORTED,\n ],\n ] as [typeof Expression, PropertiesLocation][]);\n }\n\n @cache\n static get TS_OR_DS_EXPRESSIONS (): Set<typeof Expression> {\n return new Set([\n DateDiffExpr,\n DayExpr,\n MonthExpr,\n YearExpr,\n ]);\n }\n\n static IGNORE_NULLS_FUNCS: (typeof Expression)[] = [\n FirstExpr,\n LastExpr,\n FirstValueExpr,\n LastValueExpr,\n ];\n\n ignoreNullsSql (expression: IgnoreNullsExpr): string {\n const thisExpr = expression.args.this;\n\n if ((this._constructor as typeof HiveGenerator).IGNORE_NULLS_FUNCS.some((cls) => thisExpr instanceof cls)) {\n return this.func((thisExpr!._constructor as any).sqlNames()[0], [\n thisExpr!.args.this,\n true_(),\n ]);\n }\n\n return super.ignoreNullsSql(expression);\n }\n\n unnestSql (expression: UnnestExpr): string {\n return renameFunc('EXPLODE').call(this, expression);\n }\n\n jsonPathKeySql (expression: JsonPathKeyExpr): string {\n if (expression.args.this instanceof JsonPathWildcardExpr) {\n this.unsupported('Unsupported wildcard in JSONPathKey expression');\n\n return '';\n }\n\n return super.jsonPathKeySql(expression);\n }\n\n parameterSql (expression: ParameterExpr): string {\n let thisSql = this.sql(expression, 'this');\n const expressionSql = this.sql(expression, 'expression');\n\n const parent = expression.parent;\n\n thisSql = expressionSql ? `${thisSql}:${expressionSql}` : thisSql;\n\n if (parent instanceof EqExpr && parent.parent instanceof SetItemExpr) {\n return thisSql;\n }\n\n return `\\${${thisSql}}`;\n }\n\n schemaSql (expression: SchemaExpr): string {\n for (const ordered of expression.findAll(OrderedExpr)) {\n if (ordered.args.desc === false) {\n ordered.setArgKey('desc', undefined);\n }\n }\n\n return super.schemaSql(expression);\n }\n\n constraintSql (expression: ConstraintExpr): string {\n for (const prop of Array.from(expression.findAll(PropertiesExpr))) {\n prop.pop();\n }\n\n const thisSql = this.sql(expression, 'this');\n const expressions = this.expressions(expression, {\n sep: ' ',\n flat: true,\n });\n\n return `CONSTRAINT ${thisSql} ${expressions}`;\n }\n\n rowFormatSerdePropertySql (expression: RowFormatSerdePropertyExpr): string {\n let serdeProps = this.sql(expression, 'serdeProperties');\n\n serdeProps = serdeProps ? ` ${serdeProps}` : '';\n\n return `ROW FORMAT SERDE ${this.sql(expression, 'this')}${serdeProps}`;\n }\n\n arrayAggSql (expression: ArrayAggExpr): string {\n return this.func(\n 'COLLECT_LIST',\n [expression.args.this instanceof OrderExpr ? expression.args.this.args.this : expression.args.this],\n );\n }\n\n // Hive/Spark lack native numeric TRUNC. CAST to BIGINT truncates toward zero (not rounds)\n // Potential enhancement: a TRUNC_TEMPLATE using FLOOR/CEIL with scale (Spark 3.3+)\n // could preserve decimals: CASE WHEN x >= 0 THEN FLOOR(x, d) ELSE CEIL(x, d) END\n truncSql (expression: TruncExpr): string {\n unsupportedArgs.call(this, expression, 'decimals');\n\n return this.sql(new CastExpr({\n this: expression.args.this,\n to: DataTypeExpr.build('bigint'),\n }));\n }\n\n dataTypeSql (expression: DataTypeExpr): string {\n if (\n expression.isType(Generator.PARAMETERIZABLE_TEXT_TYPES)\n && (!expression.args.expressions || (expression.args.expressions[0] as IdentifierExpr).name === 'MAX')\n ) {\n expression = DataTypeExpr.build(DataTypeExprKind.TEXT) ?? expression;\n } else if (expression.isType(DataTypeExprKind.TEXT) && expression.args.expressions) {\n expression.setArgKey('this', DataTypeExprKind.VARCHAR);\n } else if (expression.isType(DataTypeExpr.TEMPORAL_TYPES)) {\n expression = DataTypeExpr.build(expression.args.this) ?? expression;\n } else if (expression.isType('float')) {\n const sizeExpression = expression.find(DataTypeParamExpr);\n\n if (sizeExpression instanceof DataTypeParamExpr) {\n const size = parseInt(sizeExpression.args.this?.args.this?.toString() ?? '0');\n\n expression = (size <= 32 ? DataTypeExpr.build(DataTypeExprKind.FLOAT) : DataTypeExpr.build(DataTypeExprKind.DOUBLE)) ?? expression;\n }\n }\n\n return super.dataTypeSql(expression);\n }\n\n versionSql (expression: VersionExpr): string {\n const sql = super.versionSql(expression);\n\n return sql.replace('FOR ', '');\n }\n\n structSql (expression: StructExpr): string {\n const values: (string | Expression)[] = [];\n\n expression.args.expressions?.forEach((e) => {\n if (e instanceof PropertyEqExpr) {\n this.unsupported('Hive does not support named structs.');\n const exprVal = e.args.expression;\n\n values.push((exprVal instanceof Expression || typeof exprVal === 'string') ? exprVal : '');\n } else {\n values.push(e);\n }\n });\n\n return this.func('STRUCT', values);\n }\n\n columnDefSql (expression: ColumnDefExpr, options: {\n sep?: string;\n } = {}): string {\n const {\n sep = ' ',\n } = options;\n\n return super.columnDefSql(expression, {\n sep:\n expression.parent instanceof DataTypeExpr && expression.parent.isType('struct')\n ? ': '\n : sep,\n });\n }\n\n alterColumnSql (expression: AlterColumnExpr): string {\n const thisSql = this.sql(expression, 'this');\n const newName = this.sql(expression, 'renameTo') || thisSql;\n const dtype = this.sql(expression, 'dtype');\n const commentSql = this.sql(expression, 'comment');\n const comment = commentSql ? ` COMMENT ${commentSql}` : '';\n\n const defaultVal = this.sql(expression, 'default');\n const visible = expression.args.visible;\n const allowNoNull = expression.args.allowNull;\n const drop = expression.args.drop;\n\n if (defaultVal || drop || visible || allowNoNull) {\n this.unsupported('Unsupported CHANGE COLUMN syntax');\n }\n\n if (!dtype) {\n this.unsupported('CHANGE COLUMN without a type is not supported');\n }\n\n return `CHANGE COLUMN ${thisSql} ${newName} ${dtype}${comment}`;\n }\n\n renameColumnSql (_expr: Expression): string {\n this.unsupported('Cannot rename columns without data type defined in Hive');\n\n return '';\n }\n\n alterSetSql (expression: AlterSetExpr): string {\n let exprs = this.expressions(expression, {\n flat: true,\n });\n\n exprs = exprs ? ` ${exprs}` : '';\n\n let location = this.sql(expression, 'location');\n\n location = location ? ` LOCATION ${location}` : '';\n\n let fileFormat = this.expressions(expression, {\n key: 'fileFormat',\n flat: true,\n sep: ' ',\n });\n\n fileFormat = fileFormat ? ` FILEFORMAT ${fileFormat}` : '';\n\n let serde = this.sql(expression, 'serde');\n\n serde = serde ? ` SERDE ${serde}` : '';\n\n let tags = this.expressions(expression, {\n key: 'tag',\n flat: true,\n sep: '',\n });\n\n tags = tags ? ` TAGS ${tags}` : '';\n\n return `SET${serde}${exprs}${location}${fileFormat}${tags}`;\n }\n\n serdePropertiesSql (expression: SerdePropertiesExpr): string {\n const prefix = expression.args.with ? 'WITH ' : '';\n const exprs = this.expressions(expression, {\n flat: true,\n });\n\n return `${prefix}SERDEPROPERTIES (${exprs})`;\n }\n\n existsSql (expression: ExistsExpr): string {\n if (expression.args.expression) {\n return this.functionFallbackSql(expression);\n }\n\n return super.existsSql(expression);\n }\n\n timeToStrSql (expression: TimeToStrExpr): string {\n let thisNode = expression.args.this;\n\n if (thisNode instanceof TimeStrToTimeExpr) {\n thisNode = thisNode.args.this;\n }\n\n return this.func('DATE_FORMAT', [\n thisNode,\n this.formatTime(expression),\n ]);\n }\n\n fileFormatPropertySql (expression: FileFormatPropertyExpr): string {\n let thisSql: string;\n\n if (expression.args.this instanceof InputOutputFormatExpr) {\n thisSql = this.sql(expression, 'this');\n } else {\n thisSql = expression.name.toUpperCase();\n }\n\n return `STORED AS ${thisSql}`;\n }\n}\n\nexport class Hive extends Dialect {\n static DIALECT_NAME = Dialects.HIVE;\n static ALIAS_POST_TABLESAMPLE = true;\n static IDENTIFIERS_CAN_START_WITH_DIGIT = true;\n static SUPPORTS_USER_DEFINED_TYPES = false;\n\n static get EXPRESSION_METADATA () {\n return new Map(HiveTyping.EXPRESSION_METADATA);\n }\n\n @cache\n static get COERCES_TO (): Map<DataTypeExprKind, Set<DataTypeExprKind>> {\n const coercesTo = new Map(TypeAnnotator.COERCES_TO);\n\n for (const targetType of [\n ...DataTypeExpr.NUMERIC_TYPES,\n ...DataTypeExpr.TEMPORAL_TYPES,\n DataTypeExprKind.INTERVAL,\n ]) {\n const existing = coercesTo.get(targetType as DataTypeExprKind) ?? new Set<DataTypeExprKind>();\n\n coercesTo.set(targetType as DataTypeExprKind, new Set([\n ...existing,\n ...DataTypeExpr.TEXT_TYPES,\n ]));\n }\n\n return coercesTo;\n }\n\n static JsonPathTokenizer = HiveJsonPathTokenizer;\n\n static SAFE_DIVISION = true;\n static ARRAY_AGG_INCLUDES_NULLS = undefined;\n static REGEXP_EXTRACT_DEFAULT_GROUP = 1;\n static ALTER_TABLE_SUPPORTS_CASCADE = true;\n\n @cache\n static get NORMALIZATION_STRATEGY () {\n return NormalizationStrategy.CASE_INSENSITIVE;\n }\n\n static INITCAP_DEFAULT_DELIMITER_CHARS = ' \\t\\n\\r\\f\\u000b\\u001c\\u001d\\u001e\\u001f';\n\n @cache\n static get TIME_MAPPING () {\n return {\n y: '%Y',\n Y: '%Y',\n YYYY: '%Y',\n yyyy: '%Y',\n YY: '%y',\n yy: '%y',\n MMMM: '%B',\n MMM: '%b',\n MM: '%m',\n M: '%-m',\n dd: '%d',\n d: '%-d',\n HH: '%H',\n H: '%-H',\n hh: '%I',\n h: '%-I',\n mm: '%M',\n m: '%-M',\n ss: '%S',\n s: '%-S',\n SSSSSS: '%f',\n a: '%p',\n DD: '%j',\n D: '%-j',\n E: '%a',\n EE: '%a',\n EEE: '%a',\n EEEE: '%A',\n z: '%Z',\n Z: '%z',\n };\n }\n\n static DATE_FORMAT = '\\'yyyy-MM-dd\\'';\n static DATEINT_FORMAT = '\\'yyyyMMdd\\'';\n static TIME_FORMAT = '\\'yyyy-MM-dd HH:mm:ss\\'';\n\n static Tokenizer = HiveTokenizer;\n static Parser = HiveParser;\n static Generator = HiveGenerator;\n}\n"]}
@@ -1,2 +1,2 @@
1
- import{a as w}from"./chunk-SR5T64DP.js";import{Bl as T,Ek as c,Em as d,Im as B,Tl as f,a as e,b as a,c as i,d as E,dn as I,e as x,eq as D,fm as y,go as M,os as l,pk as A,ps as N,qs as g,rq as R,s as m,wl as u}from"./chunk-NNPDC7K7.js";var O,p;O=[m];var t=class t{static get EXPRESSION_METADATA(){let r=new Map(w.EXPRESSION_METADATA),o=e((s,n)=>{for(let z of s)r.set(z,n)},"extend");return o([A],{returns:"double"}),o([y,B,R],{returns:"varchar"}),o([u,T,l,N,g,D],{annotator:e((s,n)=>s.annotateByArgs(n,["this"]),"annotator")}),r.set(c,{returns:"bigint"}),r.set(d,{returns:"timestampntz"}),r.set(M,{returns:"binary"}),r.set(I,{returns:"date"}),r.set(f,{returns:"int"}),r}};p=a(null),x(p,10,"EXPRESSION_METADATA",O,t),i(p,t),E(p,3,t),e(t,"SparkTyping");var C=t;export{C as a};
2
- //# sourceMappingURL=chunk-XV77F2MB.js.map
1
+ import{a as w}from"./chunk-VPSZVDXD.js";import{As as g,Bq as R,El as T,Hk as c,Hm as d,Lm as B,Wl as f,a as e,b as a,c as i,d as E,e as x,gn as I,im as y,iq as D,jo as M,s as m,sk as A,ys as l,zl as u,zs as N}from"./chunk-GEUMLY2I.js";var O,p;O=[m];var t=class t{static get EXPRESSION_METADATA(){let r=new Map(w.EXPRESSION_METADATA),o=e((s,n)=>{for(let z of s)r.set(z,n)},"extend");return o([A],{returns:"double"}),o([y,B,R],{returns:"varchar"}),o([u,T,l,N,g,D],{annotator:e((s,n)=>s.annotateByArgs(n,["this"]),"annotator")}),r.set(c,{returns:"bigint"}),r.set(d,{returns:"timestampntz"}),r.set(M,{returns:"binary"}),r.set(I,{returns:"date"}),r.set(f,{returns:"int"}),r}};p=a(null),x(p,10,"EXPRESSION_METADATA",O,t),i(p,t),E(p,3,t),e(t,"SparkTyping");var C=t;export{C as a};
2
+ //# sourceMappingURL=chunk-L2R2F5EJ.js.map
@@ -1,2 +1,2 @@
1
- import{Ao as N,Bk as A,Bp as F,Br as H,Em as T,Jn as R,Mv as Y,No as D,On as S,Wm as y,Xp as W,Ym as M,Zn as h,a as o,b as E,c as n,d as x,e as i,en as I,es as U,fn as c,ft as X,gn as d,hn as u,jk as f,jn as l,js as V,oq as C,s as m,vn as O,yo as B,yp as P,zo as L,zp as w}from"./chunk-NNPDC7K7.js";var v,s;v=[m];var t=class t{static get EXPRESSION_METADATA(){let r=new Map(Y.EXPRESSION_METADATA),e=o((p,a)=>{for(let z of p)r.set(z,a)},"extend");return e([F,M,S,d,I,c,u,O,B,w,L,W,C,N,U,V],{returns:"bigint"}),e([X,h],{returns:"int128"}),e([f,A,H],{returns:"double"}),e([D,P],{returns:"varchar"}),r.set(y,{annotator:o((p,a)=>p.annotateByArgs(a,["expression"]),"annotator")}),r.set(T,{returns:"timestamp"}),r.set(l,{returns:"interval"}),r.set(R,{returns:"time"}),r}};s=E(null),i(s,10,"EXPRESSION_METADATA",v,t),n(s,t),x(s,3,t),o(t,"DuckDbTyping");var g=t;export{g as a};
2
- //# sourceMappingURL=chunk-4UJWN7AG.js.map
1
+ import{$m as M,$p as W,Bo as B,Co as L,Cp as P,Do as N,Dp as w,Ek as A,Fp as F,Hm as T,Lr as H,Mn as R,Qo as D,Rn as S,Wv as Y,Zm as y,a as o,ao as h,b as E,c as n,d as x,e as i,hn as I,in as c,jn as d,kn as u,mk as f,mn as l,os as U,pt as X,s as m,ts as V,yn as O,yq as C}from"./chunk-GEUMLY2I.js";var v,s;v=[m];var t=class t{static get EXPRESSION_METADATA(){let r=new Map(Y.EXPRESSION_METADATA),e=o((p,a)=>{for(let z of p)r.set(z,a)},"extend");return e([F,M,S,d,I,c,u,O,B,w,L,W,C,N,U,V],{returns:"bigint"}),e([X,h],{returns:"int128"}),e([f,A,H],{returns:"double"}),e([D,P],{returns:"varchar"}),r.set(y,{annotator:o((p,a)=>p.annotateByArgs(a,["expression"]),"annotator")}),r.set(T,{returns:"timestamp"}),r.set(l,{returns:"interval"}),r.set(R,{returns:"time"}),r}};s=E(null),i(s,10,"EXPRESSION_METADATA",v,t),n(s,t),x(s,3,t),o(t,"DuckDbTyping");var g=t;export{g as a};
2
+ //# sourceMappingURL=chunk-M2CBQKC3.js.map
@@ -1,2 +1,2 @@
1
- import{Ao as S,Bt as X,Eo as D,Eq as N,Gq as g,Gr as w,Hq as O,Km as d,Lm as f,Mv as b,Nl as y,Or as q,Un as T,Xp as h,Zn as I,Zp as C,a as e,ar as Q,b as s,bu as Y,c as x,cs as G,d as E,e as A,fs as P,hm as m,nn as R,pr as U,s as i,sm as l,vo as B,xl as c,yl as u,yp as M}from"./chunk-NNPDC7K7.js";var z,a;z=[i];var p=class p{static get EXPRESSION_METADATA(){let o=new Map(b.EXPRESSION_METADATA),n=e((r,t)=>{for(let F of r)o.set(F,t)},"extend");return n([T,q],{returns:"binary"}),n([G,R],{returns:"double"}),n([C,w,l,f,d,B,P,g,O,Q],{returns:"varchar"}),n([U,I],{returns:"bigint"}),n([h,S],{returns:"int"}),n([c,u,M],{annotator:e((r,t)=>r.annotateByArgs(t,["this"]),"annotator")}),o.set(Y,{annotator:e((r,t)=>r.annotateByArgs(t,["quantile"]),"annotator")}),o.set(y,{annotator:e((r,t)=>r.annotateByArgs(t,["expressions"]),"annotator")}),o.set(m,{annotator:e((r,t)=>r.annotateByArgs(t,["this","expressions"],{promote:!0}),"annotator")}),o.set(D,{annotator:e((r,t)=>r.annotateByArgs(t,["true","false"],{promote:!0}),"annotator")}),o.set(X,{annotator:e((r,t)=>r.annotateByArgs(t,["quantile"]),"annotator")}),o.set(N,{returns:"ARRAY<STRING>"}),o}};a=s(null),A(a,10,"EXPRESSION_METADATA",z,p),x(a,p),E(a,3,p),e(p,"HiveTyping");var k=p;export{k as a};
2
- //# sourceMappingURL=chunk-P6YCSUUX.js.map
1
+ import{$p as h,Al as c,Bl as u,Cp as M,Do as S,Ho as D,Lt as X,Nm as d,Om as f,Oq as N,Ql as y,Qq as g,Qr as w,Rq as O,Wv as b,Xn as T,Yr as q,a as e,ao as I,b as s,bq as C,c as x,d as E,e as A,km as m,kr as Q,lu as Y,ms as G,ps as P,qn as R,s as i,vm as l,yo as B,zr as U}from"./chunk-GEUMLY2I.js";var z,a;z=[i];var p=class p{static get EXPRESSION_METADATA(){let o=new Map(b.EXPRESSION_METADATA),n=e((r,t)=>{for(let F of r)o.set(F,t)},"extend");return n([T,q],{returns:"binary"}),n([G,R],{returns:"double"}),n([C,w,l,f,d,B,P,g,O,Q],{returns:"varchar"}),n([U,I],{returns:"bigint"}),n([h,S],{returns:"int"}),n([c,u,M],{annotator:e((r,t)=>r.annotateByArgs(t,["this"]),"annotator")}),o.set(Y,{annotator:e((r,t)=>r.annotateByArgs(t,["quantile"]),"annotator")}),o.set(y,{annotator:e((r,t)=>r.annotateByArgs(t,["expressions"]),"annotator")}),o.set(m,{annotator:e((r,t)=>r.annotateByArgs(t,["this","expressions"],{promote:!0}),"annotator")}),o.set(D,{annotator:e((r,t)=>r.annotateByArgs(t,["true","false"],{promote:!0}),"annotator")}),o.set(X,{annotator:e((r,t)=>r.annotateByArgs(t,["quantile"]),"annotator")}),o.set(N,{returns:"ARRAY<STRING>"}),o}};a=s(null),A(a,10,"EXPRESSION_METADATA",z,p),x(a,p),E(a,3,p),e(p,"HiveTyping");var k=p;export{k as a};
2
+ //# sourceMappingURL=chunk-MSMEPN6I.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE4WQOMI7cjs = require('./chunk-E4WQOMI7.cjs');var w,n;w=[_chunkE4WQOMI7cjs.s];var r=class r{static get EXPRESSION_METADATA(){let t=new Map(_chunkE4WQOMI7cjs.Wv.EXPRESSION_METADATA),o=_chunkE4WQOMI7cjs.a.call(void 0, (s,p)=>{for(let z of s)t.set(z,p)},"extend");return o([_chunkE4WQOMI7cjs.gk,_chunkE4WQOMI7cjs.ik,_chunkE4WQOMI7cjs.kk,_chunkE4WQOMI7cjs.mk,_chunkE4WQOMI7cjs.pk,_chunkE4WQOMI7cjs.nk,_chunkE4WQOMI7cjs.uk,_chunkE4WQOMI7cjs.wk],{returns:"float"}),o([_chunkE4WQOMI7cjs.kr,_chunkE4WQOMI7cjs.Gr],{returns:"varchar"}),o([_chunkE4WQOMI7cjs.yk,_chunkE4WQOMI7cjs.Sq],{annotator:_chunkE4WQOMI7cjs.a.call(void 0, (s,p)=>s.annotateByArgs(p,["this"]),"annotator")}),t.set(_chunkE4WQOMI7cjs.Lm,{returns:"nvarchar"}),t.set(_chunkE4WQOMI7cjs.Jm,{returns:"datetime"}),t}};n=_chunkE4WQOMI7cjs.b.call(void 0, null),_chunkE4WQOMI7cjs.e.call(void 0, n,10,"EXPRESSION_METADATA",w,r),_chunkE4WQOMI7cjs.c.call(void 0, n,r),_chunkE4WQOMI7cjs.d.call(void 0, n,3,r),_chunkE4WQOMI7cjs.a.call(void 0, r,"TSQLTyping");var h=r;exports.a = h;
2
+ //# sourceMappingURL=chunk-PHPGL3PR.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-7SURY7NK.cjs","../src/typing/tsql.ts"],"names":["_EXPRESSION_METADATA_dec","_init","cache","_TSQLTyping","map","DialectTyping","extend","__name","types","data","type","AcosExpr","AsinExpr","AtanExpr","Atan2Expr","CosExpr","CotExpr","SinExpr","TanExpr","SoundexExpr","StuffExpr","DegreesExpr","RadiansExpr","e","CurrentTimezoneExpr","CurrentTimestampExpr","__decoratorStart","__decorateElement","__decoratorMetadata","__runInitializers","TSQLTyping"],"mappings":"AAAA,iIAAmM,ICAnMA,CAAAA,CAAAC,CAAAA,CAoCED,CAAAA,CAAA,CAACE,mBAAAA,CAAAA,CADI,IAAMC,CAAAA,CAAN,MAAMA,CAAW,CAEtB,OAAA,IAAW,mBAAA,CAAA,CAA2C,CAEpD,IAAMC,CAAAA,CAA0B,IAAI,GAAA,CAAIC,oBAAAA,CAAc,mBAAmB,CAAA,CAEnEC,CAAAA,CAASC,iCAAAA,CAACC,CAAAA,CAA8BC,CAAAA,CAAAA,EAAkC,CAC9E,GAAA,CAAA,IAAWC,EAAAA,GAAQF,CAAAA,CAAOJ,CAAAA,CAAI,GAAA,CAAIM,CAAAA,CAAMD,CAAI,CAC9C,CAAA,CAFe,QAAA,CAAA,CAIf,OAAAH,CAAAA,CAAO,CACLK,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,OAAA,CAAA,OACF,CAAC,CAAA,CAEDZ,CAAAA,CAAO,CACLa,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,OAAA,CAAA,SACF,CAAC,CAAA,CAEDd,CAAAA,CAAO,CACLe,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,SAAA,CAAWf,iCAAAA,CAAC,CAAA,CAAkBgB,CAAAA,CAAAA,EAAkB,CAAA,CAAE,cAAA,CAAeA,CAAAA,CAAG,CAAC,MAAM,CAAC,CAAA,CAAjE,WAAA,CACb,CAAC,CAAA,CAEDnB,CAAAA,CAAI,GAAA,CAAIoB,oBAAAA,CAAqB,CAC3B,OAAA,CAAA,UACF,CAAC,CAAA,CAEDpB,CAAAA,CAAI,GAAA,CAAIqB,oBAAAA,CAAsB,CAC5B,OAAA,CAAA,UACF,CAAC,CAAA,CAEMrB,CACT,CACF,CAAA,CA/COH,CAAAA,CAAAyB,iCAAAA,IAAA,CAAA,CAELC,iCAAAA,CAAA1B,CAAA,EAAA,CAAW,qBAAA,CADXD,CAAAA,CADWG,CAAAA,CAAAA,CAANyB,iCAAAA,CAAA3B,CAAME,CAAAA,CAAAA,CAAN0B,iCAAAA,CAAA5B,CAAA,CAAA,CAAME,CAAAA,CAAAA,CAAWI,iCAAAA,CAAAJ,CAAA,YAAA,CAAA,CAAjB,IAAM2B,CAAAA,CAAN3B,CAAAA,CAAAA,cAAAA","file":"/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-7SURY7NK.cjs","sourcesContent":[null,"import type {\n Expression,\n} from '../expressions/expressions';\nimport {\n cache,\n} from '../port_internals';\nimport {\n DataTypeExprKind,\n} from '../expressions/types';\nimport {\n AcosExpr,\n AsinExpr,\n AtanExpr,\n Atan2Expr,\n CosExpr,\n CotExpr,\n DegreesExpr,\n SinExpr,\n TanExpr,\n SoundexExpr,\n StuffExpr,\n CurrentTimestampExpr,\n CurrentTimezoneExpr,\n RadiansExpr,\n} from '../expressions/expressions';\nimport type {\n TypeAnnotator,\n} from '../optimizer';\nimport {\n DialectTyping,\n} from './dialect';\nimport type {\n ExpressionMetadata,\n} from './dialect';\n\nexport class TSQLTyping {\n @cache\n static get EXPRESSION_METADATA (): ExpressionMetadata {\n // Clone the base metadata to apply dialect-specific overrides safely\n const map: ExpressionMetadata = new Map(DialectTyping.EXPRESSION_METADATA);\n\n const extend = (types: (typeof Expression)[], data: Record<string, unknown>) => {\n for (const type of types) map.set(type, data);\n };\n\n extend([\n AcosExpr,\n AsinExpr,\n AtanExpr,\n Atan2Expr,\n CosExpr,\n CotExpr,\n SinExpr,\n TanExpr,\n ], {\n returns: DataTypeExprKind.FLOAT,\n });\n\n extend([\n SoundexExpr,\n StuffExpr,\n ], {\n returns: DataTypeExprKind.VARCHAR,\n });\n\n extend([\n DegreesExpr,\n RadiansExpr,\n ], {\n annotator: (s: TypeAnnotator, e: Expression) => s.annotateByArgs(e, ['this']),\n });\n\n map.set(CurrentTimezoneExpr, {\n returns: DataTypeExprKind.NVARCHAR,\n });\n\n map.set(CurrentTimestampExpr, {\n returns: DataTypeExprKind.DATETIME,\n });\n\n return map;\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-PHPGL3PR.cjs","../src/typing/tsql.ts"],"names":["_EXPRESSION_METADATA_dec","_init","cache","_TSQLTyping","map","DialectTyping","extend","__name","types","data","type","AcosExpr","AsinExpr","AtanExpr","Atan2Expr","CosExpr","CotExpr","SinExpr","TanExpr","SoundexExpr","StuffExpr","DegreesExpr","RadiansExpr","e","CurrentTimezoneExpr","CurrentTimestampExpr","__decoratorStart","__decorateElement","__decoratorMetadata","__runInitializers","TSQLTyping"],"mappings":"AAAA,iIAAmM,ICAnMA,CAAAA,CAAAC,CAAAA,CAoCED,CAAAA,CAAA,CAACE,mBAAAA,CAAAA,CADI,IAAMC,CAAAA,CAAN,MAAMA,CAAW,CAEtB,OAAA,IAAW,mBAAA,CAAA,CAA2C,CAEpD,IAAMC,CAAAA,CAA0B,IAAI,GAAA,CAAIC,oBAAAA,CAAc,mBAAmB,CAAA,CAEnEC,CAAAA,CAASC,iCAAAA,CAACC,CAAAA,CAA8BC,CAAAA,CAAAA,EAAkC,CAC9E,GAAA,CAAA,IAAWC,EAAAA,GAAQF,CAAAA,CAAOJ,CAAAA,CAAI,GAAA,CAAIM,CAAAA,CAAMD,CAAI,CAC9C,CAAA,CAFe,QAAA,CAAA,CAIf,OAAAH,CAAAA,CAAO,CACLK,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,OAAA,CAAA,OACF,CAAC,CAAA,CAEDZ,CAAAA,CAAO,CACLa,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,OAAA,CAAA,SACF,CAAC,CAAA,CAEDd,CAAAA,CAAO,CACLe,oBAAAA,CACAC,oBACF,CAAA,CAAG,CACD,SAAA,CAAWf,iCAAAA,CAAC,CAAA,CAAkBgB,CAAAA,CAAAA,EAAkB,CAAA,CAAE,cAAA,CAAeA,CAAAA,CAAG,CAAC,MAAM,CAAC,CAAA,CAAjE,WAAA,CACb,CAAC,CAAA,CAEDnB,CAAAA,CAAI,GAAA,CAAIoB,oBAAAA,CAAqB,CAC3B,OAAA,CAAA,UACF,CAAC,CAAA,CAEDpB,CAAAA,CAAI,GAAA,CAAIqB,oBAAAA,CAAsB,CAC5B,OAAA,CAAA,UACF,CAAC,CAAA,CAEMrB,CACT,CACF,CAAA,CA/COH,CAAAA,CAAAyB,iCAAAA,IAAA,CAAA,CAELC,iCAAAA,CAAA1B,CAAA,EAAA,CAAW,qBAAA,CADXD,CAAAA,CADWG,CAAAA,CAAAA,CAANyB,iCAAAA,CAAA3B,CAAME,CAAAA,CAAAA,CAAN0B,iCAAAA,CAAA5B,CAAA,CAAA,CAAME,CAAAA,CAAAA,CAAWI,iCAAAA,CAAAJ,CAAA,YAAA,CAAA,CAAjB,IAAM2B,CAAAA,CAAN3B,CAAAA,CAAAA,cAAAA","file":"/home/huydna/projects/sqlingo.js/packages/sqlingo/dist/chunk-PHPGL3PR.cjs","sourcesContent":[null,"import type {\n Expression,\n} from '../expressions/expressions';\nimport {\n cache,\n} from '../port_internals';\nimport {\n DataTypeExprKind,\n} from '../expressions/types';\nimport {\n AcosExpr,\n AsinExpr,\n AtanExpr,\n Atan2Expr,\n CosExpr,\n CotExpr,\n DegreesExpr,\n SinExpr,\n TanExpr,\n SoundexExpr,\n StuffExpr,\n CurrentTimestampExpr,\n CurrentTimezoneExpr,\n RadiansExpr,\n} from '../expressions/expressions';\nimport type {\n TypeAnnotator,\n} from '../optimizer';\nimport {\n DialectTyping,\n} from './dialect';\nimport type {\n ExpressionMetadata,\n} from './dialect';\n\nexport class TSQLTyping {\n @cache\n static get EXPRESSION_METADATA (): ExpressionMetadata {\n // Clone the base metadata to apply dialect-specific overrides safely\n const map: ExpressionMetadata = new Map(DialectTyping.EXPRESSION_METADATA);\n\n const extend = (types: (typeof Expression)[], data: Record<string, unknown>) => {\n for (const type of types) map.set(type, data);\n };\n\n extend([\n AcosExpr,\n AsinExpr,\n AtanExpr,\n Atan2Expr,\n CosExpr,\n CotExpr,\n SinExpr,\n TanExpr,\n ], {\n returns: DataTypeExprKind.FLOAT,\n });\n\n extend([\n SoundexExpr,\n StuffExpr,\n ], {\n returns: DataTypeExprKind.VARCHAR,\n });\n\n extend([\n DegreesExpr,\n RadiansExpr,\n ], {\n annotator: (s: TypeAnnotator, e: Expression) => s.annotateByArgs(e, ['this']),\n });\n\n map.set(CurrentTimezoneExpr, {\n returns: DataTypeExprKind.NVARCHAR,\n });\n\n map.set(CurrentTimestampExpr, {\n returns: DataTypeExprKind.DATETIME,\n });\n\n return map;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunk2IDNLTQGcjs = require('./chunk-2IDNLTQG.cjs');var _chunkC72OQ3YOcjs = require('./chunk-C72OQ3YO.cjs');function i(S,a={}){return function(){return this.parseShowMysql(S,a)}}_chunkC72OQ3YOcjs.a.call(void 0, i,"showParser");function Ts(S){let a=this.sql(S,"this"),t=S.text("unit").toUpperCase(),e,r;if(t==="WEEK")e=`CONCAT(YEAR(${a}), ' ', WEEK(${a}, 1), ' 1')`,r="%Y %u %w";else if(t==="MONTH")e=`CONCAT(YEAR(${a}), ' ', MONTH(${a}), ' 1')`,r="%Y %c %e";else if(t==="QUARTER")e=`CONCAT(YEAR(${a}), ' ', QUARTER(${a}) * 3 - 2, ' 1')`,r="%Y %c %e";else if(t==="YEAR")e=`CONCAT(YEAR(${a}), ' 1 1')`,r="%Y %c %e";else return t!=="DAY"&&this.unsupported(`Unexpected interval unit: ${t}`),this.func("DATE",[a]);return this.func("STR_TO_DATE",[e,`'${r}'`])}_chunkC72OQ3YOcjs.a.call(void 0, Ts,"dateTruncSql");var ps=new Set(["f","H","h","I","i","k","l","p","r","S","s","T"]);function Ss(S){let a=0,t=S.length;for(;a<t;){if(S[a]==="%"&&(a+=1,a<t&&ps.has(S[a])))return!0;a+=1}return!1}_chunkC72OQ3YOcjs.a.call(void 0, Ss,"hasTimeSpecifier");function us(S){let a=_chunkC72OQ3YOcjs.Sa.call(void 0, S,1),t=Vt.formatTime(a),e=_chunkC72OQ3YOcjs.Sa.call(void 0, S,0);return a&&Ss(a instanceof _chunkC72OQ3YOcjs.xb?a.name:a)?new (0, _chunkC72OQ3YOcjs.or)({this:e,format:t||""}):new (0, _chunkC72OQ3YOcjs.nr)({this:e,format:t})}_chunkC72OQ3YOcjs.a.call(void 0, us,"buildStrToDate");function Gt(S){return this.func("STR_TO_DATE",[S.args.this,this.formatTime(S)])}_chunkC72OQ3YOcjs.a.call(void 0, Gt,"strToDateSql");function ls(S){let a=S.args.scale,t=S.args.this;return a===void 0||a.toValue()===_chunkC72OQ3YOcjs.Tr.SECONDS.toValue()?this.func("FROM_UNIXTIME",[t,this.formatTime(S)]):this.func("FROM_UNIXTIME",[new (0, _chunkC72OQ3YOcjs.sj)({this:t,expression:_chunkC72OQ3YOcjs.xu.call(void 0, "POW","10",a.toString())}),this.formatTime(S)])}_chunkC72OQ3YOcjs.a.call(void 0, ls,"unixToTimeSql");function Ft(S){return function(a){return this.func(`DATE_${S}`,[a.args.this,new (0, _chunkC72OQ3YOcjs.Si)({this:a.args.expression,unit:_chunkC72OQ3YOcjs.Ww.call(void 0, a)})])}}_chunkC72OQ3YOcjs.a.call(void 0, Ft,"dateAddSql");function cs(S){return S.args.format?Gt.call(this,S):this.func("DATE",[S.args.this])}_chunkC72OQ3YOcjs.a.call(void 0, cs,"tsOrDsToDateSql");function d(S,a=["this"]){return function(t){for(let e of a){let r=t.getArgKey(e);(r instanceof _chunkC72OQ3YOcjs.Jr||r instanceof _chunkC72OQ3YOcjs.Mr)&&!r.getArgKey("format")&&t.setArgKey(e,r.args.this)}return S?S.call(this,t):this.functionFallbackSql(t)}}_chunkC72OQ3YOcjs.a.call(void 0, d,"removeTsOrDsToDate");var fr,dr,xr,Z,f=class f extends(xr=_chunkC72OQ3YOcjs.wx,dr=[_chunkC72OQ3YOcjs.s],fr=[_chunkC72OQ3YOcjs.s],xr){constructor(){super(...arguments);this.NESTED_COMMENTS=!1}static get ORIGINAL_KEYWORDS(){return{..._chunkC72OQ3YOcjs.wx.KEYWORDS,BLOB:"blob",CHARSET:"characterSet",DISTINCTROW:"distinct",EXPLAIN:"describe",FORCE:"force",IGNORE:"ignore",KEY:"key","LOCK TABLES":"command",LONGBLOB:"longblob",LONGTEXT:"longtext",MEDIUMBLOB:"mediumblob",MEDIUMINT:"mediumint",MEDIUMTEXT:"mediumtext","MEMBER OF":"memberOf",MOD:"mod",SEPARATOR:"separator",SERIAL:"serial",SIGNED:"bigint","SIGNED INTEGER":"bigint","SOUNDS LIKE":"soundsLike",START:"begin",TIMESTAMP:"timestamptz",TINYBLOB:"tinyblob",TINYTEXT:"tinytext",TYPE:"type","UNLOCK TABLES":"command",UNSIGNED:"ubigint","UNSIGNED INTEGER":"ubigint",YEAR:"year",_ARMSCII8:"introducer",_ASCII:"introducer",_BIG5:"introducer",_BINARY:"introducer",_CP1250:"introducer",_CP1251:"introducer",_CP1256:"introducer",_CP1257:"introducer",_CP850:"introducer",_CP852:"introducer",_CP866:"introducer",_CP932:"introducer",_DEC8:"introducer",_EUCJPMS:"introducer",_EUCKR:"introducer",_GB18030:"introducer",_GB2312:"introducer",_GBK:"introducer",_GEOSTD8:"introducer",_GREEK:"introducer",_HEBREW:"introducer",_HP8:"introducer",_KEYBCS2:"introducer",_KOI8R:"introducer",_KOI8U:"introducer",_LATIN1:"introducer",_LATIN2:"introducer",_LATIN5:"introducer",_LATIN7:"introducer",_MACCE:"introducer",_MACROMAN:"introducer",_SJIS:"introducer",_SWE7:"introducer",_TIS620:"introducer",_UCS2:"introducer",_UJIS:"introducer",_UTF8:"introducer",_UTF16:"introducer",_UTF16LE:"introducer",_UTF32:"introducer",_UTF8MB3:"introducer",_UTF8MB4:"introducer","@@":"sessionParameter"}}static get COMMANDS(){let t=new Set([..._chunkC72OQ3YOcjs.wx.COMMANDS,"replace"]);return t.delete("show"),t}};Z=_chunkC72OQ3YOcjs.b.call(void 0, xr),_chunkC72OQ3YOcjs.e.call(void 0, Z,10,"ORIGINAL_KEYWORDS",dr,f),_chunkC72OQ3YOcjs.e.call(void 0, Z,10,"COMMANDS",fr,f),_chunkC72OQ3YOcjs.c.call(void 0, Z,f),_chunkC72OQ3YOcjs.d.call(void 0, Z,3,f),_chunkC72OQ3YOcjs.a.call(void 0, f,"MySQLTokenizer"),f.QUOTES=["'",'"'],f.COMMENTS=["--","#",["/*","*/"]],f.IDENTIFIERS=["`"],f.STRING_ESCAPES=["'",'"',"\\"],f.BIT_STRINGS=[["b'","'"],["B'","'"],["0b",""]],f.HEX_STRINGS=[["x'","'"],["X'","'"],["0x",""]],f.ESCAPE_FOLLOW_CHARS=["0","b","n","r","t","Z","%","_"];var wt=f,Cr,mr,Pr,gr,Dr,Ur,_r,Lr,Mr,br,qr,Br,Fr,Gr,wr,yr,Yr,Vr,Kr,Hr,A,T=class T extends(Hr=_chunkC72OQ3YOcjs.pb,Kr=[_chunkC72OQ3YOcjs.s],Vr=[_chunkC72OQ3YOcjs.s],Yr=[_chunkC72OQ3YOcjs.s],yr=[_chunkC72OQ3YOcjs.s],wr=[_chunkC72OQ3YOcjs.s],Gr=[_chunkC72OQ3YOcjs.s],Fr=[_chunkC72OQ3YOcjs.s],Br=[_chunkC72OQ3YOcjs.s],qr=[_chunkC72OQ3YOcjs.s],br=[_chunkC72OQ3YOcjs.s],Mr=[_chunkC72OQ3YOcjs.s],Lr=[_chunkC72OQ3YOcjs.s],_r=[_chunkC72OQ3YOcjs.s],Ur=[_chunkC72OQ3YOcjs.s],Dr=[_chunkC72OQ3YOcjs.s],gr=[_chunkC72OQ3YOcjs.s],Pr=[_chunkC72OQ3YOcjs.s],mr=[_chunkC72OQ3YOcjs.s],Cr=[_chunkC72OQ3YOcjs.s],Hr){static get ID_VAR_TOKENS(){return new Set([..._chunkC72OQ3YOcjs.pb.ID_VAR_TOKENS,"currentCatalog"])}static get FUNC_TOKENS(){return new Set([..._chunkC72OQ3YOcjs.pb.FUNC_TOKENS,"database","mod","schema","values","characterSet"])}static get CONJUNCTION(){return{..._chunkC72OQ3YOcjs.pb.CONJUNCTION,damp:_chunkC72OQ3YOcjs.lt,xor:_chunkC72OQ3YOcjs.nt}}static get DISJUNCTION(){return{..._chunkC72OQ3YOcjs.pb.DISJUNCTION,dpipe:_chunkC72OQ3YOcjs.mt}}static get TABLE_ALIAS_TOKENS(){return(()=>{let t=new Set(_chunkC72OQ3YOcjs.pb.TABLE_ALIAS_TOKENS);for(let e of _chunkC72OQ3YOcjs.pb.TABLE_INDEX_HINT_TOKENS)t.delete(e);return t})()}static get RANGE_PARSERS(){return{..._chunkC72OQ3YOcjs.pb.RANGE_PARSERS,soundsLike:function(t){return this.expression(_chunkC72OQ3YOcjs.yj,{this:this.expression(_chunkC72OQ3YOcjs.ar,{this:t}),expression:this.expression(_chunkC72OQ3YOcjs.ar,{this:this.parseTerm()})})},memberOf:function(t){return this.expression(_chunkC72OQ3YOcjs.mp,{this:t,expression:this.parseWrapped(this.parseExpression.bind(this))})}}}static get FUNCTIONS(){return{..._chunkC72OQ3YOcjs.pb.FUNCTIONS,BIT_AND:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.os.fromArgList(t),"BIT_AND"),BIT_OR:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.ps.fromArgList(t),"BIT_OR"),BIT_XOR:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.qs.fromArgList(t),"BIT_XOR"),BIT_COUNT:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.Ck.fromArgList(t),"BIT_COUNT"),CONVERT_TZ:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.ml)({sourceTz:_chunkC72OQ3YOcjs.Sa.call(void 0, t,1),targetTz:_chunkC72OQ3YOcjs.Sa.call(void 0, t,2),timestamp:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)}),"CONVERT_TZ"),CURDATE:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.Am.fromArgList(t),"CURDATE"),CURTIME:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.Cm.fromArgList(t),"CURTIME"),DATE:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)}),"DATE"),DATE_ADD:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.nw.call(void 0, (0, _chunkC72OQ3YOcjs.Vm))(t),"DATE_ADD"),DATE_FORMAT:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.zr)({this:new (0, _chunkC72OQ3YOcjs.Mr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)}),format:_chunkC72OQ3YOcjs.Nv.getOrRaise("mysql")._constructor.formatTime(_chunkC72OQ3YOcjs.Sa.call(void 0, t,1))}),"DATE_FORMAT"),DATE_SUB:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.nw.call(void 0, (0, _chunkC72OQ3YOcjs.Xm))(t),"DATE_SUB"),DAY:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.On)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)})}),"DAY"),DAYOFMONTH:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.gn)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)})}),"DAYOFMONTH"),DAYOFWEEK:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.en)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)})}),"DAYOFWEEK"),DAYOFYEAR:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.hn)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)})}),"DAYOFYEAR"),FORMAT:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.rr.fromArgList(t),"FORMAT"),FROM_UNIXTIME:_chunkC72OQ3YOcjs.kw.call(void 0, _chunkC72OQ3YOcjs.Tr,{dialect:"mysql"}),ISNULL:_chunkC72OQ3YOcjs.Pw,LENGTH:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.zp)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0),binary:!0}),"LENGTH"),MAKETIME:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.Jn.fromArgList(t),"MAKETIME"),MONTH:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.Xp)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)})}),"MONTH"),MONTHNAME:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.zr)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)}),format:new (0, _chunkC72OQ3YOcjs.tg)({this:"%B",isString:!0})}),"MONTHNAME"),SCHEMA:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.Km.fromArgList(t),"SCHEMA"),DATABASE:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.Km.fromArgList(t),"DATABASE"),STR_TO_DATE:us,TIMESTAMPDIFF:_chunkC72OQ3YOcjs.mw.call(void 0, _chunkC72OQ3YOcjs.Bn,void 0,{defaultUnit:"DAY"}),TO_DAYS:_chunkC72OQ3YOcjs.a.call(void 0, t=>{let e=new (0, _chunkC72OQ3YOcjs.Ym)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)}),expression:new (0, _chunkC72OQ3YOcjs.Jr)({this:new (0, _chunkC72OQ3YOcjs.tg)({this:"0000-01-01",isString:!0})}),unit:new (0, _chunkC72OQ3YOcjs.ce)({this:"DAY"})});return new (0, _chunkC72OQ3YOcjs.Zj)({this:e.add(1)})},"TO_DAYS"),VERSION:_chunkC72OQ3YOcjs.a.call(void 0, t=>_chunkC72OQ3YOcjs.xm.fromArgList(t),"VERSION"),WEEK:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.es)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)}),mode:_chunkC72OQ3YOcjs.Sa.call(void 0, t,1)}),"WEEK"),WEEKOFYEAR:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.kn)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)})}),"WEEKOFYEAR"),YEAR:_chunkC72OQ3YOcjs.a.call(void 0, t=>new (0, _chunkC72OQ3YOcjs.js)({this:new (0, _chunkC72OQ3YOcjs.Jr)({this:_chunkC72OQ3YOcjs.Sa.call(void 0, t,0)})}),"YEAR")}}static get FUNCTION_PARSERS(){return{..._chunkC72OQ3YOcjs.pb.FUNCTION_PARSERS,GROUP_CONCAT:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseGroupConcat()},"GROUP_CONCAT"),VALUES:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.expression(_chunkC72OQ3YOcjs.Uk,{this:"VALUES",expressions:[this.parseIdVar()]})},"VALUES"),JSON_VALUE:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseJsonValue()},"JSON_VALUE"),SUBSTR:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseSubstring()},"SUBSTR")}}static get STATEMENT_PARSERS(){return{..._chunkC72OQ3YOcjs.pb.STATEMENT_PARSERS,show:function(){return this.parseShow()}}}static get PROPERTY_PARSERS(){return{..._chunkC72OQ3YOcjs.pb.PROPERTY_PARSERS,LOCK:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parsePropertyAssignment(_chunkC72OQ3YOcjs.qh)},"LOCK"),"PARTITION BY":_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parsePartitionProperty()},"PARTITION BY")}}static get SET_PARSERS(){return{..._chunkC72OQ3YOcjs.pb.SET_PARSERS,PERSIST:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseSetItemAssignment({kind:"persist"})},"PERSIST"),PERSIST_ONLY:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseSetItemAssignment({kind:"PERSIST_ONLY"})},"PERSIST_ONLY"),"CHARACTER SET":_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseSetItemCharset("CHARACTER SET")},"CHARACTER SET"),CHARSET:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseSetItemCharset("CHARACTER SET")},"CHARSET"),NAMES:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseSetItemNames()},"NAMES")}}static get CONSTRAINT_PARSERS(){return{..._chunkC72OQ3YOcjs.pb.CONSTRAINT_PARSERS,FULLTEXT:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseIndexConstraint("FULLTEXT")},"FULLTEXT"),INDEX:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseIndexConstraint()},"INDEX"),KEY:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseIndexConstraint()},"KEY"),SPATIAL:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseIndexConstraint("SPATIAL")},"SPATIAL"),ZEROFILL:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.expression(_chunkC72OQ3YOcjs.Nf)},"ZEROFILL"),COLUMN_FORMAT:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseIdVar(),this.expression(_chunkC72OQ3YOcjs.ce,{this:"COLUMN_FORMAT"})},"COLUMN_FORMAT"),STORAGE:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseIdVar(),this.expression(_chunkC72OQ3YOcjs.ce,{this:"STORAGE"})},"STORAGE"),INVISIBLE:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.expression(_chunkC72OQ3YOcjs.ce,{this:"INVISIBLE"})},"INVISIBLE"),VISIBLE:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.expression(_chunkC72OQ3YOcjs.ce,{this:"VISIBLE"})},"VISIBLE")}}static get ALTER_PARSERS(){return{..._chunkC72OQ3YOcjs.pb.ALTER_PARSERS,MODIFY:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseAlterTableModify()},"MODIFY"),AUTO_INCREMENT:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parsePropertyAssignment(_chunkC72OQ3YOcjs.yg)},"AUTO_INCREMENT"),COMMENT:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parsePropertyAssignment(_chunkC72OQ3YOcjs.Ph)},"COMMENT")}}static get ALTER_ALTER_PARSERS(){return{..._chunkC72OQ3YOcjs.pb.ALTER_ALTER_PARSERS,INDEX:_chunkC72OQ3YOcjs.a.call(void 0, function(){return this.parseAlterTableAlterIndex()},"INDEX")}}static get SCHEMA_UNNAMED_CONSTRAINTS(){return new Set([..._chunkC72OQ3YOcjs.pb.SCHEMA_UNNAMED_CONSTRAINTS,"FULLTEXT","INDEX","KEY","SPATIAL"])}static get PROFILE_TYPES(){return{ALL:[],CPU:[],IPC:[],MEMORY:[],SOURCE:[],SWAPS:[],BLOCK:["IO"],CONTEXT:["SWITCHES"],PAGE:["FAULTS"]}}static get TYPE_TOKENS(){return new Set([..._chunkC72OQ3YOcjs.pb.TYPE_TOKENS,"set"])}static get ENUM_TYPE_TOKENS(){return new Set([..._chunkC72OQ3YOcjs.pb.ENUM_TYPE_TOKENS,"set"])}static get OPERATION_MODIFIERS(){return new Set(["HIGH_PRIORITY","STRAIGHT_JOIN","SQL_SMALL_RESULT","SQL_BIG_RESULT","SQL_BUFFER_RESULT","SQL_NO_CACHE","SQL_CALC_FOUND_ROWS"])}parseGeneratedAsIdentity(){let t=super.parseGeneratedAsIdentity();if(this.matchTexts(["STORED","VIRTUAL"])){let e=_optionalChain([this, 'access', _2 => _2.prev, 'optionalAccess', _3 => _3.text, 'access', _4 => _4.toUpperCase, 'call', _5 => _5()])==="STORED";t instanceof _chunkC72OQ3YOcjs.pg?t.setArgKey("persisted",e):t instanceof _chunkC72OQ3YOcjs.ag&&(t=this.expression(_chunkC72OQ3YOcjs.pg,{this:t.args.expression,persisted:e}))}return t}parsePrimaryKeyPart(){let t=this.parseIdVar();if(!this.match("lParen"))return t;let e=this.parseNumber();return this.matchRParen(),this.expression(_chunkC72OQ3YOcjs.Tc,{this:t,expression:e})}parseUnique(){this.matchTexts(["KEY","INDEX"]);let t=this.parseUniqueKey(),e=(this.match("using")||void 0)&&this.advanceAny()&&_optionalChain([this, 'access', _6 => _6.prev, 'optionalAccess', _7 => _7.text]);if(!this.match("lParen",{advance:!1}))return this.expression(_chunkC72OQ3YOcjs.lg,{this:t,indexType:e});let r=this.parseWrappedCsv(this.parseOrdered.bind(this));return this.expression(_chunkC72OQ3YOcjs.lg,{this:this.expression(_chunkC72OQ3YOcjs.ee,{this:t,expressions:r}),indexType:e||(this.match("using")||void 0)&&this.advanceAny()&&_optionalChain([this, 'access', _8 => _8.prev, 'optionalAccess', _9 => _9.text]),options:this.parseKeyConstraintOptions()})}parseIndexConstraint(t){t&&this.matchTexts(["INDEX","KEY"]);let e=this.parseIdVar({anyToken:!1}),r=this.match("using")&&this.advanceAny()&&_optionalChain([this, 'access', _10 => _10.prev, 'optionalAccess', _11 => _11.text]),u=this.parseWrappedCsv(this.parseOrdered.bind(this)),p=[];for(;;){let R;if(this.matchTextSeq(["KEY_BLOCK_SIZE"])?(this.match("eq"),R=new (0, _chunkC72OQ3YOcjs.Ac)({keyBlockSize:this.parseNumber()})):this.match("using")?R=new (0, _chunkC72OQ3YOcjs.Ac)({using:this.advanceAny()&&_optionalChain([this, 'access', _12 => _12.prev, 'optionalAccess', _13 => _13.text])}):this.matchTextSeq(["WITH","PARSER"])?R=new (0, _chunkC72OQ3YOcjs.Ac)({parser:this.parseVar({anyToken:!0})}):this.match("comment")?R=new (0, _chunkC72OQ3YOcjs.Ac)({comment:this.parseString()}):this.matchTextSeq(["VISIBLE"])?R=new (0, _chunkC72OQ3YOcjs.Ac)({visible:!0}):this.matchTextSeq(["INVISIBLE"])?R=new (0, _chunkC72OQ3YOcjs.Ac)({visible:!1}):this.matchTextSeq(["ENGINE_ATTRIBUTE"])?(this.match("eq"),R=new (0, _chunkC72OQ3YOcjs.Ac)({engineAttr:this.parseString()})):this.matchTextSeq(["SECONDARY_ENGINE_ATTRIBUTE"])&&(this.match("eq"),R=new (0, _chunkC72OQ3YOcjs.Ac)({secondaryEngineAttr:this.parseString()})),!R)break;p.push(R)}return this.expression(_chunkC72OQ3YOcjs.cg,{this:e,expressions:u,kind:t,indexType:r,options:p})}parseShowMysql(t,e={}){let{target:r=!1,full:u,global:p}=e,R=this.matchTextSeq(["JSON"]),x;r&&(typeof r=="string"&&this.matchTextSeq(r.split(" ")),x=this.parseIdVar());let j=this.matchTextSeq(["IN"])?this.parseString():void 0,m,U;t==="BINLOG EVENTS"||t==="RELAYLOG EVENTS"?m=this.matchTextSeq(["FROM"])?this.parseNumber():void 0:this.match("from")?U=this.parseIdVar():this.match("dot")&&(U=x,x=this.parseIdVar());let w=this.matchTextSeq(["FOR","CHANNEL"])?this.parseIdVar():void 0,_=this.matchTextSeq(["LIKE"])?this.parseString():void 0,z=this.parseWhere(),y,Y,g,L;t==="PROFILE"?(y=this.parseCsv(()=>this.parseVarFromOptions(T.PROFILE_TYPES)),Y=this.matchTextSeq(["FOR","QUERY"])?this.parseNumber():void 0,g=this.matchTextSeq(["OFFSET"])?this.parseNumber():void 0,L=this.matchTextSeq(["LIMIT"])?this.parseNumber():void 0):[g,L]=this.parseOldstyleLimit();let M;this.matchTextSeq(["MUTEX"])&&(M=!0),this.matchTextSeq(["STATUS"])&&(M=!1);let Q=this.matchTextSeq(["FOR","TABLE"])?this.parseIdVar():void 0,tt=this.matchTextSeq(["FOR","GROUP"])?this.parseString():void 0,et=this.matchTextSeq(["FOR","USER"])?this.parseString():void 0,rt=this.matchTextSeq(["FOR","ROLE"])?this.parseString():void 0,os=this.matchTextSeq(["INTO","OUTFILE"])?this.parseString():void 0;return this.expression(_chunkC72OQ3YOcjs.cc,{this:t,target:x,full:u,log:j,position:m,db:U,channel:w,like:_,where:z,types:y,query:Y,offset:g,limit:L,mutex:M,forTable:Q,forGroup:tt,forUser:et,forRole:rt,intoOutfile:os,json:R,global:p})}parseOldstyleLimit(){let t,e;if(this.matchTextSeq(["LIMIT"])){let r=this.parseCsv(this.parseNumber.bind(this));r.length===1?t=r[0]:r.length===2&&(t=r[1],e=r[0])}return[e,t]}parseSetItemCharset(t){let e=this.parseString()||this.parseUnquotedField();return this.expression(_chunkC72OQ3YOcjs.ac,{this:e,kind:t})}parseSetItemNames(){let t=this.parseString()||this.parseUnquotedField(),e;return this.matchTextSeq(["COLLATE"])&&(e=this.parseString()||this.parseUnquotedField()),this.expression(_chunkC72OQ3YOcjs.ac,{this:t,collate:e,kind:"NAMES"})}parseType(t={}){let{parseInterval:e=!0,fallbackToIdentifier:r=!1}=t;if(this.match("binary",{advance:!1})){let u=this.parseTypes({checkFunc:!0,allowIdentifiers:!1});if(u instanceof _chunkC72OQ3YOcjs.pe)return this.expression(_chunkC72OQ3YOcjs.Yl,{this:this.parseColumn(),to:u})}return super.parseType({parseInterval:e,fallbackToIdentifier:r})}parseAlterTableAlterIndex(){let t=this.parseField({anyToken:!0}),e;return this.matchTextSeq(["VISIBLE"])?e=!0:this.matchTextSeq(["INVISIBLE"])&&(e=!1),this.expression(_chunkC72OQ3YOcjs.oc,{this:t,visible:e})}parseAlterTableModify(){this.match("column");let t=this.parseField({anyToken:!0});if(!t)return;let e=this.parseColumnDef(t);if(e instanceof _chunkC72OQ3YOcjs.lc)return this.expression(_chunkC72OQ3YOcjs.nc,{this:e})}parsePartitionProperty(){let t,e;if(this.matchTextSeq(["RANGE"])?(t=_chunkC72OQ3YOcjs.Bh,e=this.parsePartitionRangeValue.bind(this)):this.matchTextSeq(["LIST"])&&(t=_chunkC72OQ3YOcjs.Dh,e=this.parsePartitionListValue.bind(this)),!t||!e)return;let r=this.parseWrappedCsv(this.parseAssignment.bind(this));if(!this.matchTextSeq(["(","PARTITION"],{advance:!1}))return r;let u=this.parseWrappedCsv(e);return this.expression(t,{partitionExpressions:r,createExpressions:u})}parsePartitionRangeValue(){this.matchTextSeq(["PARTITION"]);let t=this.parseIdVar();if(!this.matchTextSeq(["VALUES","LESS","THAN"]))return t;let e=this.parseWrappedCsv(this.parseExpression.bind(this));e.length===1&&e[0]instanceof _chunkC72OQ3YOcjs.Kf&&e[0].name.toUpperCase()==="MAXVALUE"&&(e=[new (0, _chunkC72OQ3YOcjs.ce)({this:"MAXVALUE"})]);let r=this.expression(_chunkC72OQ3YOcjs.ld,{this:t,expressions:e});return this.expression(_chunkC72OQ3YOcjs.kd,{expressions:[r]})}parsePartitionListValue(){this.matchTextSeq(["PARTITION"]);let t=this.parseIdVar();this.matchTextSeq(["VALUES","IN"]);let e=this.parseWrappedCsv(this.parseExpression.bind(this)),r=this.expression(_chunkC72OQ3YOcjs.Md,{this:t,expressions:e});return this.expression(_chunkC72OQ3YOcjs.kd,{expressions:[r]})}parsePrimaryKey(t={}){let{wrappedOptional:e=!1,inProps:r=!1}=t;return super.parsePrimaryKey({wrappedOptional:e,inProps:r,namedPrimaryKey:!0})}};A=_chunkC72OQ3YOcjs.b.call(void 0, Hr),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"ID_VAR_TOKENS",Kr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"FUNC_TOKENS",Vr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"CONJUNCTION",Yr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"DISJUNCTION",yr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"TABLE_ALIAS_TOKENS",wr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"RANGE_PARSERS",Gr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"FUNCTIONS",Fr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"FUNCTION_PARSERS",Br,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"STATEMENT_PARSERS",qr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"PROPERTY_PARSERS",br,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"SET_PARSERS",Mr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"CONSTRAINT_PARSERS",Lr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"ALTER_PARSERS",_r,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"ALTER_ALTER_PARSERS",Ur,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"SCHEMA_UNNAMED_CONSTRAINTS",Dr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"PROFILE_TYPES",gr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"TYPE_TOKENS",Pr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"ENUM_TYPE_TOKENS",mr,T),_chunkC72OQ3YOcjs.e.call(void 0, A,10,"OPERATION_MODIFIERS",Cr,T),_chunkC72OQ3YOcjs.c.call(void 0, A,T),_chunkC72OQ3YOcjs.d.call(void 0, A,3,T),_chunkC72OQ3YOcjs.a.call(void 0, T,"MySQLParser"),T.SHOW_PARSERS={"BINARY LOGS":i("BINARY LOGS"),"MASTER LOGS":i("BINARY LOGS"),"BINLOG EVENTS":i("BINLOG EVENTS"),"CHARACTER SET":i("CHARACTER SET"),CHARSET:i("CHARACTER SET"),COLLATION:i("COLLATION"),"FULL COLUMNS":i("COLUMNS",{target:"FROM",full:!0}),COLUMNS:i("COLUMNS",{target:"FROM"}),"CREATE DATABASE":i("CREATE DATABASE",{target:!0}),"CREATE EVENT":i("CREATE EVENT",{target:!0}),"CREATE FUNCTION":i("CREATE FUNCTION",{target:!0}),"CREATE PROCEDURE":i("CREATE PROCEDURE",{target:!0}),"CREATE TABLE":i("CREATE TABLE",{target:!0}),"CREATE TRIGGER":i("CREATE TRIGGER",{target:!0}),"CREATE VIEW":i("CREATE VIEW",{target:!0}),DATABASES:i("DATABASES"),SCHEMAS:i("DATABASES"),ENGINE:i("ENGINE",{target:!0}),"STORAGE ENGINES":i("ENGINES"),ENGINES:i("ENGINES"),ERRORS:i("ERRORS"),EVENTS:i("EVENTS"),"FUNCTION CODE":i("FUNCTION CODE",{target:!0}),"FUNCTION STATUS":i("FUNCTION STATUS"),GRANTS:i("GRANTS",{target:"FOR"}),INDEX:i("INDEX",{target:"FROM"}),"MASTER STATUS":i("MASTER STATUS"),"OPEN TABLES":i("OPEN TABLES"),PLUGINS:i("PLUGINS"),"PROCEDURE CODE":i("PROCEDURE CODE",{target:!0}),"PROCEDURE STATUS":i("PROCEDURE STATUS"),PRIVILEGES:i("PRIVILEGES"),"FULL PROCESSLIST":i("PROCESSLIST",{full:!0}),PROCESSLIST:i("PROCESSLIST"),PROFILE:i("PROFILE"),PROFILES:i("PROFILES"),"RELAYLOG EVENTS":i("RELAYLOG EVENTS"),REPLICAS:i("REPLICAS"),"SLAVE HOSTS":i("REPLICAS"),"REPLICA STATUS":i("REPLICA STATUS"),"SLAVE STATUS":i("REPLICA STATUS"),"GLOBAL STATUS":i("STATUS",{global:!0}),"SESSION STATUS":i("STATUS"),STATUS:i("STATUS"),"TABLE STATUS":i("TABLE STATUS"),"FULL TABLES":i("TABLES",{full:!0}),TABLES:i("TABLES"),TRIGGERS:i("TRIGGERS"),"GLOBAL VARIABLES":i("VARIABLES",{global:!0}),"SESSION VARIABLES":i("VARIABLES"),VARIABLES:i("VARIABLES"),WARNINGS:i("WARNINGS")},T.LOG_DEFAULTS_TO_LN=!0,T.STRING_ALIASES=!0,T.VALUES_FOLLOWED_BY_PAREN=!1,T.SUPPORTS_PARTITION_SELECTION=!0;var yt=T,kr,vr,$r,Wr,Xr,Jr,Zr,jr,zr,Qr,ts,es,rs,N,n=class n extends(rs=_chunkC72OQ3YOcjs.Kv,es=[_chunkC72OQ3YOcjs.s],ts=[_chunkC72OQ3YOcjs.s],Qr=[_chunkC72OQ3YOcjs.s],zr=[_chunkC72OQ3YOcjs.s],jr=[_chunkC72OQ3YOcjs.s],Zr=[_chunkC72OQ3YOcjs.s],Jr=[_chunkC72OQ3YOcjs.s],Xr=[_chunkC72OQ3YOcjs.s],Wr=[_chunkC72OQ3YOcjs.s],$r=[_chunkC72OQ3YOcjs.s],vr=[_chunkC72OQ3YOcjs.s],kr=[_chunkC72OQ3YOcjs.s],rs){static get AFTER_HAVING_MODIFIER_TRANSFORMS(){let t=new Map(super.AFTER_HAVING_MODIFIER_TRANSFORMS);return["cluster","distribute","sort"].forEach(e=>t.delete(e)),t}static get NULL_ORDERING_SUPPORTED(){return"unsupported"}static get ORIGINAL_TRANSFORMS(){return new Map([..._chunkC72OQ3YOcjs.Kv.TRANSFORMS,[_chunkC72OQ3YOcjs.Ns,_chunkC72OQ3YOcjs.Qv.call(void 0, "GROUP_CONCAT")],[_chunkC72OQ3YOcjs.os,_chunkC72OQ3YOcjs.Qv.call(void 0, "BIT_AND")],[_chunkC72OQ3YOcjs.ps,_chunkC72OQ3YOcjs.Qv.call(void 0, "BIT_OR")],[_chunkC72OQ3YOcjs.qs,_chunkC72OQ3YOcjs.Qv.call(void 0, "BIT_XOR")],[_chunkC72OQ3YOcjs.Ck,_chunkC72OQ3YOcjs.Qv.call(void 0, "BIT_COUNT")],[_chunkC72OQ3YOcjs.im,function(t){return this.chrSql(t,{name:"CHAR"})}],[_chunkC72OQ3YOcjs.Am,_chunkC72OQ3YOcjs.Xv],[_chunkC72OQ3YOcjs.xm,_chunkC72OQ3YOcjs.Qv.call(void 0, "VERSION")],[_chunkC72OQ3YOcjs.Ym,d(function(t){return this.func("DATEDIFF",[t.args.this,t.args.expression])},["this","expression"])],[_chunkC72OQ3YOcjs.Vm,d(Ft("ADD"))],[_chunkC72OQ3YOcjs.Kn,_chunkC72OQ3YOcjs.xw],[_chunkC72OQ3YOcjs.Xm,d(Ft("SUB"))],[_chunkC72OQ3YOcjs.Zm,Ts],[_chunkC72OQ3YOcjs.On,d()],[_chunkC72OQ3YOcjs.gn,d(_chunkC72OQ3YOcjs.Qv.call(void 0, "DAYOFMONTH"))],[_chunkC72OQ3YOcjs.en,d(_chunkC72OQ3YOcjs.Qv.call(void 0, "DAYOFWEEK"))],[_chunkC72OQ3YOcjs.hn,d(_chunkC72OQ3YOcjs.Qv.call(void 0, "DAYOFYEAR"))],[_chunkC72OQ3YOcjs.jt,function(t){return`GROUP_CONCAT(${this.sql(t,"this")} SEPARATOR ${this.sql(t,"separator")||"','"})`}],[_chunkC72OQ3YOcjs.Hj,_chunkC72OQ3YOcjs.Wv],[_chunkC72OQ3YOcjs.hp,_chunkC72OQ3YOcjs.Tv],[_chunkC72OQ3YOcjs.zp,_chunkC72OQ3YOcjs.ox],[_chunkC72OQ3YOcjs.rt,_chunkC72OQ3YOcjs.Qv.call(void 0, "MAX")],[_chunkC72OQ3YOcjs.st,_chunkC72OQ3YOcjs.Qv.call(void 0, "MIN")],[_chunkC72OQ3YOcjs.tt,_chunkC72OQ3YOcjs.Aw],[_chunkC72OQ3YOcjs.wt,_chunkC72OQ3YOcjs.zw],[_chunkC72OQ3YOcjs.Xp,d()],[_chunkC72OQ3YOcjs.zj,function(t){return this.binary(t,"<=>")}],[_chunkC72OQ3YOcjs.Aj,function(t){return`NOT ${this.binary(t,"<=>")}`}],[_chunkC72OQ3YOcjs.rr,_chunkC72OQ3YOcjs.Qv.call(void 0, "FORMAT")],[_chunkC72OQ3YOcjs.ie,_chunkC72OQ3YOcjs._v],[_chunkC72OQ3YOcjs.Ci,_chunkC72OQ3YOcjs.mv.call(void 0, [_chunkC72OQ3YOcjs.pv,_chunkC72OQ3YOcjs.Av,_chunkC72OQ3YOcjs.qv,_chunkC72OQ3YOcjs.Bv,_chunkC72OQ3YOcjs.nv])],[_chunkC72OQ3YOcjs.kr,function(t){return _chunkC72OQ3YOcjs.dw.call(this,t,{funcName:"LOCATE",supportsPosition:!0})}],[_chunkC72OQ3YOcjs.nr,Gt],[_chunkC72OQ3YOcjs.or,Gt],[_chunkC72OQ3YOcjs.wr,_chunkC72OQ3YOcjs.Qv.call(void 0, "INSERT")],[_chunkC72OQ3YOcjs.Rm,()=>"SESSION_USER()"],[_chunkC72OQ3YOcjs.ge,_chunkC72OQ3YOcjs.Zv],[_chunkC72OQ3YOcjs.Jn,_chunkC72OQ3YOcjs.Qv.call(void 0, "MAKETIME")],[_chunkC72OQ3YOcjs.zn,_chunkC72OQ3YOcjs.pw.call(void 0, "DATE","ADD")],[_chunkC72OQ3YOcjs.Bn,function(t){return this.func("TIMESTAMPDIFF",[_chunkC72OQ3YOcjs.Ww.call(void 0, t),t.args.expression,t.args.this])}],[_chunkC72OQ3YOcjs.An,_chunkC72OQ3YOcjs.pw.call(void 0, "DATE","SUB")],[_chunkC72OQ3YOcjs.Er,_chunkC72OQ3YOcjs.Qv.call(void 0, "UNIX_TIMESTAMP")],[_chunkC72OQ3YOcjs.Dr,function(t){return _chunkC72OQ3YOcjs.ww.call(this,t,{includePrecision:!t.args.zone})}],[_chunkC72OQ3YOcjs.zr,d(function(t){return this.func("DATE_FORMAT",[t.args.this,this.formatTime(t)])})],[_chunkC72OQ3YOcjs.Fr,_chunkC72OQ3YOcjs.Cw],[_chunkC72OQ3YOcjs.Kq,_chunkC72OQ3YOcjs.Qv.call(void 0, "TRUNCATE")],[_chunkC72OQ3YOcjs.bt,_chunkC72OQ3YOcjs.$v],[_chunkC72OQ3YOcjs.Gr,Ft("ADD")],[_chunkC72OQ3YOcjs.Hr,function(t){return this.func("DATEDIFF",[t.args.this,t.args.expression])}],[_chunkC72OQ3YOcjs.Jr,cs],[_chunkC72OQ3YOcjs.Pr,function(t){return`ORD(CONVERT(${this.sql(t.args.this)} USING utf32))`}],[_chunkC72OQ3YOcjs.Tr,ls],[_chunkC72OQ3YOcjs.es,d()],[_chunkC72OQ3YOcjs.kn,d(_chunkC72OQ3YOcjs.Qv.call(void 0, "WEEKOFYEAR"))],[_chunkC72OQ3YOcjs.js,d()],[_chunkC72OQ3YOcjs.Um,_chunkC72OQ3YOcjs.Qv.call(void 0, "UTC_TIMESTAMP")],[_chunkC72OQ3YOcjs.Tm,_chunkC72OQ3YOcjs.Qv.call(void 0, "UTC_TIME")]])}static get UNSIGNED_TYPE_MAPPING(){return new Map([["ubigint","BIGINT"],["uint","INT"],["umediumint","MEDIUMINT"],["usmallint","SMALLINT"],["utinyint","TINYINT"],["udecimal","DECIMAL"],["udouble","DOUBLE"]])}static get TIMESTAMP_TYPE_MAPPING(){return new Map([["datetime2","DATETIME"],["smalldatetime","DATETIME"],["timestamp","DATETIME"],["timestampntz","DATETIME"],["timestamptz","TIMESTAMP"],["timestampltz","TIMESTAMP"]])}static get TYPE_MAPPING(){let t=new Map(_chunkC72OQ3YOcjs.Kv.TYPE_MAPPING);for(let[e,r]of n.UNSIGNED_TYPE_MAPPING)t.set(e,r);for(let[e,r]of n.TIMESTAMP_TYPE_MAPPING)t.set(e,r);return t.delete("mediumtext"),t.delete("longtext"),t.delete("tinytext"),t.delete("blob"),t.delete("mediumblob"),t.delete("longblob"),t.delete("tinyblob"),t}static get PROPERTIES_LOCATION(){let t=new Map(_chunkC72OQ3YOcjs.Kv.PROPERTIES_LOCATION);return t.set(_chunkC72OQ3YOcjs.mi,"unsupported"),t.set(_chunkC72OQ3YOcjs.qi,"unsupported"),t.set(_chunkC72OQ3YOcjs.yh,"unsupported"),t.set(_chunkC72OQ3YOcjs.Bh,"postSchema"),t.set(_chunkC72OQ3YOcjs.Dh,"postSchema"),t}static get CHAR_CAST_MAPPING(){return["longtext","longblob","mediumblob","mediumtext","text","tinyblob","tinytext","varchar"].reduce((t,e)=>({...t,[e]:"CHAR"}),{})}static get SIGNED_CAST_MAPPING(){return["bigint","boolean","int","smallint","tinyint","mediumint"].reduce((t,e)=>({...t,[e]:"SIGNED"}),{})}static get CAST_MAPPING(){return{...n.CHAR_CAST_MAPPING,...n.SIGNED_CAST_MAPPING,ubigint:"UNSIGNED"}}static get TIMESTAMP_FUNC_TYPES(){return new Set(["timestamptz","timestampltz"])}static get RESERVED_KEYWORDS(){return new Set(["accessible","add","all","alter","analyze","and","as","asc","asensitive","before","between","bigint","binary","blob","both","by","call","cascade","case","change","char","character","check","collate","column","condition","constraint","continue","convert","create","cross","cube","cume_dist","current_date","current_time","current_timestamp","current_user","cursor","database","databases","day_hour","day_microsecond","day_minute","day_second","dec","decimal","declare","default","delayed","delete","dense_rank","desc","describe","deterministic","distinct","distinctrow","div","double","drop","dual","each","else","elseif","empty","enclosed","escaped","except","exists","exit","explain","false","fetch","first_value","float","float4","float8","for","force","foreign","from","fulltext","function","generated","get","grant","group","grouping","groups","having","high_priority","hour_microsecond","hour_minute","hour_second","if","ignore","in","index","infile","inner","inout","insensitive","insert","int","int1","int2","int3","int4","int8","integer","intersect","interval","into","io_after_gtids","io_before_gtids","is","iterate","join","json_table","key","keys","kill","lag","last_value","lateral","lead","leading","leave","left","like","limit","linear","lines","load","localtime","localtimestamp","lock","long","longblob","longtext","loop","low_priority","master_bind","master_ssl_verify_server_cert","match","maxvalue","mediumblob","mediumint","mediumtext","middleint","minute_microsecond","minute_second","mod","modifies","natural","not","no_write_to_binlog","nth_value","ntile","undefined","numeric","of","on","optimize","optimizer_costs","option","optionally","or","order","out","outer","outfile","over","partition","percent_rank","precision","primary","procedure","purge","range","rank","read","reads","read_write","real","recursive","references","regexp","release","rename","repeat","replace","require","resignal","restrict","return","revoke","right","rlike","row","rows","row_number","schema","schemas","second_microsecond","select","sensitive","separator","set","show","signal","smallint","spatial","specific","sql","sqlexception","sqlstate","sqlwarning","sql_big_result","sql_calc_found_rows","sql_small_result","ssl","starting","stored","straight_join","system","table","terminated","then","tinyblob","tinyint","tinytext","to","trailing","trigger","true","undo","union","unique","unlock","unsigned","update","usage","use","using","utc_date","utc_time","utc_timestamp","values","varbinary","varchar","varcharacter","varying","virtual","when","where","while","window","with","write","xor","year_month","zerofill"])}locateProperties(t){let e=super.locateProperties(t),r=t.parent;if(r instanceof _chunkC72OQ3YOcjs.Jb&&_optionalChain([r, 'access', _14 => _14.args, 'access', _15 => _15.kind, 'optionalAccess', _16 => _16.toUpperCase, 'call', _17 => _17()])==="VIEW"){let u=e.get("postSchema");if(u){for(let p=0;p<u.length;p++)if(u[p]instanceof _chunkC72OQ3YOcjs.Xh){let[R]=u.splice(p,1),x=this._constructor.SQL_SECURITY_VIEW_LOCATION;e.has(x)||e.set(x,[]),e.get(x).push(R);break}}}return e}computedColumnConstraintSql(t){let e=t.args.persisted?"STORED":"VIRTUAL";return`GENERATED ALWAYS AS (${this.sql(_optionalChain([t, 'access', _18 => _18.args, 'access', _19 => _19.this, 'optionalAccess', _20 => _20.unnest, 'call', _21 => _21()]))}) ${e}`}arraySql(t){return this.unsupported("Arrays are not supported by MySQL"),this.functionFallbackSql(t)}arrayContainsAllSql(t){return this.unsupported("Array operations are not supported by MySQL"),this.functionFallbackSql(t)}dPipeSql(t){return this.func("CONCAT",[...t.flatten()])}extractSql(t){let e=t.name;return e&&e.toLowerCase()==="epoch"?this.func("UNIX_TIMESTAMP",[t.args.expression]):super.extractSql(t)}dataTypeSql(t){if(this.constructor.VARCHAR_REQUIRES_SIZE&&t.isType("varchar")&&!_optionalChain([t, 'access', _22 => _22.args, 'access', _23 => _23.expressions, 'optionalAccess', _24 => _24.length]))return"TEXT";let e=super.dataTypeSql(t);return n.UNSIGNED_TYPE_MAPPING.has(t.args.this)&&(e=`${e} UNSIGNED`),e}jsonArrayContainsSql(t){return`${this.sql(t,"this")} MEMBER OF(${this.sql(t,"expression")})`}castSql(t,e={}){let r=t.args.to;if(r instanceof _chunkC72OQ3YOcjs.pe){let u=r.args.this;if(this._constructor.TIMESTAMP_FUNC_TYPES.has(u))return this.func("TIMESTAMP",[t.args.this]);let p=this._constructor.CAST_MAPPING[u];p&&r.setArgKey("this",p)}return super.castSql(t)}showSql(t){let e=` ${t.name}`,r=t.args.full?" FULL":"",u=t.args.global?" GLOBAL":"",p=this.sql(t,"target");p=p?` ${p}`:"",["COLUMNS","INDEX"].includes(t.name)?p=` FROM${p}`:t.name==="GRANTS"?p=` FOR${p}`:["LINKS","PARTITIONS"].includes(t.name)?p=p?` ON${p}`:"":t.name==="PROJECTIONS"&&(p=p?` ON TABLE${p}`:"");let R=this.prefixedSql("FROM",t,"db"),x=this.prefixedSql("LIKE",t,"like"),j=this.sql(t,"where"),m=this.expressions(t,{key:"types"});m=m&&` ${m}`;let U=this.prefixedSql("FOR QUERY",t,"query"),w="",_="";t.name==="PROFILE"?(w=this.prefixedSql("OFFSET",t,"offset"),_=this.prefixedSql("LIMIT",t,"limit")):_=this.oldStyleLimitSql(t);let z=this.prefixedSql("IN",t,"log"),y=this.prefixedSql("FROM",t,"position"),Y=this.prefixedSql("FOR CHANNEL",t,"channel"),g="";t.name==="ENGINE"&&(g=t.args.mutex?" MUTEX":" STATUS");let L=this.prefixedSql("FOR TABLE",t,"forTable"),M=this.prefixedSql("FOR GROUP",t,"forGroup"),Q=this.prefixedSql("FOR USER",t,"forUser"),tt=this.prefixedSql("FOR ROLE",t,"forRole"),et=this.prefixedSql("INTO OUTFILE",t,"intoOutfile"),rt=t.args.json?" JSON":"";return`SHOW${r}${u}${e}${rt}${p}${L}${m}${R}${U}${z}${y}${Y}${g}${x}${j}${w}${_}${M}${Q}${tt}${et}`}alterRenameSql(t,e={}){return super.alterRenameSql(t,{includeTo:!1})}alterColumnSql(t){let e=this.sql(t,"dtype");return e?`MODIFY COLUMN ${this.sql(t,"this")} ${e}`:super.alterColumnSql(t)}prefixedSql(t,e,r){let u=this.sql(e,r);return u?` ${t} ${u}`:""}oldStyleLimitSql(t){let e=this.sql(t,"limit"),r=this.sql(t,"offset");return e?` LIMIT ${r?`${r}, ${e}`:e}`:""}timestampTruncSql(t){let e=t.args.unit,r="0000-01-01 00:00:00",u=_chunkC72OQ3YOcjs.mw.call(void 0, (0, _chunkC72OQ3YOcjs.Bn))([e,new (0, _chunkC72OQ3YOcjs.tg)({this:r,isString:!0}),t.args.this]),p=new (0, _chunkC72OQ3YOcjs.Si)({this:u,unit:e}),R=_chunkC72OQ3YOcjs.nw.call(void 0, (0, _chunkC72OQ3YOcjs.Vm))([new (0, _chunkC72OQ3YOcjs.tg)({this:r,isString:!0}),p]);return this.sql(R)}convertTimezoneSql(t){let e=t.args.sourceTz,r=t.args.targetTz,u=t.args.timestamp;return this.func("CONVERT_TZ",[u,e,r])}atTimeZoneSql(t){return this.unsupported("AT TIME ZONE is not supported by MySQL"),this.sql(t.args.this)}isAsciiSql(t){return`REGEXP_LIKE(${this.sql(t.args.this)}, '^[[:ascii:]]*$')`}ignoreNullsSql(t){return this.unsupported("MySQL does not support IGNORE NULLS."),this.sql(t.args.this)}currentSchemaSql(t){return _chunkC72OQ3YOcjs.Jv.call(this,t,"this"),this.func("SCHEMA",[])}partitionSql(t){let e=t.parent;return e instanceof _chunkC72OQ3YOcjs.Bh||e instanceof _chunkC72OQ3YOcjs.Dh?this.expressions(t,{flat:!0}):super.partitionSql(t)}partitionByRangeOrListSql(t,e){let r=this.expressions(t,{key:"partitionExpressions",flat:!0}),u=this.expressions(t,{key:"createExpressions",flat:!0});return`PARTITION BY ${e} (${r}) (${u})`}partitionByRangePropertySql(t){return this.partitionByRangeOrListSql(t,"RANGE")}partitionByListPropertySql(t){return this.partitionByRangeOrListSql(t,"LIST")}partitionListSql(t){let e=this.sql(t,"this"),r=this.expressions(t,{flat:!0});return`PARTITION ${e} VALUES IN (${r})`}partitionRangeSql(t){let e=this.sql(t,"this"),r=this.expressions(t,{flat:!0});return`PARTITION ${e} VALUES LESS THAN (${r})`}};N=_chunkC72OQ3YOcjs.b.call(void 0, rs),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"AFTER_HAVING_MODIFIER_TRANSFORMS",es,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"NULL_ORDERING_SUPPORTED",ts,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"ORIGINAL_TRANSFORMS",Qr,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"UNSIGNED_TYPE_MAPPING",zr,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"TIMESTAMP_TYPE_MAPPING",jr,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"TYPE_MAPPING",Zr,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"PROPERTIES_LOCATION",Jr,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"CHAR_CAST_MAPPING",Xr,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"SIGNED_CAST_MAPPING",Wr,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"CAST_MAPPING",$r,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"TIMESTAMP_FUNC_TYPES",vr,n),_chunkC72OQ3YOcjs.e.call(void 0, N,10,"RESERVED_KEYWORDS",kr,n),_chunkC72OQ3YOcjs.c.call(void 0, N,n),_chunkC72OQ3YOcjs.d.call(void 0, N,3,n),_chunkC72OQ3YOcjs.a.call(void 0, n,"MySQLGenerator"),n.SUPPORTS_DECODE_CASE=!1,n.SELECT_KINDS=[],n.TRY_SUPPORTED=!1,n.SUPPORTS_UESCAPE=!1,n.INTERVAL_ALLOWS_PLURAL_FORM=!1,n.LOCKING_READS_SUPPORTED=!0,n.SUPPORTS_MODIFY_COLUMN=!0,n.JOIN_HINTS=!1,n.TABLE_HINTS=!0,n.DUPLICATE_KEY_UPDATE_WITH_SET=!1,n.QUERY_HINT_SEP=" ",n.VALUES_AS_TABLE=!1,n.NVL2_SUPPORTED=!1,n.LAST_DAY_SUPPORTS_DATE_PART=!1,n.JSON_TYPE_REQUIRED_FOR_EXTRACTION=!0,n.JSON_PATH_BRACKETED_KEY_SUPPORTED=!1,n.JSON_KEY_VALUE_PAIR_SEP=",",n.SUPPORTS_TO_NUMBER=!1,n.PARSE_JSON_NAME=void 0,n.PAD_FILL_PATTERN_IS_REQUIRED=!0,n.WRAP_DERIVED_VALUES=!1,n.VARCHAR_REQUIRES_SIZE=!0,n.SUPPORTS_MEDIAN=!1,n.UPDATE_STATEMENT_SUPPORTS_FROM=!1,n.SUPPORTS_CONVERT_TIMEZONE=!0,n.SQL_SECURITY_VIEW_LOCATION="postCreate",n.LIMIT_FETCH="LIMIT",n.LIMIT_ONLY_LITERALS=!0;var Yt=n,ss,is,ns,as,Es,D,l=class l extends(Es=_chunkC72OQ3YOcjs.Nv,as=[_chunkC72OQ3YOcjs.s],ns=[_chunkC72OQ3YOcjs.s],is=[_chunkC72OQ3YOcjs.s],ss=[_chunkC72OQ3YOcjs.s],Es){static get NORMALIZATION_STRATEGY(){return"caseSensitive"}static get EXPRESSION_METADATA(){return new Map(_chunk2IDNLTQGcjs.a.EXPRESSION_METADATA)}static get TIME_MAPPING(){return{"%M":"%B","%c":"%-m","%e":"%-d","%h":"%I","%i":"%M","%s":"%S","%u":"%W","%k":"%-H","%l":"%-I","%T":"%H:%M:%S","%W":"%A"}}static get VALID_INTERVAL_UNITS(){return new Set([..._chunkC72OQ3YOcjs.Nv.VALID_INTERVAL_UNITS,"SECOND_MICROSECOND","MINUTE_MICROSECOND","MINUTE_SECOND","HOUR_MICROSECOND","HOUR_SECOND","HOUR_MINUTE","DAY_MICROSECOND","DAY_SECOND","DAY_MINUTE","DAY_HOUR","YEAR_MONTH"])}};D=_chunkC72OQ3YOcjs.b.call(void 0, Es),_chunkC72OQ3YOcjs.e.call(void 0, D,10,"NORMALIZATION_STRATEGY",as,l),_chunkC72OQ3YOcjs.e.call(void 0, D,10,"EXPRESSION_METADATA",ns,l),_chunkC72OQ3YOcjs.e.call(void 0, D,10,"TIME_MAPPING",is,l),_chunkC72OQ3YOcjs.e.call(void 0, D,10,"VALID_INTERVAL_UNITS",ss,l),_chunkC72OQ3YOcjs.c.call(void 0, D,l),_chunkC72OQ3YOcjs.d.call(void 0, D,3,l),_chunkC72OQ3YOcjs.a.call(void 0, l,"MySQL"),l.DIALECT_NAME="mysql",l.PROMOTE_TO_INFERRED_DATETIME_TYPE=!0,l.IDENTIFIERS_CAN_START_WITH_DIGIT=!0,l.TIME_FORMAT="'%Y-%m-%d %T'",l.DPIPE_IS_STRING_CONCAT=!1,l.SUPPORTS_USER_DEFINED_TYPES=!1,l.SUPPORTS_SEMI_ANTI_JOIN=!1,l.SAFE_DIVISION=!0,l.SAFE_TO_ELIMINATE_DOUBLE_NEGATION=!1,l.LEAST_GREATEST_IGNORES_NULLS=!1,l.Tokenizer=wt,l.Parser=yt,l.Generator=Yt;var Vt=l;exports.a = i; exports.b = Ts; exports.c = ps; exports.d = us; exports.e = Gt; exports.f = ls; exports.g = Ft; exports.h = cs; exports.i = d; exports.j = Vt;
2
- //# sourceMappingURL=chunk-ABH3VZG7.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkD5E56FXAcjs = require('./chunk-D5E56FXA.cjs');var _chunkE4WQOMI7cjs = require('./chunk-E4WQOMI7.cjs');function i(S,a={}){return function(){return this.parseShowMysql(S,a)}}_chunkE4WQOMI7cjs.a.call(void 0, i,"showParser");function Ts(S){let a=this.sql(S,"this"),t=S.text("unit").toUpperCase(),e,r;if(t==="WEEK")e=`CONCAT(YEAR(${a}), ' ', WEEK(${a}, 1), ' 1')`,r="%Y %u %w";else if(t==="MONTH")e=`CONCAT(YEAR(${a}), ' ', MONTH(${a}), ' 1')`,r="%Y %c %e";else if(t==="QUARTER")e=`CONCAT(YEAR(${a}), ' ', QUARTER(${a}) * 3 - 2, ' 1')`,r="%Y %c %e";else if(t==="YEAR")e=`CONCAT(YEAR(${a}), ' 1 1')`,r="%Y %c %e";else return t!=="DAY"&&this.unsupported(`Unexpected interval unit: ${t}`),this.func("DATE",[a]);return this.func("STR_TO_DATE",[e,`'${r}'`])}_chunkE4WQOMI7cjs.a.call(void 0, Ts,"dateTruncSql");var ps=new Set(["f","H","h","I","i","k","l","p","r","S","s","T"]);function Ss(S){let a=0,t=S.length;for(;a<t;){if(S[a]==="%"&&(a+=1,a<t&&ps.has(S[a])))return!0;a+=1}return!1}_chunkE4WQOMI7cjs.a.call(void 0, Ss,"hasTimeSpecifier");function us(S){let a=_chunkE4WQOMI7cjs.Sa.call(void 0, S,1),t=Vt.formatTime(a),e=_chunkE4WQOMI7cjs.Sa.call(void 0, S,0);return a&&Ss(a instanceof _chunkE4WQOMI7cjs.xb?a.name:a)?new (0, _chunkE4WQOMI7cjs.yr)({this:e,format:t||""}):new (0, _chunkE4WQOMI7cjs.xr)({this:e,format:t})}_chunkE4WQOMI7cjs.a.call(void 0, us,"buildStrToDate");function Gt(S){return this.func("STR_TO_DATE",[S.args.this,this.formatTime(S)])}_chunkE4WQOMI7cjs.a.call(void 0, Gt,"strToDateSql");function ls(S){let a=S.args.scale,t=S.args.this;return a===void 0||a.toValue()===_chunkE4WQOMI7cjs.bs.SECONDS.toValue()?this.func("FROM_UNIXTIME",[t,this.formatTime(S)]):this.func("FROM_UNIXTIME",[new (0, _chunkE4WQOMI7cjs.vj)({this:t,expression:_chunkE4WQOMI7cjs.Hu.call(void 0, "POW","10",a.toString())}),this.formatTime(S)])}_chunkE4WQOMI7cjs.a.call(void 0, ls,"unixToTimeSql");function Ft(S){return function(a){return this.func(`DATE_${S}`,[a.args.this,new (0, _chunkE4WQOMI7cjs.Vi)({this:a.args.expression,unit:_chunkE4WQOMI7cjs.ex.call(void 0, a)})])}}_chunkE4WQOMI7cjs.a.call(void 0, Ft,"dateAddSql");function cs(S){return S.args.format?Gt.call(this,S):this.func("DATE",[S.args.this])}_chunkE4WQOMI7cjs.a.call(void 0, cs,"tsOrDsToDateSql");function d(S,a=["this"]){return function(t){for(let e of a){let r=t.getArgKey(e);(r instanceof _chunkE4WQOMI7cjs.Tr||r instanceof _chunkE4WQOMI7cjs.Wr)&&!r.getArgKey("format")&&t.setArgKey(e,r.args.this)}return S?S.call(this,t):this.functionFallbackSql(t)}}_chunkE4WQOMI7cjs.a.call(void 0, d,"removeTsOrDsToDate");var fr,dr,xr,Z,f=class f extends(xr=_chunkE4WQOMI7cjs.Gx,dr=[_chunkE4WQOMI7cjs.s],fr=[_chunkE4WQOMI7cjs.s],xr){constructor(){super(...arguments);this.NESTED_COMMENTS=!1}static get ORIGINAL_KEYWORDS(){return{..._chunkE4WQOMI7cjs.Gx.KEYWORDS,BLOB:"blob",CHARSET:"characterSet",DISTINCTROW:"distinct",EXPLAIN:"describe",FORCE:"force",IGNORE:"ignore",KEY:"key","LOCK TABLES":"command",LONGBLOB:"longblob",LONGTEXT:"longtext",MEDIUMBLOB:"mediumblob",MEDIUMINT:"mediumint",MEDIUMTEXT:"mediumtext","MEMBER OF":"memberOf",MOD:"mod",SEPARATOR:"separator",SERIAL:"serial",SIGNED:"bigint","SIGNED INTEGER":"bigint","SOUNDS LIKE":"soundsLike",START:"begin",TIMESTAMP:"timestamptz",TINYBLOB:"tinyblob",TINYTEXT:"tinytext",TYPE:"type","UNLOCK TABLES":"command",UNSIGNED:"ubigint","UNSIGNED INTEGER":"ubigint",YEAR:"year",_ARMSCII8:"introducer",_ASCII:"introducer",_BIG5:"introducer",_BINARY:"introducer",_CP1250:"introducer",_CP1251:"introducer",_CP1256:"introducer",_CP1257:"introducer",_CP850:"introducer",_CP852:"introducer",_CP866:"introducer",_CP932:"introducer",_DEC8:"introducer",_EUCJPMS:"introducer",_EUCKR:"introducer",_GB18030:"introducer",_GB2312:"introducer",_GBK:"introducer",_GEOSTD8:"introducer",_GREEK:"introducer",_HEBREW:"introducer",_HP8:"introducer",_KEYBCS2:"introducer",_KOI8R:"introducer",_KOI8U:"introducer",_LATIN1:"introducer",_LATIN2:"introducer",_LATIN5:"introducer",_LATIN7:"introducer",_MACCE:"introducer",_MACROMAN:"introducer",_SJIS:"introducer",_SWE7:"introducer",_TIS620:"introducer",_UCS2:"introducer",_UJIS:"introducer",_UTF8:"introducer",_UTF16:"introducer",_UTF16LE:"introducer",_UTF32:"introducer",_UTF8MB3:"introducer",_UTF8MB4:"introducer","@@":"sessionParameter"}}static get COMMANDS(){let t=new Set([..._chunkE4WQOMI7cjs.Gx.COMMANDS,"replace"]);return t.delete("show"),t}};Z=_chunkE4WQOMI7cjs.b.call(void 0, xr),_chunkE4WQOMI7cjs.e.call(void 0, Z,10,"ORIGINAL_KEYWORDS",dr,f),_chunkE4WQOMI7cjs.e.call(void 0, Z,10,"COMMANDS",fr,f),_chunkE4WQOMI7cjs.c.call(void 0, Z,f),_chunkE4WQOMI7cjs.d.call(void 0, Z,3,f),_chunkE4WQOMI7cjs.a.call(void 0, f,"MySQLTokenizer"),f.QUOTES=["'",'"'],f.COMMENTS=["--","#",["/*","*/"]],f.IDENTIFIERS=["`"],f.STRING_ESCAPES=["'",'"',"\\"],f.BIT_STRINGS=[["b'","'"],["B'","'"],["0b",""]],f.HEX_STRINGS=[["x'","'"],["X'","'"],["0x",""]],f.ESCAPE_FOLLOW_CHARS=["0","b","n","r","t","Z","%","_"];var wt=f,Cr,mr,Pr,gr,Dr,Ur,_r,Lr,Mr,br,qr,Br,Fr,Gr,wr,yr,Yr,Vr,Kr,Hr,A,T=class T extends(Hr=_chunkE4WQOMI7cjs.pb,Kr=[_chunkE4WQOMI7cjs.s],Vr=[_chunkE4WQOMI7cjs.s],Yr=[_chunkE4WQOMI7cjs.s],yr=[_chunkE4WQOMI7cjs.s],wr=[_chunkE4WQOMI7cjs.s],Gr=[_chunkE4WQOMI7cjs.s],Fr=[_chunkE4WQOMI7cjs.s],Br=[_chunkE4WQOMI7cjs.s],qr=[_chunkE4WQOMI7cjs.s],br=[_chunkE4WQOMI7cjs.s],Mr=[_chunkE4WQOMI7cjs.s],Lr=[_chunkE4WQOMI7cjs.s],_r=[_chunkE4WQOMI7cjs.s],Ur=[_chunkE4WQOMI7cjs.s],Dr=[_chunkE4WQOMI7cjs.s],gr=[_chunkE4WQOMI7cjs.s],Pr=[_chunkE4WQOMI7cjs.s],mr=[_chunkE4WQOMI7cjs.s],Cr=[_chunkE4WQOMI7cjs.s],Hr){static get ID_VAR_TOKENS(){return new Set([..._chunkE4WQOMI7cjs.pb.ID_VAR_TOKENS,"currentCatalog"])}static get FUNC_TOKENS(){return new Set([..._chunkE4WQOMI7cjs.pb.FUNC_TOKENS,"database","mod","schema","values","characterSet"])}static get CONJUNCTION(){return{..._chunkE4WQOMI7cjs.pb.CONJUNCTION,damp:_chunkE4WQOMI7cjs.vt,xor:_chunkE4WQOMI7cjs.xt}}static get DISJUNCTION(){return{..._chunkE4WQOMI7cjs.pb.DISJUNCTION,dpipe:_chunkE4WQOMI7cjs.wt}}static get TABLE_ALIAS_TOKENS(){return(()=>{let t=new Set(_chunkE4WQOMI7cjs.pb.TABLE_ALIAS_TOKENS);for(let e of _chunkE4WQOMI7cjs.pb.TABLE_INDEX_HINT_TOKENS)t.delete(e);return t})()}static get RANGE_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.RANGE_PARSERS,soundsLike:function(t){return this.expression(_chunkE4WQOMI7cjs.Bj,{this:this.expression(_chunkE4WQOMI7cjs.kr,{this:t}),expression:this.expression(_chunkE4WQOMI7cjs.kr,{this:this.parseTerm()})})},memberOf:function(t){return this.expression(_chunkE4WQOMI7cjs.qp,{this:t,expression:this.parseWrapped(this.parseExpression.bind(this))})}}}static get FUNCTIONS(){return{..._chunkE4WQOMI7cjs.pb.FUNCTIONS,BIT_AND:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.ys.fromArgList(t),"BIT_AND"),BIT_OR:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.zs.fromArgList(t),"BIT_OR"),BIT_XOR:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.As.fromArgList(t),"BIT_XOR"),BIT_COUNT:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Fk.fromArgList(t),"BIT_COUNT"),CONVERT_TZ:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.pl)({sourceTz:_chunkE4WQOMI7cjs.Sa.call(void 0, t,1),targetTz:_chunkE4WQOMI7cjs.Sa.call(void 0, t,2),timestamp:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)}),"CONVERT_TZ"),CURDATE:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Dm.fromArgList(t),"CURDATE"),CURTIME:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Fm.fromArgList(t),"CURTIME"),DATE:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)}),"DATE"),DATE_ADD:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.xw.call(void 0, (0, _chunkE4WQOMI7cjs.Ym))(t),"DATE_ADD"),DATE_FORMAT:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Jr)({this:new (0, _chunkE4WQOMI7cjs.Wr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)}),format:_chunkE4WQOMI7cjs.Xv.getOrRaise("mysql")._constructor.formatTime(_chunkE4WQOMI7cjs.Sa.call(void 0, t,1))}),"DATE_FORMAT"),DATE_SUB:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.xw.call(void 0, (0, _chunkE4WQOMI7cjs._m))(t),"DATE_SUB"),DAY:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Rn)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"DAY"),DAYOFMONTH:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.jn)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"DAYOFMONTH"),DAYOFWEEK:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.hn)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"DAYOFWEEK"),DAYOFYEAR:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.kn)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"DAYOFYEAR"),FORMAT:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Br.fromArgList(t),"FORMAT"),FROM_UNIXTIME:_chunkE4WQOMI7cjs.uw.call(void 0, _chunkE4WQOMI7cjs.bs,{dialect:"mysql"}),ISNULL:_chunkE4WQOMI7cjs.Zw,LENGTH:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Dp)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0),binary:!0}),"LENGTH"),MAKETIME:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Mn.fromArgList(t),"MAKETIME"),MONTH:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.$p)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"MONTH"),MONTHNAME:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.Jr)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)}),format:new (0, _chunkE4WQOMI7cjs.tg)({this:"%B",isString:!0})}),"MONTHNAME"),SCHEMA:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Nm.fromArgList(t),"SCHEMA"),DATABASE:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Nm.fromArgList(t),"DATABASE"),STR_TO_DATE:us,TIMESTAMPDIFF:_chunkE4WQOMI7cjs.ww.call(void 0, _chunkE4WQOMI7cjs.En,void 0,{defaultUnit:"DAY"}),TO_DAYS:_chunkE4WQOMI7cjs.a.call(void 0, t=>{let e=new (0, _chunkE4WQOMI7cjs.$m)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)}),expression:new (0, _chunkE4WQOMI7cjs.Tr)({this:new (0, _chunkE4WQOMI7cjs.tg)({this:"0000-01-01",isString:!0})}),unit:new (0, _chunkE4WQOMI7cjs.ce)({this:"DAY"})});return new (0, _chunkE4WQOMI7cjs.ak)({this:e.add(1)})},"TO_DAYS"),VERSION:_chunkE4WQOMI7cjs.a.call(void 0, t=>_chunkE4WQOMI7cjs.Am.fromArgList(t),"VERSION"),WEEK:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.os)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)}),mode:_chunkE4WQOMI7cjs.Sa.call(void 0, t,1)}),"WEEK"),WEEKOFYEAR:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.nn)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"WEEKOFYEAR"),YEAR:_chunkE4WQOMI7cjs.a.call(void 0, t=>new (0, _chunkE4WQOMI7cjs.ts)({this:new (0, _chunkE4WQOMI7cjs.Tr)({this:_chunkE4WQOMI7cjs.Sa.call(void 0, t,0)})}),"YEAR")}}static get FUNCTION_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.FUNCTION_PARSERS,GROUP_CONCAT:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseGroupConcat()},"GROUP_CONCAT"),VALUES:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.expression(_chunkE4WQOMI7cjs.Xk,{this:"VALUES",expressions:[this.parseIdVar()]})},"VALUES"),JSON_VALUE:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseJsonValue()},"JSON_VALUE"),SUBSTR:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseSubstring()},"SUBSTR")}}static get STATEMENT_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.STATEMENT_PARSERS,show:function(){return this.parseShow()}}}static get PROPERTY_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.PROPERTY_PARSERS,LOCK:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parsePropertyAssignment(_chunkE4WQOMI7cjs.qh)},"LOCK"),"PARTITION BY":_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parsePartitionProperty()},"PARTITION BY")}}static get SET_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.SET_PARSERS,PERSIST:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseSetItemAssignment({kind:"persist"})},"PERSIST"),PERSIST_ONLY:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseSetItemAssignment({kind:"PERSIST_ONLY"})},"PERSIST_ONLY"),"CHARACTER SET":_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseSetItemCharset("CHARACTER SET")},"CHARACTER SET"),CHARSET:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseSetItemCharset("CHARACTER SET")},"CHARSET"),NAMES:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseSetItemNames()},"NAMES")}}static get CONSTRAINT_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.CONSTRAINT_PARSERS,FULLTEXT:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseIndexConstraint("FULLTEXT")},"FULLTEXT"),INDEX:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseIndexConstraint()},"INDEX"),KEY:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseIndexConstraint()},"KEY"),SPATIAL:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseIndexConstraint("SPATIAL")},"SPATIAL"),ZEROFILL:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.expression(_chunkE4WQOMI7cjs.Nf)},"ZEROFILL"),COLUMN_FORMAT:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseIdVar(),this.expression(_chunkE4WQOMI7cjs.ce,{this:"COLUMN_FORMAT"})},"COLUMN_FORMAT"),STORAGE:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseIdVar(),this.expression(_chunkE4WQOMI7cjs.ce,{this:"STORAGE"})},"STORAGE"),INVISIBLE:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.expression(_chunkE4WQOMI7cjs.ce,{this:"INVISIBLE"})},"INVISIBLE"),VISIBLE:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.expression(_chunkE4WQOMI7cjs.ce,{this:"VISIBLE"})},"VISIBLE")}}static get ALTER_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.ALTER_PARSERS,MODIFY:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseAlterTableModify()},"MODIFY"),AUTO_INCREMENT:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parsePropertyAssignment(_chunkE4WQOMI7cjs.yg)},"AUTO_INCREMENT"),COMMENT:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parsePropertyAssignment(_chunkE4WQOMI7cjs.Qh)},"COMMENT")}}static get ALTER_ALTER_PARSERS(){return{..._chunkE4WQOMI7cjs.pb.ALTER_ALTER_PARSERS,INDEX:_chunkE4WQOMI7cjs.a.call(void 0, function(){return this.parseAlterTableAlterIndex()},"INDEX")}}static get SCHEMA_UNNAMED_CONSTRAINTS(){return new Set([..._chunkE4WQOMI7cjs.pb.SCHEMA_UNNAMED_CONSTRAINTS,"FULLTEXT","INDEX","KEY","SPATIAL"])}static get PROFILE_TYPES(){return{ALL:[],CPU:[],IPC:[],MEMORY:[],SOURCE:[],SWAPS:[],BLOCK:["IO"],CONTEXT:["SWITCHES"],PAGE:["FAULTS"]}}static get TYPE_TOKENS(){return new Set([..._chunkE4WQOMI7cjs.pb.TYPE_TOKENS,"set"])}static get ENUM_TYPE_TOKENS(){return new Set([..._chunkE4WQOMI7cjs.pb.ENUM_TYPE_TOKENS,"set"])}static get OPERATION_MODIFIERS(){return new Set(["HIGH_PRIORITY","STRAIGHT_JOIN","SQL_SMALL_RESULT","SQL_BIG_RESULT","SQL_BUFFER_RESULT","SQL_NO_CACHE","SQL_CALC_FOUND_ROWS"])}parseGeneratedAsIdentity(){let t=super.parseGeneratedAsIdentity();if(this.matchTexts(["STORED","VIRTUAL"])){let e=_optionalChain([this, 'access', _2 => _2.prev, 'optionalAccess', _3 => _3.text, 'access', _4 => _4.toUpperCase, 'call', _5 => _5()])==="STORED";t instanceof _chunkE4WQOMI7cjs.pg?t.setArgKey("persisted",e):t instanceof _chunkE4WQOMI7cjs.ag&&(t=this.expression(_chunkE4WQOMI7cjs.pg,{this:t.args.expression,persisted:e}))}return t}parsePrimaryKeyPart(){let t=this.parseIdVar();if(!this.match("lParen"))return t;let e=this.parseNumber();return this.matchRParen(),this.expression(_chunkE4WQOMI7cjs.Tc,{this:t,expression:e})}parseUnique(){this.matchTexts(["KEY","INDEX"]);let t=this.parseUniqueKey(),e=(this.match("using")||void 0)&&this.advanceAny()&&_optionalChain([this, 'access', _6 => _6.prev, 'optionalAccess', _7 => _7.text]);if(!this.match("lParen",{advance:!1}))return this.expression(_chunkE4WQOMI7cjs.lg,{this:t,indexType:e});let r=this.parseWrappedCsv(this.parseOrdered.bind(this));return this.expression(_chunkE4WQOMI7cjs.lg,{this:this.expression(_chunkE4WQOMI7cjs.ee,{this:t,expressions:r}),indexType:e||(this.match("using")||void 0)&&this.advanceAny()&&_optionalChain([this, 'access', _8 => _8.prev, 'optionalAccess', _9 => _9.text]),options:this.parseKeyConstraintOptions()})}parseIndexConstraint(t){t&&this.matchTexts(["INDEX","KEY"]);let e=this.parseIdVar({anyToken:!1}),r=this.match("using")&&this.advanceAny()&&_optionalChain([this, 'access', _10 => _10.prev, 'optionalAccess', _11 => _11.text]),u=this.parseWrappedCsv(this.parseOrdered.bind(this)),p=[];for(;;){let R;if(this.matchTextSeq(["KEY_BLOCK_SIZE"])?(this.match("eq"),R=new (0, _chunkE4WQOMI7cjs.Ac)({keyBlockSize:this.parseNumber()})):this.match("using")?R=new (0, _chunkE4WQOMI7cjs.Ac)({using:this.advanceAny()&&_optionalChain([this, 'access', _12 => _12.prev, 'optionalAccess', _13 => _13.text])}):this.matchTextSeq(["WITH","PARSER"])?R=new (0, _chunkE4WQOMI7cjs.Ac)({parser:this.parseVar({anyToken:!0})}):this.match("comment")?R=new (0, _chunkE4WQOMI7cjs.Ac)({comment:this.parseString()}):this.matchTextSeq(["VISIBLE"])?R=new (0, _chunkE4WQOMI7cjs.Ac)({visible:!0}):this.matchTextSeq(["INVISIBLE"])?R=new (0, _chunkE4WQOMI7cjs.Ac)({visible:!1}):this.matchTextSeq(["ENGINE_ATTRIBUTE"])?(this.match("eq"),R=new (0, _chunkE4WQOMI7cjs.Ac)({engineAttr:this.parseString()})):this.matchTextSeq(["SECONDARY_ENGINE_ATTRIBUTE"])&&(this.match("eq"),R=new (0, _chunkE4WQOMI7cjs.Ac)({secondaryEngineAttr:this.parseString()})),!R)break;p.push(R)}return this.expression(_chunkE4WQOMI7cjs.cg,{this:e,expressions:u,kind:t,indexType:r,options:p})}parseShowMysql(t,e={}){let{target:r=!1,full:u,global:p}=e,R=this.matchTextSeq(["JSON"]),x;r&&(typeof r=="string"&&this.matchTextSeq(r.split(" ")),x=this.parseIdVar());let j=this.matchTextSeq(["IN"])?this.parseString():void 0,m,U;t==="BINLOG EVENTS"||t==="RELAYLOG EVENTS"?m=this.matchTextSeq(["FROM"])?this.parseNumber():void 0:this.match("from")?U=this.parseIdVar():this.match("dot")&&(U=x,x=this.parseIdVar());let w=this.matchTextSeq(["FOR","CHANNEL"])?this.parseIdVar():void 0,_=this.matchTextSeq(["LIKE"])?this.parseString():void 0,z=this.parseWhere(),y,Y,g,L;t==="PROFILE"?(y=this.parseCsv(()=>this.parseVarFromOptions(T.PROFILE_TYPES)),Y=this.matchTextSeq(["FOR","QUERY"])?this.parseNumber():void 0,g=this.matchTextSeq(["OFFSET"])?this.parseNumber():void 0,L=this.matchTextSeq(["LIMIT"])?this.parseNumber():void 0):[g,L]=this.parseOldstyleLimit();let M;this.matchTextSeq(["MUTEX"])&&(M=!0),this.matchTextSeq(["STATUS"])&&(M=!1);let Q=this.matchTextSeq(["FOR","TABLE"])?this.parseIdVar():void 0,tt=this.matchTextSeq(["FOR","GROUP"])?this.parseString():void 0,et=this.matchTextSeq(["FOR","USER"])?this.parseString():void 0,rt=this.matchTextSeq(["FOR","ROLE"])?this.parseString():void 0,os=this.matchTextSeq(["INTO","OUTFILE"])?this.parseString():void 0;return this.expression(_chunkE4WQOMI7cjs.cc,{this:t,target:x,full:u,log:j,position:m,db:U,channel:w,like:_,where:z,types:y,query:Y,offset:g,limit:L,mutex:M,forTable:Q,forGroup:tt,forUser:et,forRole:rt,intoOutfile:os,json:R,global:p})}parseOldstyleLimit(){let t,e;if(this.matchTextSeq(["LIMIT"])){let r=this.parseCsv(this.parseNumber.bind(this));r.length===1?t=r[0]:r.length===2&&(t=r[1],e=r[0])}return[e,t]}parseSetItemCharset(t){let e=this.parseString()||this.parseUnquotedField();return this.expression(_chunkE4WQOMI7cjs.ac,{this:e,kind:t})}parseSetItemNames(){let t=this.parseString()||this.parseUnquotedField(),e;return this.matchTextSeq(["COLLATE"])&&(e=this.parseString()||this.parseUnquotedField()),this.expression(_chunkE4WQOMI7cjs.ac,{this:t,collate:e,kind:"NAMES"})}parseType(t={}){let{parseInterval:e=!0,fallbackToIdentifier:r=!1}=t;if(this.match("binary",{advance:!1})){let u=this.parseTypes({checkFunc:!0,allowIdentifiers:!1});if(u instanceof _chunkE4WQOMI7cjs.pe)return this.expression(_chunkE4WQOMI7cjs.$l,{this:this.parseColumn(),to:u})}return super.parseType({parseInterval:e,fallbackToIdentifier:r})}parseAlterTableAlterIndex(){let t=this.parseField({anyToken:!0}),e;return this.matchTextSeq(["VISIBLE"])?e=!0:this.matchTextSeq(["INVISIBLE"])&&(e=!1),this.expression(_chunkE4WQOMI7cjs.oc,{this:t,visible:e})}parseAlterTableModify(){this.match("column");let t=this.parseField({anyToken:!0});if(!t)return;let e=this.parseColumnDef(t);if(e instanceof _chunkE4WQOMI7cjs.lc)return this.expression(_chunkE4WQOMI7cjs.nc,{this:e})}parsePartitionProperty(){let t,e;if(this.matchTextSeq(["RANGE"])?(t=_chunkE4WQOMI7cjs.Ch,e=this.parsePartitionRangeValue.bind(this)):this.matchTextSeq(["LIST"])&&(t=_chunkE4WQOMI7cjs.Eh,e=this.parsePartitionListValue.bind(this)),!t||!e)return;let r=this.parseWrappedCsv(this.parseAssignment.bind(this));if(!this.matchTextSeq(["(","PARTITION"],{advance:!1}))return r;let u=this.parseWrappedCsv(e);return this.expression(t,{partitionExpressions:r,createExpressions:u})}parsePartitionRangeValue(){this.matchTextSeq(["PARTITION"]);let t=this.parseIdVar();if(!this.matchTextSeq(["VALUES","LESS","THAN"]))return t;let e=this.parseWrappedCsv(this.parseExpression.bind(this));e.length===1&&e[0]instanceof _chunkE4WQOMI7cjs.Kf&&e[0].name.toUpperCase()==="MAXVALUE"&&(e=[new (0, _chunkE4WQOMI7cjs.ce)({this:"MAXVALUE"})]);let r=this.expression(_chunkE4WQOMI7cjs.ld,{this:t,expressions:e});return this.expression(_chunkE4WQOMI7cjs.kd,{expressions:[r]})}parsePartitionListValue(){this.matchTextSeq(["PARTITION"]);let t=this.parseIdVar();this.matchTextSeq(["VALUES","IN"]);let e=this.parseWrappedCsv(this.parseExpression.bind(this)),r=this.expression(_chunkE4WQOMI7cjs.Md,{this:t,expressions:e});return this.expression(_chunkE4WQOMI7cjs.kd,{expressions:[r]})}parsePrimaryKey(t={}){let{wrappedOptional:e=!1,inProps:r=!1}=t;return super.parsePrimaryKey({wrappedOptional:e,inProps:r,namedPrimaryKey:!0})}};A=_chunkE4WQOMI7cjs.b.call(void 0, Hr),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"ID_VAR_TOKENS",Kr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"FUNC_TOKENS",Vr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"CONJUNCTION",Yr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"DISJUNCTION",yr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"TABLE_ALIAS_TOKENS",wr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"RANGE_PARSERS",Gr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"FUNCTIONS",Fr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"FUNCTION_PARSERS",Br,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"STATEMENT_PARSERS",qr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"PROPERTY_PARSERS",br,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"SET_PARSERS",Mr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"CONSTRAINT_PARSERS",Lr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"ALTER_PARSERS",_r,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"ALTER_ALTER_PARSERS",Ur,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"SCHEMA_UNNAMED_CONSTRAINTS",Dr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"PROFILE_TYPES",gr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"TYPE_TOKENS",Pr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"ENUM_TYPE_TOKENS",mr,T),_chunkE4WQOMI7cjs.e.call(void 0, A,10,"OPERATION_MODIFIERS",Cr,T),_chunkE4WQOMI7cjs.c.call(void 0, A,T),_chunkE4WQOMI7cjs.d.call(void 0, A,3,T),_chunkE4WQOMI7cjs.a.call(void 0, T,"MySQLParser"),T.SHOW_PARSERS={"BINARY LOGS":i("BINARY LOGS"),"MASTER LOGS":i("BINARY LOGS"),"BINLOG EVENTS":i("BINLOG EVENTS"),"CHARACTER SET":i("CHARACTER SET"),CHARSET:i("CHARACTER SET"),COLLATION:i("COLLATION"),"FULL COLUMNS":i("COLUMNS",{target:"FROM",full:!0}),COLUMNS:i("COLUMNS",{target:"FROM"}),"CREATE DATABASE":i("CREATE DATABASE",{target:!0}),"CREATE EVENT":i("CREATE EVENT",{target:!0}),"CREATE FUNCTION":i("CREATE FUNCTION",{target:!0}),"CREATE PROCEDURE":i("CREATE PROCEDURE",{target:!0}),"CREATE TABLE":i("CREATE TABLE",{target:!0}),"CREATE TRIGGER":i("CREATE TRIGGER",{target:!0}),"CREATE VIEW":i("CREATE VIEW",{target:!0}),DATABASES:i("DATABASES"),SCHEMAS:i("DATABASES"),ENGINE:i("ENGINE",{target:!0}),"STORAGE ENGINES":i("ENGINES"),ENGINES:i("ENGINES"),ERRORS:i("ERRORS"),EVENTS:i("EVENTS"),"FUNCTION CODE":i("FUNCTION CODE",{target:!0}),"FUNCTION STATUS":i("FUNCTION STATUS"),GRANTS:i("GRANTS",{target:"FOR"}),INDEX:i("INDEX",{target:"FROM"}),"MASTER STATUS":i("MASTER STATUS"),"OPEN TABLES":i("OPEN TABLES"),PLUGINS:i("PLUGINS"),"PROCEDURE CODE":i("PROCEDURE CODE",{target:!0}),"PROCEDURE STATUS":i("PROCEDURE STATUS"),PRIVILEGES:i("PRIVILEGES"),"FULL PROCESSLIST":i("PROCESSLIST",{full:!0}),PROCESSLIST:i("PROCESSLIST"),PROFILE:i("PROFILE"),PROFILES:i("PROFILES"),"RELAYLOG EVENTS":i("RELAYLOG EVENTS"),REPLICAS:i("REPLICAS"),"SLAVE HOSTS":i("REPLICAS"),"REPLICA STATUS":i("REPLICA STATUS"),"SLAVE STATUS":i("REPLICA STATUS"),"GLOBAL STATUS":i("STATUS",{global:!0}),"SESSION STATUS":i("STATUS"),STATUS:i("STATUS"),"TABLE STATUS":i("TABLE STATUS"),"FULL TABLES":i("TABLES",{full:!0}),TABLES:i("TABLES"),TRIGGERS:i("TRIGGERS"),"GLOBAL VARIABLES":i("VARIABLES",{global:!0}),"SESSION VARIABLES":i("VARIABLES"),VARIABLES:i("VARIABLES"),WARNINGS:i("WARNINGS")},T.LOG_DEFAULTS_TO_LN=!0,T.STRING_ALIASES=!0,T.VALUES_FOLLOWED_BY_PAREN=!1,T.SUPPORTS_PARTITION_SELECTION=!0;var yt=T,kr,vr,$r,Wr,Xr,Jr,Zr,jr,zr,Qr,ts,es,rs,N,n=class n extends(rs=_chunkE4WQOMI7cjs.Uv,es=[_chunkE4WQOMI7cjs.s],ts=[_chunkE4WQOMI7cjs.s],Qr=[_chunkE4WQOMI7cjs.s],zr=[_chunkE4WQOMI7cjs.s],jr=[_chunkE4WQOMI7cjs.s],Zr=[_chunkE4WQOMI7cjs.s],Jr=[_chunkE4WQOMI7cjs.s],Xr=[_chunkE4WQOMI7cjs.s],Wr=[_chunkE4WQOMI7cjs.s],$r=[_chunkE4WQOMI7cjs.s],vr=[_chunkE4WQOMI7cjs.s],kr=[_chunkE4WQOMI7cjs.s],rs){static get AFTER_HAVING_MODIFIER_TRANSFORMS(){let t=new Map(super.AFTER_HAVING_MODIFIER_TRANSFORMS);return["cluster","distribute","sort"].forEach(e=>t.delete(e)),t}static get NULL_ORDERING_SUPPORTED(){return"unsupported"}static get ORIGINAL_TRANSFORMS(){return new Map([..._chunkE4WQOMI7cjs.Uv.TRANSFORMS,[_chunkE4WQOMI7cjs.Xs,_chunkE4WQOMI7cjs._v.call(void 0, "GROUP_CONCAT")],[_chunkE4WQOMI7cjs.ys,_chunkE4WQOMI7cjs._v.call(void 0, "BIT_AND")],[_chunkE4WQOMI7cjs.zs,_chunkE4WQOMI7cjs._v.call(void 0, "BIT_OR")],[_chunkE4WQOMI7cjs.As,_chunkE4WQOMI7cjs._v.call(void 0, "BIT_XOR")],[_chunkE4WQOMI7cjs.Fk,_chunkE4WQOMI7cjs._v.call(void 0, "BIT_COUNT")],[_chunkE4WQOMI7cjs.lm,function(t){return this.chrSql(t,{name:"CHAR"})}],[_chunkE4WQOMI7cjs.Dm,_chunkE4WQOMI7cjs.fw],[_chunkE4WQOMI7cjs.Am,_chunkE4WQOMI7cjs._v.call(void 0, "VERSION")],[_chunkE4WQOMI7cjs.$m,d(function(t){return this.func("DATEDIFF",[t.args.this,t.args.expression])},["this","expression"])],[_chunkE4WQOMI7cjs.Ym,d(Ft("ADD"))],[_chunkE4WQOMI7cjs.Nn,_chunkE4WQOMI7cjs.Hw],[_chunkE4WQOMI7cjs._m,d(Ft("SUB"))],[_chunkE4WQOMI7cjs.an,Ts],[_chunkE4WQOMI7cjs.Rn,d()],[_chunkE4WQOMI7cjs.jn,d(_chunkE4WQOMI7cjs._v.call(void 0, "DAYOFMONTH"))],[_chunkE4WQOMI7cjs.hn,d(_chunkE4WQOMI7cjs._v.call(void 0, "DAYOFWEEK"))],[_chunkE4WQOMI7cjs.kn,d(_chunkE4WQOMI7cjs._v.call(void 0, "DAYOFYEAR"))],[_chunkE4WQOMI7cjs.tt,function(t){return`GROUP_CONCAT(${this.sql(t,"this")} SEPARATOR ${this.sql(t,"separator")||"','"})`}],[_chunkE4WQOMI7cjs.Kj,_chunkE4WQOMI7cjs.ew],[_chunkE4WQOMI7cjs.lp,_chunkE4WQOMI7cjs.bw],[_chunkE4WQOMI7cjs.Dp,_chunkE4WQOMI7cjs.yx],[_chunkE4WQOMI7cjs.Bt,_chunkE4WQOMI7cjs._v.call(void 0, "MAX")],[_chunkE4WQOMI7cjs.Ct,_chunkE4WQOMI7cjs._v.call(void 0, "MIN")],[_chunkE4WQOMI7cjs.Dt,_chunkE4WQOMI7cjs.Kw],[_chunkE4WQOMI7cjs.Gt,_chunkE4WQOMI7cjs.Jw],[_chunkE4WQOMI7cjs.$p,d()],[_chunkE4WQOMI7cjs.Cj,function(t){return this.binary(t,"<=>")}],[_chunkE4WQOMI7cjs.Dj,function(t){return`NOT ${this.binary(t,"<=>")}`}],[_chunkE4WQOMI7cjs.Br,_chunkE4WQOMI7cjs._v.call(void 0, "FORMAT")],[_chunkE4WQOMI7cjs.ie,_chunkE4WQOMI7cjs.iw],[_chunkE4WQOMI7cjs.Fi,_chunkE4WQOMI7cjs.wv.call(void 0, [_chunkE4WQOMI7cjs.zv,_chunkE4WQOMI7cjs.Kv,_chunkE4WQOMI7cjs.Av,_chunkE4WQOMI7cjs.Lv,_chunkE4WQOMI7cjs.xv])],[_chunkE4WQOMI7cjs.ur,function(t){return _chunkE4WQOMI7cjs.nw.call(this,t,{funcName:"LOCATE",supportsPosition:!0})}],[_chunkE4WQOMI7cjs.xr,Gt],[_chunkE4WQOMI7cjs.yr,Gt],[_chunkE4WQOMI7cjs.Gr,_chunkE4WQOMI7cjs._v.call(void 0, "INSERT")],[_chunkE4WQOMI7cjs.Um,()=>"SESSION_USER()"],[_chunkE4WQOMI7cjs.ge,_chunkE4WQOMI7cjs.hw],[_chunkE4WQOMI7cjs.Mn,_chunkE4WQOMI7cjs._v.call(void 0, "MAKETIME")],[_chunkE4WQOMI7cjs.Cn,_chunkE4WQOMI7cjs.zw.call(void 0, "DATE","ADD")],[_chunkE4WQOMI7cjs.En,function(t){return this.func("TIMESTAMPDIFF",[_chunkE4WQOMI7cjs.ex.call(void 0, t),t.args.expression,t.args.this])}],[_chunkE4WQOMI7cjs.Dn,_chunkE4WQOMI7cjs.zw.call(void 0, "DATE","SUB")],[_chunkE4WQOMI7cjs.Or,_chunkE4WQOMI7cjs._v.call(void 0, "UNIX_TIMESTAMP")],[_chunkE4WQOMI7cjs.Nr,function(t){return _chunkE4WQOMI7cjs.Gw.call(this,t,{includePrecision:!t.args.zone})}],[_chunkE4WQOMI7cjs.Jr,d(function(t){return this.func("DATE_FORMAT",[t.args.this,this.formatTime(t)])})],[_chunkE4WQOMI7cjs.Pr,_chunkE4WQOMI7cjs.Mw],[_chunkE4WQOMI7cjs.Uq,_chunkE4WQOMI7cjs._v.call(void 0, "TRUNCATE")],[_chunkE4WQOMI7cjs.lt,_chunkE4WQOMI7cjs.jw],[_chunkE4WQOMI7cjs.Qr,Ft("ADD")],[_chunkE4WQOMI7cjs.Rr,function(t){return this.func("DATEDIFF",[t.args.this,t.args.expression])}],[_chunkE4WQOMI7cjs.Tr,cs],[_chunkE4WQOMI7cjs.Zr,function(t){return`ORD(CONVERT(${this.sql(t.args.this)} USING utf32))`}],[_chunkE4WQOMI7cjs.bs,ls],[_chunkE4WQOMI7cjs.os,d()],[_chunkE4WQOMI7cjs.nn,d(_chunkE4WQOMI7cjs._v.call(void 0, "WEEKOFYEAR"))],[_chunkE4WQOMI7cjs.ts,d()],[_chunkE4WQOMI7cjs.Xm,_chunkE4WQOMI7cjs._v.call(void 0, "UTC_TIMESTAMP")],[_chunkE4WQOMI7cjs.Wm,_chunkE4WQOMI7cjs._v.call(void 0, "UTC_TIME")]])}static get UNSIGNED_TYPE_MAPPING(){return new Map([["ubigint","BIGINT"],["uint","INT"],["umediumint","MEDIUMINT"],["usmallint","SMALLINT"],["utinyint","TINYINT"],["udecimal","DECIMAL"],["udouble","DOUBLE"]])}static get TIMESTAMP_TYPE_MAPPING(){return new Map([["datetime2","DATETIME"],["smalldatetime","DATETIME"],["timestamp","DATETIME"],["timestampntz","DATETIME"],["timestamptz","TIMESTAMP"],["timestampltz","TIMESTAMP"]])}static get TYPE_MAPPING(){let t=new Map(_chunkE4WQOMI7cjs.Uv.TYPE_MAPPING);for(let[e,r]of n.UNSIGNED_TYPE_MAPPING)t.set(e,r);for(let[e,r]of n.TIMESTAMP_TYPE_MAPPING)t.set(e,r);return t.delete("mediumtext"),t.delete("longtext"),t.delete("tinytext"),t.delete("blob"),t.delete("mediumblob"),t.delete("longblob"),t.delete("tinyblob"),t}static get PROPERTIES_LOCATION(){let t=new Map(_chunkE4WQOMI7cjs.Uv.PROPERTIES_LOCATION);return t.set(_chunkE4WQOMI7cjs.oi,"unsupported"),t.set(_chunkE4WQOMI7cjs.ti,"unsupported"),t.set(_chunkE4WQOMI7cjs.zh,"unsupported"),t.set(_chunkE4WQOMI7cjs.Ch,"postSchema"),t.set(_chunkE4WQOMI7cjs.Eh,"postSchema"),t}static get CHAR_CAST_MAPPING(){return["longtext","longblob","mediumblob","mediumtext","text","tinyblob","tinytext","varchar"].reduce((t,e)=>({...t,[e]:"CHAR"}),{})}static get SIGNED_CAST_MAPPING(){return["bigint","boolean","int","smallint","tinyint","mediumint"].reduce((t,e)=>({...t,[e]:"SIGNED"}),{})}static get CAST_MAPPING(){return{...n.CHAR_CAST_MAPPING,...n.SIGNED_CAST_MAPPING,ubigint:"UNSIGNED"}}static get TIMESTAMP_FUNC_TYPES(){return new Set(["timestamptz","timestampltz"])}static get RESERVED_KEYWORDS(){return new Set(["accessible","add","all","alter","analyze","and","as","asc","asensitive","before","between","bigint","binary","blob","both","by","call","cascade","case","change","char","character","check","collate","column","condition","constraint","continue","convert","create","cross","cube","cume_dist","current_date","current_time","current_timestamp","current_user","cursor","database","databases","day_hour","day_microsecond","day_minute","day_second","dec","decimal","declare","default","delayed","delete","dense_rank","desc","describe","deterministic","distinct","distinctrow","div","double","drop","dual","each","else","elseif","empty","enclosed","escaped","except","exists","exit","explain","false","fetch","first_value","float","float4","float8","for","force","foreign","from","fulltext","function","generated","get","grant","group","grouping","groups","having","high_priority","hour_microsecond","hour_minute","hour_second","if","ignore","in","index","infile","inner","inout","insensitive","insert","int","int1","int2","int3","int4","int8","integer","intersect","interval","into","io_after_gtids","io_before_gtids","is","iterate","join","json_table","key","keys","kill","lag","last_value","lateral","lead","leading","leave","left","like","limit","linear","lines","load","localtime","localtimestamp","lock","long","longblob","longtext","loop","low_priority","master_bind","master_ssl_verify_server_cert","match","maxvalue","mediumblob","mediumint","mediumtext","middleint","minute_microsecond","minute_second","mod","modifies","natural","not","no_write_to_binlog","nth_value","ntile","undefined","numeric","of","on","optimize","optimizer_costs","option","optionally","or","order","out","outer","outfile","over","partition","percent_rank","precision","primary","procedure","purge","range","rank","read","reads","read_write","real","recursive","references","regexp","release","rename","repeat","replace","require","resignal","restrict","return","revoke","right","rlike","row","rows","row_number","schema","schemas","second_microsecond","select","sensitive","separator","set","show","signal","smallint","spatial","specific","sql","sqlexception","sqlstate","sqlwarning","sql_big_result","sql_calc_found_rows","sql_small_result","ssl","starting","stored","straight_join","system","table","terminated","then","tinyblob","tinyint","tinytext","to","trailing","trigger","true","undo","union","unique","unlock","unsigned","update","usage","use","using","utc_date","utc_time","utc_timestamp","values","varbinary","varchar","varcharacter","varying","virtual","when","where","while","window","with","write","xor","year_month","zerofill"])}locateProperties(t){let e=super.locateProperties(t),r=t.parent;if(r instanceof _chunkE4WQOMI7cjs.Jb&&_optionalChain([r, 'access', _14 => _14.args, 'access', _15 => _15.kind, 'optionalAccess', _16 => _16.toUpperCase, 'call', _17 => _17()])==="VIEW"){let u=e.get("postSchema");if(u){for(let p=0;p<u.length;p++)if(u[p]instanceof _chunkE4WQOMI7cjs.Yh){let[R]=u.splice(p,1),x=this._constructor.SQL_SECURITY_VIEW_LOCATION;e.has(x)||e.set(x,[]),e.get(x).push(R);break}}}return e}computedColumnConstraintSql(t){let e=t.args.persisted?"STORED":"VIRTUAL";return`GENERATED ALWAYS AS (${this.sql(_optionalChain([t, 'access', _18 => _18.args, 'access', _19 => _19.this, 'optionalAccess', _20 => _20.unnest, 'call', _21 => _21()]))}) ${e}`}arraySql(t){return this.unsupported("Arrays are not supported by MySQL"),this.functionFallbackSql(t)}arrayContainsAllSql(t){return this.unsupported("Array operations are not supported by MySQL"),this.functionFallbackSql(t)}dPipeSql(t){return this.func("CONCAT",[...t.flatten()])}extractSql(t){let e=t.name;return e&&e.toLowerCase()==="epoch"?this.func("UNIX_TIMESTAMP",[t.args.expression]):super.extractSql(t)}dataTypeSql(t){if(this.constructor.VARCHAR_REQUIRES_SIZE&&t.isType("varchar")&&!_optionalChain([t, 'access', _22 => _22.args, 'access', _23 => _23.expressions, 'optionalAccess', _24 => _24.length]))return"TEXT";let e=super.dataTypeSql(t);return n.UNSIGNED_TYPE_MAPPING.has(t.args.this)&&(e=`${e} UNSIGNED`),e}jsonArrayContainsSql(t){return`${this.sql(t,"this")} MEMBER OF(${this.sql(t,"expression")})`}castSql(t,e={}){let r=t.args.to;if(r instanceof _chunkE4WQOMI7cjs.pe){let u=r.args.this;if(this._constructor.TIMESTAMP_FUNC_TYPES.has(u))return this.func("TIMESTAMP",[t.args.this]);let p=this._constructor.CAST_MAPPING[u];p&&r.setArgKey("this",p)}return super.castSql(t)}showSql(t){let e=` ${t.name}`,r=t.args.full?" FULL":"",u=t.args.global?" GLOBAL":"",p=this.sql(t,"target");p=p?` ${p}`:"",["COLUMNS","INDEX"].includes(t.name)?p=` FROM${p}`:t.name==="GRANTS"?p=` FOR${p}`:["LINKS","PARTITIONS"].includes(t.name)?p=p?` ON${p}`:"":t.name==="PROJECTIONS"&&(p=p?` ON TABLE${p}`:"");let R=this.prefixedSql("FROM",t,"db"),x=this.prefixedSql("LIKE",t,"like"),j=this.sql(t,"where"),m=this.expressions(t,{key:"types"});m=m&&` ${m}`;let U=this.prefixedSql("FOR QUERY",t,"query"),w="",_="";t.name==="PROFILE"?(w=this.prefixedSql("OFFSET",t,"offset"),_=this.prefixedSql("LIMIT",t,"limit")):_=this.oldStyleLimitSql(t);let z=this.prefixedSql("IN",t,"log"),y=this.prefixedSql("FROM",t,"position"),Y=this.prefixedSql("FOR CHANNEL",t,"channel"),g="";t.name==="ENGINE"&&(g=t.args.mutex?" MUTEX":" STATUS");let L=this.prefixedSql("FOR TABLE",t,"forTable"),M=this.prefixedSql("FOR GROUP",t,"forGroup"),Q=this.prefixedSql("FOR USER",t,"forUser"),tt=this.prefixedSql("FOR ROLE",t,"forRole"),et=this.prefixedSql("INTO OUTFILE",t,"intoOutfile"),rt=t.args.json?" JSON":"";return`SHOW${r}${u}${e}${rt}${p}${L}${m}${R}${U}${z}${y}${Y}${g}${x}${j}${w}${_}${M}${Q}${tt}${et}`}alterRenameSql(t,e={}){return super.alterRenameSql(t,{includeTo:!1})}alterColumnSql(t){let e=this.sql(t,"dtype");return e?`MODIFY COLUMN ${this.sql(t,"this")} ${e}`:super.alterColumnSql(t)}prefixedSql(t,e,r){let u=this.sql(e,r);return u?` ${t} ${u}`:""}oldStyleLimitSql(t){let e=this.sql(t,"limit"),r=this.sql(t,"offset");return e?` LIMIT ${r?`${r}, ${e}`:e}`:""}timestampTruncSql(t){let e=t.args.unit,r="0000-01-01 00:00:00",u=_chunkE4WQOMI7cjs.ww.call(void 0, (0, _chunkE4WQOMI7cjs.En))([e,new (0, _chunkE4WQOMI7cjs.tg)({this:r,isString:!0}),t.args.this]),p=new (0, _chunkE4WQOMI7cjs.Vi)({this:u,unit:e}),R=_chunkE4WQOMI7cjs.xw.call(void 0, (0, _chunkE4WQOMI7cjs.Ym))([new (0, _chunkE4WQOMI7cjs.tg)({this:r,isString:!0}),p]);return this.sql(R)}convertTimezoneSql(t){let e=t.args.sourceTz,r=t.args.targetTz,u=t.args.timestamp;return this.func("CONVERT_TZ",[u,e,r])}atTimeZoneSql(t){return this.unsupported("AT TIME ZONE is not supported by MySQL"),this.sql(t.args.this)}isAsciiSql(t){return`REGEXP_LIKE(${this.sql(t.args.this)}, '^[[:ascii:]]*$')`}ignoreNullsSql(t){return this.unsupported("MySQL does not support IGNORE NULLS."),this.sql(t.args.this)}currentSchemaSql(t){return _chunkE4WQOMI7cjs.Tv.call(this,t,"this"),this.func("SCHEMA",[])}partitionSql(t){let e=t.parent;return e instanceof _chunkE4WQOMI7cjs.Ch||e instanceof _chunkE4WQOMI7cjs.Eh?this.expressions(t,{flat:!0}):super.partitionSql(t)}partitionByRangeOrListSql(t,e){let r=this.expressions(t,{key:"partitionExpressions",flat:!0}),u=this.expressions(t,{key:"createExpressions",flat:!0});return`PARTITION BY ${e} (${r}) (${u})`}partitionByRangePropertySql(t){return this.partitionByRangeOrListSql(t,"RANGE")}partitionByListPropertySql(t){return this.partitionByRangeOrListSql(t,"LIST")}partitionListSql(t){let e=this.sql(t,"this"),r=this.expressions(t,{flat:!0});return`PARTITION ${e} VALUES IN (${r})`}partitionRangeSql(t){let e=this.sql(t,"this"),r=this.expressions(t,{flat:!0});return`PARTITION ${e} VALUES LESS THAN (${r})`}};N=_chunkE4WQOMI7cjs.b.call(void 0, rs),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"AFTER_HAVING_MODIFIER_TRANSFORMS",es,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"NULL_ORDERING_SUPPORTED",ts,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"ORIGINAL_TRANSFORMS",Qr,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"UNSIGNED_TYPE_MAPPING",zr,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"TIMESTAMP_TYPE_MAPPING",jr,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"TYPE_MAPPING",Zr,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"PROPERTIES_LOCATION",Jr,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"CHAR_CAST_MAPPING",Xr,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"SIGNED_CAST_MAPPING",Wr,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"CAST_MAPPING",$r,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"TIMESTAMP_FUNC_TYPES",vr,n),_chunkE4WQOMI7cjs.e.call(void 0, N,10,"RESERVED_KEYWORDS",kr,n),_chunkE4WQOMI7cjs.c.call(void 0, N,n),_chunkE4WQOMI7cjs.d.call(void 0, N,3,n),_chunkE4WQOMI7cjs.a.call(void 0, n,"MySQLGenerator"),n.SUPPORTS_DECODE_CASE=!1,n.SELECT_KINDS=[],n.TRY_SUPPORTED=!1,n.SUPPORTS_UESCAPE=!1,n.INTERVAL_ALLOWS_PLURAL_FORM=!1,n.LOCKING_READS_SUPPORTED=!0,n.SUPPORTS_MODIFY_COLUMN=!0,n.JOIN_HINTS=!1,n.TABLE_HINTS=!0,n.DUPLICATE_KEY_UPDATE_WITH_SET=!1,n.QUERY_HINT_SEP=" ",n.VALUES_AS_TABLE=!1,n.NVL2_SUPPORTED=!1,n.LAST_DAY_SUPPORTS_DATE_PART=!1,n.JSON_TYPE_REQUIRED_FOR_EXTRACTION=!0,n.JSON_PATH_BRACKETED_KEY_SUPPORTED=!1,n.JSON_KEY_VALUE_PAIR_SEP=",",n.SUPPORTS_TO_NUMBER=!1,n.PARSE_JSON_NAME=void 0,n.PAD_FILL_PATTERN_IS_REQUIRED=!0,n.WRAP_DERIVED_VALUES=!1,n.VARCHAR_REQUIRES_SIZE=!0,n.SUPPORTS_MEDIAN=!1,n.UPDATE_STATEMENT_SUPPORTS_FROM=!1,n.SUPPORTS_CONVERT_TIMEZONE=!0,n.SQL_SECURITY_VIEW_LOCATION="postCreate",n.LIMIT_FETCH="LIMIT",n.LIMIT_ONLY_LITERALS=!0;var Yt=n,ss,is,ns,as,Es,D,l=class l extends(Es=_chunkE4WQOMI7cjs.Xv,as=[_chunkE4WQOMI7cjs.s],ns=[_chunkE4WQOMI7cjs.s],is=[_chunkE4WQOMI7cjs.s],ss=[_chunkE4WQOMI7cjs.s],Es){static get NORMALIZATION_STRATEGY(){return"caseSensitive"}static get EXPRESSION_METADATA(){return new Map(_chunkD5E56FXAcjs.a.EXPRESSION_METADATA)}static get TIME_MAPPING(){return{"%M":"%B","%c":"%-m","%e":"%-d","%h":"%I","%i":"%M","%s":"%S","%u":"%W","%k":"%-H","%l":"%-I","%T":"%H:%M:%S","%W":"%A"}}static get VALID_INTERVAL_UNITS(){return new Set([..._chunkE4WQOMI7cjs.Xv.VALID_INTERVAL_UNITS,"SECOND_MICROSECOND","MINUTE_MICROSECOND","MINUTE_SECOND","HOUR_MICROSECOND","HOUR_SECOND","HOUR_MINUTE","DAY_MICROSECOND","DAY_SECOND","DAY_MINUTE","DAY_HOUR","YEAR_MONTH"])}};D=_chunkE4WQOMI7cjs.b.call(void 0, Es),_chunkE4WQOMI7cjs.e.call(void 0, D,10,"NORMALIZATION_STRATEGY",as,l),_chunkE4WQOMI7cjs.e.call(void 0, D,10,"EXPRESSION_METADATA",ns,l),_chunkE4WQOMI7cjs.e.call(void 0, D,10,"TIME_MAPPING",is,l),_chunkE4WQOMI7cjs.e.call(void 0, D,10,"VALID_INTERVAL_UNITS",ss,l),_chunkE4WQOMI7cjs.c.call(void 0, D,l),_chunkE4WQOMI7cjs.d.call(void 0, D,3,l),_chunkE4WQOMI7cjs.a.call(void 0, l,"MySQL"),l.DIALECT_NAME="mysql",l.PROMOTE_TO_INFERRED_DATETIME_TYPE=!0,l.IDENTIFIERS_CAN_START_WITH_DIGIT=!0,l.TIME_FORMAT="'%Y-%m-%d %T'",l.DPIPE_IS_STRING_CONCAT=!1,l.SUPPORTS_USER_DEFINED_TYPES=!1,l.SUPPORTS_SEMI_ANTI_JOIN=!1,l.SAFE_DIVISION=!0,l.SAFE_TO_ELIMINATE_DOUBLE_NEGATION=!1,l.LEAST_GREATEST_IGNORES_NULLS=!1,l.Tokenizer=wt,l.Parser=yt,l.Generator=Yt;var Vt=l;exports.a = i; exports.b = Ts; exports.c = ps; exports.d = us; exports.e = Gt; exports.f = ls; exports.g = Ft; exports.h = cs; exports.i = d; exports.j = Vt;
2
+ //# sourceMappingURL=chunk-QAY6RF27.cjs.map