@milaboratories/pl-model-common 1.25.1 → 1.25.3

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 (288) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/author_marker.d.ts +9 -6
  3. package/dist/base32_encode.cjs +40 -46
  4. package/dist/base32_encode.cjs.map +1 -1
  5. package/dist/base32_encode.js +40 -45
  6. package/dist/base32_encode.js.map +1 -1
  7. package/dist/base64.cjs +5 -4
  8. package/dist/base64.cjs.map +1 -1
  9. package/dist/base64.d.ts +10 -6
  10. package/dist/base64.js +5 -3
  11. package/dist/base64.js.map +1 -1
  12. package/dist/block_state.d.ts +21 -23
  13. package/dist/bmodel/block_config.cjs +9 -10
  14. package/dist/bmodel/block_config.cjs.map +1 -1
  15. package/dist/bmodel/block_config.d.ts +53 -72
  16. package/dist/bmodel/block_config.js +9 -9
  17. package/dist/bmodel/block_config.js.map +1 -1
  18. package/dist/bmodel/code.cjs +7 -6
  19. package/dist/bmodel/code.cjs.map +1 -1
  20. package/dist/bmodel/code.d.ts +17 -13
  21. package/dist/bmodel/code.js +6 -4
  22. package/dist/bmodel/code.js.map +1 -1
  23. package/dist/bmodel/container.d.ts +46 -44
  24. package/dist/bmodel/index.cjs +3 -0
  25. package/dist/bmodel/index.d.ts +5 -6
  26. package/dist/bmodel/index.js +3 -0
  27. package/dist/bmodel/normalization.cjs +90 -106
  28. package/dist/bmodel/normalization.cjs.map +1 -1
  29. package/dist/bmodel/normalization.d.ts +7 -3
  30. package/dist/bmodel/normalization.js +90 -105
  31. package/dist/bmodel/normalization.js.map +1 -1
  32. package/dist/bmodel/types.d.ts +4 -1
  33. package/dist/branding.d.ts +5 -5
  34. package/dist/common_types.d.ts +19 -15
  35. package/dist/driver_kit.d.ts +25 -17
  36. package/dist/drivers/ChunkedStreamReader.cjs +168 -203
  37. package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
  38. package/dist/drivers/ChunkedStreamReader.d.ts +104 -100
  39. package/dist/drivers/ChunkedStreamReader.js +168 -202
  40. package/dist/drivers/ChunkedStreamReader.js.map +1 -1
  41. package/dist/drivers/blob.cjs +15 -17
  42. package/dist/drivers/blob.cjs.map +1 -1
  43. package/dist/drivers/blob.d.ts +35 -35
  44. package/dist/drivers/blob.js +14 -15
  45. package/dist/drivers/blob.js.map +1 -1
  46. package/dist/drivers/index.cjs +18 -0
  47. package/dist/drivers/index.d.ts +29 -9
  48. package/dist/drivers/index.js +18 -0
  49. package/dist/drivers/interfaces.d.ts +17 -14
  50. package/dist/drivers/log.cjs +4 -3
  51. package/dist/drivers/log.cjs.map +1 -1
  52. package/dist/drivers/log.d.ts +52 -49
  53. package/dist/drivers/log.js +4 -2
  54. package/dist/drivers/log.js.map +1 -1
  55. package/dist/drivers/ls.cjs +16 -19
  56. package/dist/drivers/ls.cjs.map +1 -1
  57. package/dist/drivers/ls.d.ts +73 -76
  58. package/dist/drivers/ls.js +16 -17
  59. package/dist/drivers/ls.js.map +1 -1
  60. package/dist/drivers/pframe/column_filter.d.ts +19 -15
  61. package/dist/drivers/pframe/data_info.cjs +201 -252
  62. package/dist/drivers/pframe/data_info.cjs.map +1 -1
  63. package/dist/drivers/pframe/data_info.d.ts +84 -109
  64. package/dist/drivers/pframe/data_info.js +201 -250
  65. package/dist/drivers/pframe/data_info.js.map +1 -1
  66. package/dist/drivers/pframe/data_types.cjs +38 -63
  67. package/dist/drivers/pframe/data_types.cjs.map +1 -1
  68. package/dist/drivers/pframe/data_types.d.ts +91 -93
  69. package/dist/drivers/pframe/data_types.js +38 -61
  70. package/dist/drivers/pframe/data_types.js.map +1 -1
  71. package/dist/drivers/pframe/driver.cjs +7 -0
  72. package/dist/drivers/pframe/driver.cjs.map +1 -0
  73. package/dist/drivers/pframe/driver.d.ts +50 -45
  74. package/dist/drivers/pframe/driver.js +6 -0
  75. package/dist/drivers/pframe/driver.js.map +1 -0
  76. package/dist/drivers/pframe/filter_spec.d.ts +127 -123
  77. package/dist/drivers/pframe/find_columns.d.ts +21 -17
  78. package/dist/drivers/pframe/index.cjs +15 -0
  79. package/dist/drivers/pframe/index.d.ts +23 -16
  80. package/dist/drivers/pframe/index.js +15 -0
  81. package/dist/drivers/pframe/linker_columns.cjs +184 -238
  82. package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
  83. package/dist/drivers/pframe/linker_columns.d.ts +45 -38
  84. package/dist/drivers/pframe/linker_columns.js +184 -236
  85. package/dist/drivers/pframe/linker_columns.js.map +1 -1
  86. package/dist/drivers/pframe/pframe.d.ts +26 -21
  87. package/dist/drivers/pframe/query/index.cjs +1 -0
  88. package/dist/drivers/pframe/query/index.d.ts +3 -4
  89. package/dist/drivers/pframe/query/index.js +1 -0
  90. package/dist/drivers/pframe/query/query_common.d.ts +205 -247
  91. package/dist/drivers/pframe/query/query_data.d.ts +25 -23
  92. package/dist/drivers/pframe/query/query_spec.d.ts +30 -29
  93. package/dist/drivers/pframe/query/utils.cjs +164 -183
  94. package/dist/drivers/pframe/query/utils.cjs.map +1 -1
  95. package/dist/drivers/pframe/query/utils.d.ts +13 -12
  96. package/dist/drivers/pframe/query/utils.js +164 -181
  97. package/dist/drivers/pframe/query/utils.js.map +1 -1
  98. package/dist/drivers/pframe/spec/anchored.cjs +178 -216
  99. package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
  100. package/dist/drivers/pframe/spec/anchored.d.ts +53 -49
  101. package/dist/drivers/pframe/spec/anchored.js +176 -214
  102. package/dist/drivers/pframe/spec/anchored.js.map +1 -1
  103. package/dist/drivers/pframe/spec/filtered_column.cjs +8 -7
  104. package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
  105. package/dist/drivers/pframe/spec/filtered_column.d.ts +20 -17
  106. package/dist/drivers/pframe/spec/filtered_column.js +8 -6
  107. package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
  108. package/dist/drivers/pframe/spec/ids.cjs +16 -14
  109. package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
  110. package/dist/drivers/pframe/spec/ids.d.ts +13 -8
  111. package/dist/drivers/pframe/spec/ids.js +14 -12
  112. package/dist/drivers/pframe/spec/ids.js.map +1 -1
  113. package/dist/drivers/pframe/spec/index.cjs +6 -0
  114. package/dist/drivers/pframe/spec/index.d.ts +6 -7
  115. package/dist/drivers/pframe/spec/index.js +6 -0
  116. package/dist/drivers/pframe/spec/native_id.cjs +16 -16
  117. package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
  118. package/dist/drivers/pframe/spec/native_id.d.ts +9 -4
  119. package/dist/drivers/pframe/spec/native_id.js +13 -13
  120. package/dist/drivers/pframe/spec/native_id.js.map +1 -1
  121. package/dist/drivers/pframe/spec/selectors.cjs +72 -112
  122. package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
  123. package/dist/drivers/pframe/spec/selectors.d.ts +99 -94
  124. package/dist/drivers/pframe/spec/selectors.js +72 -110
  125. package/dist/drivers/pframe/spec/selectors.js.map +1 -1
  126. package/dist/drivers/pframe/spec/spec.cjs +282 -324
  127. package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
  128. package/dist/drivers/pframe/spec/spec.d.ts +263 -272
  129. package/dist/drivers/pframe/spec/spec.js +281 -322
  130. package/dist/drivers/pframe/spec/spec.js.map +1 -1
  131. package/dist/drivers/pframe/table.d.ts +28 -24
  132. package/dist/drivers/pframe/table_calculate.cjs +117 -147
  133. package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
  134. package/dist/drivers/pframe/table_calculate.d.ts +219 -220
  135. package/dist/drivers/pframe/table_calculate.js +117 -145
  136. package/dist/drivers/pframe/table_calculate.js.map +1 -1
  137. package/dist/drivers/pframe/table_common.cjs +13 -14
  138. package/dist/drivers/pframe/table_common.cjs.map +1 -1
  139. package/dist/drivers/pframe/table_common.d.ts +24 -19
  140. package/dist/drivers/pframe/table_common.js +13 -13
  141. package/dist/drivers/pframe/table_common.js.map +1 -1
  142. package/dist/drivers/pframe/unique_values.d.ts +23 -18
  143. package/dist/drivers/upload.d.ts +21 -18
  144. package/dist/drivers/urls.cjs +5 -6
  145. package/dist/drivers/urls.cjs.map +1 -1
  146. package/dist/drivers/urls.d.ts +12 -9
  147. package/dist/drivers/urls.js +5 -5
  148. package/dist/drivers/urls.js.map +1 -1
  149. package/dist/errors.cjs +65 -86
  150. package/dist/errors.cjs.map +1 -1
  151. package/dist/errors.d.ts +36 -33
  152. package/dist/errors.js +65 -85
  153. package/dist/errors.js.map +1 -1
  154. package/dist/flags/block_flags.cjs +7 -6
  155. package/dist/flags/block_flags.cjs.map +1 -1
  156. package/dist/flags/block_flags.d.ts +12 -8
  157. package/dist/flags/block_flags.js +7 -5
  158. package/dist/flags/block_flags.js.map +1 -1
  159. package/dist/flags/flag_utils.cjs +69 -108
  160. package/dist/flags/flag_utils.cjs.map +1 -1
  161. package/dist/flags/flag_utils.d.ts +40 -42
  162. package/dist/flags/flag_utils.js +70 -107
  163. package/dist/flags/flag_utils.js.map +1 -1
  164. package/dist/flags/type_utils.d.ts +12 -11
  165. package/dist/httpAuth.cjs +16 -20
  166. package/dist/httpAuth.cjs.map +1 -1
  167. package/dist/httpAuth.d.ts +10 -7
  168. package/dist/httpAuth.js +16 -19
  169. package/dist/httpAuth.js.map +1 -1
  170. package/dist/index.cjs +176 -179
  171. package/dist/index.d.ts +58 -20
  172. package/dist/index.js +37 -34
  173. package/dist/json.cjs +10 -8
  174. package/dist/json.cjs.map +1 -1
  175. package/dist/json.d.ts +18 -18
  176. package/dist/json.js +8 -6
  177. package/dist/json.js.map +1 -1
  178. package/dist/navigation.cjs +3 -2
  179. package/dist/navigation.cjs.map +1 -1
  180. package/dist/navigation.d.ts +18 -21
  181. package/dist/navigation.js +3 -1
  182. package/dist/navigation.js.map +1 -1
  183. package/dist/plid.cjs +16 -20
  184. package/dist/plid.cjs.map +1 -1
  185. package/dist/plid.d.ts +11 -7
  186. package/dist/plid.js +15 -18
  187. package/dist/plid.js.map +1 -1
  188. package/dist/pool/entry.d.ts +11 -11
  189. package/dist/pool/index.d.ts +3 -4
  190. package/dist/pool/query.cjs +21 -43
  191. package/dist/pool/query.cjs.map +1 -1
  192. package/dist/pool/query.d.ts +25 -20
  193. package/dist/pool/query.js +20 -40
  194. package/dist/pool/query.js.map +1 -1
  195. package/dist/pool/spec.cjs +40 -47
  196. package/dist/pool/spec.cjs.map +1 -1
  197. package/dist/pool/spec.d.ts +33 -31
  198. package/dist/pool/spec.js +40 -45
  199. package/dist/pool/spec.js.map +1 -1
  200. package/dist/ref.cjs +51 -71
  201. package/dist/ref.cjs.map +1 -1
  202. package/dist/ref.d.ts +36 -33
  203. package/dist/ref.js +50 -69
  204. package/dist/ref.js.map +1 -1
  205. package/dist/utag.d.ts +18 -14
  206. package/dist/util.cjs +8 -7
  207. package/dist/util.cjs.map +1 -1
  208. package/dist/util.d.ts +5 -2
  209. package/dist/util.js +8 -6
  210. package/dist/util.js.map +1 -1
  211. package/dist/value_or_error.cjs +7 -3
  212. package/dist/value_or_error.cjs.map +1 -1
  213. package/dist/value_or_error.d.ts +9 -6
  214. package/dist/value_or_error.js +7 -2
  215. package/dist/value_or_error.js.map +1 -1
  216. package/package.json +6 -6
  217. package/src/flags/block_flags.ts +2 -1
  218. package/src/flags/flag_utils.ts +0 -22
  219. package/dist/author_marker.d.ts.map +0 -1
  220. package/dist/base32_encode.d.ts +0 -8
  221. package/dist/base32_encode.d.ts.map +0 -1
  222. package/dist/base64.d.ts.map +0 -1
  223. package/dist/block_state.d.ts.map +0 -1
  224. package/dist/bmodel/block_config.d.ts.map +0 -1
  225. package/dist/bmodel/code.d.ts.map +0 -1
  226. package/dist/bmodel/container.d.ts.map +0 -1
  227. package/dist/bmodel/index.d.ts.map +0 -1
  228. package/dist/bmodel/normalization.d.ts.map +0 -1
  229. package/dist/bmodel/types.d.ts.map +0 -1
  230. package/dist/branding.d.ts.map +0 -1
  231. package/dist/common_types.d.ts.map +0 -1
  232. package/dist/driver_kit.d.ts.map +0 -1
  233. package/dist/drivers/ChunkedStreamReader.d.ts.map +0 -1
  234. package/dist/drivers/blob.d.ts.map +0 -1
  235. package/dist/drivers/index.d.ts.map +0 -1
  236. package/dist/drivers/interfaces.d.ts.map +0 -1
  237. package/dist/drivers/log.d.ts.map +0 -1
  238. package/dist/drivers/ls.d.ts.map +0 -1
  239. package/dist/drivers/pframe/column_filter.d.ts.map +0 -1
  240. package/dist/drivers/pframe/data_info.d.ts.map +0 -1
  241. package/dist/drivers/pframe/data_types.d.ts.map +0 -1
  242. package/dist/drivers/pframe/driver.d.ts.map +0 -1
  243. package/dist/drivers/pframe/filter_spec.d.ts.map +0 -1
  244. package/dist/drivers/pframe/find_columns.d.ts.map +0 -1
  245. package/dist/drivers/pframe/index.d.ts.map +0 -1
  246. package/dist/drivers/pframe/linker_columns.d.ts.map +0 -1
  247. package/dist/drivers/pframe/pframe.d.ts.map +0 -1
  248. package/dist/drivers/pframe/query/index.d.ts.map +0 -1
  249. package/dist/drivers/pframe/query/query_common.d.ts.map +0 -1
  250. package/dist/drivers/pframe/query/query_data.d.ts.map +0 -1
  251. package/dist/drivers/pframe/query/query_spec.d.ts.map +0 -1
  252. package/dist/drivers/pframe/query/utils.d.ts.map +0 -1
  253. package/dist/drivers/pframe/spec/anchored.d.ts.map +0 -1
  254. package/dist/drivers/pframe/spec/filtered_column.d.ts.map +0 -1
  255. package/dist/drivers/pframe/spec/ids.d.ts.map +0 -1
  256. package/dist/drivers/pframe/spec/index.d.ts.map +0 -1
  257. package/dist/drivers/pframe/spec/native_id.d.ts.map +0 -1
  258. package/dist/drivers/pframe/spec/selectors.d.ts.map +0 -1
  259. package/dist/drivers/pframe/spec/spec.d.ts.map +0 -1
  260. package/dist/drivers/pframe/table.d.ts.map +0 -1
  261. package/dist/drivers/pframe/table_calculate.d.ts.map +0 -1
  262. package/dist/drivers/pframe/table_common.d.ts.map +0 -1
  263. package/dist/drivers/pframe/type_util.d.ts +0 -5
  264. package/dist/drivers/pframe/type_util.d.ts.map +0 -1
  265. package/dist/drivers/pframe/unique_values.d.ts.map +0 -1
  266. package/dist/drivers/upload.d.ts.map +0 -1
  267. package/dist/drivers/urls.d.ts.map +0 -1
  268. package/dist/errors.d.ts.map +0 -1
  269. package/dist/flags/block_flags.d.ts.map +0 -1
  270. package/dist/flags/flag_utils.d.ts.map +0 -1
  271. package/dist/flags/index.d.ts +0 -4
  272. package/dist/flags/index.d.ts.map +0 -1
  273. package/dist/flags/type_utils.d.ts.map +0 -1
  274. package/dist/httpAuth.d.ts.map +0 -1
  275. package/dist/index.cjs.map +0 -1
  276. package/dist/index.d.ts.map +0 -1
  277. package/dist/index.js.map +0 -1
  278. package/dist/json.d.ts.map +0 -1
  279. package/dist/navigation.d.ts.map +0 -1
  280. package/dist/plid.d.ts.map +0 -1
  281. package/dist/pool/entry.d.ts.map +0 -1
  282. package/dist/pool/index.d.ts.map +0 -1
  283. package/dist/pool/query.d.ts.map +0 -1
  284. package/dist/pool/spec.d.ts.map +0 -1
  285. package/dist/ref.d.ts.map +0 -1
  286. package/dist/utag.d.ts.map +0 -1
  287. package/dist/util.d.ts.map +0 -1
  288. package/dist/value_or_error.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"table_calculate.cjs","sources":["../../../src/drivers/pframe/table_calculate.ts"],"sourcesContent":["import type { PTableColumnId, PTableColumnSpec } from \"./table_common\";\nimport type { PTableVector } from \"./data_types\";\nimport type { PObjectId } from \"../../pool\";\nimport { assertNever } from \"../../util\";\nimport { getAxisId, type PColumn } from \"./spec/spec\";\nimport type { PColumnValues } from \"./data_info\";\nimport type { SpecQuery } from \"./query/query_spec\";\nimport { canonicalizeJson } from \"../../json\";\nimport { mapSpecQueryColumns } from \"./query\";\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: \"column\";\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Axis filter slicing target axis from column axes.\n * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).\n * */\nexport interface ConstantAxisFilter {\n /** Filter type discriminator */\n readonly type: \"constant\";\n\n /** Index of axis to slice (zero-based) */\n readonly axisIndex: number;\n\n /** Equality filter reference value, see {@link SingleValueEqualPredicate} */\n readonly constant: string | number;\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface SlicedColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: \"slicedColumn\";\n\n /** Local column */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Non-empty list of axis filters */\n readonly axisFilters: ConstantAxisFilter[];\n}\n\nexport interface ArtificialColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: \"artificialColumn\";\n\n /** Column definition */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Indices of axes to pick from the column (zero-based) */\n readonly axesIndices: number[];\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface InlineColumnJoinEntry {\n /** Node type discriminator */\n readonly type: \"inlineColumn\";\n\n /** Column definition */\n readonly column: PColumn<PColumnValues>;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: \"inner\";\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: \"full\";\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: \"outer\";\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | SlicedColumnJoinEntry<Col>\n | ArtificialColumnJoinEntry<Col>\n | InlineColumnJoinEntry\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: \"IsNA\";\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: \"Equal\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueInSetPredicate {\n /** Comparison operator */\n readonly operator: \"InSet\";\n\n /** Reference values, NA values will not match */\n readonly references: (string | number)[];\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: \"IEqual\";\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: \"Less\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: \"LessOrEqual\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: \"Greater\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: \"GreaterOrEqual\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: \"StringContains\";\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: \"StringIContains\";\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: \"Matches\";\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: \"StringContainsFuzzy\";\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: \"StringIContainsFuzzy\";\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: \"Not\";\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: \"And\";\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: \"Or\";\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueInSetPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: \"bySingleColumnV2\";\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Partition filters */\n readonly partitionFilters: PTableRecordFilter[];\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Information required to instantiate a PTable (V2, query-based). */\nexport interface PTableDefV2<Col> {\n /** Pre-built query spec describing joins, filters and sorting */\n readonly query: SpecQuery<Col>;\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n};\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(def: PTableDef<C1>, cb: (c: C1) => C2): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function sortPTableDef(def: PTableDef<PObjectId>): PTableDef<PObjectId> {\n function sortFilters(filters: PTableRecordFilter[]): PTableRecordFilter[] {\n return filters.toSorted((lhs, rhs) => {\n if (lhs.column.type === \"axis\" && rhs.column.type === \"axis\") {\n const lhsId = canonicalizeJson(getAxisId(lhs.column.id));\n const rhsId = canonicalizeJson(getAxisId(rhs.column.id));\n return lhsId < rhsId ? -1 : 1;\n } else if (lhs.column.type === \"column\" && rhs.column.type === \"column\") {\n return lhs.column.id < rhs.column.id ? -1 : 1;\n } else {\n return lhs.column.type === \"axis\" ? -1 : 1;\n }\n });\n }\n return {\n src: sortJoinEntry(def.src),\n partitionFilters: sortFilters(def.partitionFilters),\n filters: sortFilters(def.filters),\n sorting: def.sorting,\n };\n}\n\nexport function mapPTableDefV2<C1, C2>(def: PTableDefV2<C1>, cb: (c: C1) => C2): PTableDefV2<C2> {\n return { query: mapSpecQueryColumns(def.query, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(entry: JoinEntry<C1>, cb: (c: C1) => C2): JoinEntry<C2> {\n switch (entry.type) {\n case \"column\":\n return {\n type: \"column\",\n column: cb(entry.column),\n };\n case \"slicedColumn\":\n return {\n type: \"slicedColumn\",\n column: cb(entry.column),\n newId: entry.newId,\n axisFilters: entry.axisFilters,\n };\n case \"artificialColumn\":\n return {\n type: \"artificialColumn\",\n column: cb(entry.column),\n newId: entry.newId,\n axesIndices: entry.axesIndices,\n };\n case \"inlineColumn\":\n return entry;\n case \"inner\":\n case \"full\":\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb)),\n };\n case \"outer\":\n return {\n type: \"outer\",\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb)),\n };\n default:\n assertNever(entry);\n }\n}\n\nfunction cmpJoinEntries(lhs: JoinEntry<PObjectId>, rhs: JoinEntry<PObjectId>): number {\n if (lhs.type !== rhs.type) {\n return lhs.type < rhs.type ? -1 : 1;\n }\n const type = lhs.type;\n switch (type) {\n case \"column\":\n return lhs.column < (rhs as typeof lhs).column ? -1 : 1;\n case \"slicedColumn\":\n case \"artificialColumn\":\n return lhs.newId < (rhs as typeof lhs).newId ? -1 : 1;\n case \"inlineColumn\": {\n return lhs.column.id < (rhs as typeof lhs).column.id ? -1 : 1;\n }\n case \"inner\":\n case \"full\": {\n const rhsInner = rhs as typeof lhs;\n if (lhs.entries.length !== rhsInner.entries.length) {\n return lhs.entries.length - rhsInner.entries.length;\n }\n for (let i = 0; i < lhs.entries.length; i++) {\n const cmp = cmpJoinEntries(lhs.entries[i], rhsInner.entries[i]);\n if (cmp !== 0) {\n return cmp;\n }\n }\n return 0;\n }\n case \"outer\": {\n const rhsOuter = rhs as typeof lhs;\n const cmp = cmpJoinEntries(lhs.primary, rhsOuter.primary);\n if (cmp !== 0) {\n return cmp;\n }\n if (lhs.secondary.length !== rhsOuter.secondary.length) {\n return lhs.secondary.length - rhsOuter.secondary.length;\n }\n for (let i = 0; i < lhs.secondary.length; i++) {\n const cmp = cmpJoinEntries(lhs.secondary[i], rhsOuter.secondary[i]);\n if (cmp !== 0) {\n return cmp;\n }\n }\n return 0;\n }\n default:\n assertNever(type);\n }\n}\n\nexport function sortJoinEntry(entry: JoinEntry<PObjectId>): JoinEntry<PObjectId> {\n switch (entry.type) {\n case \"column\":\n case \"slicedColumn\":\n case \"inlineColumn\":\n return entry;\n case \"artificialColumn\": {\n const sortedAxesIndices = entry.axesIndices.toSorted((lhs, rhs) => lhs - rhs);\n return {\n ...entry,\n axesIndices: sortedAxesIndices,\n };\n }\n case \"inner\":\n case \"full\": {\n const sortedEntries = entry.entries.map(sortJoinEntry);\n sortedEntries.sort(cmpJoinEntries);\n return {\n ...entry,\n entries: sortedEntries,\n };\n }\n case \"outer\": {\n const sortedSecondary = entry.secondary.map(sortJoinEntry);\n sortedSecondary.sort(cmpJoinEntries);\n return {\n ...entry,\n primary: sortJoinEntry(entry.primary),\n secondary: sortedSecondary,\n };\n }\n default:\n assertNever(entry);\n }\n}\n"],"names":["canonicalizeJson","getAxisId","mapSpecQueryColumns","assertNever"],"mappings":";;;;;;;AA+YM,SAAU,YAAY,CAAS,GAAkB,EAAE,EAAiB,EAAA;AACxE,IAAA,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE;AACnD;AAEM,SAAU,aAAa,CAAC,GAAyB,EAAA;IACrD,SAAS,WAAW,CAAC,OAA6B,EAAA;QAChD,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,GAAG,KAAI;AACnC,YAAA,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,K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YAClC,OAAO;AACL,gBAAA,GAAG,KAAK;AACR,gBAAA,OAAO,EAAE,aAAa;aACvB;QACH;QACA,KAAK,OAAO,EAAE;YACZ,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC;AAC1D,YAAA,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC;YACpC,OAAO;AACL,gBAAA,GAAG,KAAK;AACR,gBAAA,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;AACrC,gBAAA,SAAS,EAAE,eAAe;aAC3B;QACH;AACA,QAAA;YACEA,gBAAW,CAAC,KAAK,CAAC;;AAExB;;;;;;;;"}
