@quereus/quereus 4.4.1 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (593) hide show
  1. package/README.md +5 -4
  2. package/dist/src/core/database-events.d.ts +99 -1
  3. package/dist/src/core/database-events.d.ts.map +1 -1
  4. package/dist/src/core/database-events.js +219 -3
  5. package/dist/src/core/database-events.js.map +1 -1
  6. package/dist/src/core/database-materialized-views-analysis.d.ts.map +1 -1
  7. package/dist/src/core/database-materialized-views-analysis.js +1 -0
  8. package/dist/src/core/database-materialized-views-analysis.js.map +1 -1
  9. package/dist/src/core/database-materialized-views-plan-builders.d.ts.map +1 -1
  10. package/dist/src/core/database-materialized-views-plan-builders.js +29 -2
  11. package/dist/src/core/database-materialized-views-plan-builders.js.map +1 -1
  12. package/dist/src/core/database-transaction.d.ts +9 -0
  13. package/dist/src/core/database-transaction.d.ts.map +1 -1
  14. package/dist/src/core/database-transaction.js +9 -0
  15. package/dist/src/core/database-transaction.js.map +1 -1
  16. package/dist/src/core/database.d.ts +7 -1
  17. package/dist/src/core/database.d.ts.map +1 -1
  18. package/dist/src/core/database.js +20 -5
  19. package/dist/src/core/database.js.map +1 -1
  20. package/dist/src/func/builtins/aggregate.js +11 -11
  21. package/dist/src/func/builtins/aggregate.js.map +1 -1
  22. package/dist/src/func/builtins/builtin-window-functions.d.ts.map +1 -1
  23. package/dist/src/func/builtins/builtin-window-functions.js +15 -85
  24. package/dist/src/func/builtins/builtin-window-functions.js.map +1 -1
  25. package/dist/src/func/builtins/conversion.d.ts.map +1 -1
  26. package/dist/src/func/builtins/conversion.js +10 -9
  27. package/dist/src/func/builtins/conversion.js.map +1 -1
  28. package/dist/src/func/builtins/datetime.d.ts.map +1 -1
  29. package/dist/src/func/builtins/datetime.js +28 -10
  30. package/dist/src/func/builtins/datetime.js.map +1 -1
  31. package/dist/src/func/builtins/json.d.ts.map +1 -1
  32. package/dist/src/func/builtins/json.js +23 -17
  33. package/dist/src/func/builtins/json.js.map +1 -1
  34. package/dist/src/func/builtins/mutation.js +2 -2
  35. package/dist/src/func/builtins/mutation.js.map +1 -1
  36. package/dist/src/func/builtins/return-types.d.ts +327 -0
  37. package/dist/src/func/builtins/return-types.d.ts.map +1 -0
  38. package/dist/src/func/builtins/return-types.js +43 -0
  39. package/dist/src/func/builtins/return-types.js.map +1 -0
  40. package/dist/src/func/builtins/scalar.d.ts.map +1 -1
  41. package/dist/src/func/builtins/scalar.js +193 -37
  42. package/dist/src/func/builtins/scalar.js.map +1 -1
  43. package/dist/src/func/builtins/schema.d.ts.map +1 -1
  44. package/dist/src/func/builtins/schema.js +11 -3
  45. package/dist/src/func/builtins/schema.js.map +1 -1
  46. package/dist/src/func/builtins/string.d.ts.map +1 -1
  47. package/dist/src/func/builtins/string.js +4 -2
  48. package/dist/src/func/builtins/string.js.map +1 -1
  49. package/dist/src/func/builtins/timespan.d.ts +3 -0
  50. package/dist/src/func/builtins/timespan.d.ts.map +1 -1
  51. package/dist/src/func/builtins/timespan.js +15 -11
  52. package/dist/src/func/builtins/timespan.js.map +1 -1
  53. package/dist/src/func/registration.d.ts +39 -1
  54. package/dist/src/func/registration.d.ts.map +1 -1
  55. package/dist/src/func/registration.js +236 -41
  56. package/dist/src/func/registration.js.map +1 -1
  57. package/dist/src/index.d.ts +14 -7
  58. package/dist/src/index.d.ts.map +1 -1
  59. package/dist/src/index.js +14 -5
  60. package/dist/src/index.js.map +1 -1
  61. package/dist/src/parser/parser.d.ts +46 -0
  62. package/dist/src/parser/parser.d.ts.map +1 -1
  63. package/dist/src/parser/parser.js +160 -44
  64. package/dist/src/parser/parser.js.map +1 -1
  65. package/dist/src/planner/analysis/check-extraction.d.ts.map +1 -1
  66. package/dist/src/planner/analysis/check-extraction.js +37 -4
  67. package/dist/src/planner/analysis/check-extraction.js.map +1 -1
  68. package/dist/src/planner/analysis/coarsened-key.d.ts +4 -3
  69. package/dist/src/planner/analysis/coarsened-key.d.ts.map +1 -1
  70. package/dist/src/planner/analysis/coarsened-key.js +37 -3
  71. package/dist/src/planner/analysis/coarsened-key.js.map +1 -1
  72. package/dist/src/planner/analysis/comparison-collation.d.ts +41 -13
  73. package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -1
  74. package/dist/src/planner/analysis/comparison-collation.js +51 -14
  75. package/dist/src/planner/analysis/comparison-collation.js.map +1 -1
  76. package/dist/src/planner/analysis/constraint-extractor.d.ts +0 -7
  77. package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
  78. package/dist/src/planner/analysis/constraint-extractor.js +59 -59
  79. package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
  80. package/dist/src/planner/analysis/coverage-prover.d.ts +13 -2
  81. package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
  82. package/dist/src/planner/analysis/coverage-prover.js +10 -14
  83. package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
  84. package/dist/src/planner/analysis/predicate-conjuncts.d.ts +10 -4
  85. package/dist/src/planner/analysis/predicate-conjuncts.d.ts.map +1 -1
  86. package/dist/src/planner/analysis/predicate-conjuncts.js +28 -7
  87. package/dist/src/planner/analysis/predicate-conjuncts.js.map +1 -1
  88. package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -1
  89. package/dist/src/planner/analysis/query-rewrite-matcher.js +8 -27
  90. package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -1
  91. package/dist/src/planner/analysis/scalar-subqueries.d.ts +22 -3
  92. package/dist/src/planner/analysis/scalar-subqueries.d.ts.map +1 -1
  93. package/dist/src/planner/analysis/scalar-subqueries.js +32 -3
  94. package/dist/src/planner/analysis/scalar-subqueries.js.map +1 -1
  95. package/dist/src/planner/analysis/set-op-type-merge.d.ts +64 -0
  96. package/dist/src/planner/analysis/set-op-type-merge.d.ts.map +1 -0
  97. package/dist/src/planner/analysis/set-op-type-merge.js +97 -0
  98. package/dist/src/planner/analysis/set-op-type-merge.js.map +1 -0
  99. package/dist/src/planner/building/alter-table.d.ts.map +1 -1
  100. package/dist/src/planner/building/alter-table.js +65 -27
  101. package/dist/src/planner/building/alter-table.js.map +1 -1
  102. package/dist/src/planner/building/coercion.d.ts +54 -0
  103. package/dist/src/planner/building/coercion.d.ts.map +1 -0
  104. package/dist/src/planner/building/coercion.js +88 -0
  105. package/dist/src/planner/building/coercion.js.map +1 -0
  106. package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
  107. package/dist/src/planner/building/constraint-builder.js +5 -18
  108. package/dist/src/planner/building/constraint-builder.js.map +1 -1
  109. package/dist/src/planner/building/expression.d.ts +17 -0
  110. package/dist/src/planner/building/expression.d.ts.map +1 -1
  111. package/dist/src/planner/building/expression.js +23 -115
  112. package/dist/src/planner/building/expression.js.map +1 -1
  113. package/dist/src/planner/building/function-call.d.ts.map +1 -1
  114. package/dist/src/planner/building/function-call.js +13 -0
  115. package/dist/src/planner/building/function-call.js.map +1 -1
  116. package/dist/src/planner/building/select-aggregates.d.ts +1 -1
  117. package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
  118. package/dist/src/planner/building/select-aggregates.js +53 -2
  119. package/dist/src/planner/building/select-aggregates.js.map +1 -1
  120. package/dist/src/planner/building/select-compound.d.ts.map +1 -1
  121. package/dist/src/planner/building/select-compound.js +10 -6
  122. package/dist/src/planner/building/select-compound.js.map +1 -1
  123. package/dist/src/planner/building/select-context.d.ts +7 -0
  124. package/dist/src/planner/building/select-context.d.ts.map +1 -1
  125. package/dist/src/planner/building/select-context.js +10 -40
  126. package/dist/src/planner/building/select-context.js.map +1 -1
  127. package/dist/src/planner/building/select.d.ts +37 -1
  128. package/dist/src/planner/building/select.d.ts.map +1 -1
  129. package/dist/src/planner/building/select.js +112 -51
  130. package/dist/src/planner/building/select.js.map +1 -1
  131. package/dist/src/planner/cost/conjunct-cost.d.ts +82 -0
  132. package/dist/src/planner/cost/conjunct-cost.d.ts.map +1 -0
  133. package/dist/src/planner/cost/conjunct-cost.js +107 -0
  134. package/dist/src/planner/cost/conjunct-cost.js.map +1 -0
  135. package/dist/src/planner/cost/index.d.ts +10 -0
  136. package/dist/src/planner/cost/index.d.ts.map +1 -1
  137. package/dist/src/planner/cost/index.js +15 -0
  138. package/dist/src/planner/cost/index.js.map +1 -1
  139. package/dist/src/planner/mutation/propagate.d.ts.map +1 -1
  140. package/dist/src/planner/mutation/propagate.js +1 -0
  141. package/dist/src/planner/mutation/propagate.js.map +1 -1
  142. package/dist/src/planner/nodes/aggregate-node.d.ts +6 -0
  143. package/dist/src/planner/nodes/aggregate-node.d.ts.map +1 -1
  144. package/dist/src/planner/nodes/aggregate-node.js +10 -2
  145. package/dist/src/planner/nodes/aggregate-node.js.map +1 -1
  146. package/dist/src/planner/nodes/alias-node.d.ts.map +1 -1
  147. package/dist/src/planner/nodes/alias-node.js +2 -1
  148. package/dist/src/planner/nodes/alias-node.js.map +1 -1
  149. package/dist/src/planner/nodes/alter-table-node.d.ts +24 -8
  150. package/dist/src/planner/nodes/alter-table-node.d.ts.map +1 -1
  151. package/dist/src/planner/nodes/alter-table-node.js.map +1 -1
  152. package/dist/src/planner/nodes/asof-scan-node.d.ts.map +1 -1
  153. package/dist/src/planner/nodes/asof-scan-node.js +4 -1
  154. package/dist/src/planner/nodes/asof-scan-node.js.map +1 -1
  155. package/dist/src/planner/nodes/asserted-keys-node.d.ts.map +1 -1
  156. package/dist/src/planner/nodes/asserted-keys-node.js +2 -1
  157. package/dist/src/planner/nodes/asserted-keys-node.js.map +1 -1
  158. package/dist/src/planner/nodes/async-gather-node.d.ts.map +1 -1
  159. package/dist/src/planner/nodes/async-gather-node.js +19 -8
  160. package/dist/src/planner/nodes/async-gather-node.js.map +1 -1
  161. package/dist/src/planner/nodes/bloom-join-node.d.ts +2 -0
  162. package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
  163. package/dist/src/planner/nodes/bloom-join-node.js +17 -7
  164. package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
  165. package/dist/src/planner/nodes/cache-node.d.ts.map +1 -1
  166. package/dist/src/planner/nodes/cache-node.js +2 -1
  167. package/dist/src/planner/nodes/cache-node.js.map +1 -1
  168. package/dist/src/planner/nodes/distinct-node.d.ts +6 -0
  169. package/dist/src/planner/nodes/distinct-node.d.ts.map +1 -1
  170. package/dist/src/planner/nodes/distinct-node.js +10 -2
  171. package/dist/src/planner/nodes/distinct-node.js.map +1 -1
  172. package/dist/src/planner/nodes/eager-prefetch-node.d.ts.map +1 -1
  173. package/dist/src/planner/nodes/eager-prefetch-node.js +2 -1
  174. package/dist/src/planner/nodes/eager-prefetch-node.js.map +1 -1
  175. package/dist/src/planner/nodes/fanout-lookup-join-node.d.ts +5 -0
  176. package/dist/src/planner/nodes/fanout-lookup-join-node.d.ts.map +1 -1
  177. package/dist/src/planner/nodes/fanout-lookup-join-node.js +13 -6
  178. package/dist/src/planner/nodes/fanout-lookup-join-node.js.map +1 -1
  179. package/dist/src/planner/nodes/filter.d.ts.map +1 -1
  180. package/dist/src/planner/nodes/filter.js +12 -5
  181. package/dist/src/planner/nodes/filter.js.map +1 -1
  182. package/dist/src/planner/nodes/hash-aggregate.d.ts +6 -0
  183. package/dist/src/planner/nodes/hash-aggregate.d.ts.map +1 -1
  184. package/dist/src/planner/nodes/hash-aggregate.js +10 -2
  185. package/dist/src/planner/nodes/hash-aggregate.js.map +1 -1
  186. package/dist/src/planner/nodes/join-node.d.ts +25 -1
  187. package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
  188. package/dist/src/planner/nodes/join-node.js +38 -10
  189. package/dist/src/planner/nodes/join-node.js.map +1 -1
  190. package/dist/src/planner/nodes/join-utils.d.ts +78 -0
  191. package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
  192. package/dist/src/planner/nodes/join-utils.js +73 -0
  193. package/dist/src/planner/nodes/join-utils.js.map +1 -1
  194. package/dist/src/planner/nodes/key-set-semi-join-node.d.ts +87 -0
  195. package/dist/src/planner/nodes/key-set-semi-join-node.d.ts.map +1 -0
  196. package/dist/src/planner/nodes/key-set-semi-join-node.js +141 -0
  197. package/dist/src/planner/nodes/key-set-semi-join-node.js.map +1 -0
  198. package/dist/src/planner/nodes/lens-auxiliary-access-node.d.ts.map +1 -1
  199. package/dist/src/planner/nodes/lens-auxiliary-access-node.js +2 -1
  200. package/dist/src/planner/nodes/lens-auxiliary-access-node.js.map +1 -1
  201. package/dist/src/planner/nodes/limit-offset.d.ts +6 -0
  202. package/dist/src/planner/nodes/limit-offset.d.ts.map +1 -1
  203. package/dist/src/planner/nodes/limit-offset.js +10 -2
  204. package/dist/src/planner/nodes/limit-offset.js.map +1 -1
  205. package/dist/src/planner/nodes/merge-join-node.d.ts +2 -0
  206. package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
  207. package/dist/src/planner/nodes/merge-join-node.js +21 -8
  208. package/dist/src/planner/nodes/merge-join-node.js.map +1 -1
  209. package/dist/src/planner/nodes/ordinal-slice-node.d.ts +5 -0
  210. package/dist/src/planner/nodes/ordinal-slice-node.d.ts.map +1 -1
  211. package/dist/src/planner/nodes/ordinal-slice-node.js +9 -2
  212. package/dist/src/planner/nodes/ordinal-slice-node.js.map +1 -1
  213. package/dist/src/planner/nodes/plan-node-type.d.ts +1 -0
  214. package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
  215. package/dist/src/planner/nodes/plan-node-type.js +1 -0
  216. package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
  217. package/dist/src/planner/nodes/plan-node.d.ts +24 -0
  218. package/dist/src/planner/nodes/plan-node.d.ts.map +1 -1
  219. package/dist/src/planner/nodes/plan-node.js.map +1 -1
  220. package/dist/src/planner/nodes/project-node.d.ts.map +1 -1
  221. package/dist/src/planner/nodes/project-node.js +2 -1
  222. package/dist/src/planner/nodes/project-node.js.map +1 -1
  223. package/dist/src/planner/nodes/reference.d.ts.map +1 -1
  224. package/dist/src/planner/nodes/reference.js +3 -2
  225. package/dist/src/planner/nodes/reference.js.map +1 -1
  226. package/dist/src/planner/nodes/retrieve-node.d.ts.map +1 -1
  227. package/dist/src/planner/nodes/retrieve-node.js +2 -1
  228. package/dist/src/planner/nodes/retrieve-node.js.map +1 -1
  229. package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
  230. package/dist/src/planner/nodes/scalar.js +5 -18
  231. package/dist/src/planner/nodes/scalar.js.map +1 -1
  232. package/dist/src/planner/nodes/set-operation-node.d.ts +68 -16
  233. package/dist/src/planner/nodes/set-operation-node.d.ts.map +1 -1
  234. package/dist/src/planner/nodes/set-operation-node.js +147 -26
  235. package/dist/src/planner/nodes/set-operation-node.js.map +1 -1
  236. package/dist/src/planner/nodes/sort.d.ts.map +1 -1
  237. package/dist/src/planner/nodes/sort.js +3 -1
  238. package/dist/src/planner/nodes/sort.js.map +1 -1
  239. package/dist/src/planner/nodes/stream-aggregate.d.ts +6 -0
  240. package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
  241. package/dist/src/planner/nodes/stream-aggregate.js +10 -2
  242. package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
  243. package/dist/src/planner/nodes/table-access-nodes.d.ts +19 -1
  244. package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
  245. package/dist/src/planner/nodes/table-access-nodes.js +18 -2
  246. package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
  247. package/dist/src/planner/nodes/window-function.d.ts.map +1 -1
  248. package/dist/src/planner/nodes/window-function.js +8 -0
  249. package/dist/src/planner/nodes/window-function.js.map +1 -1
  250. package/dist/src/planner/nodes/window-node.d.ts +1 -1
  251. package/dist/src/planner/nodes/window-node.d.ts.map +1 -1
  252. package/dist/src/planner/nodes/window-node.js +3 -1
  253. package/dist/src/planner/nodes/window-node.js.map +1 -1
  254. package/dist/src/planner/optimizer.d.ts +9 -1
  255. package/dist/src/planner/optimizer.d.ts.map +1 -1
  256. package/dist/src/planner/optimizer.js +126 -6
  257. package/dist/src/planner/optimizer.js.map +1 -1
  258. package/dist/src/planner/rules/access/rule-key-set-seek.d.ts +68 -0
  259. package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -0
  260. package/dist/src/planner/rules/access/rule-key-set-seek.js +343 -0
  261. package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -0
  262. package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts.map +1 -1
  263. package/dist/src/planner/rules/access/rule-monotonic-range-access.js +2 -2
  264. package/dist/src/planner/rules/access/rule-monotonic-range-access.js.map +1 -1
  265. package/dist/src/planner/rules/access/rule-select-access-path.d.ts +46 -0
  266. package/dist/src/planner/rules/access/rule-select-access-path.d.ts.map +1 -1
  267. package/dist/src/planner/rules/access/rule-select-access-path.js +54 -13
  268. package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
  269. package/dist/src/planner/rules/cache/rule-cte-optimization.d.ts.map +1 -1
  270. package/dist/src/planner/rules/cache/rule-cte-optimization.js +9 -0
  271. package/dist/src/planner/rules/cache/rule-cte-optimization.js.map +1 -1
  272. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.d.ts.map +1 -1
  273. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js +6 -4
  274. package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js.map +1 -1
  275. package/dist/src/planner/rules/join/equi-pair-extractor.d.ts +49 -49
  276. package/dist/src/planner/rules/join/equi-pair-extractor.d.ts.map +1 -1
  277. package/dist/src/planner/rules/join/equi-pair-extractor.js +54 -58
  278. package/dist/src/planner/rules/join/equi-pair-extractor.js.map +1 -1
  279. package/dist/src/planner/rules/join/index-nested-loop.d.ts +49 -0
  280. package/dist/src/planner/rules/join/index-nested-loop.d.ts.map +1 -0
  281. package/dist/src/planner/rules/join/index-nested-loop.js +285 -0
  282. package/dist/src/planner/rules/join/index-nested-loop.js.map +1 -0
  283. package/dist/src/planner/rules/join/rule-fanout-batched-outer.js +8 -8
  284. package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts +10 -4
  285. package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts.map +1 -1
  286. package/dist/src/planner/rules/join/rule-join-physical-selection.js +97 -29
  287. package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
  288. package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -1
  289. package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +15 -5
  290. package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
  291. package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts +1 -1
  292. package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js +1 -1
  293. package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts +43 -0
  294. package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts.map +1 -0
  295. package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js +119 -0
  296. package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js.map +1 -0
  297. package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts +44 -3
  298. package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts.map +1 -1
  299. package/dist/src/planner/rules/predicate/rule-filter-selectivity.js +142 -18
  300. package/dist/src/planner/rules/predicate/rule-filter-selectivity.js.map +1 -1
  301. package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.d.ts +73 -0
  302. package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.d.ts.map +1 -0
  303. package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.js +205 -0
  304. package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.js.map +1 -0
  305. package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts +14 -11
  306. package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts.map +1 -1
  307. package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js +21 -85
  308. package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js.map +1 -1
  309. package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts +10 -2
  310. package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts.map +1 -1
  311. package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js +20 -2
  312. package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +1 -1
  313. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.d.ts.map +1 -1
  314. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +18 -3
  315. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
  316. package/dist/src/planner/rules/shared/access-leaf.d.ts +39 -0
  317. package/dist/src/planner/rules/shared/access-leaf.d.ts.map +1 -0
  318. package/dist/src/planner/rules/shared/access-leaf.js +79 -0
  319. package/dist/src/planner/rules/shared/access-leaf.js.map +1 -0
  320. package/dist/src/planner/rules/shared/index-style-context.d.ts +17 -0
  321. package/dist/src/planner/rules/shared/index-style-context.d.ts.map +1 -1
  322. package/dist/src/planner/rules/shared/index-style-context.js +7 -0
  323. package/dist/src/planner/rules/shared/index-style-context.js.map +1 -1
  324. package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.d.ts.map +1 -1
  325. package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js +18 -8
  326. package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js.map +1 -1
  327. package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts +3 -1
  328. package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts.map +1 -1
  329. package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js +27 -10
  330. package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js.map +1 -1
  331. package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts +24 -6
  332. package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
  333. package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +243 -70
  334. package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js.map +1 -1
  335. package/dist/src/planner/rules/window/rule-monotonic-window.d.ts +17 -7
  336. package/dist/src/planner/rules/window/rule-monotonic-window.d.ts.map +1 -1
  337. package/dist/src/planner/rules/window/rule-monotonic-window.js +124 -87
  338. package/dist/src/planner/rules/window/rule-monotonic-window.js.map +1 -1
  339. package/dist/src/planner/scopes/aliased.d.ts.map +1 -1
  340. package/dist/src/planner/scopes/aliased.js +6 -0
  341. package/dist/src/planner/scopes/aliased.js.map +1 -1
  342. package/dist/src/planner/stats/catalog-stats.d.ts +87 -4
  343. package/dist/src/planner/stats/catalog-stats.d.ts.map +1 -1
  344. package/dist/src/planner/stats/catalog-stats.js +250 -28
  345. package/dist/src/planner/stats/catalog-stats.js.map +1 -1
  346. package/dist/src/planner/stats/conjunct-selectivity.d.ts +48 -0
  347. package/dist/src/planner/stats/conjunct-selectivity.d.ts.map +1 -0
  348. package/dist/src/planner/stats/conjunct-selectivity.js +168 -0
  349. package/dist/src/planner/stats/conjunct-selectivity.js.map +1 -0
  350. package/dist/src/planner/stats/index.d.ts +36 -2
  351. package/dist/src/planner/stats/index.d.ts.map +1 -1
  352. package/dist/src/planner/stats/index.js.map +1 -1
  353. package/dist/src/planner/stats/selectivity-combine.d.ts +53 -0
  354. package/dist/src/planner/stats/selectivity-combine.d.ts.map +1 -0
  355. package/dist/src/planner/stats/selectivity-combine.js +75 -0
  356. package/dist/src/planner/stats/selectivity-combine.js.map +1 -0
  357. package/dist/src/planner/stats/table-cardinality.d.ts +28 -0
  358. package/dist/src/planner/stats/table-cardinality.d.ts.map +1 -0
  359. package/dist/src/planner/stats/table-cardinality.js +29 -0
  360. package/dist/src/planner/stats/table-cardinality.js.map +1 -0
  361. package/dist/src/planner/util/column-origins.d.ts +79 -0
  362. package/dist/src/planner/util/column-origins.d.ts.map +1 -0
  363. package/dist/src/planner/util/column-origins.js +150 -0
  364. package/dist/src/planner/util/column-origins.js.map +1 -0
  365. package/dist/src/planner/util/fd-utils.d.ts +32 -8
  366. package/dist/src/planner/util/fd-utils.d.ts.map +1 -1
  367. package/dist/src/planner/util/fd-utils.js +46 -9
  368. package/dist/src/planner/util/fd-utils.js.map +1 -1
  369. package/dist/src/planner/util/ind-utils.d.ts +56 -17
  370. package/dist/src/planner/util/ind-utils.d.ts.map +1 -1
  371. package/dist/src/planner/util/ind-utils.js +82 -21
  372. package/dist/src/planner/util/ind-utils.js.map +1 -1
  373. package/dist/src/planner/util/key-utils.d.ts +20 -2
  374. package/dist/src/planner/util/key-utils.d.ts.map +1 -1
  375. package/dist/src/planner/util/key-utils.js +37 -3
  376. package/dist/src/planner/util/key-utils.js.map +1 -1
  377. package/dist/src/planner/util/row-estimates.d.ts +28 -0
  378. package/dist/src/planner/util/row-estimates.d.ts.map +1 -0
  379. package/dist/src/planner/util/row-estimates.js +40 -0
  380. package/dist/src/planner/util/row-estimates.js.map +1 -0
  381. package/dist/src/planner/util/row-population.d.ts +42 -0
  382. package/dist/src/planner/util/row-population.d.ts.map +1 -0
  383. package/dist/src/planner/util/row-population.js +71 -0
  384. package/dist/src/planner/util/row-population.js.map +1 -0
  385. package/dist/src/runtime/deferred-constraint-queue.d.ts +40 -0
  386. package/dist/src/runtime/deferred-constraint-queue.d.ts.map +1 -1
  387. package/dist/src/runtime/deferred-constraint-queue.js +90 -9
  388. package/dist/src/runtime/deferred-constraint-queue.js.map +1 -1
  389. package/dist/src/runtime/emit/add-constraint.d.ts.map +1 -1
  390. package/dist/src/runtime/emit/add-constraint.js +39 -1
  391. package/dist/src/runtime/emit/add-constraint.js.map +1 -1
  392. package/dist/src/runtime/emit/aggregate.d.ts.map +1 -1
  393. package/dist/src/runtime/emit/aggregate.js +4 -4
  394. package/dist/src/runtime/emit/aggregate.js.map +1 -1
  395. package/dist/src/runtime/emit/alter-schema-event.d.ts +42 -0
  396. package/dist/src/runtime/emit/alter-schema-event.d.ts.map +1 -0
  397. package/dist/src/runtime/emit/alter-schema-event.js +28 -0
  398. package/dist/src/runtime/emit/alter-schema-event.js.map +1 -0
  399. package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
  400. package/dist/src/runtime/emit/alter-table.js +386 -154
  401. package/dist/src/runtime/emit/alter-table.js.map +1 -1
  402. package/dist/src/runtime/emit/analyze.d.ts.map +1 -1
  403. package/dist/src/runtime/emit/analyze.js +35 -3
  404. package/dist/src/runtime/emit/analyze.js.map +1 -1
  405. package/dist/src/runtime/emit/asof-scan.d.ts.map +1 -1
  406. package/dist/src/runtime/emit/asof-scan.js +8 -3
  407. package/dist/src/runtime/emit/asof-scan.js.map +1 -1
  408. package/dist/src/runtime/emit/between.d.ts.map +1 -1
  409. package/dist/src/runtime/emit/between.js +4 -38
  410. package/dist/src/runtime/emit/between.js.map +1 -1
  411. package/dist/src/runtime/emit/binary.d.ts.map +1 -1
  412. package/dist/src/runtime/emit/binary.js +2 -23
  413. package/dist/src/runtime/emit/binary.js.map +1 -1
  414. package/dist/src/runtime/emit/bloom-join.d.ts.map +1 -1
  415. package/dist/src/runtime/emit/bloom-join.js +6 -35
  416. package/dist/src/runtime/emit/bloom-join.js.map +1 -1
  417. package/dist/src/runtime/emit/case.d.ts.map +1 -1
  418. package/dist/src/runtime/emit/case.js +40 -6
  419. package/dist/src/runtime/emit/case.js.map +1 -1
  420. package/dist/src/runtime/emit/cast.d.ts.map +1 -1
  421. package/dist/src/runtime/emit/cast.js +4 -19
  422. package/dist/src/runtime/emit/cast.js.map +1 -1
  423. package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
  424. package/dist/src/runtime/emit/constraint-check.js +32 -8
  425. package/dist/src/runtime/emit/constraint-check.js.map +1 -1
  426. package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
  427. package/dist/src/runtime/emit/dml-executor.js +90 -50
  428. package/dist/src/runtime/emit/dml-executor.js.map +1 -1
  429. package/dist/src/runtime/emit/drop-index.d.ts.map +1 -1
  430. package/dist/src/runtime/emit/drop-index.js +4 -3
  431. package/dist/src/runtime/emit/drop-index.js.map +1 -1
  432. package/dist/src/runtime/emit/filter.d.ts +18 -0
  433. package/dist/src/runtime/emit/filter.d.ts.map +1 -1
  434. package/dist/src/runtime/emit/filter.js +52 -10
  435. package/dist/src/runtime/emit/filter.js.map +1 -1
  436. package/dist/src/runtime/emit/hash-aggregate.d.ts.map +1 -1
  437. package/dist/src/runtime/emit/hash-aggregate.js +2 -2
  438. package/dist/src/runtime/emit/hash-aggregate.js.map +1 -1
  439. package/dist/src/runtime/emit/join-key-extractor.d.ts +46 -0
  440. package/dist/src/runtime/emit/join-key-extractor.d.ts.map +1 -0
  441. package/dist/src/runtime/emit/join-key-extractor.js +60 -0
  442. package/dist/src/runtime/emit/join-key-extractor.js.map +1 -0
  443. package/dist/src/runtime/emit/join.d.ts.map +1 -1
  444. package/dist/src/runtime/emit/join.js +8 -46
  445. package/dist/src/runtime/emit/join.js.map +1 -1
  446. package/dist/src/runtime/emit/key-set-semi-join.d.ts +29 -0
  447. package/dist/src/runtime/emit/key-set-semi-join.d.ts.map +1 -0
  448. package/dist/src/runtime/emit/key-set-semi-join.js +149 -0
  449. package/dist/src/runtime/emit/key-set-semi-join.js.map +1 -0
  450. package/dist/src/runtime/emit/merge-join.d.ts.map +1 -1
  451. package/dist/src/runtime/emit/merge-join.js +15 -8
  452. package/dist/src/runtime/emit/merge-join.js.map +1 -1
  453. package/dist/src/runtime/emit/operand-comparator.d.ts +70 -0
  454. package/dist/src/runtime/emit/operand-comparator.d.ts.map +1 -0
  455. package/dist/src/runtime/emit/operand-comparator.js +93 -0
  456. package/dist/src/runtime/emit/operand-comparator.js.map +1 -0
  457. package/dist/src/runtime/emit/scan.d.ts.map +1 -1
  458. package/dist/src/runtime/emit/scan.js +11 -2
  459. package/dist/src/runtime/emit/scan.js.map +1 -1
  460. package/dist/src/runtime/emit/schema-declarative.d.ts.map +1 -1
  461. package/dist/src/runtime/emit/schema-declarative.js +30 -0
  462. package/dist/src/runtime/emit/schema-declarative.js.map +1 -1
  463. package/dist/src/runtime/emit/subquery.d.ts.map +1 -1
  464. package/dist/src/runtime/emit/subquery.js +153 -52
  465. package/dist/src/runtime/emit/subquery.js.map +1 -1
  466. package/dist/src/runtime/emit/window.js +36 -23
  467. package/dist/src/runtime/emit/window.js.map +1 -1
  468. package/dist/src/runtime/parallel-driver.d.ts +5 -2
  469. package/dist/src/runtime/parallel-driver.d.ts.map +1 -1
  470. package/dist/src/runtime/parallel-driver.js +6 -2
  471. package/dist/src/runtime/parallel-driver.js.map +1 -1
  472. package/dist/src/runtime/register.d.ts.map +1 -1
  473. package/dist/src/runtime/register.js +2 -0
  474. package/dist/src/runtime/register.js.map +1 -1
  475. package/dist/src/runtime/types.d.ts +7 -0
  476. package/dist/src/runtime/types.d.ts.map +1 -1
  477. package/dist/src/runtime/types.js.map +1 -1
  478. package/dist/src/schema/catalog-persistability.d.ts +19 -16
  479. package/dist/src/schema/catalog-persistability.d.ts.map +1 -1
  480. package/dist/src/schema/catalog-persistability.js +76 -20
  481. package/dist/src/schema/catalog-persistability.js.map +1 -1
  482. package/dist/src/schema/catalog.d.ts +67 -2
  483. package/dist/src/schema/catalog.d.ts.map +1 -1
  484. package/dist/src/schema/catalog.js +194 -3
  485. package/dist/src/schema/catalog.js.map +1 -1
  486. package/dist/src/schema/column.d.ts +26 -3
  487. package/dist/src/schema/column.d.ts.map +1 -1
  488. package/dist/src/schema/column.js.map +1 -1
  489. package/dist/src/schema/ddl-generator.d.ts.map +1 -1
  490. package/dist/src/schema/ddl-generator.js +19 -6
  491. package/dist/src/schema/ddl-generator.js.map +1 -1
  492. package/dist/src/schema/function.d.ts +40 -0
  493. package/dist/src/schema/function.d.ts.map +1 -1
  494. package/dist/src/schema/function.js +10 -2
  495. package/dist/src/schema/function.js.map +1 -1
  496. package/dist/src/schema/manager.d.ts +84 -7
  497. package/dist/src/schema/manager.d.ts.map +1 -1
  498. package/dist/src/schema/manager.js +153 -53
  499. package/dist/src/schema/manager.js.map +1 -1
  500. package/dist/src/schema/schema-differ.d.ts.map +1 -1
  501. package/dist/src/schema/schema-differ.js +104 -28
  502. package/dist/src/schema/schema-differ.js.map +1 -1
  503. package/dist/src/schema/table.d.ts +149 -1
  504. package/dist/src/schema/table.d.ts.map +1 -1
  505. package/dist/src/schema/table.js +248 -1
  506. package/dist/src/schema/table.js.map +1 -1
  507. package/dist/src/schema/unique-enforcement.d.ts +5 -3
  508. package/dist/src/schema/unique-enforcement.d.ts.map +1 -1
  509. package/dist/src/schema/unique-enforcement.js +5 -3
  510. package/dist/src/schema/unique-enforcement.js.map +1 -1
  511. package/dist/src/types/builtin-types.d.ts +16 -0
  512. package/dist/src/types/builtin-types.d.ts.map +1 -1
  513. package/dist/src/types/builtin-types.js +76 -12
  514. package/dist/src/types/builtin-types.js.map +1 -1
  515. package/dist/src/types/cast-semantics.d.ts +42 -0
  516. package/dist/src/types/cast-semantics.d.ts.map +1 -1
  517. package/dist/src/types/cast-semantics.js +64 -0
  518. package/dist/src/types/cast-semantics.js.map +1 -1
  519. package/dist/src/types/comparison-coercion.d.ts +101 -0
  520. package/dist/src/types/comparison-coercion.d.ts.map +1 -0
  521. package/dist/src/types/comparison-coercion.js +162 -0
  522. package/dist/src/types/comparison-coercion.js.map +1 -0
  523. package/dist/src/types/index.d.ts +2 -2
  524. package/dist/src/types/index.d.ts.map +1 -1
  525. package/dist/src/types/index.js +2 -2
  526. package/dist/src/types/index.js.map +1 -1
  527. package/dist/src/types/logical-type.d.ts +7 -0
  528. package/dist/src/types/logical-type.d.ts.map +1 -1
  529. package/dist/src/types/logical-type.js.map +1 -1
  530. package/dist/src/types/validation.d.ts +56 -0
  531. package/dist/src/types/validation.d.ts.map +1 -1
  532. package/dist/src/types/validation.js +68 -0
  533. package/dist/src/types/validation.js.map +1 -1
  534. package/dist/src/util/coercion.d.ts +8 -0
  535. package/dist/src/util/coercion.d.ts.map +1 -1
  536. package/dist/src/util/coercion.js +8 -0
  537. package/dist/src/util/coercion.js.map +1 -1
  538. package/dist/src/util/comparison.d.ts +41 -3
  539. package/dist/src/util/comparison.d.ts.map +1 -1
  540. package/dist/src/util/comparison.js +52 -5
  541. package/dist/src/util/comparison.js.map +1 -1
  542. package/dist/src/util/key-serializer.d.ts +46 -0
  543. package/dist/src/util/key-serializer.d.ts.map +1 -1
  544. package/dist/src/util/key-serializer.js +47 -0
  545. package/dist/src/util/key-serializer.js.map +1 -1
  546. package/dist/src/util/value-set.d.ts +21 -0
  547. package/dist/src/util/value-set.d.ts.map +1 -0
  548. package/dist/src/util/value-set.js +22 -0
  549. package/dist/src/util/value-set.js.map +1 -0
  550. package/dist/src/vtab/best-access-plan.d.ts +87 -0
  551. package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
  552. package/dist/src/vtab/best-access-plan.js +87 -0
  553. package/dist/src/vtab/best-access-plan.js.map +1 -1
  554. package/dist/src/vtab/capabilities.d.ts +1 -1
  555. package/dist/src/vtab/events.d.ts +5 -1
  556. package/dist/src/vtab/events.d.ts.map +1 -1
  557. package/dist/src/vtab/events.js.map +1 -1
  558. package/dist/src/vtab/memory/layer/alter-column.d.ts +147 -0
  559. package/dist/src/vtab/memory/layer/alter-column.d.ts.map +1 -0
  560. package/dist/src/vtab/memory/layer/alter-column.js +214 -0
  561. package/dist/src/vtab/memory/layer/alter-column.js.map +1 -0
  562. package/dist/src/vtab/memory/layer/base.d.ts +6 -4
  563. package/dist/src/vtab/memory/layer/base.d.ts.map +1 -1
  564. package/dist/src/vtab/memory/layer/base.js +10 -7
  565. package/dist/src/vtab/memory/layer/base.js.map +1 -1
  566. package/dist/src/vtab/memory/layer/interface.d.ts +2 -2
  567. package/dist/src/vtab/memory/layer/interface.d.ts.map +1 -1
  568. package/dist/src/vtab/memory/layer/manager.d.ts +232 -39
  569. package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
  570. package/dist/src/vtab/memory/layer/manager.js +657 -519
  571. package/dist/src/vtab/memory/layer/manager.js.map +1 -1
  572. package/dist/src/vtab/memory/layer/scan-layer.d.ts.map +1 -1
  573. package/dist/src/vtab/memory/layer/scan-layer.js +32 -5
  574. package/dist/src/vtab/memory/layer/scan-layer.js.map +1 -1
  575. package/dist/src/vtab/memory/layer/transaction.d.ts +111 -16
  576. package/dist/src/vtab/memory/layer/transaction.d.ts.map +1 -1
  577. package/dist/src/vtab/memory/layer/transaction.js +154 -51
  578. package/dist/src/vtab/memory/layer/transaction.js.map +1 -1
  579. package/dist/src/vtab/memory/module.d.ts +14 -2
  580. package/dist/src/vtab/memory/module.d.ts.map +1 -1
  581. package/dist/src/vtab/memory/module.js +53 -40
  582. package/dist/src/vtab/memory/module.js.map +1 -1
  583. package/dist/src/vtab/memory/table.d.ts +1 -1
  584. package/dist/src/vtab/memory/table.d.ts.map +1 -1
  585. package/dist/src/vtab/memory/table.js +15 -3
  586. package/dist/src/vtab/memory/table.js.map +1 -1
  587. package/dist/src/vtab/module.d.ts +51 -21
  588. package/dist/src/vtab/module.d.ts.map +1 -1
  589. package/dist/src/vtab/table.d.ts +10 -2
  590. package/dist/src/vtab/table.d.ts.map +1 -1
  591. package/dist/src/vtab/table.js +1 -1
  592. package/dist/src/vtab/table.js.map +1 -1
  593. package/package.json +3 -3
