@intentius/chant-lexicon-sql 0.0.0-stage → 0.112.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (936) hide show
  1. package/README.md +39 -2
  2. package/dist/clickhouse/apply/apply.d.ts +82 -0
  3. package/dist/clickhouse/apply/apply.d.ts.map +1 -0
  4. package/dist/clickhouse/apply/mutations.d.ts +46 -0
  5. package/dist/clickhouse/apply/mutations.d.ts.map +1 -0
  6. package/dist/clickhouse/apply/statements.d.ts +99 -0
  7. package/dist/clickhouse/apply/statements.d.ts.map +1 -0
  8. package/dist/clickhouse/catalog-types.d.ts +76 -0
  9. package/dist/clickhouse/catalog-types.d.ts.map +1 -0
  10. package/dist/clickhouse/container.d.ts +63 -0
  11. package/dist/clickhouse/container.d.ts.map +1 -0
  12. package/dist/clickhouse/engine-syntax.d.ts +43 -0
  13. package/dist/clickhouse/engine-syntax.d.ts.map +1 -0
  14. package/dist/clickhouse/entities.d.ts +183 -0
  15. package/dist/clickhouse/entities.d.ts.map +1 -0
  16. package/dist/clickhouse/http.d.ts +40 -0
  17. package/dist/clickhouse/http.d.ts.map +1 -0
  18. package/dist/clickhouse/import/generator.d.ts +16 -0
  19. package/dist/clickhouse/import/generator.d.ts.map +1 -0
  20. package/dist/clickhouse/import/ir.d.ts +52 -0
  21. package/dist/clickhouse/import/ir.d.ts.map +1 -0
  22. package/dist/clickhouse/import/live-export.d.ts +28 -0
  23. package/dist/clickhouse/import/live-export.d.ts.map +1 -0
  24. package/dist/clickhouse/import/parser.d.ts +10 -0
  25. package/dist/clickhouse/import/parser.d.ts.map +1 -0
  26. package/dist/clickhouse/live/bind.d.ts +56 -0
  27. package/dist/clickhouse/live/bind.d.ts.map +1 -0
  28. package/dist/clickhouse/live/catalog.d.ts +39 -0
  29. package/dist/clickhouse/live/catalog.d.ts.map +1 -0
  30. package/dist/clickhouse/live/describe-resources.d.ts +34 -0
  31. package/dist/clickhouse/live/describe-resources.d.ts.map +1 -0
  32. package/dist/clickhouse/overlays/codecs.d.ts +28 -0
  33. package/dist/clickhouse/overlays/codecs.d.ts.map +1 -0
  34. package/dist/clickhouse/overlays/engines.d.ts +20 -0
  35. package/dist/clickhouse/overlays/engines.d.ts.map +1 -0
  36. package/dist/clickhouse/overlays/kinds.d.ts +38 -0
  37. package/dist/clickhouse/overlays/kinds.d.ts.map +1 -0
  38. package/dist/clickhouse/overlays/projections.d.ts +27 -0
  39. package/dist/clickhouse/overlays/projections.d.ts.map +1 -0
  40. package/dist/clickhouse/overlays/skip-indexes.d.ts +10 -0
  41. package/dist/clickhouse/overlays/skip-indexes.d.ts.map +1 -0
  42. package/dist/clickhouse/overlays/ttl.d.ts +35 -0
  43. package/dist/clickhouse/overlays/ttl.d.ts.map +1 -0
  44. package/dist/clickhouse/overlays/types.d.ts +21 -0
  45. package/dist/clickhouse/overlays/types.d.ts.map +1 -0
  46. package/dist/clickhouse/ownership.d.ts +71 -0
  47. package/dist/clickhouse/ownership.d.ts.map +1 -0
  48. package/dist/clickhouse/parser.d.ts +130 -0
  49. package/dist/clickhouse/parser.d.ts.map +1 -0
  50. package/dist/clickhouse/plan/commands.d.ts +26 -0
  51. package/dist/clickhouse/plan/commands.d.ts.map +1 -0
  52. package/dist/clickhouse/plan/deep.d.ts +32 -0
  53. package/dist/clickhouse/plan/deep.d.ts.map +1 -0
  54. package/dist/clickhouse/plan/diff.d.ts +37 -0
  55. package/dist/clickhouse/plan/diff.d.ts.map +1 -0
  56. package/dist/clickhouse/plan/disruption.d.ts +17 -0
  57. package/dist/clickhouse/plan/disruption.d.ts.map +1 -0
  58. package/dist/clickhouse/plan/normalize.d.ts +97 -0
  59. package/dist/clickhouse/plan/normalize.d.ts.map +1 -0
  60. package/dist/clickhouse/plan/rebuild-handoff.d.ts +38 -0
  61. package/dist/clickhouse/plan/rebuild-handoff.d.ts.map +1 -0
  62. package/dist/clickhouse/plan/report.d.ts +6 -0
  63. package/dist/clickhouse/plan/report.d.ts.map +1 -0
  64. package/dist/clickhouse/plan/rules.d.ts +60 -0
  65. package/dist/clickhouse/plan/rules.d.ts.map +1 -0
  66. package/dist/clickhouse/plan/schema.d.ts +23 -0
  67. package/dist/clickhouse/plan/schema.d.ts.map +1 -0
  68. package/dist/clickhouse/plan/server-format.d.ts +12 -0
  69. package/dist/clickhouse/plan/server-format.d.ts.map +1 -0
  70. package/dist/clickhouse/rebuild/backfill.d.ts +70 -0
  71. package/dist/clickhouse/rebuild/backfill.d.ts.map +1 -0
  72. package/dist/clickhouse/rebuild/observe.d.ts +157 -0
  73. package/dist/clickhouse/rebuild/observe.d.ts.map +1 -0
  74. package/dist/clickhouse/rebuild/op.d.ts +108 -0
  75. package/dist/clickhouse/rebuild/op.d.ts.map +1 -0
  76. package/dist/clickhouse/rebuild/partitions.d.ts +24 -0
  77. package/dist/clickhouse/rebuild/partitions.d.ts.map +1 -0
  78. package/dist/clickhouse/rebuild/receipts.d.ts +76 -0
  79. package/dist/clickhouse/rebuild/receipts.d.ts.map +1 -0
  80. package/dist/clickhouse/rebuild/replicas.d.ts +78 -0
  81. package/dist/clickhouse/rebuild/replicas.d.ts.map +1 -0
  82. package/dist/clickhouse/rebuild/steps.d.ts +151 -0
  83. package/dist/clickhouse/rebuild/steps.d.ts.map +1 -0
  84. package/dist/clickhouse/rebuild/verify.d.ts +51 -0
  85. package/dist/clickhouse/rebuild/verify.d.ts.map +1 -0
  86. package/dist/clickhouse/testing/fake-server.d.ts +27 -0
  87. package/dist/clickhouse/testing/fake-server.d.ts.map +1 -0
  88. package/dist/clickhouse/testing/roundtrip-schema.d.ts +3 -0
  89. package/dist/clickhouse/testing/roundtrip-schema.d.ts.map +1 -0
  90. package/dist/clickhouse/testing/writable-server.d.ts +35 -0
  91. package/dist/clickhouse/testing/writable-server.d.ts.map +1 -0
  92. package/dist/clickhouse/tokens.d.ts +15 -0
  93. package/dist/clickhouse/tokens.d.ts.map +1 -0
  94. package/dist/clickhouse.d.ts +24 -0
  95. package/dist/clickhouse.d.ts.map +1 -0
  96. package/dist/codegen/classifier-page.d.ts +6 -0
  97. package/dist/codegen/classifier-page.d.ts.map +1 -0
  98. package/dist/codegen/clickhouse-module.d.ts +23 -0
  99. package/dist/codegen/clickhouse-module.d.ts.map +1 -0
  100. package/dist/codegen/docs-cli.d.ts +3 -0
  101. package/dist/codegen/docs-cli.d.ts.map +1 -0
  102. package/dist/codegen/docs.d.ts +8 -0
  103. package/dist/codegen/docs.d.ts.map +1 -0
  104. package/dist/codegen/generate-cli.d.ts +3 -0
  105. package/dist/codegen/generate-cli.d.ts.map +1 -0
  106. package/dist/codegen/generate.d.ts +40 -0
  107. package/dist/codegen/generate.d.ts.map +1 -0
  108. package/dist/codegen/package.d.ts +7 -0
  109. package/dist/codegen/package.d.ts.map +1 -0
  110. package/dist/codegen/postgres-classifier-page.d.ts +7 -0
  111. package/dist/codegen/postgres-classifier-page.d.ts.map +1 -0
  112. package/dist/codegen/postgres-module.d.ts +30 -0
  113. package/dist/codegen/postgres-module.d.ts.map +1 -0
  114. package/dist/codegen/registry.d.ts +12 -0
  115. package/dist/codegen/registry.d.ts.map +1 -0
  116. package/dist/composites/audit-log-table.d.ts +31 -0
  117. package/dist/composites/audit-log-table.d.ts.map +1 -0
  118. package/dist/composites/catalog.d.ts +3 -0
  119. package/dist/composites/catalog.d.ts.map +1 -0
  120. package/dist/composites/cdc-mirror.d.ts +32 -0
  121. package/dist/composites/cdc-mirror.d.ts.map +1 -0
  122. package/dist/composites/clickhouse.d.ts +7 -0
  123. package/dist/composites/clickhouse.d.ts.map +1 -0
  124. package/dist/composites/events-table.d.ts +32 -0
  125. package/dist/composites/events-table.d.ts.map +1 -0
  126. package/dist/composites/index.d.ts +9 -0
  127. package/dist/composites/index.d.ts.map +1 -0
  128. package/dist/composites/join-table.d.ts +41 -0
  129. package/dist/composites/join-table.d.ts.map +1 -0
  130. package/dist/composites/postgres.d.ts +7 -0
  131. package/dist/composites/postgres.d.ts.map +1 -0
  132. package/dist/composites/refreshed-view.d.ts +32 -0
  133. package/dist/composites/refreshed-view.d.ts.map +1 -0
  134. package/dist/composites/replacing-table.d.ts +34 -0
  135. package/dist/composites/replacing-table.d.ts.map +1 -0
  136. package/dist/composites/rollup-view.d.ts +39 -0
  137. package/dist/composites/rollup-view.d.ts.map +1 -0
  138. package/dist/composites/sharded-table.d.ts +35 -0
  139. package/dist/composites/sharded-table.d.ts.map +1 -0
  140. package/dist/composites/soft-delete-table.d.ts +40 -0
  141. package/dist/composites/soft-delete-table.d.ts.map +1 -0
  142. package/dist/composites/tenant-table.d.ts +34 -0
  143. package/dist/composites/tenant-table.d.ts.map +1 -0
  144. package/dist/config.d.ts +213 -0
  145. package/dist/config.d.ts.map +1 -0
  146. package/dist/core/apply.d.ts +89 -0
  147. package/dist/core/apply.d.ts.map +1 -0
  148. package/dist/core/classifier.d.ts +88 -0
  149. package/dist/core/classifier.d.ts.map +1 -0
  150. package/dist/core/container.d.ts +45 -0
  151. package/dist/core/container.d.ts.map +1 -0
  152. package/dist/core/cursor.d.ts +67 -0
  153. package/dist/core/cursor.d.ts.map +1 -0
  154. package/dist/core/diff.d.ts +49 -0
  155. package/dist/core/diff.d.ts.map +1 -0
  156. package/dist/core/entity.d.ts +41 -0
  157. package/dist/core/entity.d.ts.map +1 -0
  158. package/dist/core/find-templates.d.ts +69 -0
  159. package/dist/core/find-templates.d.ts.map +1 -0
  160. package/dist/core/handoff.d.ts +36 -0
  161. package/dist/core/handoff.d.ts.map +1 -0
  162. package/dist/core/index.d.ts +61 -0
  163. package/dist/core/index.d.ts.map +1 -0
  164. package/dist/core/interpolation.d.ts +88 -0
  165. package/dist/core/interpolation.d.ts.map +1 -0
  166. package/dist/core/normalize.d.ts +18 -0
  167. package/dist/core/normalize.d.ts.map +1 -0
  168. package/dist/core/ownership.d.ts +60 -0
  169. package/dist/core/ownership.d.ts.map +1 -0
  170. package/dist/core/receipts.d.ts +28 -0
  171. package/dist/core/receipts.d.ts.map +1 -0
  172. package/dist/core/references.d.ts +37 -0
  173. package/dist/core/references.d.ts.map +1 -0
  174. package/dist/core/template.d.ts +41 -0
  175. package/dist/core/template.d.ts.map +1 -0
  176. package/dist/core/testing/http-stub.d.ts +17 -0
  177. package/dist/core/testing/http-stub.d.ts.map +1 -0
  178. package/dist/core/tokens.d.ts +102 -0
  179. package/dist/core/tokens.d.ts.map +1 -0
  180. package/dist/coverage.d.ts +25 -0
  181. package/dist/coverage.d.ts.map +1 -0
  182. package/dist/detect.d.ts +15 -0
  183. package/dist/detect.d.ts.map +1 -0
  184. package/dist/dialects.d.ts +20 -0
  185. package/dist/dialects.d.ts.map +1 -0
  186. package/dist/generated/clickhouse-types.d.ts +4380 -0
  187. package/dist/generated/clickhouse-types.d.ts.map +1 -0
  188. package/dist/generated/clickhouse.d.ts +11 -0
  189. package/dist/generated/clickhouse.d.ts.map +1 -0
  190. package/dist/generated/postgres-types.d.ts +1579 -0
  191. package/dist/generated/postgres-types.d.ts.map +1 -0
  192. package/dist/generated/postgres.d.ts +9 -0
  193. package/dist/generated/postgres.d.ts.map +1 -0
  194. package/dist/import-generator.d.ts +8 -0
  195. package/dist/import-generator.d.ts.map +1 -0
  196. package/dist/index.d.ts +7 -0
  197. package/dist/index.d.ts.map +1 -0
  198. package/dist/init-templates.d.ts +20 -0
  199. package/dist/init-templates.d.ts.map +1 -0
  200. package/dist/integrity.json +61 -0
  201. package/dist/lint/audit-catalog.d.ts +10 -0
  202. package/dist/lint/audit-catalog.d.ts.map +1 -0
  203. package/dist/lint/audit-lineage.d.ts +25 -0
  204. package/dist/lint/audit-lineage.d.ts.map +1 -0
  205. package/dist/lint/post-synth/audit-entries.d.ts +8 -0
  206. package/dist/lint/post-synth/audit-entries.d.ts.map +1 -0
  207. package/dist/lint/post-synth/clickhouse-helpers.d.ts +85 -0
  208. package/dist/lint/post-synth/clickhouse-helpers.d.ts.map +1 -0
  209. package/dist/lint/post-synth/index.d.ts +3 -0
  210. package/dist/lint/post-synth/index.d.ts.map +1 -0
  211. package/dist/lint/post-synth/postgres-audit-entries.d.ts +9 -0
  212. package/dist/lint/post-synth/postgres-audit-entries.d.ts.map +1 -0
  213. package/dist/lint/post-synth/postgres-helpers.d.ts +89 -0
  214. package/dist/lint/post-synth/postgres-helpers.d.ts.map +1 -0
  215. package/dist/lint/post-synth/sql-helpers.d.ts +27 -0
  216. package/dist/lint/post-synth/sql-helpers.d.ts.map +1 -0
  217. package/dist/lint/post-synth/sqlch101.d.ts +12 -0
  218. package/dist/lint/post-synth/sqlch101.d.ts.map +1 -0
  219. package/dist/lint/post-synth/sqlch102.d.ts +9 -0
  220. package/dist/lint/post-synth/sqlch102.d.ts.map +1 -0
  221. package/dist/lint/post-synth/sqlch103.d.ts +10 -0
  222. package/dist/lint/post-synth/sqlch103.d.ts.map +1 -0
  223. package/dist/lint/post-synth/sqlch104.d.ts +9 -0
  224. package/dist/lint/post-synth/sqlch104.d.ts.map +1 -0
  225. package/dist/lint/post-synth/sqlch105.d.ts +10 -0
  226. package/dist/lint/post-synth/sqlch105.d.ts.map +1 -0
  227. package/dist/lint/post-synth/sqlch106.d.ts +11 -0
  228. package/dist/lint/post-synth/sqlch106.d.ts.map +1 -0
  229. package/dist/lint/post-synth/sqlch107.d.ts +10 -0
  230. package/dist/lint/post-synth/sqlch107.d.ts.map +1 -0
  231. package/dist/lint/post-synth/sqlch108.d.ts +11 -0
  232. package/dist/lint/post-synth/sqlch108.d.ts.map +1 -0
  233. package/dist/lint/post-synth/sqlch109.d.ts +10 -0
  234. package/dist/lint/post-synth/sqlch109.d.ts.map +1 -0
  235. package/dist/lint/post-synth/sqlch110.d.ts +12 -0
  236. package/dist/lint/post-synth/sqlch110.d.ts.map +1 -0
  237. package/dist/lint/post-synth/sqlch111.d.ts +11 -0
  238. package/dist/lint/post-synth/sqlch111.d.ts.map +1 -0
  239. package/dist/lint/post-synth/sqlch112.d.ts +12 -0
  240. package/dist/lint/post-synth/sqlch112.d.ts.map +1 -0
  241. package/dist/lint/post-synth/sqlch113.d.ts +9 -0
  242. package/dist/lint/post-synth/sqlch113.d.ts.map +1 -0
  243. package/dist/lint/post-synth/sqlch114.d.ts +8 -0
  244. package/dist/lint/post-synth/sqlch114.d.ts.map +1 -0
  245. package/dist/lint/post-synth/sqlch115.d.ts +13 -0
  246. package/dist/lint/post-synth/sqlch115.d.ts.map +1 -0
  247. package/dist/lint/post-synth/sqlch116.d.ts +10 -0
  248. package/dist/lint/post-synth/sqlch116.d.ts.map +1 -0
  249. package/dist/lint/post-synth/sqlch117.d.ts +9 -0
  250. package/dist/lint/post-synth/sqlch117.d.ts.map +1 -0
  251. package/dist/lint/post-synth/sqlch118.d.ts +10 -0
  252. package/dist/lint/post-synth/sqlch118.d.ts.map +1 -0
  253. package/dist/lint/post-synth/sqlch119.d.ts +11 -0
  254. package/dist/lint/post-synth/sqlch119.d.ts.map +1 -0
  255. package/dist/lint/post-synth/sqlch120.d.ts +10 -0
  256. package/dist/lint/post-synth/sqlch120.d.ts.map +1 -0
  257. package/dist/lint/post-synth/sqlpg101.d.ts +12 -0
  258. package/dist/lint/post-synth/sqlpg101.d.ts.map +1 -0
  259. package/dist/lint/post-synth/sqlpg102.d.ts +11 -0
  260. package/dist/lint/post-synth/sqlpg102.d.ts.map +1 -0
  261. package/dist/lint/post-synth/sqlpg103.d.ts +11 -0
  262. package/dist/lint/post-synth/sqlpg103.d.ts.map +1 -0
  263. package/dist/lint/post-synth/sqlpg104.d.ts +10 -0
  264. package/dist/lint/post-synth/sqlpg104.d.ts.map +1 -0
  265. package/dist/lint/post-synth/sqlpg105.d.ts +10 -0
  266. package/dist/lint/post-synth/sqlpg105.d.ts.map +1 -0
  267. package/dist/lint/post-synth/sqlpg106.d.ts +9 -0
  268. package/dist/lint/post-synth/sqlpg106.d.ts.map +1 -0
  269. package/dist/lint/post-synth/sqlpg107.d.ts +10 -0
  270. package/dist/lint/post-synth/sqlpg107.d.ts.map +1 -0
  271. package/dist/lint/post-synth/sqlpg108.d.ts +11 -0
  272. package/dist/lint/post-synth/sqlpg108.d.ts.map +1 -0
  273. package/dist/lint/post-synth/sqlpg109.d.ts +11 -0
  274. package/dist/lint/post-synth/sqlpg109.d.ts.map +1 -0
  275. package/dist/lint/post-synth/sqlpg110.d.ts +12 -0
  276. package/dist/lint/post-synth/sqlpg110.d.ts.map +1 -0
  277. package/dist/lint/post-synth/sqlpg111.d.ts +10 -0
  278. package/dist/lint/post-synth/sqlpg111.d.ts.map +1 -0
  279. package/dist/lint/post-synth/sqlpg112.d.ts +10 -0
  280. package/dist/lint/post-synth/sqlpg112.d.ts.map +1 -0
  281. package/dist/lint/post-synth/sqlpg113.d.ts +11 -0
  282. package/dist/lint/post-synth/sqlpg113.d.ts.map +1 -0
  283. package/dist/lint/post-synth/sqlpg114.d.ts +13 -0
  284. package/dist/lint/post-synth/sqlpg114.d.ts.map +1 -0
  285. package/dist/lint/post-synth/sqlpg115.d.ts +13 -0
  286. package/dist/lint/post-synth/sqlpg115.d.ts.map +1 -0
  287. package/dist/lint/post-synth/sqlpg116.d.ts +11 -0
  288. package/dist/lint/post-synth/sqlpg116.d.ts.map +1 -0
  289. package/dist/lint/post-synth/sqlpg117.d.ts +12 -0
  290. package/dist/lint/post-synth/sqlpg117.d.ts.map +1 -0
  291. package/dist/lint/post-synth/sqlpg118.d.ts +12 -0
  292. package/dist/lint/post-synth/sqlpg118.d.ts.map +1 -0
  293. package/dist/lint/rules/index.d.ts +12 -0
  294. package/dist/lint/rules/index.d.ts.map +1 -0
  295. package/dist/lint/rules/postgres-templates.d.ts +18 -0
  296. package/dist/lint/rules/postgres-templates.d.ts.map +1 -0
  297. package/dist/lint/rules/sqlch001.d.ts +12 -0
  298. package/dist/lint/rules/sqlch001.d.ts.map +1 -0
  299. package/dist/lint/rules/sqlch002.d.ts +11 -0
  300. package/dist/lint/rules/sqlch002.d.ts.map +1 -0
  301. package/dist/lint/rules/sqlch003.d.ts +12 -0
  302. package/dist/lint/rules/sqlch003.d.ts.map +1 -0
  303. package/dist/lint/rules/sqlpg001.d.ts +16 -0
  304. package/dist/lint/rules/sqlpg001.d.ts.map +1 -0
  305. package/dist/lint/rules/sqlpg002.d.ts +12 -0
  306. package/dist/lint/rules/sqlpg002.d.ts.map +1 -0
  307. package/dist/lint/rules/sqlpg003.d.ts +16 -0
  308. package/dist/lint/rules/sqlpg003.d.ts.map +1 -0
  309. package/dist/lint/rules/sqlpg004.d.ts +21 -0
  310. package/dist/lint/rules/sqlpg004.d.ts.map +1 -0
  311. package/dist/lint/rules/templates.d.ts +23 -0
  312. package/dist/lint/rules/templates.d.ts.map +1 -0
  313. package/dist/live-dialect.d.ts +25 -0
  314. package/dist/live-dialect.d.ts.map +1 -0
  315. package/dist/lsp/catalog.d.ts +22 -0
  316. package/dist/lsp/catalog.d.ts.map +1 -0
  317. package/dist/lsp/completions.d.ts +13 -0
  318. package/dist/lsp/completions.d.ts.map +1 -0
  319. package/dist/lsp/hover.d.ts +12 -0
  320. package/dist/lsp/hover.d.ts.map +1 -0
  321. package/dist/lsp/postgres-catalog.d.ts +85 -0
  322. package/dist/lsp/postgres-catalog.d.ts.map +1 -0
  323. package/dist/lsp/postgres-template.d.ts +35 -0
  324. package/dist/lsp/postgres-template.d.ts.map +1 -0
  325. package/dist/lsp/postgres.d.ts +20 -0
  326. package/dist/lsp/postgres.d.ts.map +1 -0
  327. package/dist/lsp/refs.d.ts +8 -0
  328. package/dist/lsp/refs.d.ts.map +1 -0
  329. package/dist/lsp/registry.d.ts +4 -0
  330. package/dist/lsp/registry.d.ts.map +1 -0
  331. package/dist/lsp/template.d.ts +34 -0
  332. package/dist/lsp/template.d.ts.map +1 -0
  333. package/dist/manifest.json +8 -0
  334. package/dist/mcp/index.d.ts +13 -0
  335. package/dist/mcp/index.d.ts.map +1 -0
  336. package/dist/mcp/postgres.d.ts +32 -0
  337. package/dist/mcp/postgres.d.ts.map +1 -0
  338. package/dist/meta.json +67 -0
  339. package/dist/okf/index.md +67 -0
  340. package/dist/okf/rules/SQLCH001.md +11 -0
  341. package/dist/okf/rules/SQLCH002.md +11 -0
  342. package/dist/okf/rules/SQLCH003.md +11 -0
  343. package/dist/okf/rules/SQLCH101.md +15 -0
  344. package/dist/okf/rules/SQLCH102.md +11 -0
  345. package/dist/okf/rules/SQLCH103.md +11 -0
  346. package/dist/okf/rules/SQLCH104.md +11 -0
  347. package/dist/okf/rules/SQLCH105.md +11 -0
  348. package/dist/okf/rules/SQLCH106.md +11 -0
  349. package/dist/okf/rules/SQLCH107.md +11 -0
  350. package/dist/okf/rules/SQLCH108.md +15 -0
  351. package/dist/okf/rules/SQLCH109.md +11 -0
  352. package/dist/okf/rules/SQLCH110.md +11 -0
  353. package/dist/okf/rules/SQLCH111.md +11 -0
  354. package/dist/okf/rules/SQLCH112.md +11 -0
  355. package/dist/okf/rules/SQLCH113.md +11 -0
  356. package/dist/okf/rules/SQLCH114.md +11 -0
  357. package/dist/okf/rules/SQLCH115.md +11 -0
  358. package/dist/okf/rules/SQLCH116.md +11 -0
  359. package/dist/okf/rules/SQLCH117.md +15 -0
  360. package/dist/okf/rules/SQLCH118.md +15 -0
  361. package/dist/okf/rules/SQLCH119.md +15 -0
  362. package/dist/okf/rules/SQLCH120.md +15 -0
  363. package/dist/okf/rules/SQLPG001.md +11 -0
  364. package/dist/okf/rules/SQLPG002.md +11 -0
  365. package/dist/okf/rules/SQLPG003.md +11 -0
  366. package/dist/okf/rules/SQLPG004.md +11 -0
  367. package/dist/okf/rules/SQLPG101.md +11 -0
  368. package/dist/okf/rules/SQLPG102.md +11 -0
  369. package/dist/okf/rules/SQLPG103.md +11 -0
  370. package/dist/okf/rules/SQLPG104.md +11 -0
  371. package/dist/okf/rules/SQLPG105.md +11 -0
  372. package/dist/okf/rules/SQLPG106.md +11 -0
  373. package/dist/okf/rules/SQLPG107.md +11 -0
  374. package/dist/okf/rules/SQLPG108.md +11 -0
  375. package/dist/okf/rules/SQLPG109.md +11 -0
  376. package/dist/okf/rules/SQLPG110.md +11 -0
  377. package/dist/okf/rules/SQLPG111.md +11 -0
  378. package/dist/okf/rules/SQLPG112.md +11 -0
  379. package/dist/okf/rules/SQLPG113.md +24 -0
  380. package/dist/okf/rules/SQLPG114.md +11 -0
  381. package/dist/okf/rules/SQLPG115.md +11 -0
  382. package/dist/okf/rules/SQLPG116.md +15 -0
  383. package/dist/okf/rules/SQLPG117.md +11 -0
  384. package/dist/okf/rules/SQLPG118.md +11 -0
  385. package/dist/okf/types/Database.md +15 -0
  386. package/dist/okf/types/MaterializedView.md +14 -0
  387. package/dist/okf/types/PostgresDomain.md +13 -0
  388. package/dist/okf/types/PostgresEnum.md +13 -0
  389. package/dist/okf/types/PostgresExtension.md +13 -0
  390. package/dist/okf/types/PostgresIndex.md +9 -0
  391. package/dist/okf/types/PostgresMaterializedView.md +13 -0
  392. package/dist/okf/types/PostgresSchema.md +13 -0
  393. package/dist/okf/types/PostgresSequence.md +13 -0
  394. package/dist/okf/types/PostgresTable.md +13 -0
  395. package/dist/okf/types/PostgresView.md +13 -0
  396. package/dist/okf/types/Table.md +15 -0
  397. package/dist/okf/types/View.md +13 -0
  398. package/dist/op/activities/clickhouse-apply.d.ts +56 -0
  399. package/dist/op/activities/clickhouse-apply.d.ts.map +1 -0
  400. package/dist/op/activities/clickhouse-emulator.d.ts +26 -0
  401. package/dist/op/activities/clickhouse-emulator.d.ts.map +1 -0
  402. package/dist/op/activities/clickhouse-rebuild.d.ts +43 -0
  403. package/dist/op/activities/clickhouse-rebuild.d.ts.map +1 -0
  404. package/dist/op/activities/index.d.ts +19 -0
  405. package/dist/op/activities/index.d.ts.map +1 -0
  406. package/dist/op/activities/postgres-apply.d.ts +69 -0
  407. package/dist/op/activities/postgres-apply.d.ts.map +1 -0
  408. package/dist/op/activities/postgres-emulator.d.ts +33 -0
  409. package/dist/op/activities/postgres-emulator.d.ts.map +1 -0
  410. package/dist/op/activities/postgres-migration.d.ts +48 -0
  411. package/dist/op/activities/postgres-migration.d.ts.map +1 -0
  412. package/dist/op/activity-contracts.d.ts +464 -0
  413. package/dist/op/activity-contracts.d.ts.map +1 -0
  414. package/dist/package-cli.d.ts +3 -0
  415. package/dist/package-cli.d.ts.map +1 -0
  416. package/dist/plugin.d.ts +12 -0
  417. package/dist/plugin.d.ts.map +1 -0
  418. package/dist/postgres/apply/apply.d.ts +163 -0
  419. package/dist/postgres/apply/apply.d.ts.map +1 -0
  420. package/dist/postgres/apply/statements.d.ts +138 -0
  421. package/dist/postgres/apply/statements.d.ts.map +1 -0
  422. package/dist/postgres/catalog-types.d.ts +50 -0
  423. package/dist/postgres/catalog-types.d.ts.map +1 -0
  424. package/dist/postgres/container.d.ts +23 -0
  425. package/dist/postgres/container.d.ts.map +1 -0
  426. package/dist/postgres/entities.d.ts +322 -0
  427. package/dist/postgres/entities.d.ts.map +1 -0
  428. package/dist/postgres/entity-types.d.ts +17 -0
  429. package/dist/postgres/entity-types.d.ts.map +1 -0
  430. package/dist/postgres/import/generator.d.ts +28 -0
  431. package/dist/postgres/import/generator.d.ts.map +1 -0
  432. package/dist/postgres/import/ir.d.ts +24 -0
  433. package/dist/postgres/import/ir.d.ts.map +1 -0
  434. package/dist/postgres/import/live-export.d.ts +26 -0
  435. package/dist/postgres/import/live-export.d.ts.map +1 -0
  436. package/dist/postgres/keywords.d.ts +22 -0
  437. package/dist/postgres/keywords.d.ts.map +1 -0
  438. package/dist/postgres/live/bind.d.ts +76 -0
  439. package/dist/postgres/live/bind.d.ts.map +1 -0
  440. package/dist/postgres/live/catalog.d.ts +98 -0
  441. package/dist/postgres/live/catalog.d.ts.map +1 -0
  442. package/dist/postgres/live/client.d.ts +32 -0
  443. package/dist/postgres/live/client.d.ts.map +1 -0
  444. package/dist/postgres/live/describe-resources.d.ts +41 -0
  445. package/dist/postgres/live/describe-resources.d.ts.map +1 -0
  446. package/dist/postgres/migrate/backfill.d.ts +103 -0
  447. package/dist/postgres/migrate/backfill.d.ts.map +1 -0
  448. package/dist/postgres/migrate/batches.d.ts +90 -0
  449. package/dist/postgres/migrate/batches.d.ts.map +1 -0
  450. package/dist/postgres/migrate/carry.d.ts +196 -0
  451. package/dist/postgres/migrate/carry.d.ts.map +1 -0
  452. package/dist/postgres/migrate/handoff.d.ts +46 -0
  453. package/dist/postgres/migrate/handoff.d.ts.map +1 -0
  454. package/dist/postgres/migrate/names.d.ts +55 -0
  455. package/dist/postgres/migrate/names.d.ts.map +1 -0
  456. package/dist/postgres/migrate/observe.d.ts +139 -0
  457. package/dist/postgres/migrate/observe.d.ts.map +1 -0
  458. package/dist/postgres/migrate/op.d.ts +128 -0
  459. package/dist/postgres/migrate/op.d.ts.map +1 -0
  460. package/dist/postgres/migrate/receipts.d.ts +63 -0
  461. package/dist/postgres/migrate/receipts.d.ts.map +1 -0
  462. package/dist/postgres/migrate/replication.d.ts +80 -0
  463. package/dist/postgres/migrate/replication.d.ts.map +1 -0
  464. package/dist/postgres/migrate/steps.d.ts +225 -0
  465. package/dist/postgres/migrate/steps.d.ts.map +1 -0
  466. package/dist/postgres/overlays/columns.d.ts +6 -0
  467. package/dist/postgres/overlays/columns.d.ts.map +1 -0
  468. package/dist/postgres/overlays/constraints.d.ts +8 -0
  469. package/dist/postgres/overlays/constraints.d.ts.map +1 -0
  470. package/dist/postgres/overlays/indexes.d.ts +8 -0
  471. package/dist/postgres/overlays/indexes.d.ts.map +1 -0
  472. package/dist/postgres/overlays/kinds.d.ts +48 -0
  473. package/dist/postgres/overlays/kinds.d.ts.map +1 -0
  474. package/dist/postgres/overlays/partitioning.d.ts +5 -0
  475. package/dist/postgres/overlays/partitioning.d.ts.map +1 -0
  476. package/dist/postgres/overlays/relations.d.ts +6 -0
  477. package/dist/postgres/overlays/relations.d.ts.map +1 -0
  478. package/dist/postgres/overlays/storage.d.ts +28 -0
  479. package/dist/postgres/overlays/storage.d.ts.map +1 -0
  480. package/dist/postgres/overlays/type-ddl.d.ts +7 -0
  481. package/dist/postgres/overlays/type-ddl.d.ts.map +1 -0
  482. package/dist/postgres/overlays/types.d.ts +24 -0
  483. package/dist/postgres/overlays/types.d.ts.map +1 -0
  484. package/dist/postgres/parser.d.ts +216 -0
  485. package/dist/postgres/parser.d.ts.map +1 -0
  486. package/dist/postgres/plan/commands.d.ts +61 -0
  487. package/dist/postgres/plan/commands.d.ts.map +1 -0
  488. package/dist/postgres/plan/deep.d.ts +33 -0
  489. package/dist/postgres/plan/deep.d.ts.map +1 -0
  490. package/dist/postgres/plan/diff.d.ts +45 -0
  491. package/dist/postgres/plan/diff.d.ts.map +1 -0
  492. package/dist/postgres/plan/disruption.d.ts +14 -0
  493. package/dist/postgres/plan/disruption.d.ts.map +1 -0
  494. package/dist/postgres/plan/normalize.d.ts +108 -0
  495. package/dist/postgres/plan/normalize.d.ts.map +1 -0
  496. package/dist/postgres/plan/report.d.ts +6 -0
  497. package/dist/postgres/plan/report.d.ts.map +1 -0
  498. package/dist/postgres/plan/rules.d.ts +84 -0
  499. package/dist/postgres/plan/rules.d.ts.map +1 -0
  500. package/dist/postgres/plan/schema.d.ts +50 -0
  501. package/dist/postgres/plan/schema.d.ts.map +1 -0
  502. package/dist/postgres/plan/server-normalize.d.ts +26 -0
  503. package/dist/postgres/plan/server-normalize.d.ts.map +1 -0
  504. package/dist/postgres/providers/aurora.d.ts +12 -0
  505. package/dist/postgres/providers/aurora.d.ts.map +1 -0
  506. package/dist/postgres/providers/azure.d.ts +14 -0
  507. package/dist/postgres/providers/azure.d.ts.map +1 -0
  508. package/dist/postgres/providers/cloud-sql.d.ts +11 -0
  509. package/dist/postgres/providers/cloud-sql.d.ts.map +1 -0
  510. package/dist/postgres/providers/index.d.ts +35 -0
  511. package/dist/postgres/providers/index.d.ts.map +1 -0
  512. package/dist/postgres/providers/neon.d.ts +13 -0
  513. package/dist/postgres/providers/neon.d.ts.map +1 -0
  514. package/dist/postgres/providers/rds.d.ts +10 -0
  515. package/dist/postgres/providers/rds.d.ts.map +1 -0
  516. package/dist/postgres/providers/supabase.d.ts +12 -0
  517. package/dist/postgres/providers/supabase.d.ts.map +1 -0
  518. package/dist/postgres/providers/types.d.ts +59 -0
  519. package/dist/postgres/providers/types.d.ts.map +1 -0
  520. package/dist/postgres/testing/fake-client.d.ts +38 -0
  521. package/dist/postgres/testing/fake-client.d.ts.map +1 -0
  522. package/dist/postgres/testing/migration.d.ts +25 -0
  523. package/dist/postgres/testing/migration.d.ts.map +1 -0
  524. package/dist/postgres/testing/roundtrip-schema.d.ts +11 -0
  525. package/dist/postgres/testing/roundtrip-schema.d.ts.map +1 -0
  526. package/dist/postgres/testing/server.d.ts +17 -0
  527. package/dist/postgres/testing/server.d.ts.map +1 -0
  528. package/dist/postgres/testing/writable-server.d.ts +45 -0
  529. package/dist/postgres/testing/writable-server.d.ts.map +1 -0
  530. package/dist/postgres/tokens.d.ts +26 -0
  531. package/dist/postgres/tokens.d.ts.map +1 -0
  532. package/dist/postgres.d.ts +13 -0
  533. package/dist/postgres.d.ts.map +1 -0
  534. package/dist/rules/audit-entries.ts +29 -0
  535. package/dist/rules/clickhouse-helpers.ts +206 -0
  536. package/dist/rules/postgres-audit-entries.ts +29 -0
  537. package/dist/rules/postgres-helpers.ts +126 -0
  538. package/dist/rules/postgres-templates.ts +36 -0
  539. package/dist/rules/sql-helpers.ts +53 -0
  540. package/dist/rules/sqlch001.ts +53 -0
  541. package/dist/rules/sqlch002.ts +115 -0
  542. package/dist/rules/sqlch003.ts +68 -0
  543. package/dist/rules/sqlch101.ts +35 -0
  544. package/dist/rules/sqlch102.ts +23 -0
  545. package/dist/rules/sqlch103.ts +45 -0
  546. package/dist/rules/sqlch104.ts +42 -0
  547. package/dist/rules/sqlch105.ts +35 -0
  548. package/dist/rules/sqlch106.ts +27 -0
  549. package/dist/rules/sqlch107.ts +35 -0
  550. package/dist/rules/sqlch108.ts +27 -0
  551. package/dist/rules/sqlch109.ts +21 -0
  552. package/dist/rules/sqlch110.ts +29 -0
  553. package/dist/rules/sqlch111.ts +40 -0
  554. package/dist/rules/sqlch112.ts +30 -0
  555. package/dist/rules/sqlch113.ts +20 -0
  556. package/dist/rules/sqlch114.ts +26 -0
  557. package/dist/rules/sqlch115.ts +31 -0
  558. package/dist/rules/sqlch116.ts +22 -0
  559. package/dist/rules/sqlch117.ts +25 -0
  560. package/dist/rules/sqlch118.ts +26 -0
  561. package/dist/rules/sqlch119.ts +31 -0
  562. package/dist/rules/sqlch120.ts +21 -0
  563. package/dist/rules/sqlpg001.ts +88 -0
  564. package/dist/rules/sqlpg002.ts +68 -0
  565. package/dist/rules/sqlpg003.ts +59 -0
  566. package/dist/rules/sqlpg004.ts +73 -0
  567. package/dist/rules/sqlpg101.ts +24 -0
  568. package/dist/rules/sqlpg102.ts +30 -0
  569. package/dist/rules/sqlpg103.ts +23 -0
  570. package/dist/rules/sqlpg104.ts +23 -0
  571. package/dist/rules/sqlpg105.ts +22 -0
  572. package/dist/rules/sqlpg106.ts +22 -0
  573. package/dist/rules/sqlpg107.ts +22 -0
  574. package/dist/rules/sqlpg108.ts +27 -0
  575. package/dist/rules/sqlpg109.ts +37 -0
  576. package/dist/rules/sqlpg110.ts +33 -0
  577. package/dist/rules/sqlpg111.ts +23 -0
  578. package/dist/rules/sqlpg112.ts +25 -0
  579. package/dist/rules/sqlpg113.ts +28 -0
  580. package/dist/rules/sqlpg114.ts +37 -0
  581. package/dist/rules/sqlpg115.ts +38 -0
  582. package/dist/rules/sqlpg116.ts +25 -0
  583. package/dist/rules/sqlpg117.ts +24 -0
  584. package/dist/rules/sqlpg118.ts +22 -0
  585. package/dist/rules/templates.ts +35 -0
  586. package/dist/serializer.d.ts +37 -0
  587. package/dist/serializer.d.ts.map +1 -0
  588. package/dist/skill-defs.d.ts +3 -0
  589. package/dist/skill-defs.d.ts.map +1 -0
  590. package/dist/spec/catalog.d.ts +125 -0
  591. package/dist/spec/catalog.d.ts.map +1 -0
  592. package/dist/spec/fetch.d.ts +43 -0
  593. package/dist/spec/fetch.d.ts.map +1 -0
  594. package/dist/spec/pin.d.ts +39 -0
  595. package/dist/spec/pin.d.ts.map +1 -0
  596. package/dist/spec/postgres-catalog.d.ts +108 -0
  597. package/dist/spec/postgres-catalog.d.ts.map +1 -0
  598. package/dist/spec/postgres-fetch.d.ts +46 -0
  599. package/dist/spec/postgres-fetch.d.ts.map +1 -0
  600. package/dist/spec/postgres-pin.d.ts +67 -0
  601. package/dist/spec/postgres-pin.d.ts.map +1 -0
  602. package/dist/types/index.d.ts +4386 -0
  603. package/dist/validate-cli.d.ts +3 -0
  604. package/dist/validate-cli.d.ts.map +1 -0
  605. package/dist/validate.d.ts +15 -0
  606. package/dist/validate.d.ts.map +1 -0
  607. package/package.json +74 -4
  608. package/src/clickhouse/apply/apply.ts +288 -0
  609. package/src/clickhouse/apply/mutations.ts +90 -0
  610. package/src/clickhouse/apply/statements.ts +393 -0
  611. package/src/clickhouse/catalog-types.ts +84 -0
  612. package/src/clickhouse/container.ts +176 -0
  613. package/src/clickhouse/engine-syntax.test.ts +53 -0
  614. package/src/clickhouse/engine-syntax.ts +173 -0
  615. package/src/clickhouse/entities.test.ts +188 -0
  616. package/src/clickhouse/entities.ts +425 -0
  617. package/src/clickhouse/http.ts +76 -0
  618. package/src/clickhouse/import/generator.ts +153 -0
  619. package/src/clickhouse/import/import.test.ts +157 -0
  620. package/src/clickhouse/import/ir.ts +171 -0
  621. package/src/clickhouse/import/live-export.ts +53 -0
  622. package/src/clickhouse/import/parser.ts +27 -0
  623. package/src/clickhouse/import/roundtrip.test.ts +90 -0
  624. package/src/clickhouse/live/bind.ts +126 -0
  625. package/src/clickhouse/live/catalog.ts +96 -0
  626. package/src/clickhouse/live/describe-resources.ts +98 -0
  627. package/src/clickhouse/live/live.test.ts +143 -0
  628. package/src/clickhouse/live/roundtrip.e2e.test.ts +93 -0
  629. package/src/clickhouse/overlays/codecs.ts +68 -0
  630. package/src/clickhouse/overlays/engines.ts +108 -0
  631. package/src/clickhouse/overlays/kinds.ts +38 -0
  632. package/src/clickhouse/overlays/projections.ts +36 -0
  633. package/src/clickhouse/overlays/skip-indexes.ts +44 -0
  634. package/src/clickhouse/overlays/ttl.ts +55 -0
  635. package/src/clickhouse/overlays/types.ts +58 -0
  636. package/src/clickhouse/ownership.test.ts +20 -0
  637. package/src/clickhouse/ownership.ts +103 -0
  638. package/src/clickhouse/parser.test.ts +166 -0
  639. package/src/clickhouse/parser.ts +459 -0
  640. package/src/clickhouse/plan/commands.ts +101 -0
  641. package/src/clickhouse/plan/deep.ts +124 -0
  642. package/src/clickhouse/plan/diff.ts +203 -0
  643. package/src/clickhouse/plan/disruption.ts +61 -0
  644. package/src/clickhouse/plan/normalize.ts +352 -0
  645. package/src/clickhouse/plan/plan-wiring.test.ts +77 -0
  646. package/src/clickhouse/plan/plan.e2e.test.ts +77 -0
  647. package/src/clickhouse/plan/plan.test.ts +201 -0
  648. package/src/clickhouse/plan/rebuild-handoff.ts +59 -0
  649. package/src/clickhouse/plan/report.ts +19 -0
  650. package/src/clickhouse/plan/rules.ts +241 -0
  651. package/src/clickhouse/plan/schema.ts +56 -0
  652. package/src/clickhouse/plan/server-format.ts +39 -0
  653. package/src/clickhouse/rebuild/backfill.ts +186 -0
  654. package/src/clickhouse/rebuild/observe.ts +380 -0
  655. package/src/clickhouse/rebuild/op.ts +206 -0
  656. package/src/clickhouse/rebuild/partitions.ts +62 -0
  657. package/src/clickhouse/rebuild/rebuild-replicated.e2e.test.ts +513 -0
  658. package/src/clickhouse/rebuild/rebuild.e2e.test.ts +351 -0
  659. package/src/clickhouse/rebuild/rebuild.test.ts +190 -0
  660. package/src/clickhouse/rebuild/receipts.ts +143 -0
  661. package/src/clickhouse/rebuild/replicas.test.ts +70 -0
  662. package/src/clickhouse/rebuild/replicas.ts +148 -0
  663. package/src/clickhouse/rebuild/steps.ts +382 -0
  664. package/src/clickhouse/rebuild/verify.ts +124 -0
  665. package/src/clickhouse/testdata/NOTICE +5 -0
  666. package/src/clickhouse/testdata/clickhouse-tests-corpus.json +302 -0
  667. package/src/clickhouse/testing/fake-server.ts +65 -0
  668. package/src/clickhouse/testing/roundtrip-schema.ts +25 -0
  669. package/src/clickhouse/testing/writable-server.ts +141 -0
  670. package/src/clickhouse/tokens.ts +28 -0
  671. package/src/clickhouse.ts +63 -0
  672. package/src/codegen/classifier-page.test.ts +16 -0
  673. package/src/codegen/classifier-page.ts +76 -0
  674. package/src/codegen/clickhouse-module.test.ts +63 -0
  675. package/src/codegen/clickhouse-module.ts +269 -0
  676. package/src/codegen/docs-cli.ts +4 -0
  677. package/src/codegen/docs.ts +225 -0
  678. package/src/codegen/generate-cli.ts +13 -0
  679. package/src/codegen/generate.ts +126 -0
  680. package/src/codegen/package.ts +36 -0
  681. package/src/codegen/postgres-classifier-page.ts +81 -0
  682. package/src/codegen/postgres-module.test.ts +77 -0
  683. package/src/codegen/postgres-module.ts +434 -0
  684. package/src/codegen/registry.ts +36 -0
  685. package/src/composites/audit-log-table.ts +54 -0
  686. package/src/composites/catalog.test.ts +61 -0
  687. package/src/composites/catalog.ts +529 -0
  688. package/src/composites/cdc-mirror.ts +54 -0
  689. package/src/composites/clickhouse.ts +7 -0
  690. package/src/composites/composites.test.ts +758 -0
  691. package/src/composites/events-table.ts +49 -0
  692. package/src/composites/index.ts +9 -0
  693. package/src/composites/join-table.ts +57 -0
  694. package/src/composites/postgres.ts +7 -0
  695. package/src/composites/refreshed-view.ts +46 -0
  696. package/src/composites/replacing-table.ts +49 -0
  697. package/src/composites/rollup-view.ts +55 -0
  698. package/src/composites/sharded-table.ts +49 -0
  699. package/src/composites/soft-delete-table.ts +61 -0
  700. package/src/composites/tenant-table.ts +50 -0
  701. package/src/config.ts +157 -0
  702. package/src/core/apply.ts +153 -0
  703. package/src/core/classifier.ts +186 -0
  704. package/src/core/container.ts +93 -0
  705. package/src/core/core.test.ts +254 -0
  706. package/src/core/cursor.ts +189 -0
  707. package/src/core/diff.ts +72 -0
  708. package/src/core/entity.ts +85 -0
  709. package/src/core/find-templates.ts +158 -0
  710. package/src/core/handoff.ts +44 -0
  711. package/src/core/index.ts +61 -0
  712. package/src/core/interpolation.ts +225 -0
  713. package/src/core/normalize.ts +39 -0
  714. package/src/core/ownership.test.ts +36 -0
  715. package/src/core/ownership.ts +133 -0
  716. package/src/core/receipts.ts +29 -0
  717. package/src/core/references.ts +74 -0
  718. package/src/core/template.ts +83 -0
  719. package/src/core/testing/http-stub.ts +33 -0
  720. package/src/core/tokens.ts +252 -0
  721. package/src/coverage.ts +64 -0
  722. package/src/detect.ts +32 -0
  723. package/src/dialects.ts +21 -0
  724. package/src/generated/clickhouse-types.ts +4386 -0
  725. package/src/generated/clickhouse.ts +2476 -0
  726. package/src/generated/index.d.ts +4386 -0
  727. package/src/generated/lexicon-sql.json +67 -0
  728. package/src/generated/postgres-types.ts +1190 -0
  729. package/src/generated/postgres.ts +1039 -0
  730. package/src/import-generator.ts +18 -0
  731. package/src/index.ts +21 -0
  732. package/src/init-templates.test.ts +108 -0
  733. package/src/init-templates.ts +327 -0
  734. package/src/lint/audit-catalog.ts +73 -0
  735. package/src/lint/audit-lineage.ts +47 -0
  736. package/src/lint/post-synth/audit-entries.ts +29 -0
  737. package/src/lint/post-synth/clickhouse-checks.test.ts +278 -0
  738. package/src/lint/post-synth/clickhouse-helpers.ts +206 -0
  739. package/src/lint/post-synth/index.ts +81 -0
  740. package/src/lint/post-synth/post-synth.test.ts +33 -0
  741. package/src/lint/post-synth/postgres-audit-entries.ts +29 -0
  742. package/src/lint/post-synth/postgres-checks.test.ts +257 -0
  743. package/src/lint/post-synth/postgres-helpers.ts +126 -0
  744. package/src/lint/post-synth/sql-helpers.ts +53 -0
  745. package/src/lint/post-synth/sqlch101.ts +35 -0
  746. package/src/lint/post-synth/sqlch102.ts +23 -0
  747. package/src/lint/post-synth/sqlch103.ts +45 -0
  748. package/src/lint/post-synth/sqlch104.ts +42 -0
  749. package/src/lint/post-synth/sqlch105.ts +35 -0
  750. package/src/lint/post-synth/sqlch106.ts +27 -0
  751. package/src/lint/post-synth/sqlch107.ts +35 -0
  752. package/src/lint/post-synth/sqlch108.ts +27 -0
  753. package/src/lint/post-synth/sqlch109.ts +21 -0
  754. package/src/lint/post-synth/sqlch110.ts +29 -0
  755. package/src/lint/post-synth/sqlch111.ts +40 -0
  756. package/src/lint/post-synth/sqlch112.ts +30 -0
  757. package/src/lint/post-synth/sqlch113.ts +20 -0
  758. package/src/lint/post-synth/sqlch114.ts +26 -0
  759. package/src/lint/post-synth/sqlch115.ts +31 -0
  760. package/src/lint/post-synth/sqlch116.ts +22 -0
  761. package/src/lint/post-synth/sqlch117.ts +25 -0
  762. package/src/lint/post-synth/sqlch118.ts +26 -0
  763. package/src/lint/post-synth/sqlch119.ts +31 -0
  764. package/src/lint/post-synth/sqlch120.ts +21 -0
  765. package/src/lint/post-synth/sqlpg101.ts +24 -0
  766. package/src/lint/post-synth/sqlpg102.ts +30 -0
  767. package/src/lint/post-synth/sqlpg103.ts +23 -0
  768. package/src/lint/post-synth/sqlpg104.ts +23 -0
  769. package/src/lint/post-synth/sqlpg105.ts +22 -0
  770. package/src/lint/post-synth/sqlpg106.ts +22 -0
  771. package/src/lint/post-synth/sqlpg107.ts +22 -0
  772. package/src/lint/post-synth/sqlpg108.ts +27 -0
  773. package/src/lint/post-synth/sqlpg109.ts +37 -0
  774. package/src/lint/post-synth/sqlpg110.ts +33 -0
  775. package/src/lint/post-synth/sqlpg111.ts +23 -0
  776. package/src/lint/post-synth/sqlpg112.ts +25 -0
  777. package/src/lint/post-synth/sqlpg113.ts +28 -0
  778. package/src/lint/post-synth/sqlpg114.ts +37 -0
  779. package/src/lint/post-synth/sqlpg115.ts +38 -0
  780. package/src/lint/post-synth/sqlpg116.ts +25 -0
  781. package/src/lint/post-synth/sqlpg117.ts +24 -0
  782. package/src/lint/post-synth/sqlpg118.ts +22 -0
  783. package/src/lint/rules/index.ts +13 -0
  784. package/src/lint/rules/postgres-templates.ts +36 -0
  785. package/src/lint/rules/rules.test.ts +228 -0
  786. package/src/lint/rules/sqlch001.ts +53 -0
  787. package/src/lint/rules/sqlch002.ts +115 -0
  788. package/src/lint/rules/sqlch003.ts +68 -0
  789. package/src/lint/rules/sqlpg001.ts +88 -0
  790. package/src/lint/rules/sqlpg002.ts +68 -0
  791. package/src/lint/rules/sqlpg003.ts +59 -0
  792. package/src/lint/rules/sqlpg004.ts +73 -0
  793. package/src/lint/rules/templates.ts +35 -0
  794. package/src/live-dialect.ts +37 -0
  795. package/src/lsp/catalog.ts +60 -0
  796. package/src/lsp/completions.test.ts +111 -0
  797. package/src/lsp/completions.ts +128 -0
  798. package/src/lsp/diagnostics.test.ts +26 -0
  799. package/src/lsp/hover.test.ts +90 -0
  800. package/src/lsp/hover.ts +113 -0
  801. package/src/lsp/postgres-catalog.ts +234 -0
  802. package/src/lsp/postgres-template.ts +161 -0
  803. package/src/lsp/postgres.test.ts +150 -0
  804. package/src/lsp/postgres.ts +270 -0
  805. package/src/lsp/refs.ts +53 -0
  806. package/src/lsp/registry.ts +19 -0
  807. package/src/lsp/template.ts +166 -0
  808. package/src/mcp/index.ts +304 -0
  809. package/src/mcp/mcp.test.ts +184 -0
  810. package/src/mcp/postgres.ts +125 -0
  811. package/src/op/activities/clickhouse-apply.e2e.test.ts +150 -0
  812. package/src/op/activities/clickhouse-apply.test.ts +265 -0
  813. package/src/op/activities/clickhouse-apply.ts +113 -0
  814. package/src/op/activities/clickhouse-emulator.test.ts +23 -0
  815. package/src/op/activities/clickhouse-emulator.ts +37 -0
  816. package/src/op/activities/clickhouse-rebuild.ts +136 -0
  817. package/src/op/activities/index.ts +50 -0
  818. package/src/op/activities/postgres-apply.e2e.test.ts +184 -0
  819. package/src/op/activities/postgres-apply.test.ts +304 -0
  820. package/src/op/activities/postgres-apply.ts +170 -0
  821. package/src/op/activities/postgres-emulator.test.ts +26 -0
  822. package/src/op/activities/postgres-emulator.ts +44 -0
  823. package/src/op/activities/postgres-migration.ts +182 -0
  824. package/src/op/activity-contracts.ts +210 -0
  825. package/src/package-cli.ts +17 -0
  826. package/src/plugin.test.ts +74 -0
  827. package/src/plugin.ts +242 -0
  828. package/src/postgres/apply/apply.ts +582 -0
  829. package/src/postgres/apply/statements.test.ts +155 -0
  830. package/src/postgres/apply/statements.ts +603 -0
  831. package/src/postgres/catalog-types.ts +59 -0
  832. package/src/postgres/container.ts +72 -0
  833. package/src/postgres/entities.test.ts +170 -0
  834. package/src/postgres/entities.ts +1016 -0
  835. package/src/postgres/entity-types.ts +18 -0
  836. package/src/postgres/import/generator.ts +176 -0
  837. package/src/postgres/import/import.test.ts +71 -0
  838. package/src/postgres/import/ir.ts +67 -0
  839. package/src/postgres/import/live-export.ts +53 -0
  840. package/src/postgres/import/live-warnings.test.ts +45 -0
  841. package/src/postgres/keywords.ts +40 -0
  842. package/src/postgres/live/bind.ts +146 -0
  843. package/src/postgres/live/catalog.ts +581 -0
  844. package/src/postgres/live/client.ts +84 -0
  845. package/src/postgres/live/describe-resources.ts +111 -0
  846. package/src/postgres/live/live.test.ts +198 -0
  847. package/src/postgres/live/roundtrip.e2e.test.ts +111 -0
  848. package/src/postgres/migrate/backfill.ts +233 -0
  849. package/src/postgres/migrate/batches.e2e.test.ts +163 -0
  850. package/src/postgres/migrate/batches.test.ts +36 -0
  851. package/src/postgres/migrate/batches.ts +159 -0
  852. package/src/postgres/migrate/carry.e2e.test.ts +335 -0
  853. package/src/postgres/migrate/carry.test.ts +103 -0
  854. package/src/postgres/migrate/carry.ts +653 -0
  855. package/src/postgres/migrate/handoff.ts +73 -0
  856. package/src/postgres/migrate/kinds.e2e.test.ts +204 -0
  857. package/src/postgres/migrate/migrate.e2e.test.ts +362 -0
  858. package/src/postgres/migrate/migrate.test.ts +322 -0
  859. package/src/postgres/migrate/names.ts +93 -0
  860. package/src/postgres/migrate/observe.ts +521 -0
  861. package/src/postgres/migrate/op.ts +242 -0
  862. package/src/postgres/migrate/receipts.ts +135 -0
  863. package/src/postgres/migrate/replication.ts +151 -0
  864. package/src/postgres/migrate/steps.ts +657 -0
  865. package/src/postgres/overlays/columns.ts +34 -0
  866. package/src/postgres/overlays/constraints.ts +56 -0
  867. package/src/postgres/overlays/indexes.ts +27 -0
  868. package/src/postgres/overlays/kinds.ts +53 -0
  869. package/src/postgres/overlays/partitioning.ts +26 -0
  870. package/src/postgres/overlays/relations.ts +29 -0
  871. package/src/postgres/overlays/storage.ts +75 -0
  872. package/src/postgres/overlays/type-ddl.ts +38 -0
  873. package/src/postgres/overlays/types.ts +56 -0
  874. package/src/postgres/parser.test.ts +214 -0
  875. package/src/postgres/parser.ts +1062 -0
  876. package/src/postgres/plan/commands.ts +124 -0
  877. package/src/postgres/plan/deep.ts +177 -0
  878. package/src/postgres/plan/diff.ts +323 -0
  879. package/src/postgres/plan/disruption.ts +52 -0
  880. package/src/postgres/plan/normalize.test.ts +148 -0
  881. package/src/postgres/plan/normalize.ts +542 -0
  882. package/src/postgres/plan/plan.e2e.test.ts +117 -0
  883. package/src/postgres/plan/plan.test.ts +244 -0
  884. package/src/postgres/plan/report.ts +24 -0
  885. package/src/postgres/plan/rules.ts +276 -0
  886. package/src/postgres/plan/schema.ts +114 -0
  887. package/src/postgres/plan/server-normalize.ts +123 -0
  888. package/src/postgres/providers/aurora.ts +45 -0
  889. package/src/postgres/providers/azure.ts +54 -0
  890. package/src/postgres/providers/cloud-sql.ts +42 -0
  891. package/src/postgres/providers/index.ts +90 -0
  892. package/src/postgres/providers/neon.ts +45 -0
  893. package/src/postgres/providers/providers.test.ts +136 -0
  894. package/src/postgres/providers/rds.ts +48 -0
  895. package/src/postgres/providers/supabase.ts +46 -0
  896. package/src/postgres/providers/types.ts +70 -0
  897. package/src/postgres/testdata/NOTICE +31 -0
  898. package/src/postgres/testdata/postgres-regress-corpus.json +460 -0
  899. package/src/postgres/testing/fake-client.ts +42 -0
  900. package/src/postgres/testing/migration.ts +52 -0
  901. package/src/postgres/testing/roundtrip-schema.ts +46 -0
  902. package/src/postgres/testing/server.ts +58 -0
  903. package/src/postgres/testing/writable-server.ts +188 -0
  904. package/src/postgres/tokens.ts +46 -0
  905. package/src/postgres.ts +75 -0
  906. package/src/serializer.test.ts +128 -0
  907. package/src/serializer.ts +148 -0
  908. package/src/skill-defs.test.ts +81 -0
  909. package/src/skill-defs.ts +102 -0
  910. package/src/skills/chant-sql-plan.md +123 -0
  911. package/src/skills/chant-sql-postgres-migration.md +126 -0
  912. package/src/skills/chant-sql-postgres-plan.md +194 -0
  913. package/src/skills/chant-sql-postgres.md +165 -0
  914. package/src/skills/chant-sql-rebuild.md +68 -0
  915. package/src/skills/chant-sql.md +123 -0
  916. package/src/spec/catalog.e2e.test.ts +29 -0
  917. package/src/spec/catalog.test.ts +56 -0
  918. package/src/spec/catalog.ts +311 -0
  919. package/src/spec/clickhouse-catalog.snapshot.json +5246 -0
  920. package/src/spec/fetch.test.ts +77 -0
  921. package/src/spec/fetch.ts +112 -0
  922. package/src/spec/pin.ts +47 -0
  923. package/src/spec/postgres-catalog-14.snapshot.json +3494 -0
  924. package/src/spec/postgres-catalog-15.snapshot.json +3529 -0
  925. package/src/spec/postgres-catalog-16.snapshot.json +3597 -0
  926. package/src/spec/postgres-catalog-17.snapshot.json +3656 -0
  927. package/src/spec/postgres-catalog-18.snapshot.json +3747 -0
  928. package/src/spec/postgres-catalog.test.ts +43 -0
  929. package/src/spec/postgres-catalog.ts +301 -0
  930. package/src/spec/postgres-fetch.test.ts +75 -0
  931. package/src/spec/postgres-fetch.ts +112 -0
  932. package/src/spec/postgres-pin.test.ts +64 -0
  933. package/src/spec/postgres-pin.ts +101 -0
  934. package/src/typecheck.test.ts +104 -0
  935. package/src/validate-cli.ts +6 -0
  936. package/src/validate.ts +149 -0