1
+ {"version":3,"file":"table_calculate.cjs","names":["canonicalizeJson","getAxisId","mapSpecQueryColumns"],"sources":["../../../src/drivers/pframe/table_calculate.ts"],"sourcesContent":["import type { PTableColumnId, PTableColumnSpec } from \"./table_common\";\nimport type { PTableVector } from \"./data_types\";\nimport type { PObjectId } from \"../../pool\";\nimport { assertNever } from \"../../util\";\nimport { getAxisId, type PColumn } from \"./spec/spec\";\nimport type { PColumnValues } from \"./data_info\";\nimport type { SpecQuery } from \"./query/query_spec\";\nimport { canonicalizeJson } from \"../../json\";\nimport { mapSpecQueryColumns } from \"./query\";\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: \"column\";\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Axis filter slicing target axis from column axes.\n * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).\n * */\nexport interface ConstantAxisFilter {\n /** Filter type discriminator */\n readonly type: \"constant\";\n\n /** Index of axis to slice (zero-based) */\n readonly axisIndex: number;\n\n /** Equality filter reference value, see {@link SingleValueEqualPredicate} */\n readonly constant: string | number;\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface SlicedColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: \"slicedColumn\";\n\n /** Local column */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Non-empty list of axis filters */\n readonly axisFilters: ConstantAxisFilter[];\n}\n\nexport interface ArtificialColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: \"artificialColumn\";\n\n /** Column definition */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Indices of axes to pick from the column (zero-based) */\n readonly axesIndices: number[];\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface InlineColumnJoinEntry {\n /** Node type discriminator */\n readonly type: \"inlineColumn\";\n\n /** Column definition */\n readonly column: PColumn<PColumnValues>;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: \"inner\";\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: \"full\";\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: \"outer\";\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | SlicedColumnJoinEntry<Col>\n | ArtificialColumnJoinEntry<Col>\n | InlineColumnJoinEntry\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: \"IsNA\";\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: \"Equal\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueInSetPredicate {\n /** Comparison operator */\n readonly operator: \"InSet\";\n\n /** Reference values, NA values will not match */\n readonly references: (string | number)[];\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: \"IEqual\";\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: \"Less\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: \"LessOrEqual\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: \"Greater\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: \"GreaterOrEqual\";\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: \"StringContains\";\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: \"StringIContains\";\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: \"Matches\";\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: \"StringContainsFuzzy\";\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: \"StringIContainsFuzzy\";\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: \"Not\";\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: \"And\";\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: \"Or\";\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueInSetPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: \"bySingleColumnV2\";\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Partition filters */\n readonly partitionFilters: PTableRecordFilter[];\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Information required to instantiate a PTable (V2, query-based). */\nexport interface PTableDefV2<Col> {\n /** Pre-built query spec describing joins, filters and sorting */\n readonly query: SpecQuery<Col>;\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n};\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(def: PTableDef<C1>, cb: (c: C1) => C2): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function sortPTableDef(def: PTableDef<PObjectId>): PTableDef<PObjectId> {\n function sortFilters(filters: PTableRecordFilter[]): PTableRecordFilter[] {\n return filters.toSorted((lhs, rhs) => {\n if (lhs.column.type === \"axis\" && rhs.column.type === \"axis\") {\n const lhsId = canonicalizeJson(getAxisId(lhs.column.id));\n const rhsId = canonicalizeJson(getAxisId(rhs.column.id));\n return lhsId < rhsId ? -1 : 1;\n } else if (lhs.column.type === \"column\" && rhs.column.type === \"column\") {\n return lhs.column.id < rhs.column.id ? -1 : 1;\n } else {\n return lhs.column.type === \"axis\" ? -1 : 1;\n }\n });\n }\n return {\n src: sortJoinEntry(def.src),\n partitionFilters: sortFilters(def.partitionFilters),\n filters: sortFilters(def.filters),\n sorting: def.sorting,\n };\n}\n\nexport function mapPTableDefV2<C1, C2>(def: PTableDefV2<C1>, cb: (c: C1) => C2): PTableDefV2<C2> {\n return { query: mapSpecQueryColumns(def.query, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(entry: JoinEntry<C1>, cb: (c: C1) => C2): JoinEntry<C2> {\n switch (entry.type) {\n case \"column\":\n return {\n type: \"column\",\n column: cb(entry.column),\n };\n case \"slicedColumn\":\n return {\n type: \"slicedColumn\",\n column: cb(entry.column),\n newId: entry.newId,\n axisFilters: entry.axisFilters,\n };\n case \"artificialColumn\":\n return {\n type: \"artificialColumn\",\n column: cb(entry.column),\n newId: entry.newId,\n axesIndices: entry.axesIndices,\n };\n case \"inlineColumn\":\n return entry;\n case \"inner\":\n case \"full\":\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb)),\n };\n case \"outer\":\n return {\n type: \"outer\",\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb)),\n };\n default:\n assertNever(entry);\n }\n}\n\nfunction cmpJoinEntries(lhs: JoinEntry<PObjectId>, rhs: JoinEntry<PObjectId>): number {\n if (lhs.type !== rhs.type) {\n return lhs.type < rhs.type ? -1 : 1;\n }\n const type = lhs.type;\n switch (type) {\n case \"column\":\n return lhs.column < (rhs as typeof lhs).column ? -1 : 1;\n case \"slicedColumn\":\n case \"artificialColumn\":\n return lhs.newId < (rhs as typeof lhs).newId ? -1 : 1;\n case \"inlineColumn\": {\n return lhs.column.id < (rhs as typeof lhs).column.id ? -1 : 1;\n }\n case \"inner\":\n case \"full\": {\n const rhsInner = rhs as typeof lhs;\n if (lhs.entries.length !== rhsInner.entries.length) {\n return lhs.entries.length - rhsInner.entries.length;\n }\n for (let i = 0; i < lhs.entries.length; i++) {\n const cmp = cmpJoinEntries(lhs.entries[i], rhsInner.entries[i]);\n if (cmp !== 0) {\n return cmp;\n }\n }\n return 0;\n }\n case \"outer\": {\n const rhsOuter = rhs as typeof lhs;\n const cmp = cmpJoinEntries(lhs.primary, rhsOuter.primary);\n if (cmp !== 0) {\n return cmp;\n }\n if (lhs.secondary.length !== rhsOuter.secondary.length) {\n return lhs.secondary.length - rhsOuter.secondary.length;\n }\n for (let i = 0; i < lhs.secondary.length; i++) {\n const cmp = cmpJoinEntries(lhs.secondary[i], rhsOuter.secondary[i]);\n if (cmp !== 0) {\n return cmp;\n }\n }\n return 0;\n }\n default:\n assertNever(type);\n }\n}\n\nexport function sortJoinEntry(entry: JoinEntry<PObjectId>): JoinEntry<PObjectId> {\n switch (entry.type) {\n case \"column\":\n case \"slicedColumn\":\n case \"inlineColumn\":\n return entry;\n case \"artificialColumn\": {\n const sortedAxesIndices = entry.axesIndices.toSorted((lhs, rhs) => lhs - rhs);\n return {\n ...entry,\n axesIndices: sortedAxesIndices,\n };\n }\n case \"inner\":\n case \"full\": {\n const sortedEntries = entry.entries.map(sortJoinEntry);\n sortedEntries.sort(cmpJoinEntries);\n return {\n ...entry,\n entries: sortedEntries,\n };\n }\n case \"outer\": {\n const sortedSecondary = entry.secondary.map(sortJoinEntry);\n sortedSecondary.sort(cmpJoinEntries);\n return {\n ...entry,\n primary: sortJoinEntry(entry.primary),\n secondary: sortedSecondary,\n };\n }\n default:\n assertNever(entry);\n }\n}\n"],"mappings":";;;;;;;AA+YA,SAAgB,aAAqB,KAAoB,IAAkC;AACzF,QAAO;EAAE,GAAG;EAAK,KAAK,aAAa,IAAI,KAAK,GAAG;EAAE;;AAGnD,SAAgB,cAAc,KAAiD;CAC7E,SAAS,YAAY,SAAqD;AACxE,SAAO,QAAQ,UAAU,KAAK,QAAQ;AACpC,OAAI,IAAI,OAAO,SAAS,UAAU,IAAI,OAAO,SAAS,OAGpD,QAFcA,8BAAiBC,uBAAU,IAAI,OAAO,GAAG,CAAC,GAC1CD,8BAAiBC,uBAAU,IAAI,OAAO,GAAG,CAAC,GACjC,KAAK;YACnB,IAAI,OAAO,SAAS,YAAY,IAAI,OAAO,SAAS,SAC7D,QAAO,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK;OAE5C,QAAO,IAAI,OAAO,SAAS,SAAS,KAAK;IAE3C;;AAEJ,QAAO;EACL,KAAK,cAAc,IAAI,IAAI;EAC3B,kBAAkB,YAAY,IAAI,iBAAiB;EACnD,SAAS,YAAY,IAAI,QAAQ;EACjC,SAAS,IAAI;EACd;;AAGH,SAAgB,eAAuB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AI,QAAQ,QAAQ,KAAK;IAC3C,MAAM,MAAM,eAAe,IAAI,QAAQ,IAAI,SAAS,QAAQ,GAAG;AAC/D,QAAI,QAAQ,EACV,QAAO;;AAGX,UAAO;;EAET,KAAK,SAAS;GACZ,MAAM,WAAW;GACjB,MAAM,MAAM,eAAe,IAAI,SAAS,SAAS,QAAQ;AACzD,OAAI,QAAQ,EACV,QAAO;AAET,OAAI,IAAI,UAAU,WAAW,SAAS,UAAU,OAC9C,QAAO,IAAI,UAAU,SAAS,SAAS,UAAU;AAEnD,QAAK,IAAI,IAAI,GAAG,IAAI,IAAI,UAAU,QAAQ,KAAK;IAC7C,MAAM,MAAM,eAAe,IAAI,UAAU,IAAI,SAAS,UAAU,GAAG;AACnE,QAAI,QAAQ,EACV,QAAO;;AAGX,UAAO;;EAET,QACE,0BAAY,KAAK;;;AAIvB,SAAgB,cAAc,OAAmD;AAC/E,SAAQ,MAAM,MAAd;EACE,KAAK;EACL,KAAK;EACL,KAAK,eACH,QAAO;EACT,KAAK,oBAAoB;GACvB,MAAM,oBAAoB,MAAM,YAAY,UAAU,KAAK,QAAQ,MAAM,IAAI;AAC7E,UAAO;IACL,GAAG;IACH,aAAa;IACd;;EAEH,KAAK;EACL,KAAK,QAAQ;GACX,MAAM,gBAAgB,MAAM,QAAQ,IAAI,cAAc;AACtD,iBAAc,KAAK,eAAe;AAClC,UAAO;IACL,GAAG;IACH,SAAS;IACV;;EAEH,KAAK,SAAS;GACZ,MAAM,kBAAkB,MAAM,UAAU,IAAI,cAAc;AAC1D,mBAAgB,KAAK,eAAe;AACpC,UAAO;IACL,GAAG;IACH,SAAS,cAAc,MAAM,QAAQ;IACrC,WAAW;IACZ;;EAEH,QACE,0BAAY,MAAM"}
@@ -1,65 +1,68 @@
1
- import type { PTableColumnId, PTableColumnSpec } from "./table_common";
2
- import type { PTableVector } from "./data_types";
3
- import type { PObjectId } from "../../pool";
4
- import { type PColumn } from "./spec/spec";
5
- import type { PColumnValues } from "./data_info";
6
- import type { SpecQuery } from "./query/query_spec";
1
+ import { PObjectId } from "../../pool/spec.js";
2
+ import "../../pool/index.js";
3
+ import { PColumn } from "./spec/spec.js";
4
+ import { PColumnValues } from "./data_info.js";
5
+ import { PTableVector } from "./data_types.js";
6
+ import { PTableColumnId, PTableColumnSpec } from "./table_common.js";
7
+ import { SpecQuery } from "./query/query_spec.js";
8
+
9
+ //#region src/drivers/pframe/table_calculate.d.ts
7
10
  /** Defines a terminal column node in the join request tree */