@@ -4,8 +4,24 @@
4
4
  */
5
5
  import type { ScalarPlanNode } from '../nodes/plan-node.js';
6
6
  import type { TableSchema } from '../../schema/table.js';
7
+ /**
8
+ * Resolves the attribute id of a column reference appearing in a predicate to the
9
+ * name of the base-table column whose statistics describe it.
10
+ *
11
+ * Returns undefined when the attribute was minted above the base table (a computed
12
+ * projection, an aggregate or window output, a set-operation output) — such a column
13
+ * has no base-table statistics, whatever it happens to be named.
14
+ */
15
+ export type ColumnStatsResolver = (attributeId: number) => string | undefined;
7
16
  /**
8
17
  * Statistics provider interface for optimizer
18
+ *
19
+ * The `resolve` parameter on the selectivity family identifies a predicate's columns
20
+ * by attribute identity rather than by the name in their AST. A caller holding a plan
21
+ * tree MUST pass one: without it a provider falls back to the syntactic name, and a
22
+ * computed column aliased to a base column's name silently borrows that column's
23
+ * statistics. It stays optional only for callers with no plan context (direct unit
24
+ * tests over hand-built nodes).
9
25
  */
10
26
  export interface StatsProvider {
11
27
  /**
@@ -18,17 +34,35 @@ export interface StatsProvider {
18
34
  * Get selectivity estimate for a predicate on a table
19
35
  * @param table Table schema
20
36
  * @param predicate Predicate expression
37
+ * @param resolve Attribute id → base-column name; see {@link ColumnStatsResolver}
21
38
  * @returns Selectivity factor (0.0 to 1.0), or undefined if unknown
22
39
  */
23
- selectivity(table: TableSchema, predicate: ScalarPlanNode): number | undefined;
40
+ selectivity(table: TableSchema, predicate: ScalarPlanNode, resolve?: ColumnStatsResolver): number | undefined;
41
+ /**
42
+ * Selectivity derived from REAL statistics only, with no heuristic fallback.
43
+ *
44
+ * `selectivity` always answers, substituting a fabricated per-nodeType guess when
45
+ * the catalog cannot say anything. Callers that must distinguish "the statistics
46
+ * say 0.25" from "nobody knows, here is 0.1" use this instead; undefined means the
47
+ * backing statistics could not answer. A provider that never fabricates may alias
48
+ * this to `selectivity`; one that only ever guesses should leave it unimplemented,
49
+ * which reads as "no real statistics".
50
+ *
51
+ * @param table Table schema
52
+ * @param predicate Predicate expression
53
+ * @param resolve Attribute id → base-column name; see {@link ColumnStatsResolver}
54
+ * @returns Selectivity factor (0.0 to 1.0), or undefined if real statistics cannot answer
55
+ */
56
+ statsOnlySelectivity?(table: TableSchema, predicate: ScalarPlanNode, resolve?: ColumnStatsResolver): number | undefined;
24
57
  /**
25
58
  * Get join selectivity estimate
26
59
  * @param leftTable Left table schema
27
60
  * @param rightTable Right table schema
28
61
  * @param joinCondition Join condition
62
+ * @param resolve Attribute id → base-column name; see {@link ColumnStatsResolver}
29
63
  * @returns Join selectivity factor, or undefined if unknown
30
64
  */
31
- joinSelectivity?(leftTable: TableSchema, rightTable: TableSchema, joinCondition: ScalarPlanNode): number | undefined;
65
+ joinSelectivity?(leftTable: TableSchema, rightTable: TableSchema, joinCondition: ScalarPlanNode, resolve?: ColumnStatsResolver): number | undefined;
32
66
  /**
33
67
  * Get number of distinct values for a column
34
68
  * @param table Table schema
@@ -1 +1 @@
1
- {"version":3,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W;gBACf,OAAO,GAAG,CAAC,CAAC,oCAAoC;YACjD;gBACC,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACjC,CAAC;IACF,CAAC;CACD;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAE7D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAClC,YAAkC,EAClC,cAAoC;IAEpC,OAAO,IAAI;QACV,SAAS,CAAC,KAAkB;YAC3B,OAAO,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/E,CAAC;QAED,WAAW,CAAC,KAAkB,EAAE,SAAyB;YACxD,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;YAClD,OAAO,cAAc,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,oBAAoB,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACvF,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Selectivity combinators.
3
+ *
4
+ * Pure numeric helpers that fold a list of per-conjunct / per-disjunct
5
+ * selectivities into a single factor. No plan-node knowledge lives here — the
6
+ * caller ({@link CatalogStatsProvider}) walks the boolean structure and hands
7
+ * these functions plain numbers.
8
+ *
9
+ * ## Why exponential backoff rather than plain independence
10
+ *
11
+ * The textbook conjunction model assumes independent predicates and multiplies:
12
+ * `Πsᵢ`. That collapses fast — five conditions at 0.1 each give 1e-5, i.e. "no
13
+ * rows" for any realistic table. Real-world predicates are correlated far more
14
+ * often than not (`city = 'Seattle' and state = 'WA'`), so the plain product
15
+ * systematically *under*-estimates surviving rows and pushes the optimizer into
16
+ * pathological plans (nested loops over what is actually a large intermediate).
17
+ *
18
+ * Instead we sort ascending (most selective first) and damp each subsequent
19
+ * factor by taking successive square roots:
20
+ *
21
+ * ```
22
+ * s₁ · s₂^(1/2) · s₃^(1/4) · s₄^(1/8)
23
+ * ```
24
+ *
25
+ * This is the model SQL Server has used by default since 2014. It needs no
26
+ * correlation statistics, degrades gracefully as conjunct count grows, and is
27
+ * identical to plain independence for a single conjunct. Conjuncts past
28
+ * {@link BACKOFF_CONJUNCT_LIMIT} are dropped rather than multiplied in: they are
29
+ * the *least* selective ones, so their damped exponent would contribute almost
30
+ * nothing anyway.
31
+ *
32
+ * Disjunction uses straight independence (`1 - Π(1 - sᵢ)`), which errs toward
33
+ * over-estimating rows — the safe direction for plan choice.
34
+ */
35
+ /** How many conjuncts participate in the damped product; the rest are dropped. */
36
+ export declare const BACKOFF_CONJUNCT_LIMIT = 4;
37
+ /**
38
+ * Combine AND-ed selectivities using exponential backoff (see file doc-comment).
39
+ *
40
+ * Inputs and result are clamped to [0, 1]; input order does not matter. An empty
41
+ * list is not expected — callers gate on a non-empty list — and returns 1 (the
42
+ * conjunctive identity: no reduction claimed).
43
+ */
44
+ export declare function combineConjunctive(selectivities: readonly number[]): number;
45
+ /**
46
+ * Combine OR-ed selectivities assuming independence: `1 - Π(1 - sᵢ)`.
47
+ *
48
+ * Inputs and result are clamped to [0, 1]. An empty list is not expected —
49
+ * callers gate on a non-empty list — and returns 0 (the disjunctive identity:
50
+ * nothing survives).
51
+ */
52
+ export declare function combineDisjunctive(selectivities: readonly number[]): number;
53
+ //# sourceMappingURL=selectivity-combine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectivity-combine.d.ts","sourceRoot":"","sources":["../../../../src/planner/stats/selectivity-combine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAOxC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAW3E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAQ3E"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Selectivity combinators.
3
+ *
4
+ * Pure numeric helpers that fold a list of per-conjunct / per-disjunct
5
+ * selectivities into a single factor. No plan-node knowledge lives here — the
6
+ * caller ({@link CatalogStatsProvider}) walks the boolean structure and hands
7
+ * these functions plain numbers.
8
+ *
9
+ * ## Why exponential backoff rather than plain independence
10
+ *
11
+ * The textbook conjunction model assumes independent predicates and multiplies:
12
+ * `Πsᵢ`. That collapses fast — five conditions at 0.1 each give 1e-5, i.e. "no
13
+ * rows" for any realistic table. Real-world predicates are correlated far more
14
+ * often than not (`city = 'Seattle' and state = 'WA'`), so the plain product
15
+ * systematically *under*-estimates surviving rows and pushes the optimizer into
16
+ * pathological plans (nested loops over what is actually a large intermediate).
17
+ *
18
+ * Instead we sort ascending (most selective first) and damp each subsequent
19
+ * factor by taking successive square roots:
20
+ *
21
+ * ```
22
+ * s₁ · s₂^(1/2) · s₃^(1/4) · s₄^(1/8)
23
+ * ```
24
+ *
25
+ * This is the model SQL Server has used by default since 2014. It needs no
26
+ * correlation statistics, degrades gracefully as conjunct count grows, and is
27
+ * identical to plain independence for a single conjunct. Conjuncts past
28
+ * {@link BACKOFF_CONJUNCT_LIMIT} are dropped rather than multiplied in: they are
29
+ * the *least* selective ones, so their damped exponent would contribute almost
30
+ * nothing anyway.
31
+ *
32
+ * Disjunction uses straight independence (`1 - Π(1 - sᵢ)`), which errs toward
33
+ * over-estimating rows — the safe direction for plan choice.
34
+ */
35
+ /** How many conjuncts participate in the damped product; the rest are dropped. */
36
+ export const BACKOFF_CONJUNCT_LIMIT = 4;
37
+ /** Clamp a selectivity into the valid [0, 1] range. */
38
+ function clamp(selectivity) {
39
+ return Math.min(1, Math.max(0, selectivity));
40
+ }
41
+ /**
42
+ * Combine AND-ed selectivities using exponential backoff (see file doc-comment).
43
+ *
44
+ * Inputs and result are clamped to [0, 1]; input order does not matter. An empty
45
+ * list is not expected — callers gate on a non-empty list — and returns 1 (the
46
+ * conjunctive identity: no reduction claimed).
47
+ */
48
+ export function combineConjunctive(selectivities) {
49
+ if (selectivities.length === 0)
50
+ return 1;
51
+ const sorted = selectivities.map(clamp).sort((a, b) => a - b);
52
+ const participating = sorted.slice(0, BACKOFF_CONJUNCT_LIMIT);
53
+ let result = 1;
54
+ for (let i = 0; i < participating.length; i++) {
55
+ result *= Math.pow(participating[i], 1 / Math.pow(2, i));
56
+ }
57
+ return clamp(result);
58
+ }
59
+ /**
60
+ * Combine OR-ed selectivities assuming independence: `1 - Π(1 - sᵢ)`.
61
+ *
62
+ * Inputs and result are clamped to [0, 1]. An empty list is not expected —
63
+ * callers gate on a non-empty list — and returns 0 (the disjunctive identity:
64
+ * nothing survives).
65
+ */
66
+ export function combineDisjunctive(selectivities) {
67
+ if (selectivities.length === 0)
68
+ return 0;
69
+ let complement = 1;
70
+ for (const s of selectivities) {
71
+ complement *= 1 - clamp(s);
72
+ }
73
+ return clamp(1 - complement);
74
+ }
75
+ //# sourceMappingURL=selectivity-combine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectivity-combine.js","sourceRoot":"","sources":["../../../../src/planner/stats/selectivity-combine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,kFAAkF;AAClF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,uDAAuD;AACvD,SAAS,KAAK,CAAC,WAAmB;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,aAAgC;IAClE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAEzC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9D,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;IAE9D,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/C,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,aAAgC;IAClE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAEzC,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,KAAK,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC;QAC/B,UAAU,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Shared base-table row-count helper.
3
+ *
4
+ * Statistics-first: prefer the `ANALYZE`-collected `rowCount` over the static
5
+ * `TableSchema.estimatedRows` field (which `SchemaManager` hardcodes to 0 at
6
+ * CREATE TABLE and never updates). `undefined` means "nobody knows" and must
7
+ * stay `undefined` — callers apply their own fallback (e.g. NaiveStatsProvider's
8
+ * default of 1000); folding that default in here would change every
9
+ * un-analyzed table's cardinality.
10
+ *
11
+ * `TableReferenceNode.estimatedRows` and `CatalogStatsProvider.tableRows` both
12
+ * call this so the logical/physical estimate and the stats-provider estimate
13
+ * cannot drift apart.
14
+ *
15
+ * NOTE: `rowCount` is a snapshot from the last `ANALYZE` — rows written
16
+ * afterwards are invisible until the next one.
17
+ *
18
+ * NOTE: a real 0 (analyzed, empty table) is distinct from `undefined`, but the
19
+ * `estimatedRows || default` spellings in `rule-select-access-path`,
20
+ * `rule-grow-retrieve` and `IndexSeekNode.computePhysical` collapse the two and
21
+ * substitute their default — so an analyzed empty table reaches
22
+ * `getBestAccessPlan` as "unknown" (1000) while a SeqScan over it reports 0.
23
+ * Harmless today (any plan over 0 rows is cheap); switch those to `??` if an
24
+ * empty-table plan ever costs out wrong.
25
+ */
26
+ import type { TableSchema } from '../../schema/table.js';
27
+ export declare function catalogRowCount(table: TableSchema): number | undefined;
28
+ //# sourceMappingURL=table-cardinality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-cardinality.d.ts","sourceRoot":"","sources":["../../../../src/planner/stats/table-cardinality.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAEtE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Shared base-table row-count helper.
3
+ *
4
+ * Statistics-first: prefer the `ANALYZE`-collected `rowCount` over the static
5
+ * `TableSchema.estimatedRows` field (which `SchemaManager` hardcodes to 0 at
6
+ * CREATE TABLE and never updates). `undefined` means "nobody knows" and must
7
+ * stay `undefined` — callers apply their own fallback (e.g. NaiveStatsProvider's
8
+ * default of 1000); folding that default in here would change every
9
+ * un-analyzed table's cardinality.
10
+ *
11
+ * `TableReferenceNode.estimatedRows` and `CatalogStatsProvider.tableRows` both
12
+ * call this so the logical/physical estimate and the stats-provider estimate
13
+ * cannot drift apart.
14
+ *
15
+ * NOTE: `rowCount` is a snapshot from the last `ANALYZE` — rows written
16
+ * afterwards are invisible until the next one.
17
+ *
18
+ * NOTE: a real 0 (analyzed, empty table) is distinct from `undefined`, but the
19
+ * `estimatedRows || default` spellings in `rule-select-access-path`,
20
+ * `rule-grow-retrieve` and `IndexSeekNode.computePhysical` collapse the two and
21
+ * substitute their default — so an analyzed empty table reaches
22
+ * `getBestAccessPlan` as "unknown" (1000) while a SeqScan over it reports 0.
23
+ * Harmless today (any plan over 0 rows is cheap); switch those to `??` if an
24
+ * empty-table plan ever costs out wrong.
25
+ */
26
+ export function catalogRowCount(table) {
27
+ return table.statistics?.rowCount ?? table.estimatedRows;
28
+ }
29
+ //# sourceMappingURL=table-cardinality.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-cardinality.js","sourceRoot":"","sources":["../../../../src/planner/stats/table-cardinality.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,MAAM,UAAU,eAAe,CAAC,KAAkB;IACjD,OAAO,KAAK,CAAC,UAAU,EAAE,QAAQ,IAAI,KAAK,CAAC,aAAa,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Column origin attribution.
3
+ *
4
+ * Maps every output attribute id reachable under a relational subtree back to the
5
+ * base-table column that minted it. `rule-filter-selectivity` uses this to route
6
+ * each conjunct of a filter-over-join predicate to the statistics of the table its
7
+ * columns actually come from, instead of declining the whole filter because its
8
+ * source spans more than one table.
9
+ *
10
+ * ## Identity — not schema — distinguishes the two sides of a self-join
11
+ *
12
+ * `ColumnOrigin.relation` is an opaque token standing for ONE instance of a relation
13
+ * in the plan. `from t a join t b` yields two distinct TableReferenceNodes sharing
14
+ * ONE `TableSchema` object, so a caller asking "how many relations does this
15
+ * expression touch?" must key on `relation` identity. Keying on `table` collapses the
16
+ * two sides and mis-classifies `a.age > b.age` as a single-table predicate
17
+ * comparing a column to a constant.
18
+ *
19
+ * ## Attributes minted above a base table are deliberately absent
20
+ *
21
+ * Computed projections, aggregate outputs, `values` rows and join existence flags
22
+ * never appear in the map. A predicate over one of them has no base-table column
23
+ * statistics to consult, so the caller must treat it as unknown rather than
24
+ * mis-attribute it by column name.
25
+ *
26
+ * ## Row-merging operators are opaque
27
+ *
28
+ * A set operation and a recursive CTE both *forward* their left / base-case branch's
29
+ * attribute ids (see `analysis/attribute-provenance.ts`), but the rows behind those
30
+ * ids come from every branch. `union all` of a 4-distinct-value column with a
31
+ * 1000-distinct-value one publishes the left branch's id while carrying both
32
+ * distributions, so attributing it to the left base table alone would hand the
33
+ * caller one branch's statistics as if they described the whole relation. The walk
34
+ * therefore stops at such a node and records nothing beneath it — a conjunct over a
35
+ * union reads as unknown, exactly like one over a computed projection.
36
+ *
37
+ * `rule-async-gather-union-all` rewrites a unionAll set operation into an
38
+ * `AsyncGatherNode` that forwards the same ids, so `isRowMerging` recognises that
39
+ * gather too — see `row-population.ts`.
40
+ *
41
+ * ## A CTE reference republishes its body's columns under its own relation instance
42
+ *
43
+ * `CTEReferenceNode` mints FRESH attribute ids for every column it republishes
44
+ * (`cte-reference-node.ts`), so the walk cannot simply descend through it: nothing
45
+ * above would land in the map. It instead maps the body's origins positionally onto
46
+ * the reference's own ids — but under a relation token minted PER REFERENCE, because
47
+ * two references to one `with` clause share a single body subtree. Pairing them with
48
+ * the body's own relation tokens would make both arms of a CTE self-join the same
49
+ * relation, and `rule-filter-selectivity` would read `a.qty > b.qty` as a
50
+ * single-relation predicate comparing a column to a constant.
51
+ */
52
+ import type { RelationalPlanNode } from '../nodes/plan-node.js';
53
+ import type { TableSchema } from '../../schema/table.js';
54
+ /**
55
+ * Identity of one *instance* of a relation in the plan — compared by reference and
56
+ * never dereferenced. A `TableReferenceNode` is its own instance; a CTE reference
57
+ * mints one per (reference, underlying relation) pair so that two references to the
58
+ * same `with` clause stay distinguishable.
59
+ */
60
+ export type RelationInstance = object;
61
+ /** Where a single attribute came from: a column of a specific relation instance. */
62
+ export interface ColumnOrigin {
63
+ /** The relation instance that published this attribute — identity is significant. */
64
+ readonly relation: RelationInstance;
65
+ readonly table: TableSchema;
66
+ readonly columnIndex: number;
67
+ readonly columnName: string;
68
+ }
69
+ /**
70
+ * Attribute id → originating base-table column, for every base column reachable
71
+ * under `node` via `getRelations()`.
72
+ *
73
+ * The walk descends relations only, so scalar subqueries hanging off a join
74
+ * condition or a filter predicate are NOT traversed — their columns stay out of
75
+ * the map and any conjunct referencing them reads as unknown. It also stops at a
76
+ * row-merging operator and at a CTE reference (see the file doc-comment).
77
+ */
78
+ export declare function collectColumnOrigins(node: RelationalPlanNode): Map<number, ColumnOrigin>;
79
+ //# sourceMappingURL=column-origins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-origins.d.ts","sourceRoot":"","sources":["../../../../src/planner/util/column-origins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAKH,OAAO,KAAK,EAAY,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC5B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAKD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAExF"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Column origin attribution.
3
+ *
4
+ * Maps every output attribute id reachable under a relational subtree back to the
5
+ * base-table column that minted it. `rule-filter-selectivity` uses this to route
6
+ * each conjunct of a filter-over-join predicate to the statistics of the table its
7
+ * columns actually come from, instead of declining the whole filter because its
8
+ * source spans more than one table.
9
+ *
10
+ * ## Identity — not schema — distinguishes the two sides of a self-join
11
+ *
12
+ * `ColumnOrigin.relation` is an opaque token standing for ONE instance of a relation
13
+ * in the plan. `from t a join t b` yields two distinct TableReferenceNodes sharing
14
+ * ONE `TableSchema` object, so a caller asking "how many relations does this
15
+ * expression touch?" must key on `relation` identity. Keying on `table` collapses the
16
+ * two sides and mis-classifies `a.age > b.age` as a single-table predicate
17
+ * comparing a column to a constant.
18
+ *
19
+ * ## Attributes minted above a base table are deliberately absent
20
+ *
21
+ * Computed projections, aggregate outputs, `values` rows and join existence flags
22
+ * never appear in the map. A predicate over one of them has no base-table column
23
+ * statistics to consult, so the caller must treat it as unknown rather than
24
+ * mis-attribute it by column name.
25
+ *
26
+ * ## Row-merging operators are opaque
27
+ *
28
+ * A set operation and a recursive CTE both *forward* their left / base-case branch's
29
+ * attribute ids (see `analysis/attribute-provenance.ts`), but the rows behind those
30
+ * ids come from every branch. `union all` of a 4-distinct-value column with a
31
+ * 1000-distinct-value one publishes the left branch's id while carrying both
32
+ * distributions, so attributing it to the left base table alone would hand the
33
+ * caller one branch's statistics as if they described the whole relation. The walk
34
+ * therefore stops at such a node and records nothing beneath it — a conjunct over a
35
+ * union reads as unknown, exactly like one over a computed projection.
36
+ *
37
+ * `rule-async-gather-union-all` rewrites a unionAll set operation into an
38
+ * `AsyncGatherNode` that forwards the same ids, so `isRowMerging` recognises that
39
+ * gather too — see `row-population.ts`.
40
+ *
41
+ * ## A CTE reference republishes its body's columns under its own relation instance
42
+ *
43
+ * `CTEReferenceNode` mints FRESH attribute ids for every column it republishes
44
+ * (`cte-reference-node.ts`), so the walk cannot simply descend through it: nothing
45
+ * above would land in the map. It instead maps the body's origins positionally onto
46
+ * the reference's own ids — but under a relation token minted PER REFERENCE, because
47
+ * two references to one `with` clause share a single body subtree. Pairing them with
48
+ * the body's own relation tokens would make both arms of a CTE self-join the same
49
+ * relation, and `rule-filter-selectivity` would read `a.qty > b.qty` as a
50
+ * single-relation predicate comparing a column to a constant.
51
+ */
52
+ import { TableReferenceNode } from '../nodes/reference.js';
53
+ import { CTEReferenceNode } from '../nodes/cte-reference-node.js';
54
+ import { isRowMerging } from './row-population.js';
55
+ /**
56
+ * Attribute id → originating base-table column, for every base column reachable
57
+ * under `node` via `getRelations()`.
58
+ *
59
+ * The walk descends relations only, so scalar subqueries hanging off a join
60
+ * condition or a filter predicate are NOT traversed — their columns stay out of
61
+ * the map and any conjunct referencing them reads as unknown. It also stops at a
62
+ * row-merging operator and at a CTE reference (see the file doc-comment).
63
+ */
64
+ export function collectColumnOrigins(node) {
65
+ return collect(node, new Map());
66
+ }
67
+ function collect(node, bodies) {
68
+ const origins = new Map();
69
+ // Plan trees are DAGs (a CTE instance can be shared), so dedupe by identity.
70
+ const visited = new Set();
71
+ const stack = [node];
72
+ while (stack.length > 0) {
73
+ const n = stack.pop();
74
+ if (visited.has(n))
75
+ continue;
76
+ visited.add(n);
77
+ if (n instanceof TableReferenceNode) {
78
+ addBaseColumns(n, origins);
79
+ continue;
80
+ }
81
+ if (n instanceof CTEReferenceNode) {
82
+ // Deliberately NOT descended: the body publishes ids this node does not
83
+ // expose, and the body may be shared with a sibling reference.
84
+ addCTEColumns(n, origins, bodies);
85
+ continue;
86
+ }
87
+ if (isRowMerging(n))
88
+ continue;
89
+ for (const rel of n.getRelations())
90
+ stack.push(rel);
91
+ }
92
+ return origins;
93
+ }
94
+ /** Zip a table reference's attributes with its schema columns (1:1 by construction). */
95
+ function addBaseColumns(ref, out) {
96
+ // TableReferenceNode builds its attributes by mapping `tableSchema.columns`
97
+ // positionally (see reference.ts), so index i describes the same column in both
98
+ // lists — the same zip `computePhysical` uses to seed update lineage.
99
+ const attrs = ref.getAttributes();
100
+ ref.tableSchema.columns.forEach((col, i) => {
101
+ const attr = attrs[i];
102
+ if (!attr)
103
+ return;
104
+ out.set(attr.id, { relation: ref, table: ref.tableSchema, columnIndex: i, columnName: col.name });
105
+ });
106
+ }
107
+ /**
108
+ * Re-publish a CTE body's origins under this reference's own attribute ids and its
109
+ * own relation instances.
110
+ *
111
+ * `CTEReferenceNode.buildAttributes` maps `CTENode.getAttributes()` one for one and
112
+ * `CTENode` forwards its source's attribute ids verbatim, so index i names the same
113
+ * column on both sides. Columns the body computed (or could not attribute) simply
114
+ * have no entry, exactly as for the equivalent inline subquery.
115
+ */
116
+ function addCTEColumns(ref, out, bodies) {
117
+ const body = ref.source;
118
+ // A recursive CTE's rows come from its base case AND its recursive case, so no
119
+ // base-table column describes them — same reasoning as a set operation.
120
+ if (isRowMerging(body))
121
+ return;
122
+ const bodyOrigins = bodyOriginsOf(body, bodies);
123
+ if (bodyOrigins.size === 0)
124
+ return;
125
+ // One fresh instance per underlying relation, minted for THIS reference: two
126
+ // references to one CTE must never share an instance.
127
+ const instances = new Map();
128
+ const bodyAttrs = body.getAttributes();
129
+ ref.getAttributes().forEach((attr, i) => {
130
+ const bodyAttr = bodyAttrs[i];
131
+ const origin = bodyAttr && bodyOrigins.get(bodyAttr.id);
132
+ if (!origin)
133
+ return;
134
+ let instance = instances.get(origin.relation);
135
+ if (!instance) {
136
+ instance = {};
137
+ instances.set(origin.relation, instance);
138
+ }
139
+ out.set(attr.id, { ...origin, relation: instance });
140
+ });
141
+ }
142
+ function bodyOriginsOf(body, bodies) {
143
+ const cached = bodies.get(body);
144
+ if (cached)
145
+ return cached;
146
+ const computed = collect(body, bodies);
147
+ bodies.set(body, computed);
148
+ return computed;
149
+ }
150
+ //# sourceMappingURL=column-origins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-origins.js","sourceRoot":"","sources":["../../../../src/planner/util/column-origins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EA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YAAE,OAAO;QACpB,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,QAAQ,GAAG,EAAE,CAAC;YACd,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC1C,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,IAAwB,EAAE,MAAuB;IACvE,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3B,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -328,18 +328,42 @@ export interface EqualityFds {
328
328
  *
329
329
  * Non-equality conjuncts contribute nothing.
330
330
  *
331
- * **Collation gate.** Every extracted fact is a VALUE-level claim (a pinned
332
- * column has one value across rows; `col1 = col2` rows are value-equal), so a
333
- * conjunct only contributes when its comparison is value-discriminating
334
- * (`isValueDiscriminatingEquality`): for textual operands the effective
335
- * comparison collation must be BINARY. A NOCASE/RTRIM comparison — via a
336
- * `COLLATE` wrapper on either side or a non-BINARY declared column collation —
337
- * passes value-DIFFERENT rows ('Bob' = 'bob' NOCASE), so its facts would
338
- * over-claim (false ≤1-row keys, false EC-driven inferences, wrong insert
331
+ * **Collation gate (all shapes).** Every extracted fact is a VALUE-level claim
332
+ * (a pinned column has one value across rows; `col1 = col2` rows are
333
+ * value-equal), so a conjunct only contributes when its comparison is
334
+ * value-discriminating (`isValueDiscriminatingEquality`): for textual operands
335
+ * the effective comparison collation must be BINARY. A NOCASE/RTRIM comparison —
336
+ * via a `COLLATE` wrapper on either side or a non-BINARY declared column
337
+ * collation — passes value-DIFFERENT rows ('Bob' = 'bob' NOCASE), so its facts
338
+ * would over-claim (false ≤1-row keys, false EC-driven inferences, wrong insert
339
339
  * defaults — ticket `collation-blind-equality-fact-extraction`). Declared-
340
340
  * collation covered-key ≤1-row detection is NOT lost: it flows through the
341
341
  * independent (and collation-sound) `extractConstraints` path in
342
342
  * `FilterNode.computePhysical`.
343
+ *
344
+ * **Semantic-ordering gate (`col1 = col2` ONLY).** A few logical types compare
345
+ * by meaning rather than by stored text (`timespan`: 'PT1H' = 'PT60M'; `json`:
346
+ * '{"a":1}' = '{ "a" : 1 }'). For a MIXED pair — `d timespan = s text` — the
347
+ * mirror FDs and the equivalence class are both FALSE: two surviving rows can
348
+ * agree on `d` (same elapsed time) while disagreeing on `s` (distinct strings),
349
+ * because the two columns have no common notion of "same value". So the col=col
350
+ * arm additionally requires `semanticOrderingsAgree` on the two declared logical
351
+ * types, mirroring the two join-side extractors that mint the same kind of fact
352
+ * (`extractEquiPairsFromCondition` in `nodes/join-node.ts`, `extractEquiPairs`
353
+ * in `rules/join/equi-pair-extractor.ts`). Same-type pairs (`timespan =
354
+ * timespan`) stay admitted — under the type's own identity both facts hold.
355
+ * Invariant OPT-051; ticket `debt-filter-equality-facts-ignore-semantic-ordering`.
356
+ *
357
+ * **The constant-pin arms are deliberately NOT semantic-ordering-gated.** This is
358
+ * intentional, not an oversight. `where d = 'PT60M'` keeps every row whose `d` is
359
+ * one hour whatever text it stores, and under the engine's identity for a
360
+ * `timespan` column — the same identity `distinct`/`group by`/`unique` use —
361
+ * those rows all hold *the same value*, so `∅ → d` is true. The
362
+ * `ConstantBinding` claim is likewise true as defined (see its declaration in
363
+ * `nodes/plan-node.ts`): the column *compares equal to* the bound value under its
364
+ * own comparison. Gating this arm would decline EVERY constant pin on a
365
+ * `timespan`/`json` column (a literal never declares a semantic-ordering type),
366
+ * losing real optimizations to "fix" a claim that is not wrong.
343
367
  */
344
368
  export declare function extractEqualityFds(predicate: ScalarPlanNode, attrIdToIndex: ReadonlyMap<number, number>): EqualityFds;
345
369
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"fd-utils.d.ts","sourceRoot":"","sources":["../../../../src/planner/util/fd-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAe,cAAc,EAAE,mBAAmB,EAAE,SAAS,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrN,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAW7D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,GAAG,EAAE,aAAa,CAAC,oBAAoB,CAAC,GACtC,GAAG,CAAC,MAAM,CAAC,CAkBb;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC7B,GAAG,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,EACzC,GAAG,EAAE,aAAa,CAAC,oBAAoB,CAAC,GACtC,oBAAoB,EAAE,CAYxB;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CACzB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,EAC3B,GAAG,EAAE,aAAa,CAAC,oBAAoB,CAAC,GACtC,OAAO,CAOT;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,GAAG,EAAE,aAAa,CAAC,oBAAoB,CAAC,GACtC,GAAG,CAAC,MAAM,CAAC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