@@ -0,0 +1,302 @@
1
+ [
2
+ "CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory",
3
+ "CREATE TABLE insert_fewer_columns\n(\n a UInt8,\n b UInt8\n)\nENGINE = Memory()",
4
+ "CREATE TABLE replicated_collapsing_merge_tree_with_sampling\n\t(d Date, a String, b UInt8, x String, y Int8, z UInt32) ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/{database}/test_00083/01/replicated_collapsing_merge_tree_with_sampling/', 'r1', d, sipHash64(a) + b, (a, sipHash64(a) + b), 111, y)",
5
+ "CREATE TABLE tmp (date Date, name String) ENGINE = Memory",
6
+ "---- avg\ncreate table summing_merge_tree_aggregate_function (d materialized today(), k UInt64, x AggregateFunction(avg, Float64)) engine=SummingMergeTree(d, k, 8192)",
7
+ "CREATE TABLE aggregating_00191\n(\n d Date DEFAULT '2000-01-01',\n k UInt64,\n u AggregateFunction(uniq, UInt64)\n)\nENGINE = AggregatingMergeTree(d, k, 8192)",
8
+ "CREATE TABLE sample_00276\n(\n d Date DEFAULT '2000-01-01',\n x UInt8\n)\nENGINE = MergeTree(d, x, x, 10)",
9
+ "CREATE TABLE summing_composite_key (d Date, k UInt64, FirstMap Nested(k1 UInt32, k2ID Int8, s Float64), SecondMap Nested(k1ID UInt64, k2Key String, k3Type Int32, s Int64)) ENGINE = SummingMergeTree(d, k, 1)",
10
+ "CREATE TABLE test1_00395(\ncol1 UInt64, col2 Nullable(UInt64),\ncol3 String, col4 Nullable(String),\ncol5 Array(UInt64), col6 Array(Nullable(UInt64)),\ncol7 Array(String), col8 Array(Nullable(String)),\nd Date) Engine = Memory",
11
+ "CREATE TABLE test1_00395\n(\n col1 Array(Nullable(String)),\n col2 Nullable(String)\n)\nENGINE = TinyLog()",
12
+ "CREATE TABLE merge_s64_u64 (x UInt64) ENGINE = Merge(currentDatabase(), '^s64|u64$')",
13
+ "CREATE TABLE tab_00481\n(\n date Date,\n value UInt64,\n s String,\n m FixedString(16)\n)\nENGINE = MergeTree(date, (date, value), 8)",
14
+ "CREATE TABLE partitioned_by_tuple(d Date, x UInt8, y UInt8) ENGINE MergeTree ORDER BY x PARTITION BY (d, x)",
15
+ "CREATE TABLE globalin\n(\n CounterID UInt32,\n StartDate Date\n)\nENGINE = Memory()",
16
+ "CREATE TABLE arr\n(\n x Array(String),\n y Nullable(String),\n z Array(Array(Nullable(String)))\n)\nENGINE = TinyLog()",
17
+ "create table mult_tab (date Date, value UInt64, key UInt64, version UInt64, sign Int8) engine = VersionedCollapsingMergeTree(date, (date), 8192, sign, version)",
18
+ "CREATE TABLE columns (a UInt8, b UInt8, c UInt8) ENGINE = Memory",
19
+ "create table tab (date Date, time DateTime, data String) ENGINE = MergeTree(date, (time, data), 8192)",
20
+ "CREATE TABLE truncate_test_materialized_depend\n(\n p Date,\n k UInt64\n)\nENGINE = Null()",
21
+ "CREATE TABLE orin_test\n(\n c1 Int32\n)\nENGINE = Memory()",
22
+ "CREATE TABLE alter_00665\n(\n boolean_false Nullable(String)\n)\nENGINE = MergeTree()\nORDER BY tuple()",
23
+ "CREATE TABLE lc_prewhere\n(\n key UInt64,\n val UInt64,\n str LowCardinality(String),\n s String\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = '8192'",
24
+ "CREATE TABLE IF NOT EXISTS decimal\n(\n d1 DECIMAL(9, 8),\n d2 DECIMAL(18),\n d3 DECIMAL\n)\nENGINE = MergeTree()\nORDER BY (d2, d3)\nPARTITION BY toInt32(d1)",
25
+ "CREATE TABLE sample_prewhere\n(\n CounterID UInt32,\n UserID UInt64\n)\nENGINE = MergeTree()\nORDER BY UserID\nSAMPLE BY UserID",
26
+ "-- Check COMMENT COLUMN and MODIFY COLUMN statements with simple engine\nCREATE TABLE check_query_comment_column\n (\n first_column UInt8 DEFAULT 1 COMMENT 'comment 1',\n second_column UInt8 MATERIALIZED first_column COMMENT 'comment 2',\n third_column UInt8 ALIAS second_column COMMENT 'comment 3',\n fourth_column UInt8 COMMENT 'comment 4',\n fifth_column UInt8\n ) ENGINE = TinyLog",
27
+ "CREATE TABLE quorum1\n(\n x UInt32,\n y Date\n)\nENGINE = ReplicatedMergeTree('/clickhouse/tables/{database}/test_00732/quorum_old_data', '1')\nORDER BY x\nPARTITION BY y",
28
+ "CREATE MATERIALIZED VIEW t_mv_00751\nENGINE = MergeTree()\nORDER BY date\nAS\nSELECT\n date,\n platform,\n app\nFROM t_00751\nWHERE app = (\n SELECT min(app)\n FROM u_00751\n )\n AND platform = (\n SELECT (\n SELECT min(platform)\n FROM v_00751\n )\n )",
29
+ "CREATE MATERIALIZED VIEW check_system_tables_mv ENGINE = MergeTree() ORDER BY name2 AS SELECT name1, name2, name3 FROM check_system_tables",
30
+ "CREATE TABLE lc_00800_2\n(\n val LowCardinality(UInt64)\n)\nENGINE = MergeTree()\nORDER BY val",
31
+ "-- { serverError ILLEGAL_SYNTAX_FOR_CODEC_TYPE }\n\nCREATE TABLE params_when_no_params\n(\n id UInt64 CODEC(LZ4(1))\n)\nENGINE = MergeTree()\nORDER BY tuple()",
32
+ "CREATE TABLE table1\n(\n a String,\n b Date\n)\nENGINE = MergeTree()\nORDER BY a",
33
+ "CREATE TABLE minmax_idx2\n(\n u64 UInt64,\n i32 Int32,\n INDEX idx1 u64 + i32 TYPE minmax() GRANULARITY 10,\n INDEX idx2 u64 * i32 TYPE minmax() GRANULARITY 10\n)\nENGINE = MergeTree()\nORDER BY u64",
34
+ "CREATE TABLE table1\n(\n id String\n)\nENGINE = Log()",
35
+ "CREATE TABLE t\n(\n x String\n)\nENGINE = MergeTree()\nORDER BY tuple()",
36
+ "CREATE TABLE arrays_test (a1 Array(UInt16), a2 Array(UInt16), a3 Array(Array(UInt16)), a4 Array(Array(UInt16)) ) ENGINE = Memory",
37
+ "CREATE TABLE simple\n(\n id UInt64,\n nullable_str SimpleAggregateFunction(anyLast, Nullable(String)),\n nullable_str_respect_nulls SimpleAggregateFunction(anyLastRespectNulls, Nullable(String)),\n low_str SimpleAggregateFunction(anyLast, LowCardinality(Nullable(String))),\n ip SimpleAggregateFunction(anyLast, IPv4),\n status SimpleAggregateFunction(groupBitOr, UInt32),\n tup SimpleAggregateFunction(sumMap, Tuple(Array(Int32), Array(Int64))),\n tup_min SimpleAggregateFunction(minMap, Tuple(Array(Int32), Array(Int64))),\n tup_max SimpleAggregateFunction(maxMap, Tuple(Array(Int32), Array(Int64))),\n arr SimpleAggregateFunction(groupArrayArray, Array(Int32)),\n uniq_arr SimpleAggregateFunction(groupUniqArrayArray, Array(Int32)),\n map_uniq_arr SimpleAggregateFunction(groupUniqArrayArrayMap, Map(Int32, Array(Int64)))\n)\nENGINE = SummingMergeTree()\nORDER BY id",
38
+ "CREATE TABLE two_rows_per_granule\n(\n p Date,\n k UInt64,\n v1 UInt64,\n v2 Int64\n)\nENGINE = ReplacingMergeTree()\nORDER BY k\nPARTITION BY toYYYYMM(p)\nSETTINGS index_granularity_bytes = '40', min_index_granularity_bytes = '10', write_final_mark = '0', enable_vertical_merge_algorithm = '1', vertical_merge_algorithm_min_rows_to_activate = '0', vertical_merge_algorithm_min_columns_to_activate = '0', min_bytes_for_wide_part = '0', min_bytes_for_full_part_storage = '0'",
39
+ "create table test_in (a LowCardinality(String)) Engine = MergeTree order by a",
40
+ "CREATE TABLE ttl_00933_2\n(\n d DateTime,\n a Int,\n b DEFAULT a * 2 TTL d + toIntervalDay(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nPARTITION BY toDayOfMonth(d)",
41
+ "CREATE TABLE bloom_filter_array_lc_null_types_test (\n order_key Array(LowCardinality(Nullable(UInt64))),\n\n i8 Array(LowCardinality(Nullable(Int8))),\n i16 Array(LowCardinality(Nullable(Int16))),\n i32 Array(LowCardinality(Nullable(Int32))),\n i64 Array(LowCardinality(Nullable(Int64))),\n u8 Array(LowCardinality(Nullable(UInt8))),\n u16 Array(LowCardinality(Nullable(UInt16))),\n u32 Array(LowCardinality(Nullable(UInt32))),\n u64 Array(LowCardinality(Nullable(UInt64))),\n f32 Array(LowCardinality(Nullable(Float32))),\n f64 Array(LowCardinality(Nullable(Float64))),\n\n date Array(LowCardinality(Nullable(Date))),\n date_time Array(LowCardinality(Nullable(DateTime('Asia/Istanbul')))),\n\n str Array(LowCardinality(Nullable(String))),\n fixed_string Array(LowCardinality(Nullable(FixedString(5)))),\n INDEX idx (i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, date, date_time, str, fixed_string)\n TYPE bloom_filter GRANULARITY 1)\nENGINE = MergeTree() ORDER BY order_key SETTINGS index_granularity = 6, index_granularity_bytes = '10Mi', allow_nullable_key = 1",
42
+ "CREATE MATERIALIZED VIEW v0 REFRESH AFTER 1 SECOND APPEND TO tab (c0 String CODEC(DoubleDelta(2))) EMPTY AS (SELECT 'a' AS c0)",
43
+ "CREATE TABLE tableMergeTree_00968\n(\n id UInt64\n)\nENGINE = MergeTree()\nORDER BY id\nPARTITION BY id",
44
+ "create table t(a Nullable(Int64), b Nullable(Int64), c Nullable(String)) engine = MergeTree ORDER BY tuple()",
45
+ "CREATE TABLE test1 (a UInt8, b String) ENGINE MergeTree ORDER BY a",
46
+ "CREATE TABLE constrained (URL String, CONSTRAINT is_censor CHECK domainWithoutWWW(URL) = 'censor.net', CONSTRAINT is_utf8 CHECK isValidUTF8(URL)) ENGINE = StripeLog",
47
+ "CREATE TABLE foo (key int, INDEX i1 key TYPE minmax GRANULARITY 1) Engine=MergeTree() ORDER BY key",
48
+ "CREATE TABLE CLICKHOUSE_DATABASE.table_ip_trie\n(\n prefix String,\n val String\n)\nENGINE = TinyLog()",
49
+ "CREATE TABLE userid_test\n(\n userid UInt64\n)\nENGINE = MergeTree()\nORDER BY userid\nPARTITION BY intDiv(userid, 500)\nSETTINGS index_granularity = '8192'",
50
+ "CREATE TABLE CLICKHOUSE_DATABASE.table_for_dict\n(\n key_column UInt64,\n second_column UInt8,\n third_column String\n)\nENGINE = MergeTree()\nORDER BY key_column",
51
+ "CREATE TABLE check_query_test_non_adaptive (SomeKey UInt64, SomeValue String) ENGINE = MergeTree() ORDER BY SomeKey SETTINGS index_granularity_bytes = 0, min_bytes_for_wide_part = 0, min_rows_for_wide_part = 0",
52
+ "CREATE TABLE a\n(\n id1 UInt32,\n id2 UInt32,\n valA UInt32\n)\nENGINE = TinyLog()",
53
+ "create table mt_compact(a UInt64, b UInt64 DEFAULT a * a, s String, n Nested(x UInt32, y String), lc LowCardinality(String))\nengine = MergeTree\norder by a partition by a % 10\nsettings index_granularity = 8,\nmin_bytes_for_wide_part = 0,\nmin_rows_for_wide_part = 10",
54
+ "-- the same for second pipeline\nCREATE TABLE checkouts (\n id UInt64,\n ts DateTime('UTC')\n) Engine=MergeTree ORDER BY id",
55
+ "create table ttl (a Int, b Int, c Int default 42 ttl d, d Date, index ind (b * c) type minmax granularity 1)\nengine = MergeTree order by a",
56
+ "CREATE TABLE bloom_filter_not_has (ary Array(LowCardinality(Nullable(String))), d Date, INDEX idx_ary ary TYPE bloom_filter(0.01) GRANULARITY 1024) ENGINE = MergeTree() PARTITION BY d ORDER BY d",
57
+ "CREATE TABLE test_table_2\n(\n a Array(Int8),\n d Decimal32(4),\n c Tuple(DateTime64(3, 'UTC'), UUID)\n)\nENGINE = GenerateRandom(10, 5, 3)",
58
+ "CREATE TABLE local_01099_a (number UInt64) ENGINE = Log",
59
+ "CREATE TABLE t1 (key UInt64, a UInt8, b String, c Float64) ENGINE = MergeTree() ORDER BY key",
60
+ "CREATE TABLE nr (`x` Nullable(UInt32), `lc` Nullable(String)) ENGINE = MergeTree ORDER BY tuple()",
61
+ "CREATE TABLE `.inner_id.e15f3ab5-6cae-4df3-b879-f40deafd82c2`\n(\n n Int32,\n n2 Int64\n)\nENGINE = MergeTree()\nORDER BY n\nPARTITION BY n % 10",
62
+ "CREATE TABLE rmt2\n(\n n UInt8,\n m Int32,\n d Date,\n t DateTime\n)\nENGINE = ReplicatedMergeTree('/test/01165/{database}/rmt', '2')\nORDER BY n\nPARTITION BY (n, m, d, t)",
63
+ "CREATE TABLE table_without_pk\n(\n key1 UInt8,\n key2 UInt32,\n key3 DateTime64(6, 'UTC'),\n value String\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS min_compress_block_size = '65536', max_compress_block_size = '65536'",
64
+ "CREATE TABLE dict_data (key UInt64, val UInt64) Engine=Memory()",
65
+ "CREATE TABLE test1 (s String) ENGINE = MergeTree ORDER BY s SETTINGS index_granularity = 1",
66
+ "CREATE TABLE d\n(\n `v` Enum8('a' = 1)\n)\nENGINE = Distributed('test_cluster_two_shards', currentDatabase(), m, rand())",
67
+ "CREATE TABLE cannot_be_nullable\n(\n n Int8,\n a Array(UInt8)\n)\nENGINE = Memory()",
68
+ "CREATE TABLE codecs6\n(\n a UInt8 CODEC(Delta())\n)\nENGINE = MergeTree()\nORDER BY tuple()",
69
+ "CREATE TABLE ttl (d DateTime) ENGINE = MergeTree ORDER BY tuple() TTL d + INTERVAL 10 DAY SETTINGS remove_empty_parts=0",
70
+ "CREATE TABLE merge\n(\n CounterID UInt32,\n StartDate Date,\n Sign Int8,\n VisitID UInt64,\n UserID UInt64,\n StartTime DateTime,\n ClickLogID UInt64\n)\nENGINE = Merge(currentDatabase(), 'merge\\\\[0-9\\\\]')",
71
+ "CREATE TABLE local_table_1 (id String) ENGINE = MergeTree ORDER BY (id)",
72
+ "CREATE TABLE index\n(\n d Date\n)\nENGINE = MergeTree()\nORDER BY d",
73
+ "CREATE TABLE codecs\n(\n id UInt32,\n val UInt32 CODEC(Delta(), ZSTD()),\n s String CODEC(ZSTD())\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS min_rows_for_wide_part = '10000', ratio_of_defaults_for_sparse_serialization = '1', serialization_info_version = 'basic'",
74
+ "CREATE TABLE test\n(\n x UInt8,\n y UInt8\n)\nENGINE = MergeTree()\nORDER BY tuple()",
75
+ "CREATE TABLE test_23634\n(\n id Nullable(String),\n s Nullable(String),\n s1 Nullable(String)\n)\nENGINE = MergeTree()\nORDER BY (id, s)\nSETTINGS allow_nullable_key = '1'",
76
+ "CREATE TABLE modify_sample (d Date DEFAULT '2000-01-01', x UInt8) ENGINE = MergeTree PARTITION BY d ORDER BY x",
77
+ "CREATE TABLE test_local\n(\n date Date,\n value UInt32\n)\nENGINE = MergeTree(date, date, 8192)",
78
+ "CREATE TABLE t_nul (n Nullable(UInt32)) ENGINE = MergeTree ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0",
79
+ "CREATE TABLE t_enum(x Enum8('hello' = 1, 'world' = 2)) ENGINE = TinyLog",
80
+ "CREATE TABLE db_01501.table_cache_dict\n(\n KeyField UInt64,\n UInt8_ UInt8,\n UInt16_ UInt16,\n UInt32_ UInt32,\n UInt64_ UInt64,\n Int8_ Int8,\n Int16_ Int16,\n Int32_ Int32,\n Int64_ Int64,\n UUID_ UUID,\n Date_ Date,\n DateTime_ DateTime,\n String_ String,\n Float32_ Float32,\n Float64_ Float64,\n Decimal32_ Decimal32(5),\n Decimal64_ Decimal64(15),\n Decimal128_ Decimal128(35),\n ParentKeyField UInt64\n)\nENGINE = MergeTree()\nORDER BY KeyField",
81
+ "CREATE TABLE buf\n(\n timestamp DateTime\n)\nENGINE = Buffer(currentDatabase(), buf_dest, 16, 3, 20, 2000000, 20000000, 100000000, 300000000)",
82
+ "CREATE TABLE visits\n(\n `CounterID` UInt32,\n `StartDate` Date,\n `StartTime` DateTime,\n `GoalsID` Array(UInt32),\n `Sign` Int8\n)\nENGINE = Null",
83
+ "-- Tags: distributed\n\nCREATE TABLE IF NOT EXISTS topXtest(A Int64) ENGINE = Memory",
84
+ "/* that test requires fixed zookeeper path, so we cannot use ReplicatedMergeTree({database}) */\nCREATE TABLE execute_on_single_replica_r1 (x UInt64) ENGINE=ReplicatedMergeTree('/clickhouse/tables/test_01532/execute_on_single_replica', 'r1') ORDER BY tuple() SETTINGS execute_merges_on_single_replica_time_threshold=10",
85
+ "CREATE TABLE collate_test3\n(\n x UInt32,\n s Tuple(UInt32, Tuple(UInt32, Array(String)))\n)\nENGINE = Memory()",
86
+ "CREATE TABLE data_01551\n(\n key UInt32\n)\nENGINE = AggregatingMergeTree()\nORDER BY (key, key / 2)\nPARTITION BY key % 2\nSETTINGS index_granularity = '10', index_granularity_bytes = '10Mi'",
87
+ "CREATE TABLE prod_hist\n(\n categoryId UUID,\n productId UUID\n)\nENGINE = MergeTree()\nORDER BY productId",
88
+ "CREATE TABLE d (a String, b Int) ENGINE = Distributed(test_shard_localhost, currentDatabase(), t)",
89
+ "CREATE TABLE select_in_test\n(\n value Int8\n)\nENGINE = TinyLog()",
90
+ "CREATE TABLE skip_idx_comp_parts\n(\n a Int,\n b Int,\n INDEX b_idx b TYPE minmax() GRANULARITY 4\n)\nENGINE = MergeTree()\nORDER BY a\nSETTINGS index_granularity = '256', index_granularity_bytes = '10Mi', merge_max_block_size = '100'",
91
+ "CREATE TABLE constraint_test_strong_connectivity\n(\n a String,\n b String,\n c String,\n d String,\n CONSTRAINT c1 ASSUME a <= b\n AND b <= c\n AND c <= d\n AND d <= a\n)\nENGINE = TinyLog()",
92
+ "create table data_01641 (key Int, value String) engine=MergeTree order by (key, repeat(value, 40)) settings old_parts_lifetime=0, min_bytes_for_wide_part=0",
93
+ "CREATE TABLE test_01640(i Int64, d Date, s String)\nENGINE = ReplicatedMergeTree('/clickhouse/{database}/{shard}/tables/test_01640','{replica}')\nPARTITION BY toYYYYMM(d) ORDER BY i",
94
+ "-- Tags: no-parallel\n\nCREATE DATABASE database_dictionary_test_key_expression",
95
+ "CREATE TABLE dist_01683\n(\n n UInt64\n)\nENGINE = Distributed(test_cluster_two_shards, currentDatabase(), tmp_01683, n)",
96
+ "CREATE TABLE has_final_mark\n(\n i int,\n j int\n)\nENGINE = MergeTree()\nORDER BY j\nPARTITION BY i % 2\nSETTINGS index_granularity = '10', write_final_mark = '1'",
97
+ "CREATE TABLE tp\n(\n type Int32,\n eventcnt UInt64,\n PROJECTION p (SELECT sum(eventcnt), type GROUP BY type ORDER BY sum(eventcnt))\n)\nENGINE = MergeTree()\nORDER BY type",
98
+ "CREATE TABLE sales\n(\n DATE_SOLD DateTime64(3, 'UTC'),\n PRODUCT_ID Nullable(String)\n)\nENGINE = MergeTree()\nORDER BY DATE_SOLD\nPARTITION BY toYYYYMM(DATE_SOLD)",
99
+ "CREATE TABLE 01720_dictionary_db.dictionary_source_table\n(\n\tkey UInt8,\n value String\n)\nENGINE = TinyLog",
100
+ "CREATE MATERIALIZED VIEW `01746_merge_tree_mv`\nENGINE = Memory AS\nSELECT\n n2,\n n3\nFROM `01746_merge_tree`",
101
+ "CREATE TABLE 01754_dictionary_db.complex_key_complex_attributes_source_table\n(\n id UInt64,\n id_key String,\n value_first String,\n value_second Nullable(String)\n)\nENGINE = MergeTree ORDER BY tuple()",
102
+ "CREATE TABLE 01765_db.simple_key_complex_attributes_source_table\n(\n id UInt64,\n value_first String,\n value_second Nullable(String)\n)\nENGINE = TinyLog",
103
+ "CREATE TABLE t_sparse_pk (k UInt64, s String)\nENGINE = MergeTree ORDER BY k\nSETTINGS ratio_of_defaults_for_sparse_serialization = 0.0, index_granularity = 1",
104
+ "CREATE TABLE t_having (c0 Int32, c1 UInt64) ENGINE = MergeTree ORDER BY c0",
105
+ "CREATE TABLE main_table_01818\n(\n `id` UInt32,\n `advertiser_id` String,\n `campaign_id` String,\n `name` String,\n `budget` Float64,\n `budget_mode` String,\n `landing_type` String,\n `status` String,\n `modify_time` String,\n `campaign_type` String,\n `campaign_create_time` DateTime,\n `campaign_modify_time` DateTime,\n `create_time` DateTime,\n `update_time` DateTime\n)\nENGINE = MergeTree\nPARTITION BY advertiser_id\nORDER BY campaign_id\nSETTINGS index_granularity = 8192",
106
+ "CREATE TABLE t_json\n(\n id UInt64,\n obj JSON\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS min_bytes_for_wide_part = '0'",
107
+ "CREATE TABLE s2_indexes\n(\n s2_index UInt64,\n longitude Float64,\n latitude Float64\n)\nENGINE = Memory()",
108
+ "CREATE OR REPLACE VIEW view_nulls AS\nSELECT * FROM ( SELECT number + 1 AS a, number + 11 AS b FROM numbers(2) ) AS t1\nFULL JOIN ( SELECT number + 2 AS a, number + 22 AS c FROM numbers(2) ) AS t2\nUSING a ORDER BY a",
109
+ "create table tab (t DateTime) engine = MergeTree order by toStartOfDay(t)",
110
+ "CREATE TABLE test_table_nullable_signed_values\n(\n id UInt64,\n value1 Nullable(Int8),\n value2 Nullable(Int16),\n value3 Nullable(Int32),\n value4 Nullable(Int64),\n predicate_value UInt8\n)\nENGINE = TinyLog()",
111
+ "CREATE DATABASE `01902_db_repr2`",
112
+ "create table my_table(Id UInt32, Object Nested(Key UInt8, Value String)) engine MergeTree order by Id",
113
+ "CREATE TABLE t_array_index (n Nested(key String, value String))\nENGINE = MergeTree ORDER BY n.key",
114
+ "CREATE TABLE users (user_id UUID) ENGINE = Memory",
115
+ "CREATE TABLE bf_tokenbf_map_keys_test\n(\n row_id UInt32,\n map Map(String, String),\n map_fixed Map(FixedString(2), String),\n INDEX map_keys_tokenbf mapKeys(map) TYPE tokenbf_v1(256,2,0) GRANULARITY 1,\n INDEX map_fixed_keys_tokenbf mapKeys(map_fixed) TYPE ngrambf_v1(4,256,2,0) GRANULARITY 1\n) Engine=MergeTree() ORDER BY row_id SETTINGS index_granularity = 1",
116
+ "CREATE TABLE test02008 (\n col Tuple(\n a Tuple(key1 int, key2 int),\n b Tuple(key1 int, key2 int)\n )\n) ENGINE=Memory()",
117
+ "CREATE TABLE summing_mt_aggregating_column\n(\n Key UInt64,\n Value UInt64,\n ConcatArraySimple SimpleAggregateFunction(groupArrayArray, Array(UInt64)),\n ConcatArrayComplex AggregateFunction(groupArrayArray, Array(UInt64))\n)\nENGINE = SummingMergeTree()\nORDER BY Key",
118
+ "CREATE TABLE test_table\n(\n key UInt64,\n value String,\n INDEX value_index value TYPE minmax GRANULARITY 1\n)\nEngine=MergeTree()\nORDER BY key SETTINGS compress_marks=false, add_minmax_index_for_numeric_columns=0",
119
+ "CREATE TABLE polygons_test_table\n(\n key Array(Array(Array(Tuple(Float64, Float64)))),\n name String\n) ENGINE = TinyLog",
120
+ "CREATE TABLE insert_dedup_token\n(\n id Int32,\n val UInt32\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS non_replicated_deduplication_window = '4294967295'",
121
+ "CREATE TABLE `02131_rqtable`\n(\n x UInt8\n)\nENGINE = MergeTree()\nORDER BY x",
122
+ "CREATE TABLE t02155_t64_tz\n(\n a DateTime64(9, 'America/Chicago')\n)\nENGINE = Memory()",
123
+ "CREATE TABLE test_tb (a UInt64, s String) ENGINE = MergeTree() ORDER BY a",
124
+ "create table t (c Decimal32(9)) engine MergeTree order by c",
125
+ "CREATE MATERIALIZED VIEW test_view\n(\n `Rows` UInt64,\n MaxHitTime DateTime('America/Los_Angeles')\n)\nAS\nSELECT\n count() AS `Rows`,\n max(UTCEventTime) AS MaxHitTime\nFROM test_table",
126
+ "CREATE MATERIALIZED VIEW IF NOT EXISTS mv2\nTO data_b_02187\nAS\nSELECT sleepEachRow(0.05) AS a\nFROM data_a_02187",
127
+ "CREATE TABLE events32 ( `year` Int32, `month` Int32 ) ENGINE = TinyLog",
128
+ "CREATE TABLE t_random_1\n(\n ordinary_1 UInt32\n)\nENGINE = GenerateRandom(1, 5, 3)",
129
+ "CREATE TABLE test_02245_2\n(\n a UInt64,\n _path Int32\n)\nENGINE = S3(s3_conn, filename = 'test_02245_2', `format` = Parquet)",
130
+ "CREATE TABLE table_for_alter (\n id UInt64,\n Data String\n) ENGINE = MergeTree() ORDER BY id SETTINGS parts_to_throw_insert = 1, parts_to_delay_insert = 1",
131
+ "CREATE TABLE ignore_auto_increment (\n di DEFAULT 1, id int AUTO_INCREMENT, s String EPHEMERAL\n) ENGINE=MergeTree() ORDER BY tuple()",
132
+ "CREATE TABLE null_before\n(\n id INT NOT NULL DEFAULT 1\n)\nENGINE = MergeTree()\nORDER BY tuple()",
133
+ "CREATE TABLE codecTest\n(\n key UInt64,\n name String,\n ref_valueF64 Float64,\n ref_valueF32 Float32,\n valueF64 Float64 CODEC(FPC()),\n valueF32 Float32 CODEC(FPC())\n)\nENGINE = MergeTree()\nORDER BY key",
134
+ "CREATE TABLE segfault\n(\n id UInt32,\n uuid UUID,\n tags_ids Array(UInt32)\n)\nENGINE = MergeTree()\nORDER BY id",
135
+ "create materialized view mv_table to table_2 (x UInt32, y String) as select * from table_1",
136
+ "CREATE TABLE tab (c0 LowCardinality(String), INDEX i0 c0 TYPE text(tokenizer = 'splitByNonAlpha')) ENGINE = MergeTree ORDER BY tuple()",
137
+ "-- { serverError BAD_ARGUMENTS }\nCREATE TABLE tab\n(\n str String,\n INDEX idx str TYPE text(tokenizer = splitByString([1, 2]))\n)\nENGINE = MergeTree\nORDER BY tuple()",
138
+ "CREATE TABLE tab\n(\n str String,\n INDEX idx str TYPE text(tokenizer = 'invalid') GRANULARITY 100000000\n)\nENGINE = MergeTree()\nORDER BY tuple()",
139
+ "-- { serverError BAD_ARGUMENTS }\n\nCREATE TABLE tab\n(\n str String,\n INDEX idx str TYPE text(tokenizer = ngrams(3), tokenizer = ngrams(4)) GRANULARITY 100000000\n)\nENGINE = MergeTree()\nORDER BY tuple()",
140
+ "CREATE TABLE tab\n(\n id UInt32,\n str String\n)\nENGINE = MergeTree()\nORDER BY tuple()",
141
+ "CREATE VIEW explain_index_key_like AS (\n SELECT trimLeft(explain) AS explain FROM (\n EXPLAIN indexes=1\n SELECT count() FROM tab WHERE mapContainsKeyLike({col:Identifier}, {pattern:String})\n )\n WHERE explain LIKE '%Description:%' OR explain LIKE '%Parts:%' OR explain LIKE '%Granules:%'\n LIMIT 2, 3\n)",
142
+ "CREATE TABLE tab_uncompressed\n(\n ts DateTime CODEC(LZ4()),\n str String CODEC(LZ4()),\n INDEX inv_idx str TYPE text(tokenizer = 'splitByNonAlpha') GRANULARITY 100000000\n)\nENGINE = MergeTree()\nORDER BY ts\nSETTINGS min_rows_for_wide_part = '0', min_bytes_for_wide_part = '0', index_granularity = '8192', index_granularity_bytes = '0', enable_block_offset_column = '0', enable_block_number_column = '0', string_serialization_version = 'with_size_stream', primary_key_compress_block_size = '65536', marks_compress_block_size = '65536', min_compress_block_size = '65536', max_compress_block_size = '1048576', ratio_of_defaults_for_sparse_serialization = 0.95, serialization_info_version = 'basic', auto_statistics_types = 'minmax'",
143
+ "CREATE TABLE tab\n(\n id UInt32,\n key String,\n value String,\n INDEX idx_key key TYPE text(tokenizer = 'splitByNonAlpha') GRANULARITY 100000000\n)\nENGINE = ReplacingMergeTree()\nORDER BY id",
144
+ "CREATE TABLE tab\n(\n id Int32,\n vec Array(Float32),\n INDEX vec_idx vec TYPE vector_similarity('hnsw', 'cosineDistance', 8, 'b1', 64, 128) GRANULARITY 100000000\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS index_granularity = '1'",
145
+ "-- { serverError INCORRECT_QUERY }\n\nCREATE TABLE tab\n(\n vec Array(Float32),\n INDEX idx vec TYPE vector_similarity('hnsw', 'invalid_distance', 1) GRANULARITY 100000000\n)\nENGINE = MergeTree()\nORDER BY tuple()",
146
+ "CREATE TABLE tab_cos_f64\n(\n id Int32,\n vec Array(Float32),\n INDEX idx vec TYPE vector_similarity('hnsw', 'cosineDistance', 2, 'f64', 0, 0) GRANULARITY 2\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS index_granularity = '3'",
147
+ "CREATE TABLE t2 (c1 Int32, c2 Int32, c3 String) ENGINE MergeTree ORDER BY (c1, c2, c3)",
148
+ "CREATE TABLE special_set_table\n(\n id UInt64\n) ENGINE=Set",
149
+ "CREATE TABLE test_02381\n(\n a UInt64,\n b UInt64\n)\nENGINE = MergeTree()\nORDER BY (a, b)\nSETTINGS compress_marks = false, compress_primary_key = false, ratio_of_defaults_for_sparse_serialization = '1', serialization_info_version = 'basic', auto_statistics_types = '', add_minmax_index_for_numeric_columns = '0'",
150
+ "CREATE TABLE m2\n(\n id UInt64\n)\nENGINE = Merge(currentDatabase(), 'm0|m1v')",
151
+ "CREATE TABLE test\n(\n x Array(Array(Map(UInt8, AggregateFunction(uniq, UInt64))))\n)\nENGINE = Memory()",
152
+ "CREATE TABLE item\n(\n `i_item_sk` Int64,\n `i_item_id` String,\n `i_rec_start_date` Nullable(Date),\n `i_rec_end_date` Nullable(Date),\n `i_item_desc` Nullable(String),\n `i_current_price` Nullable(Float32),\n `i_wholesale_cost` Nullable(Float32),\n `i_brand_id` Nullable(Int64),\n `i_brand` Nullable(String),\n `i_class_id` Nullable(Int64),\n `i_class` Nullable(String),\n `i_category_id` Nullable(Int64),\n `i_category` Nullable(String),\n `i_manufact_id` Nullable(Int64),\n `i_manufact` Nullable(String),\n `i_size` Nullable(String),\n `i_formulation` Nullable(String),\n `i_color` Nullable(String),\n `i_units` Nullable(String),\n `i_container` Nullable(String),\n `i_manager_id` Nullable(Int64),\n `i_product_name` Nullable(String)\n)\nENGINE = MergeTree ORDER BY i_item_sk",
153
+ "CREATE TABLE dep\n(\n `id` Int32,\n `country` LowCardinality(String),\n `purchase_location` UInt16 MATERIALIZED if(id IN joinGet(concat(currentDatabase(), '.id_join'), 'location', 'CLICK'), 123, 456)\n)\nENGINE = ReplicatedMergeTree('/test/02433/{database}/dep', '1') ORDER BY tuple()",
154
+ "CREATE TABLE t_row_exists\n(\n a int,\n _row_exists int\n)\nENGINE = Memory()",
155
+ "CREATE TABLE test\n(\n x Nullable(UInt32),\n y UInt32\n)\nENGINE = Memory()",
156
+ "CREATE TABLE bloom_filter_nullable_index__fuzz_1\n(\n `order_key` UInt64,\n `str` String,\n INDEX idx str TYPE bloom_filter GRANULARITY 1\n)\nENGINE = MergeTree ORDER BY order_key SETTINGS index_granularity = 6, index_granularity_bytes = '10Mi'",
157
+ "CREATE TABLE testing\n(\n a String,\n b String,\n c String,\n d String,\n PROJECTION proj_1\n (\n SELECT b, c\n ORDER BY d\n )\n)\nENGINE = MergeTree()\nPRIMARY KEY (a)\nORDER BY (a, b)\nSETTINGS index_granularity = 8192, index_granularity_bytes = 0, min_bytes_for_wide_part = 0",
158
+ "CREATE TABLE `02483_substitute_udf`\n(\n id UInt32,\n number UInt32 DEFAULT `02483_plusone`(id)\n)\nENGINE = MergeTree()\nORDER BY id",
159
+ "CREATE TABLE table2 (column1 String, column2 String, column3 String) ENGINE=MergeTree() ORDER BY tuple()",
160
+ "CREATE TABLE t2\n(\n key UInt64,\n a UInt64\n)\nENGINE = Join(`ALL`, `RIGHT`, key)",
161
+ "CREATE TABLE datetime_date_table (\n col_date Date,\n col_datetime DateTime,\n col_datetime64 DateTime64(3),\n col_date_string String,\n col_datetime_string String,\n col_datetime64_string DateTime64,\n col_date_lc LowCardinality(String),\n col_datetime_lc LowCardinality(String),\n col_datetime64_lc LowCardinality(String),\n PRIMARY KEY col_date\n) ENGINE = MergeTree",
162
+ "CREATE TABLE merge3 (`Id` Int32, `Val` Int32) ENGINE = Merge(currentDatabase(), '^foo__fuzz_0')",
163
+ "CREATE TABLE t13\n(\n a UInt32,\n b UInt32\n)\nENGINE = MergeTree()\nORDER BY a\nPARTITION BY (intDiv(a, 2), intDiv(b, 3))\nSETTINGS index_granularity = '8192', index_granularity_bytes = '10Mi'",
164
+ "CREATE TABLE test\n(\n x UInt32,\n y String\n)\nENGINE = Memory()",
165
+ "CREATE TABLE ip4test\n(\n ip IPv4\n)\nENGINE = Memory()",
166
+ "CREATE TABLE test\n(\n x LowCardinality(String) DEFAULT 'Hello'\n)\nENGINE = Memory()",
167
+ "CREATE TABLE data_02572\n(\n key Int\n)\nENGINE = Memory()",
168
+ "CREATE TABLE t_sparse_mutations_3 (key UInt8, id UInt64, s String)\nENGINE = MergeTree ORDER BY id PARTITION BY key\nSETTINGS ratio_of_defaults_for_sparse_serialization = 0.9, serialization_info_version = 'basic'",
169
+ "-- works only for PREWHERE\n\nCREATE TABLE t1\n(\n a UInt64,\n b UInt64,\n c UInt64,\n d UInt64\n)\nENGINE = Memory()",
170
+ "CREATE TABLE test_table (n Int32, s String) ENGINE MergeTree PARTITION BY n ORDER BY n",
171
+ "CREATE TABLE t_memory_compressed (id UInt64, s String, arr Array(LowCardinality(String)), m Map(String, String))\nENGINE = Memory SETTINGS compress = 1",
172
+ "CREATE TABLE dummy\n(\n num1 Int32,\n num2 Enum8('foo' = 0, 'bar' = 1, 'tar' = 2)\n)\nENGINE = MergeTree()\nORDER BY num1 AS\nSELECT\n 5,\n 'bar'",
173
+ "CREATE TABLE test\n(\n report_date Date,\n sspid UInt64\n)\nENGINE = MergeTree()\nORDER BY report_date\nPARTITION BY report_date",
174
+ "CREATE TABLE t1 (vkey UInt32) ENGINE = AggregatingMergeTree ORDER BY vkey",
175
+ "CREATE TABLE date32_t\n(\n id UInt32,\n value1 String,\n date1 Date32\n)\nENGINE = ReplacingMergeTree()\nORDER BY id",
176
+ "-- create source table\nCREATE TABLE fx_1m\n(\n symbol LowCardinality(String) CODEC(ZSTD()),\n dt_close DateTime64(3, 'UTC') CODEC(DoubleDelta(), ZSTD()),\n open Float32 CODEC(Delta(), ZSTD()),\n high Float32 CODEC(Delta(), ZSTD()),\n low Float32 CODEC(Delta(), ZSTD()),\n close Float32 CODEC(Delta(), ZSTD()),\n volume Float32 CODEC(Delta(), ZSTD())\n)\nENGINE = MergeTree()\nORDER BY (symbol, dt_close)\nPARTITION BY toYear(dt_close)\nSETTINGS index_granularity = '8192', index_granularity_bytes = '10Mi'",
177
+ "-- { serverError BAD_ARGUMENTS }\n\nCREATE TABLE pk_test22\n(\n a String,\n b String PRIMARY KEY,\n c String\n)\nPRIMARY KEY b\nORDER BY (a, b, c)",
178
+ "CREATE TABLE optimize_lazy_materialization_with_datetime_data_type\n(\n a UInt64,\n b UInt64,\n c DateTime\n)\nENGINE = MergeTree()\nORDER BY a",
179
+ "CREATE VIEW test_param_view2\nAS\nWITH 0 AS param_test_val\n\nSELECT\n param_test_val,\n arrayCount((a -> a < param_test_val), t.arr) AS cnt1,\n arrayCount((a -> a < param_test_val + 1), t.arr) AS cnt2\nFROM (\n SELECT [1, 2, 3, 4, 5] AS arr\n ) AS t",
180
+ "CREATE TABLE test (id UInt64, agg AggregateFunction(groupArraySorted(2), UInt64)) engine=MergeTree ORDER BY id",
181
+ "CREATE TABLE source_table_log (x UInt16) ENGINE = Log",
182
+ "CREATE TABLE t_uuid\n(\n x UUID\n)\nENGINE = MergeTree()\nORDER BY x",
183
+ "CREATE TABLE tab (col UInt256 STATISTICS(uniq)) Engine = MergeTree() ORDER BY tuple()",
184
+ "CREATE TABLE tab (col LowCardinality(UInt8) STATISTICS(minmax)) Engine = MergeTree() ORDER BY tuple()",
185
+ "-- { serverError ILLEGAL_STATISTICS }\n\nCREATE TABLE tab\n(\n col Map(UInt64, UInt64) STATISTICS(uniq())\n)\nENGINE = MergeTree()\nORDER BY tuple()",
186
+ "CREATE TABLE test\n(\n ip IPv4 CODEC(ZSTD(6))\n)\nENGINE = MergeTree()\nORDER BY ip",
187
+ "CREATE TABLE table_gcd_codec_uint64 (n UInt64 CODEC(GCD, LZ4)) ENGINE = Memory",
188
+ "CREATE TABLE t_json_merge\n(\n id UInt64,\n s1 String,\n s2 String\n)\nENGINE = Memory()",
189
+ "CREATE TABLE attach_partition_t2\n(\n a UInt32,\n b String,\n INDEX bf b TYPE bloom_filter() GRANULARITY 1\n)\nENGINE = MergeTree()\nORDER BY a",
190
+ "CREATE TABLE t_leading_zeroes_f\n(\n id Int64,\n input String,\n val Float64,\n expected Float64,\n comment String\n)\nENGINE = MergeTree()\nORDER BY id",
191
+ "CREATE TABLE t2\n(\n key UInt32\n)\nENGINE = MergeTree()\nORDER BY key",
192
+ "CREATE TABLE t2 (x Nullable(Int64), y Nullable(UInt64)) ENGINE = TinyLog",
193
+ "CREATE TABLE table_02916\n(\n `ID` UInt32,\n `Name` String\n)\nENGINE = MergeTree\nORDER BY ID",
194
+ "-- using 4 param in the select of the view work here.\nCREATE OR REPLACE VIEW V_DELTA\nAS\nSELECT DISTINCT uid\nFROM (\n SELECT\n uid,\n name,\n age\n FROM users\n WHERE age >= 0\n OR age >= 0\n OR age >= 0\n OR age >= 0\n )\nORDER BY uid ASC",
195
+ "CREATE TABLE IF NOT EXISTS test_max_num_to_warn_02931.test_max_num_to_warn_6\n(\n id Int32,\n str String\n)\nENGINE = Memory()",
196
+ "CREATE TABLE tab (id String) ENGINE = MergeTree ORDER BY id",
197
+ "CREATE TABLE tab\n(\n id Int64,\n dflt Int64 DEFAULT 54321\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS min_bytes_for_wide_part = '1'",
198
+ "CREATE TABLE 02952_disjunction_optimization\n(a Int32, b String)\nENGINE=Memory",
199
+ "CREATE TABLE f32_table (my_field Float32) ENGINE=Memory()",
200
+ "CREATE TABLE tlb\n(\n k UInt64\n)\nENGINE = MergeTree()\nORDER BY k",
201
+ "-- {serverError SUSPICIOUS_TYPE_FOR_LOW_CARDINALITY}\ncreate table test (x Array(Array(LowCardinality(UInt64)))) engine=Memory",
202
+ "CREATE TABLE shard_0.t_local\n(\n a Int\n)\nENGINE = Memory()",
203
+ "CREATE TABLE test_table_replicated_second\n(\n id UInt64,\n value String,\n insert_time DateTime\n) ENGINE=ReplicatedMergeTree('/clickhouse/tables/{database}/test_table_replicated', '2_replica') ORDER BY id",
204
+ "CREATE TABLE date_t__fuzz_0\n(\n id UInt32,\n value1 String,\n date1 Date\n)\nENGINE = ReplacingMergeTree()\nORDER BY id\nSETTINGS allow_nullable_key = '1'",
205
+ "CREATE TABLE `03006_buffer_overflow_l`\n(\n a String,\n b Tuple(String, String)\n)\nENGINE = Memory()",
206
+ "CREATE TABLE faulty_memory (i UInt32) ENGINE = Memory SETTINGS min_rows_to_keep = 100",
207
+ "-- ALTER AggregatingMergeTree\nCREATE TABLE data\n(\n key Int\n)\nENGINE = AggregatingMergeTree()\nORDER BY key",
208
+ "CREATE TABLE base (a Int32) ENGINE = TinyLog COMMENT 'original comment'",
209
+ "CREATE TABLE test\n(\n id UInt64,\n value String\n) ENGINE=MergeTree ORDER BY id",
210
+ "CREATE TABLE move_partition_to_oneself (key UInt64 CODEC(NONE)) ENGINE = MergeTree ORDER BY tuple()",
211
+ "CREATE TABLE nested_test\n(\n s String,\n nest Nested\n (\n x UInt64,\n y UInt64\n )\n) ENGINE = MergeTree\nORDER BY s",
212
+ "CREATE TABLE colors\n(\n color_key UInt64,\n color_name String\n)\nENGINE = MergeTree()\nORDER BY tuple()",
213
+ "CREATE TABLE CLICKHOUSE_DATABASE_1.`2-1`\n(\n field Int8\n)\nENGINE = Memory()",
214
+ "CREATE MATERIALIZED VIEW mv2 ENGINE = SummingMergeTree ORDER BY key AS SELECT key, count(value) AS value FROM d6 GROUP BY key",
215
+ "create table mutation_table (dt Nullable(Date), name Nullable(String))\nengine MergeTree order by tuple()\nsettings enable_block_number_column = 1, enable_block_offset_column = 1",
216
+ "CREATE TABLE t_lwu_condition_cache\n(\n id UInt64 DEFAULT generateSnowflakeID(),\n `exists` UInt8\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS index_granularity = '8192', enable_block_number_column = '1', enable_block_offset_column = '1'",
217
+ "create table x(\n a UInt64,\n `sipHash64(a)` UInt64\n) engine = MergeTree order by a",
218
+ "CREATE TABLE t4 (c0 Int32) ENGINE = Memory()",
219
+ "CREATE TABLE t\n(\n n Int8\n)\nENGINE = MergeTree()\nORDER BY n",
220
+ "CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = MergeTree() ORDER BY (s)",
221
+ "CREATE TABLE 03164_users (uid Nullable(Int16), name String, age Int16) ENGINE=MergeTree ORDER BY (uid) SETTINGS allow_nullable_key=1",
222
+ "-- Tags: zookeeper, no-replicated-database, no-ordinary-database\nCREATE TABLE hourly_data\n (domain_name String, event_time DateTime, count_views UInt64)\n ENGINE = MergeTree ORDER BY (domain_name, event_time)",
223
+ "CREATE TABLE test_no_loop.t5\n(\n c0 Int\n)\nENGINE = MergeTree()\nORDER BY c0",
224
+ "CREATE TABLE my_events\n(\n start UInt32,\n `end` UInt32\n)\nENGINE = MergeTree()\nORDER BY tuple() AS\nSELECT *\nFROM VALUES('start UInt32, end UInt32', (1, 3), (1, 6), (2, 5), (3, 7))",
225
+ "CREATE TABLE test\n(\n a UInt64,\n b UInt64,\n Block_Height UInt64,\n Block_Date Date\n)\nENGINE = Log()",
226
+ "CREATE TABLE test\n(\n json JSON(SKIP a)\n)\nENGINE = Memory()",
227
+ "CREATE TABLE realtimebuff__fuzz_19\n(\n amount UInt32\n)\nENGINE = Buffer(currentDatabase(), 'realtimedistributed', 16, 3600, 36000, 10000, 1000000, 10000000, 100000000)",
228
+ "CREATE TABLE b\n(\n b_id AggregateFunction(uniq, Nullable(String))\n)\nENGINE = AggregatingMergeTree()\nORDER BY tuple()\nPARTITION BY tuple()",
229
+ "CREATE TABLE test_03217_merge_replica_2(x UInt32)\n ENGINE ReplicatedMergeTree('/clickhouse/tables/{database}/test_03217_merge_replica', 'r2')\n ORDER BY x",
230
+ "CREATE TABLE t2 (`key` Int32, `val` Int64) ENGINE = MergeTree ORDER BY key",
231
+ "CREATE TABLE test_new_json_type(id UInt32, data JSON, version UInt64) ENGINE=ReplacingMergeTree(version) ORDER BY id",
232
+ "CREATE TABLE a\n(\n x Int64,\n y Int64 MATERIALIZED 1 SETTINGS(max_compress_block_size = '30000')\n)\nENGINE = MergeTree()\nORDER BY x",
233
+ "-- {serverError DATA_TYPE_CANNOT_BE_USED_IN_KEY}\n\nCREATE TABLE test\n(\n d Variant(UInt64)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nPARTITION BY d",
234
+ "CREATE TABLE users_03236_zero\n(\n uid Int16,\n name String,\n num Int16\n)\nENGINE = Memory()",
235
+ "create table test (x UInt32, v String) engine=Memory",
236
+ "CREATE table 03250_avoid_prefetch(id UInt64, string LowCardinality(String))\nENGINE = MergeTree\nORDER BY id\nSETTINGS enable_vertical_merge_algorithm = 1, vertical_merge_algorithm_min_rows_to_activate = 1, vertical_merge_remote_filesystem_prefetch = 1,\nvertical_merge_algorithm_min_bytes_to_activate = 1, vertical_merge_algorithm_min_columns_to_activate = 1,\nmin_rows_for_wide_part = 1, min_bytes_for_wide_part = 1, remove_empty_parts = 0, storage_policy = 's3_no_cache'",
237
+ "CREATE TABLE ts_raw_data(timestamp DateTime64(3,'UTC'), value Float64) ENGINE = MergeTree() ORDER BY timestamp",
238
+ "CREATE TABLE tbl1\n(\n key Int,\n x Int,\n y Int,\n INDEX x_idx x TYPE minmax GRANULARITY 1\n)\nENGINE=MergeTree()\nORDER BY key\nSETTINGS add_minmax_index_for_numeric_columns = true,\n add_minmax_index_for_string_columns = true,\n add_minmax_index_for_temporal_columns = true,\n index_granularity = 8192,\n index_granularity_bytes = 10485760",
239
+ "CREATE TABLE alpha\n(\n `ts` DateTime64(6),\n `auid` Int64,\n)\nENGINE = MergeTree\nORDER BY (auid, ts)\nSETTINGS index_granularity = 1, add_minmax_index_for_numeric_columns=0",
240
+ "CREATE TABLE decimal_dt\n(\n timestamp DateTime64(9)\n)\nENGINE = MergeTree()\nORDER BY timestamp",
241
+ "CREATE TABLE t_prewarm_cache_rmt_2 (a UInt64, b UInt64, c UInt64)\nENGINE = ReplicatedMergeTree('/clickhouse/tables/{database}/03274_prewarm_mark_cache_smt/t_prewarm_cache', '2')\nORDER BY a PARTITION BY a % 2\nSETTINGS prewarm_primary_key_cache = 1, use_primary_key_cache = 1",
242
+ "CREATE TABLE adaptive_spill_03277_1\n(\n k String,\n x String\n)\nENGINE = Memory()",
243
+ "CREATE TABLE t1\n(\n key UInt32,\n a UInt32,\n attr String\n)\nENGINE = MergeTree()\nORDER BY key",
244
+ "CREATE TABLE t_final_replacing (a UInt64, b UInt64) ENGINE = ReplacingMergeTree ORDER BY a SETTINGS index_granularity = 1",
245
+ "CREATE TABLE test_33602_t0a\n(\n e Enum8('LOW' = 123, 'MEDIUM' = 12, 'HIGH' = 33)\n)\nENGINE = Memory()",
246
+ "CREATE TABLE tab (x UInt32) ENGINE = MergeTree ORDER BY x",
247
+ "CREATE TABLE t2 (x Nullable(Int32), y Nullable(Int32)) ENGINE = Memory",
248
+ "create table vv (number Int8) engine Merge(currentDatabase(),'v')",
249
+ "create table product (id String, name String) Engine = MergeTree() order by id",
250
+ "CREATE TABLE tab_l\n(\n a UInt32,\n b UInt32,\n c UInt32,\n d UInt32\n)\nENGINE = MergeTree()\nORDER BY (a * 2, b + c)",
251
+ "-- {serverError BAD_ARGUMENTS};\n\n-- hive partition strategy can't be used without partition by clause\nCREATE TABLE t_03363_s3_err\n(\n year UInt16,\n country String,\n counter UInt8\n)\nENGINE = S3(s3_conn, filename = 't_03363_parquet', partition_strategy = 'hive', `format` = Parquet)",
252
+ "-- Tags: no-fasttest\n-- virtual hosted style\ncreate table s3_03364 (id UInt32) engine=S3('http://{_partition_id}.s3.region.amazonaws.com/key')",
253
+ "CREATE TABLE qbit (id UInt32, vec QBit(BFloat16, 3)) ENGINE = Memory",
254
+ "CREATE TABLE qbits (id UInt32, vec QBit(BFloat16, 16)) ENGINE = ReplacingMergeTree ORDER BY id",
255
+ "-- https://github.com/ClickHouse/ClickHouse/issues/88362\nCREATE TABLE qbit\n(\n id UInt32,\n vec QBit(BFloat16, 1)\n)\nENGINE = Memory()",
256
+ "-- Test 1: Memory engine - UPDATE + RENAME on same column should be rejected\nCREATE TABLE test_alter_atomic\n(\n c0 Int32\n)\nENGINE = Memory()",
257
+ "CREATE TABLE `03402_data`\n(\n id UInt32\n)\nENGINE = MergeTree()\nORDER BY id",
258
+ "CREATE TABLE `03409_users`\n(\n uid Int16,\n name String,\n age Nullable(Int16),\n age2 Nullable(Int16),\n version Nullable(UInt8)\n)\nENGINE = ReplicatedCoalescingMergeTree('/clickhouse/tables/{database}/test_00754/summing', 'r1')\nORDER BY (uid, name)",
259
+ "CREATE TABLE test_geom (id UInt32, geom Geometry) ENGINE = Memory",
260
+ "CREATE VIEW parameterized_view_without_renaming AS\nSELECT {test:Int32} * 2",
261
+ "CREATE TABLE numeric_indexed_vector\n(\n ds Date,\n vector AggregateFunction(groupNumericIndexedVector, UInt32, Float64)\n)\nENGINE = MergeTree()\nORDER BY ds",
262
+ "CREATE TABLE test_tz\n(\n `dt` DateTime('UTC')\n)\nENGINE = StripeLog",
263
+ "CREATE TABLE f1\n(\n c0 Float64\n)\nENGINE = MergeTree()\nORDER BY c0 DESC\nSETTINGS allow_experimental_reverse_key = '1'",
264
+ "CREATE TABLE ttl_03519_3 (date Date32, str String TTL date + INTERVAL 1 MONTH) ENGINE=MergeTree ORDER BY date",
265
+ "-- now ensure that insert into Log will not break anything\ncreate table log (key String) engine=Log",
266
+ "CREATE TABLE partsupp (\n ps_partkey Int32,\n ps_suppkey Int32,\n ps_availqty Int32\n)\nORDER BY (ps_partkey, ps_suppkey)",
267
+ "create table distributed_table_1 (id int) engine = Distributed(test_cluster_two_shard_three_replicas_localhost, currentDatabase(), local_table_1)",
268
+ "CREATE TABLE IF NOT EXISTS geom5 (a MultiPolygon) ENGINE = Memory()",
269
+ "CREATE TABLE test_compact_map\n(\n json JSON(max_dynamic_paths = 8)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS min_bytes_for_wide_part = '200G', min_rows_for_wide_part = '1', write_marks_for_substreams_in_compact_parts = '1', object_serialization_version = 'v3', object_shared_data_serialization_version = 'map', object_shared_data_serialization_version_for_zero_level_parts = 'map'",
270
+ "-- { serverError BAD_ARGUMENTS }\n\nCREATE TABLE t\n(\n n Int\n)\nENGINE = MergeTree()\nORDER BY n\nSETTINGS merge_max_block_size = '1'",
271
+ "CREATE TABLE electric_vehicle_state\n(\n vin String,\n last_update DateTime64 MATERIALIZED now64(),\n battery_level Nullable(UInt8),\n lat Nullable(Float64),\n lon Nullable(Float64),\n firmware_version Nullable(String),\n cabin_temperature Nullable(Float32),\n speed_kmh Nullable(Float32)\n)\nENGINE = CoalescingMergeTree()\nORDER BY vin",
272
+ "CREATE TABLE test (x Int, d Dynamic) ENGINE = MergeTree ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0",
273
+ "CREATE TABLE 03593_t (\n s String,\n n UInt64,\n PROJECTION prj_s_pos (SELECT _part_offset ORDER BY s))\nENGINE = MergeTree\nORDER BY n\nSETTINGS allow_part_offset_column_in_projections=0",
274
+ "create table test (t Tuple(a UInt32), a UInt32 materialized t.a + 42) engine=MergeTree() order by tuple()",
275
+ "-- When `serialization_info_version` is set to `single_stream`, any per-type string serialization version (`string_serialization_version`) will be ignored and reset to `DEFAULT`.\ncreate table test (s String) engine MergeTree order by () settings serialization_info_version = 'basic', string_serialization_version = 'with_size_stream'",
276
+ "create table test(c1 Int64, c2 Int64)\nEngine=MergeTree ORDER BY c2 AS \nWITH gen as \n (SELECT xxHash32(number) % 1000000 AS u1,\n xxHash32(number+12345) % 1000000 AS u2\n FROM numbers(1e6))\nSELECT\n 1071106,\n 5+(1 + 151703 * ((2 * u1) * (2 * u2)))\nFROM gen\nunion all\nSELECT\n 1071102,\n 8+(1 + 151693 * ((2 * u1) * (2 * u2)))\nFROM gen",
277
+ "CREATE TABLE table_test\n(\n `c1` Int32,\n `c2` Nullable(Int32),\n `c3` Nullable(String),\n `c4` Nullable(Date32),\n `c5` Nullable(String)\n)\nENGINE = ReplacingMergeTree\nORDER BY c1\nSETTINGS index_granularity = 8192",
278
+ "CREATE TABLE test_03629 (a UInt64) ENGINE = S3(s3_conn, filename='test_03629_{_partition_id}', format='Native') PARTITION BY a",
279
+ "-- Statistics are disabled to avoid accounting for them in `ReadCompressedBytes`\nCREATE TABLE t(a UInt64, s String, d Date) ENGINE=MergeTree PARTITION BY toYYYYMM(d) ORDER BY a SETTINGS auto_statistics_types='', index_granularity=8192, min_bytes_for_wide_part = 1e18",
280
+ "create table test_materialize (part Int, key Int, value String) engine=MergeTree() partition by part order by key settings index_granularity=100, use_const_adaptive_granularity=false, enable_index_granularity_compression=false, min_bytes_for_wide_part=0",
281
+ "CREATE TABLE t1 (x Int32, y String) ENGINE = Memory",
282
+ "CREATE OR REPLACE TABLE t (x INT) ENGINE=MergeTree ORDER BY x SETTINGS disk='s3_plain_rewritable_cache_multi'",
283
+ "CREATE TABLE info (iid UInt32) ENGINE = MergeTree() ORDER BY iid",
284
+ "CREATE TABLE ref_table_all\n(`id` UInt64, `name` String, `i8` String, `i16` String, `i32` String, `i64` String, `u8` String, `u16` String, `u32` String, `u64` String, `f32` String, `f64` String, `d` String, `dt` String, `uid` String, `ip4` String, `ip6` String)\nENGINE = MergeTree ORDER BY id",
285
+ "CREATE TABLE test (x UInt8)",
286
+ "CREATE TABLE t1 (c0 Decimal(18,0)) ENGINE = MergeTree() ORDER BY (c0) SETTINGS auto_statistics_types='countmin'",
287
+ "CREATE TABLE test_nullable_named_tuples\n(\n id UInt32,\n person Nullable(Tuple(name String, age UInt8, salary Float64))\n)\nENGINE = Memory()",
288
+ "CREATE TABLE qualified_match_nullable_tuple_direct\n(\n id UInt8,\n t Nullable(Tuple(a Int32, s String))\n)\nENGINE = TinyLog",
289
+ "CREATE TABLE 03720_mutations (k1 UInt32, k2 UInt32, val String) ENGINE=EmbeddedRocksDB PRIMARY KEY (k1, k2)",
290
+ "create table test (a Array(UInt64)) engine=MergeTree order by tuple()",
291
+ "CREATE TABLE fact_click\n(\n sid String,\n campaign_sid LowCardinality(String),\n campaign_batch_sid LowCardinality(String),\n email_address String\n)\nENGINE = ReplacingMergeTree()\nORDER BY (campaign_sid, campaign_batch_sid, sid)\nSETTINGS index_granularity = '8192'",
292
+ "CREATE TABLE t1\n(\n c1 UInt64\n)\nENGINE = MergeTree()\nORDER BY c1",
293
+ "create materialized view mv_1_1\nTO dst_1_1\nas select id, count() as c from src_table where id % 2 = 1 GROUP BY id",
294
+ "CREATE TABLE test\n(\n s String,\n json JSON MATERIALIZED s\n)\nENGINE = MergeTree()\nORDER BY tuple()",
295
+ "create table test_length_string (id UInt64, `s.size` UInt64, s String) engine=MergeTree order by tuple()",
296
+ "CREATE TABLE test_table\n(\n c0 Int\n)\nENGINE = MergeTree()\nORDER BY c0\nPARTITION BY c0",
297
+ "CREATE TABLE mergetree_metrics\n(\n `metric` String,\n `value` Int64,\n PROJECTION values\n (\n SELECT\n metric,\n dictGet('mergetree_dict', 'value', metric) AS value\n ORDER BY value\n )\n)\nENGINE = MergeTree\nORDER BY metric",
298
+ "CREATE TABLE t1\n(\n Col LowCardinality(String)\n)\nENGINE = MergeTree()",
299
+ "CREATE TABLE t_cast_bug (val UInt8) ENGINE = MergeTree ORDER BY val SETTINGS add_minmax_index_for_numeric_columns=0",
300
+ "CREATE TABLE table2\n(\n x UInt32\n)\nENGINE = ReplicatedMergeTree('/clickhouse/tables/{database}/test_03779/table', '2')\nORDER BY x",
301
+ "CREATE TABLE nullable_tuple_sparse_2\n(\n tup Nullable(Tuple(u UInt64, s String))\n)\nENGINE = MergeTree\nSETTINGS ratio_of_defaults_for_sparse_serialization = 0, nullable_serialization_version = 'allow_sparse', min_bytes_for_wide_part = 0"
302
+ ]
@@ -0,0 +1,65 @@
1
+ /**
2
+ * A stand-in for a ClickHouse server's HTTP interface, for tests: answers the
3
+ * catalog queries chant's live reads make from a fixed set of objects.
4
+ * Not a SQL engine.
5
+ */
6
+
7
+ import { startHttpStub, type StubAnswer } from "../../core/testing/http-stub";
8
+
9
+ export interface FakeObject {
10
+ database?: string;
11
+ name: string;
12
+ engine: string;
13
+ statement: string;
14
+ comment?: string;
15
+ }
16
+
17
+ export interface FakeServer {
18
+ url: string;
19
+ queries: string[];
20
+ close(): Promise<void>;
21
+ }
22
+
23
+ export interface FakeOptions {
24
+ /** Answer every query with this status and body (an auth failure, say). */
25
+ fail?: { status: number; body: string };
26
+ version?: string;
27
+ }
28
+
29
+ const row = (o: Record<string, unknown>) => `${JSON.stringify(o)}\n`;
30
+ const unquote = (s: string) => s.replace(/^`|`$/g, "").replace(/``/g, "`");
31
+
32
+ export async function fakeClickHouse(objects: FakeObject[], options: FakeOptions = {}): Promise<FakeServer> {
33
+ const queries: string[] = [];
34
+ const ok = (text: string): StubAnswer => ({ status: 200, text });
35
+ const stub = await startHttpStub((body) => {
36
+ queries.push(body);
37
+ if (options.fail) return { status: options.fail.status, text: options.fail.body };
38
+ if (/version\(\)/.test(body)) return ok(row({ v: options.version ?? "26.8.15.10" }));
39
+ if (/FROM system\.databases/.test(body)) {
40
+ return ok(
41
+ objects
42
+ .filter((o) => o.database === undefined)
43
+ .map((o) => row({ name: o.name, engine: o.engine, uuid: "00000000-0000-0000-0000-000000000000", comment: o.comment ?? "" }))
44
+ .join(""),
45
+ );
46
+ }
47
+ if (/FROM system\.tables/.test(body)) {
48
+ return ok(
49
+ objects
50
+ .filter((o) => o.database !== undefined)
51
+ .map((o) => row({ database: o.database, name: o.name, engine: o.engine, uuid: "00000000-0000-0000-0000-000000000000", comment: o.comment ?? "" }))
52
+ .join(""),
53
+ );
54
+ }
55
+ const show = /^SHOW CREATE (DATABASE|TABLE) (`(?:[^`]|``)*`)(?:\.(`(?:[^`]|``)*`))?$/.exec(body.trim());
56
+ if (show) {
57
+ const [db, name] = show[3] ? [unquote(show[2]!), unquote(show[3])] : [undefined, unquote(show[2]!)];
58
+ const o = objects.find((x) => x.database === db && x.name === name);
59
+ if (o) return ok(row({ statement: o.statement }));
60
+ return { status: 404, text: `Code: 60. DB::Exception: Table ${name} does not exist. (UNKNOWN_TABLE)` };
61
+ }
62
+ return { status: 400, text: `fake ClickHouse cannot answer: ${body.slice(0, 80)}` };
63
+ });
64
+ return { url: stub.url, queries, close: stub.close };
65
+ }
@@ -0,0 +1,25 @@
1
+ /** The schema the round trip tests import, build, and compare: roundtrip.e2e.test.ts against live servers, import/roundtrip.test.ts offline. */
2
+ export const SCHEMA = [
3
+ "CREATE DATABASE analytics ENGINE = Atomic COMMENT 'product analytics'",
4
+ `CREATE TABLE analytics.events (
5
+ user_id UUID,
6
+ kind LowCardinality(String) DEFAULT 'click' COMMENT 'what happened',
7
+ ts DateTime CODEC(Delta, ZSTD(3)),
8
+ props Map(String, String),
9
+ n Nullable(UInt32),
10
+ total UInt64 MATERIALIZED ifNull(n, 0) * 2,
11
+ INDEX by_kind kind TYPE bloom_filter(0.01) GRANULARITY 4,
12
+ PROJECTION per_kind (SELECT kind, count() GROUP BY kind)
13
+ )
14
+ ENGINE = MergeTree
15
+ PARTITION BY toYYYYMM(ts)
16
+ ORDER BY (user_id, kind, ts)
17
+ TTL ts + INTERVAL 180 DAY
18
+ SETTINGS min_bytes_for_wide_part = 0
19
+ COMMENT 'raw events'`,
20
+ "CREATE TABLE analytics.users (id UUID, email String, updated_at DateTime) ENGINE = ReplacingMergeTree(updated_at) ORDER BY id",
21
+ "CREATE TABLE analytics.daily (day Date, kind LowCardinality(String), users AggregateFunction(uniq, UUID)) ENGINE = AggregatingMergeTree ORDER BY (day, kind)",
22
+ "CREATE MATERIALIZED VIEW analytics.daily_mv TO analytics.daily AS SELECT toDate(ts) AS day, kind, uniqState(user_id) AS users FROM analytics.events GROUP BY day, kind",
23
+ "CREATE VIEW analytics.by_kind AS SELECT kind, count() AS n FROM analytics.events GROUP BY kind",
24
+ "CREATE TABLE default.scratch (a UInt8) ENGINE = Log",
25
+ ];
@@ -0,0 +1,141 @@
1
+ /**
2
+ * A stand-in for a ClickHouse server that an apply can write to, for the
3
+ * applier's tests (#3208). It keeps a set of objects, answers the catalog
4
+ * reads observation makes, and takes the writes an apply sends: a `CREATE`
5
+ * adds an object with the statement as its definition, a `DROP` removes one,
6
+ * `MODIFY COMMENT` sets a comment. Every other `ALTER` is recorded and
7
+ * answered, and does not change the definition. Not a SQL engine.
8
+ */
9
+
10
+ import { startHttpStub } from "../../core/testing/http-stub";
11
+ import { canonicalObject } from "../plan/normalize";
12
+
13
+ export interface StoredObject {
14
+ database?: string;
15
+ name: string;
16
+ engine: string;
17
+ statement: string;
18
+ comment?: string;
19
+ }
20
+
21
+ export interface WritableServer {
22
+ url: string;
23
+ objects: StoredObject[];
24
+ /** Every statement that is not a read, in order. */
25
+ writes: string[];
26
+ /** The targets of every DROP. */
27
+ deletes: string[];
28
+ /** Unfinished mutations `system.mutations` reports. */
29
+ mutations: Array<{ database: string; table: string; mutation_id: string; latest_fail_reason?: string }>;
30
+ /** Refuse statements matching this, with the server's error. */
31
+ refuse?: RegExp;
32
+ close(): Promise<void>;
33
+ }
34
+
35
+ const row = (o: Record<string, unknown>) => `${JSON.stringify(o)}\n`;
36
+ const unquote = (s: string) => s.replace(/^`|`$/g, "").replace(/``/g, "`");
37
+ const literal = (s: string) => s.slice(1, -1).replace(/\\(.)/g, "$1");
38
+
39
+ function engineOf(statement: string): string {
40
+ const c = canonicalObject(statement);
41
+ if (c.kind === "view") return "View";
42
+ if (c.kind === "materializedView") return "MaterializedView";
43
+ return c.engineName ?? (c.kind === "database" ? "Atomic" : "MergeTree");
44
+ }
45
+
46
+ export async function writableClickHouse(initial: StoredObject[] = []): Promise<WritableServer> {
47
+ const state: WritableServer = {
48
+ url: "",
49
+ objects: initial.map((o) => ({ ...o })),
50
+ writes: [],
51
+ deletes: [],
52
+ mutations: [],
53
+ close: async () => undefined,
54
+ };
55
+ const find = (db: string | undefined, name: string) => state.objects.find((o) => o.database === db && o.name === name);
56
+
57
+ const answer = (body: string): { status: number; text: string } => {
58
+ const sql = body.trim();
59
+ if (/^SELECT version\(\)/.test(sql)) return { status: 200, text: row({ v: "26.8.15.10" }) };
60
+ if (/FROM system\.databases/.test(sql)) {
61
+ return {
62
+ status: 200,
63
+ text: state.objects
64
+ .filter((o) => o.database === undefined)
65
+ .map((o) => row({ name: o.name, engine: o.engine, uuid: "00000000-0000-0000-0000-000000000000", comment: o.comment ?? "" }))
66
+ .join(""),
67
+ };
68
+ }
69
+ if (/^SELECT count\(\) AS n FROM system\.tables WHERE database = '(.*)'$/.test(sql)) {
70
+ const db = literal(/'(.*)'$/.exec(sql)![0]);
71
+ return { status: 200, text: row({ n: state.objects.filter((o) => o.database === db).length }) };
72
+ }
73
+ if (/FROM system\.tables/.test(sql)) {
74
+ return {
75
+ status: 200,
76
+ text: state.objects
77
+ .filter((o) => o.database !== undefined)
78
+ .map((o) => row({ database: o.database, name: o.name, engine: o.engine, uuid: "00000000-0000-0000-0000-000000000000", comment: o.comment ?? "" }))
79
+ .join(""),
80
+ };
81
+ }
82
+ if (/FROM system\.mutations/.test(sql)) {
83
+ const m = /database = '([^']*)' AND table = '([^']*)'/.exec(sql);
84
+ return {
85
+ status: 200,
86
+ text: state.mutations
87
+ .filter((x) => m && x.database === m[1] && x.table === m[2])
88
+ .map((x) => row({ mutation_id: x.mutation_id, command: "(MODIFY COLUMN)", latest_fail_reason: x.latest_fail_reason ?? "" }))
89
+ .join(""),
90
+ };
91
+ }
92
+ const show = /^SHOW CREATE (DATABASE|TABLE) (`(?:[^`]|``)*`)(?:\.(`(?:[^`]|``)*`))?$/.exec(sql);
93
+ if (show) {
94
+ const [db, name] = show[3] ? [unquote(show[2]!), unquote(show[3])] : [undefined, unquote(show[2]!)];
95
+ const o = find(db, name);
96
+ return o ? { status: 200, text: row({ statement: o.statement }) } : { status: 404, text: `Code: 60. DB::Exception: Table ${name} does not exist. (UNKNOWN_TABLE)` };
97
+ }
98
+ if (/^SELECT formatQuerySingleLine/.test(sql)) return { status: 400, text: "fake ClickHouse does not format" };
99
+
100
+ state.writes.push(sql);
101
+ if (state.refuse?.test(sql)) return { status: 500, text: `Code: 36. DB::Exception: refused by the test. (BAD_ARGUMENTS)` };
102
+ if (/^(?:--[^\n]*\n\s*)*CREATE\b/i.test(sql)) {
103
+ const c = canonicalObject(sql);
104
+ const existing = find(c.kind === "database" ? undefined : c.database, c.name);
105
+ if (existing && !/^(?:--[^\n]*\n\s*)*CREATE OR REPLACE/i.test(sql)) return { status: 500, text: `Code: 57. DB::Exception: Table ${c.name} already exists. (TABLE_ALREADY_EXISTS)` };
106
+ if (existing) state.objects.splice(state.objects.indexOf(existing), 1);
107
+ state.objects.push({
108
+ ...(c.kind === "database" ? {} : { database: c.database }),
109
+ name: c.name,
110
+ engine: engineOf(sql),
111
+ statement: sql.replace(/^CREATE OR REPLACE /i, "CREATE "),
112
+ ...(c.comment !== undefined ? { comment: c.comment } : {}),
113
+ });
114
+ return { status: 200, text: "" };
115
+ }
116
+ const drop = /^DROP (DATABASE|TABLE|VIEW) (`(?:[^`]|``)*`)(?:\.(`(?:[^`]|``)*`))?/.exec(sql);
117
+ if (drop) {
118
+ const [db, name] = drop[3] ? [unquote(drop[2]!), unquote(drop[3])] : [undefined, unquote(drop[2]!)];
119
+ state.deletes.push(db ? `${db}.${name}` : name);
120
+ const o = find(db, name);
121
+ if (o) state.objects.splice(state.objects.indexOf(o), 1);
122
+ return { status: 200, text: "" };
123
+ }
124
+ const comment = /^ALTER (DATABASE|TABLE) (`(?:[^`]|``)*`)(?:\.(`(?:[^`]|``)*`))? MODIFY COMMENT ('(?:[^'\\]|\\.)*')$/.exec(sql);
125
+ if (comment) {
126
+ const [db, name] = comment[3] ? [unquote(comment[2]!), unquote(comment[3])] : [undefined, unquote(comment[2]!)];
127
+ const o = find(db, name);
128
+ if (o) {
129
+ o.comment = literal(comment[4]!);
130
+ o.statement = `${o.statement.replace(/\s+COMMENT '(?:[^'\\]|\\.)*'\s*$/, "")}\nCOMMENT ${comment[4]}`;
131
+ }
132
+ return { status: 200, text: "" };
133
+ }
134
+ return { status: 200, text: "" };
135
+ };
136
+
137
+ const stub = await startHttpStub((body) => answer(body));
138
+ state.url = stub.url;
139
+ state.close = stub.close;
140
+ return state;
141
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * ClickHouse's lexical rules over the shared lossless tokenizer
3
+ * (`../core/tokens.ts`, chant #3196): `` ` `` and `"` quote an identifier, a
4
+ * backslash escapes inside any quote, `( ) , ; . =` are punctuation, and a
5
+ * number may run into letters (`00662_events`, which the parser accepts as a
6
+ * name).
7
+ */
8
+
9
+ import { tokenize as tokenizeWith, tokenizeText as tokenizeTextWith, type LexicalRules, type Token } from "../core/tokens";
10
+
11
+ export { isTrivia, SqlSyntaxError, untokenize, type LexicalRules, type Token, type TokenKind } from "../core/tokens";
12
+
13
+ export const CLICKHOUSE_LEXICAL: LexicalRules = {
14
+ identQuotes: '`"',
15
+ backslashEscapes: true,
16
+ punct: "(),;.=",
17
+ opChars: /[+\-*/%<>!|&^~?:[\]{}@]/,
18
+ };
19
+
20
+ /** Tokenize one string with ClickHouse's rules. `part` is the part index recorded on each token and on an error. */
21
+ export function tokenizeText(src: string, part: number): Token[] {
22
+ return tokenizeTextWith(src, part, CLICKHOUSE_LEXICAL);
23
+ }
24
+
25
+ /** Tokenize a template's parts with ClickHouse's rules, with a `ref` token for each interpolation between them. */
26
+ export function tokenize(parts: readonly string[]): Token[] {
27
+ return tokenizeWith(parts, CLICKHOUSE_LEXICAL);
28
+ }