8
- export interface ColumnJoinEntry<Col> {
9
- /** Node type discriminator */
10
- readonly type: "column";
11
- /** Local column */
12
- readonly column: Col;
11
+ interface ColumnJoinEntry<Col> {
12
+ /** Node type discriminator */
13
+ readonly type: "column";
14
+ /** Local column */
15
+ readonly column: Col;
13
16
  }
14
17
  /**
15
18
  * Axis filter slicing target axis from column axes.
16
19
  * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).
17
20
  * */
18
- export interface ConstantAxisFilter {
19
- /** Filter type discriminator */
20
- readonly type: "constant";
21
- /** Index of axis to slice (zero-based) */
22
- readonly axisIndex: number;
23
- /** Equality filter reference value, see {@link SingleValueEqualPredicate} */
24
- readonly constant: string | number;
21
+ interface ConstantAxisFilter {
22
+ /** Filter type discriminator */
23
+ readonly type: "constant";
24
+ /** Index of axis to slice (zero-based) */
25
+ readonly axisIndex: number;
26
+ /** Equality filter reference value, see {@link SingleValueEqualPredicate} */
27
+ readonly constant: string | number;
25
28
  }
26
29
  /** Defines a terminal column node in the join request tree */
27
- export interface SlicedColumnJoinEntry<Col> {
28
- /** Node type discriminator */
29
- readonly type: "slicedColumn";
30
- /** Local column */
31
- readonly column: Col;
32
- /** New column id */
33
- readonly newId: PObjectId;
34
- /** Non-empty list of axis filters */
35
- readonly axisFilters: ConstantAxisFilter[];
30
+ interface SlicedColumnJoinEntry<Col> {
31
+ /** Node type discriminator */
32
+ readonly type: "slicedColumn";
33
+ /** Local column */
34
+ readonly column: Col;
35
+ /** New column id */
36
+ readonly newId: PObjectId;
37
+ /** Non-empty list of axis filters */
38
+ readonly axisFilters: ConstantAxisFilter[];
36
39
  }
37
- export interface ArtificialColumnJoinEntry<Col> {
38
- /** Node type discriminator */
39
- readonly type: "artificialColumn";
40
- /** Column definition */
41
- readonly column: Col;
42
- /** New column id */
43
- readonly newId: PObjectId;
44
- /** Indices of axes to pick from the column (zero-based) */
45
- readonly axesIndices: number[];
40
+ interface ArtificialColumnJoinEntry<Col> {
41
+ /** Node type discriminator */
42
+ readonly type: "artificialColumn";
43
+ /** Column definition */
44
+ readonly column: Col;
45
+ /** New column id */
46
+ readonly newId: PObjectId;
47
+ /** Indices of axes to pick from the column (zero-based) */
48
+ readonly axesIndices: number[];
46
49
  }
47
50
  /** Defines a terminal column node in the join request tree */
48
- export interface InlineColumnJoinEntry {
49
- /** Node type discriminator */
50
- readonly type: "inlineColumn";
51
- /** Column definition */
52
- readonly column: PColumn<PColumnValues>;
51
+ interface InlineColumnJoinEntry {
52
+ /** Node type discriminator */
53
+ readonly type: "inlineColumn";
54
+ /** Column definition */
55
+ readonly column: PColumn<PColumnValues>;
53
56
  }
54
57
  /**
55
58
  * Defines a join request tree node that will output only records present in
56
59
  * all child nodes ({@link entries}).
57
60
  * */
58
- export interface InnerJoin<Col> {
59
- /** Node type discriminator */
60
- readonly type: "inner";
61
- /** Child nodes to be inner joined */
62
- readonly entries: JoinEntry<Col>[];
61
+ interface InnerJoin<Col> {
62
+ /** Node type discriminator */
63
+ readonly type: "inner";
64
+ /** Child nodes to be inner joined */
65
+ readonly entries: JoinEntry<Col>[];
63
66
  }
64
67
  /**
65
68
  * Defines a join request tree node that will output all records present at
@@ -67,11 +70,11 @@ export interface InnerJoin<Col> {
67
70
  * that lacks corresponding combinations of axis values will be marked as absent,
68
71
  * see {@link PTableVector.absent}.
69
72
  * */
70
- export interface FullJoin<Col> {
71
- /** Node type discriminator */
72
- readonly type: "full";
73
- /** Child nodes to be fully outer joined */
74
- readonly entries: JoinEntry<Col>[];
73
+ interface FullJoin<Col> {
74
+ /** Node type discriminator */
75
+ readonly type: "full";
76
+ /** Child nodes to be fully outer joined */
77
+ readonly entries: JoinEntry<Col>[];
75
78
  }
76
79
  /**
77
80
  * Defines a join request tree node that will output all records present in
@@ -83,14 +86,14 @@ export interface FullJoin<Col> {
83
86
  * This node can be thought as a chain of SQL LEFT JOIN operations starting from
84
87
  * the {@link primary} node and adding {@link secondary} nodes one by one.
85
88
  * */
86
- export interface OuterJoin<Col> {
87
- /** Node type discriminator */
88
- readonly type: "outer";
89
- /** Primes the join operation. Left part of LEFT JOIN. */
90
- readonly primary: JoinEntry<Col>;
91
- /** Driven nodes, giving their values only if primary node have corresponding
92
- * nodes. Right parts of LEFT JOIN chain. */
93
- readonly secondary: JoinEntry<Col>[];
89
+ interface OuterJoin<Col> {
90
+ /** Node type discriminator */
91
+ readonly type: "outer";
92
+ /** Primes the join operation. Left part of LEFT JOIN. */
93
+ readonly primary: JoinEntry<Col>;
94
+ /** Driven nodes, giving their values only if primary node have corresponding
95
+ * nodes. Right parts of LEFT JOIN chain. */
96
+ readonly secondary: JoinEntry<Col>[];
94
97
  }
95
98
  /**
96
99
  * Base type of all join request tree nodes. Join request tree allows to combine
@@ -99,201 +102,197 @@ export interface OuterJoin<Col> {
99
102
  * the PColumns. Common axis are those axis which have equal {@link AxisId} derived
100
103
  * from the columns axes spec.
101
104
  * */
102
- export type JoinEntry<Col> = ColumnJoinEntry<Col> | SlicedColumnJoinEntry<Col> | ArtificialColumnJoinEntry<Col> | InlineColumnJoinEntry | InnerJoin<Col> | FullJoin<Col> | OuterJoin<Col>;
105
+ type JoinEntry<Col> = ColumnJoinEntry<Col> | SlicedColumnJoinEntry<Col> | ArtificialColumnJoinEntry<Col> | InlineColumnJoinEntry | InnerJoin<Col> | FullJoin<Col> | OuterJoin<Col>;
103
106
  /** Container representing whole data stored in specific PTable column. */
104
- export interface FullPTableColumnData {
105
- /** Unified spec */
106
- readonly spec: PTableColumnSpec;
107
- /** Data */
108
- readonly data: PTableVector;
107
+ interface FullPTableColumnData {
108
+ /** Unified spec */
109
+ readonly spec: PTableColumnSpec;
110
+ /** Data */
111
+ readonly data: PTableVector;
109
112
  }
110
- export interface SingleValueIsNAPredicate {
111
- /** Comparison operator */
112
- readonly operator: "IsNA";
113
+ interface SingleValueIsNAPredicate {
114
+ /** Comparison operator */
115
+ readonly operator: "IsNA";
113
116
  }
114
- export interface SingleValueEqualPredicate {
115
- /** Comparison operator */
116
- readonly operator: "Equal";
117
- /** Reference value, NA values will not match */
118
- readonly reference: string | number;
117
+ interface SingleValueEqualPredicate {
118
+ /** Comparison operator */
119
+ readonly operator: "Equal";
120
+ /** Reference value, NA values will not match */
121
+ readonly reference: string | number;
119
122
  }
120
- export interface SingleValueInSetPredicate {
121
- /** Comparison operator */
122
- readonly operator: "InSet";
123
- /** Reference values, NA values will not match */
124
- readonly references: (string | number)[];
123
+ interface SingleValueInSetPredicate {
124
+ /** Comparison operator */
125
+ readonly operator: "InSet";
126
+ /** Reference values, NA values will not match */
127
+ readonly references: (string | number)[];
125
128
  }
126
- export interface SingleValueIEqualPredicate {
127
- /** Comparison operator (case insensitive) */
128
- readonly operator: "IEqual";
129
- /** Reference value, NA values will not match */
130
- readonly reference: string;
129
+ interface SingleValueIEqualPredicate {
130
+ /** Comparison operator (case insensitive) */
131
+ readonly operator: "IEqual";
132
+ /** Reference value, NA values will not match */
133
+ readonly reference: string;
131
134
  }
132
- export interface SingleValueLessPredicate {
133
- /** Comparison operator */
134
- readonly operator: "Less";
135
- /** Reference value, NA values will not match */
136
- readonly reference: string | number;
135
+ interface SingleValueLessPredicate {
136
+ /** Comparison operator */
137
+ readonly operator: "Less";
138
+ /** Reference value, NA values will not match */
139
+ readonly reference: string | number;
137
140
  }
138
- export interface SingleValueLessOrEqualPredicate {
139
- /** Comparison operator */
140
- readonly operator: "LessOrEqual";
141
- /** Reference value, NA values will not match */
142
- readonly reference: string | number;
141
+ interface SingleValueLessOrEqualPredicate {
142
+ /** Comparison operator */
143
+ readonly operator: "LessOrEqual";
144
+ /** Reference value, NA values will not match */
145
+ readonly reference: string | number;
143
146
  }
144
- export interface SingleValueGreaterPredicate {
145
- /** Comparison operator */
146
- readonly operator: "Greater";
147
- /** Reference value, NA values will not match */
148
- readonly reference: string | number;
147
+ interface SingleValueGreaterPredicate {
148
+ /** Comparison operator */
149
+ readonly operator: "Greater";
150
+ /** Reference value, NA values will not match */
151
+ readonly reference: string | number;
149
152
  }
150
- export interface SingleValueGreaterOrEqualPredicate {
151
- /** Comparison operator */
152
- readonly operator: "GreaterOrEqual";
153
- /** Reference value, NA values will not match */
154
- readonly reference: string | number;
153
+ interface SingleValueGreaterOrEqualPredicate {
154
+ /** Comparison operator */
155
+ readonly operator: "GreaterOrEqual";
156
+ /** Reference value, NA values will not match */
157
+ readonly reference: string | number;
155
158
  }
156
- export interface SingleValueStringContainsPredicate {
157
- /** Comparison operator */
158
- readonly operator: "StringContains";
159
- /** Reference substring, NA values are skipped */
160
- readonly substring: string;
159
+ interface SingleValueStringContainsPredicate {
160
+ /** Comparison operator */
161
+ readonly operator: "StringContains";
162
+ /** Reference substring, NA values are skipped */
163
+ readonly substring: string;
161
164
  }
162
- export interface SingleValueStringIContainsPredicate {
163
- /** Comparison operator (case insensitive) */
164
- readonly operator: "StringIContains";
165
- /** Reference substring, NA values are skipped */
166
- readonly substring: string;
165
+ interface SingleValueStringIContainsPredicate {
166
+ /** Comparison operator (case insensitive) */
167
+ readonly operator: "StringIContains";
168
+ /** Reference substring, NA values are skipped */
169
+ readonly substring: string;
167
170
  }
168
- export interface SingleValueMatchesPredicate {
169
- /** Comparison operator */
170
- readonly operator: "Matches";
171
- /** Regular expression, NA values are skipped */
172
- readonly regex: string;
171
+ interface SingleValueMatchesPredicate {
172
+ /** Comparison operator */
173
+ readonly operator: "Matches";
174
+ /** Regular expression, NA values are skipped */
175
+ readonly regex: string;
173
176
  }
174
- export interface SingleValueStringContainsFuzzyPredicate {
175
- /** Comparison operator */
176
- readonly operator: "StringContainsFuzzy";
177
- /** Reference value, NA values are skipped */
178
- readonly reference: string;
179
- /**
180
- * Integer specifying the upper bound of edit distance between
181
- * reference and actual value.
182
- * When {@link substitutionsOnly} is not defined or set to false
183
- * Levenshtein distance is used (substitutions and indels)
184
- * @see https://en.wikipedia.org/wiki/Levenshtein_distance
185
- * When {@link substitutionsOnly} is set to true
186
- * Hamming distance is used (substitutions only)
187
- * @see https://en.wikipedia.org/wiki/Hamming_distance
188
- */
189
- readonly maxEdits: number;
190
- /** Changes the type of edit distance in {@link maxEdits} */
191
- readonly substitutionsOnly?: boolean;
192
- /**
193
- * Some character in {@link reference} that will match any
194
- * single character in searched text.
195
- */
196
- readonly wildcard?: string;
177
+ interface SingleValueStringContainsFuzzyPredicate {
178
+ /** Comparison operator */
179
+ readonly operator: "StringContainsFuzzy";
180
+ /** Reference value, NA values are skipped */
181
+ readonly reference: string;
182
+ /**
183
+ * Integer specifying the upper bound of edit distance between
184
+ * reference and actual value.
185
+ * When {@link substitutionsOnly} is not defined or set to false
186
+ * Levenshtein distance is used (substitutions and indels)
187
+ * @see https://en.wikipedia.org/wiki/Levenshtein_distance
188
+ * When {@link substitutionsOnly} is set to true
189
+ * Hamming distance is used (substitutions only)
190
+ * @see https://en.wikipedia.org/wiki/Hamming_distance
191
+ */
192
+ readonly maxEdits: number;
193
+ /** Changes the type of edit distance in {@link maxEdits} */
194
+ readonly substitutionsOnly?: boolean;
195
+ /**
196
+ * Some character in {@link reference} that will match any
197
+ * single character in searched text.
198
+ */
199
+ readonly wildcard?: string;
197
200
  }
198
- export interface SingleValueStringIContainsFuzzyPredicate {
199
- /** Comparison operator (case insensitive) */
200
- readonly operator: "StringIContainsFuzzy";
201
- /** Reference value, NA values are skipped */
202
- readonly reference: string;
203
- /**
204
- * Integer specifying the upper bound of edit distance between
205
- * reference and actual value.
206
- * When {@link substitutionsOnly} is not defined or set to false
207
- * Levenshtein distance is used (substitutions and indels)
208
- * @see https://en.wikipedia.org/wiki/Levenshtein_distance
209
- * When {@link substitutionsOnly} is set to true
210
- * Hamming distance is used (substitutions only)
211
- * @see https://en.wikipedia.org/wiki/Hamming_distance
212
- */
213
- readonly maxEdits: number;
214
- /** Changes the type of edit distance in {@link maxEdits} */
215
- readonly substitutionsOnly?: boolean;
216
- /**
217
- * Some character in {@link reference} that will match any
218
- * single character in searched text.
219
- */
220
- readonly wildcard?: string;
201
+ interface SingleValueStringIContainsFuzzyPredicate {
202
+ /** Comparison operator (case insensitive) */
203
+ readonly operator: "StringIContainsFuzzy";
204
+ /** Reference value, NA values are skipped */
205
+ readonly reference: string;
206
+ /**
207
+ * Integer specifying the upper bound of edit distance between
208
+ * reference and actual value.
209
+ * When {@link substitutionsOnly} is not defined or set to false
210
+ * Levenshtein distance is used (substitutions and indels)
211
+ * @see https://en.wikipedia.org/wiki/Levenshtein_distance
212
+ * When {@link substitutionsOnly} is set to true
213
+ * Hamming distance is used (substitutions only)
214
+ * @see https://en.wikipedia.org/wiki/Hamming_distance
215
+ */
216
+ readonly maxEdits: number;
217
+ /** Changes the type of edit distance in {@link maxEdits} */
218
+ readonly substitutionsOnly?: boolean;
219
+ /**
220
+ * Some character in {@link reference} that will match any
221
+ * single character in searched text.
222
+ */
223
+ readonly wildcard?: string;
221
224
  }
222
- export interface SingleValueNotPredicateV2 {
223
- /** Comparison operator */
224
- readonly operator: "Not";
225
- /** Operand to negate */
226
- readonly operand: SingleValuePredicateV2;
225
+ interface SingleValueNotPredicateV2 {
226
+ /** Comparison operator */
227
+ readonly operator: "Not";
228
+ /** Operand to negate */
229
+ readonly operand: SingleValuePredicateV2;
227
230
  }
228
- export interface SingleValueAndPredicateV2 {
229
- /** Comparison operator */
230
- readonly operator: "And";
231
- /** Operands to combine */
232
- readonly operands: SingleValuePredicateV2[];
231
+ interface SingleValueAndPredicateV2 {
232
+ /** Comparison operator */
233
+ readonly operator: "And";
234
+ /** Operands to combine */
235
+ readonly operands: SingleValuePredicateV2[];
233
236
  }
234
- export interface SingleValueOrPredicateV2 {
235
- /** Comparison operator */
236
- readonly operator: "Or";
237
- /** Operands to combine */
238
- readonly operands: SingleValuePredicateV2[];
237
+ interface SingleValueOrPredicateV2 {
238
+ /** Comparison operator */
239
+ readonly operator: "Or";
240
+ /** Operands to combine */
241
+ readonly operands: SingleValuePredicateV2[];
239
242
  }
240
243
  /** Filtering predicate for a single axis or column value */
241
- export type SingleValuePredicateV2 = SingleValueIsNAPredicate | SingleValueEqualPredicate | SingleValueInSetPredicate | SingleValueLessPredicate | SingleValueLessOrEqualPredicate | SingleValueGreaterPredicate | SingleValueGreaterOrEqualPredicate | SingleValueStringContainsPredicate | SingleValueMatchesPredicate | SingleValueStringContainsFuzzyPredicate | SingleValueNotPredicateV2 | SingleValueAndPredicateV2 | SingleValueOrPredicateV2 | SingleValueIEqualPredicate | SingleValueStringIContainsPredicate | SingleValueStringIContainsFuzzyPredicate;
244
+ type SingleValuePredicateV2 = SingleValueIsNAPredicate | SingleValueEqualPredicate | SingleValueInSetPredicate | SingleValueLessPredicate | SingleValueLessOrEqualPredicate | SingleValueGreaterPredicate | SingleValueGreaterOrEqualPredicate | SingleValueStringContainsPredicate | SingleValueMatchesPredicate | SingleValueStringContainsFuzzyPredicate | SingleValueNotPredicateV2 | SingleValueAndPredicateV2 | SingleValueOrPredicateV2 | SingleValueIEqualPredicate | SingleValueStringIContainsPredicate | SingleValueStringIContainsFuzzyPredicate;
242
245
  /**
243
246
  * Filter PTable records based on specific axis or column value. If this is an
244
247
  * axis value filter and the axis is part of a partitioning key in some of the
245
248
  * source PColumns, the filter will be pushed down to those columns, so only
246
249
  * specific partitions will be retrieved from the remote storage.
247
250
  * */
248
- export interface PTableRecordSingleValueFilterV2 {
249
- /** Filter type discriminator */
250
- readonly type: "bySingleColumnV2";
251
- /** Target axis selector to examine values from */
252
- readonly column: PTableColumnId;
253
- /** Value predicate */
254
- readonly predicate: SingleValuePredicateV2;
251
+ interface PTableRecordSingleValueFilterV2 {
252
+ /** Filter type discriminator */
253
+ readonly type: "bySingleColumnV2";
254
+ /** Target axis selector to examine values from */
255
+ readonly column: PTableColumnId;
256
+ /** Value predicate */
257
+ readonly predicate: SingleValuePredicateV2;
255
258
  }
256
259
  /** Generic PTable records filter */
257
- export type PTableRecordFilter = PTableRecordSingleValueFilterV2;
260
+ type PTableRecordFilter = PTableRecordSingleValueFilterV2;
258
261
  /** Sorting parameters for a PTable. */
259
- export type PTableSorting = {
260
- /** Unified column identifier */
261
- readonly column: PTableColumnId;
262
- /** Sorting order */
263
- readonly ascending: boolean;
264
- /** Sorting in respect to NA and absent values */
265
- readonly naAndAbsentAreLeastValues: boolean;
262
+ type PTableSorting = {
263
+ /** Unified column identifier */readonly column: PTableColumnId; /** Sorting order */
264
+ readonly ascending: boolean; /** Sorting in respect to NA and absent values */
265
+ readonly naAndAbsentAreLeastValues: boolean;
266
266
  };
267
267
  /** Information required to instantiate a PTable. */
268
- export interface PTableDef<Col> {
269
- /** Join tree to populate the PTable */
270
- readonly src: JoinEntry<Col>;
271
- /** Partition filters */
272
- readonly partitionFilters: PTableRecordFilter[];
273
- /** Record filters */
274
- readonly filters: PTableRecordFilter[];
275
- /** Table sorting */
276
- readonly sorting: PTableSorting[];
268
+ interface PTableDef<Col> {
269
+ /** Join tree to populate the PTable */
270
+ readonly src: JoinEntry<Col>;
271
+ /** Partition filters */
272
+ readonly partitionFilters: PTableRecordFilter[];
273
+ /** Record filters */
274
+ readonly filters: PTableRecordFilter[];
275
+ /** Table sorting */
276
+ readonly sorting: PTableSorting[];
277
277
  }
278
278
  /** Information required to instantiate a PTable (V2, query-based). */
279
- export interface PTableDefV2<Col> {
280
- /** Pre-built query spec describing joins, filters and sorting */
281
- readonly query: SpecQuery<Col>;
279
+ interface PTableDefV2<Col> {
280
+ /** Pre-built query spec describing joins, filters and sorting */
281
+ readonly query: SpecQuery<Col>;
282
282
  }
283
283
  /** Request to create and retrieve entirety of data of PTable. */
284
- export type CalculateTableDataRequest<Col> = {
285
- /** Join tree to populate the PTable */
286
- readonly src: JoinEntry<Col>;
287
- /** Record filters */
288
- readonly filters: PTableRecordFilter[];
289
- /** Table sorting */
290
- readonly sorting: PTableSorting[];
284
+ type CalculateTableDataRequest<Col> = {
285
+ /** Join tree to populate the PTable */readonly src: JoinEntry<Col>; /** Record filters */
286
+ readonly filters: PTableRecordFilter[]; /** Table sorting */
287
+ readonly sorting: PTableSorting[];
291
288
  };
292
289
  /** Response for {@link CalculateTableDataRequest} */
293
- export type CalculateTableDataResponse = FullPTableColumnData[];
294
- export declare function mapPTableDef<C1, C2>(def: PTableDef<C1>, cb: (c: C1) => C2): PTableDef<C2>;
295
- export declare function sortPTableDef(def: PTableDef<PObjectId>): PTableDef<PObjectId>;
296
- export declare function mapPTableDefV2<C1, C2>(def: PTableDefV2<C1>, cb: (c: C1) => C2): PTableDefV2<C2>;
297
- export declare function mapJoinEntry<C1, C2>(entry: JoinEntry<C1>, cb: (c: C1) => C2): JoinEntry<C2>;
298
- export declare function sortJoinEntry(entry: JoinEntry<PObjectId>): JoinEntry<PObjectId>;
290
+ type CalculateTableDataResponse = FullPTableColumnData[];
291
+ declare function mapPTableDef<C1, C2>(def: PTableDef<C1>, cb: (c: C1) => C2): PTableDef<C2>;
292
+ declare function sortPTableDef(def: PTableDef<PObjectId>): PTableDef<PObjectId>;
293
+ declare function mapPTableDefV2<C1, C2>(def: PTableDefV2<C1>, cb: (c: C1) => C2): PTableDefV2<C2>;
294
+ declare function mapJoinEntry<C1, C2>(entry: JoinEntry<C1>, cb: (c: C1) => C2): JoinEntry<C2>;
295
+ declare function sortJoinEntry(entry: JoinEntry<PObjectId>): JoinEntry<PObjectId>;
296
+ //#endregion
297
+ export { ArtificialColumnJoinEntry, CalculateTableDataRequest, CalculateTableDataResponse, ColumnJoinEntry, ConstantAxisFilter, FullJoin, FullPTableColumnData, InlineColumnJoinEntry, InnerJoin, JoinEntry, OuterJoin, PTableDef, PTableDefV2, PTableRecordFilter, PTableRecordSingleValueFilterV2, PTableSorting, SingleValueAndPredicateV2, SingleValueEqualPredicate, SingleValueGreaterOrEqualPredicate, SingleValueGreaterPredicate, SingleValueIEqualPredicate, SingleValueInSetPredicate, SingleValueIsNAPredicate, SingleValueLessOrEqualPredicate, SingleValueLessPredicate, SingleValueMatchesPredicate, SingleValueNotPredicateV2, SingleValueOrPredicateV2, SingleValuePredicateV2, SingleValueStringContainsFuzzyPredicate, SingleValueStringContainsPredicate, SingleValueStringIContainsFuzzyPredicate, SingleValueStringIContainsPredicate, SlicedColumnJoinEntry, mapJoinEntry, mapPTableDef, mapPTableDefV2, sortJoinEntry, sortPTableDef };
299
298
  //# sourceMappingURL=table_calculate.d.ts.map