@malloydata/malloy 0.0.22-dev230126015148 → 0.0.22-dev230202171033

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 (307) hide show
  1. package/dist/lang/ast/ast-main.d.ts +18 -815
  2. package/dist/lang/ast/ast-main.js +106 -3241
  3. package/dist/lang/ast/ast-utils.d.ts +10 -0
  4. package/dist/lang/ast/ast-utils.js +42 -0
  5. package/dist/lang/ast/elements/define-explore.d.ts +17 -0
  6. package/dist/lang/ast/elements/define-explore.js +79 -0
  7. package/dist/lang/ast/elements/define-query.d.ts +14 -0
  8. package/dist/lang/ast/elements/define-query.js +56 -0
  9. package/dist/lang/ast/elements/mallobj.d.ts +12 -0
  10. package/dist/lang/ast/elements/mallobj.js +53 -0
  11. package/dist/lang/ast/elements/pipeline-desc.d.ts +28 -0
  12. package/dist/lang/ast/elements/pipeline-desc.js +102 -0
  13. package/dist/lang/ast/elements/refined-explore.d.ts +15 -0
  14. package/dist/lang/ast/elements/refined-explore.js +121 -0
  15. package/dist/lang/ast/error-factory.d.ts +9 -0
  16. package/dist/lang/ast/error-factory.js +61 -0
  17. package/dist/lang/ast/executors/index-executor.d.ts +18 -0
  18. package/dist/lang/ast/executors/index-executor.js +96 -0
  19. package/dist/lang/ast/executors/project-executor.d.ts +10 -0
  20. package/dist/lang/ast/executors/project-executor.js +68 -0
  21. package/dist/lang/ast/executors/reduce-executor.d.ts +20 -0
  22. package/dist/lang/ast/executors/reduce-executor.js +149 -0
  23. package/dist/lang/ast/explore-properties/field-list-edit.d.ts +8 -0
  24. package/dist/lang/ast/explore-properties/field-list-edit.js +36 -0
  25. package/dist/lang/ast/explore-properties/primary-key.d.ts +7 -0
  26. package/dist/lang/ast/{apply-expr.js → explore-properties/primary-key.js} +9 -8
  27. package/dist/lang/ast/explore-properties/renames.d.ts +11 -0
  28. package/dist/lang/ast/explore-properties/renames.js +43 -0
  29. package/dist/lang/ast/explore-properties/turtles.d.ts +5 -0
  30. package/dist/lang/ast/explore-properties/turtles.js +33 -0
  31. package/dist/lang/ast/expressions/apply.d.ts +8 -0
  32. package/dist/lang/ast/expressions/apply.js +37 -0
  33. package/dist/lang/ast/expressions/binary-boolean.d.ts +12 -0
  34. package/dist/lang/ast/expressions/binary-boolean.js +54 -0
  35. package/dist/lang/ast/expressions/binary-numeric.d.ts +11 -0
  36. package/dist/lang/ast/expressions/binary-numeric.js +42 -0
  37. package/dist/lang/ast/expressions/boolean.d.ts +8 -0
  38. package/dist/lang/ast/expressions/boolean.js +39 -0
  39. package/dist/lang/ast/expressions/constant-sub-expression.d.ts +16 -0
  40. package/dist/lang/ast/expressions/constant-sub-expression.js +98 -0
  41. package/dist/lang/ast/expressions/expr-add-sub.d.ts +4 -0
  42. package/dist/lang/ast/expressions/expr-add-sub.js +34 -0
  43. package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +15 -0
  44. package/dist/lang/ast/expressions/expr-aggregate-function.js +99 -0
  45. package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +11 -0
  46. package/dist/lang/ast/expressions/expr-alternation-tree.js +54 -0
  47. package/dist/lang/ast/expressions/expr-asymmetric.d.ts +10 -0
  48. package/dist/lang/ast/expressions/expr-asymmetric.js +27 -0
  49. package/dist/lang/ast/expressions/expr-avg.d.ts +6 -0
  50. package/dist/lang/ast/expressions/expr-avg.js +34 -0
  51. package/dist/lang/ast/expressions/expr-case.d.ts +11 -0
  52. package/dist/lang/ast/expressions/expr-case.js +84 -0
  53. package/dist/lang/ast/expressions/expr-cast.d.ts +13 -0
  54. package/dist/lang/ast/expressions/expr-cast.js +29 -0
  55. package/dist/lang/ast/expressions/expr-compare.d.ts +10 -0
  56. package/dist/lang/ast/expressions/expr-compare.js +48 -0
  57. package/dist/lang/ast/expressions/expr-count-distinct.d.ts +6 -0
  58. package/dist/lang/ast/expressions/expr-count-distinct.js +35 -0
  59. package/dist/lang/ast/expressions/expr-count.d.ts +11 -0
  60. package/dist/lang/ast/expressions/expr-count.js +57 -0
  61. package/dist/lang/ast/expressions/expr-filter.d.ts +12 -0
  62. package/dist/lang/ast/expressions/expr-filter.js +69 -0
  63. package/dist/lang/ast/expressions/expr-func.d.ts +10 -0
  64. package/dist/lang/ast/expressions/expr-func.js +63 -0
  65. package/dist/lang/ast/expressions/expr-granular-time.d.ts +24 -0
  66. package/dist/lang/ast/expressions/expr-granular-time.js +117 -0
  67. package/dist/lang/ast/expressions/expr-id-reference.d.ts +12 -0
  68. package/dist/lang/ast/expressions/expr-id-reference.js +76 -0
  69. package/dist/lang/ast/expressions/expr-logical-op.d.ts +9 -0
  70. package/dist/lang/ast/expressions/expr-logical-op.js +36 -0
  71. package/dist/lang/ast/expressions/expr-max.d.ts +9 -0
  72. package/dist/lang/ast/expressions/expr-max.js +16 -0
  73. package/dist/lang/ast/expressions/expr-min.d.ts +9 -0
  74. package/dist/lang/ast/expressions/expr-min.js +16 -0
  75. package/dist/lang/ast/expressions/expr-minus.d.ts +9 -0
  76. package/dist/lang/ast/expressions/expr-minus.js +48 -0
  77. package/dist/lang/ast/expressions/expr-mul-div.d.ts +4 -0
  78. package/dist/lang/ast/expressions/expr-mul-div.js +34 -0
  79. package/dist/lang/ast/expressions/expr-not.d.ts +10 -0
  80. package/dist/lang/ast/expressions/expr-not.js +49 -0
  81. package/dist/lang/ast/expressions/expr-now.d.ts +7 -0
  82. package/dist/lang/ast/expressions/expr-now.js +46 -0
  83. package/dist/lang/ast/expressions/expr-null.d.ts +6 -0
  84. package/dist/lang/ast/expressions/expr-null.js +41 -0
  85. package/dist/lang/ast/expressions/expr-number.d.ts +10 -0
  86. package/dist/lang/ast/expressions/expr-number.js +42 -0
  87. package/dist/lang/ast/expressions/expr-parens.d.ts +10 -0
  88. package/dist/lang/ast/expressions/expr-parens.js +42 -0
  89. package/dist/lang/ast/expressions/expr-regex.d.ts +8 -0
  90. package/dist/lang/ast/expressions/expr-regex.js +42 -0
  91. package/dist/lang/ast/expressions/expr-string.d.ts +9 -0
  92. package/dist/lang/ast/expressions/expr-string.js +50 -0
  93. package/dist/lang/ast/expressions/expr-sum.d.ts +6 -0
  94. package/dist/lang/ast/expressions/expr-sum.js +12 -0
  95. package/dist/lang/ast/expressions/expr-time-extract.d.ts +13 -0
  96. package/dist/lang/ast/expressions/expr-time-extract.js +117 -0
  97. package/dist/lang/ast/expressions/expr-time.d.ts +11 -0
  98. package/dist/lang/ast/expressions/expr-time.js +62 -0
  99. package/dist/lang/ast/expressions/expr-ungroup.d.ts +14 -0
  100. package/dist/lang/ast/expressions/expr-ungroup.js +83 -0
  101. package/dist/lang/ast/expressions/for-range.d.ts +19 -0
  102. package/dist/lang/ast/expressions/for-range.js +101 -0
  103. package/dist/lang/ast/expressions/granular-literal.d.ts +20 -0
  104. package/dist/lang/ast/expressions/granular-literal.js +148 -0
  105. package/dist/lang/ast/expressions/partial-compare.d.ts +14 -0
  106. package/dist/lang/ast/expressions/partial-compare.js +50 -0
  107. package/dist/lang/ast/expressions/pick-when.d.ts +19 -0
  108. package/dist/lang/ast/expressions/pick-when.js +156 -0
  109. package/dist/lang/ast/expressions/range.d.ts +12 -0
  110. package/dist/lang/ast/expressions/range.js +80 -0
  111. package/dist/lang/ast/expressions/time-frame.d.ts +7 -0
  112. package/dist/lang/ast/expressions/time-frame.js +40 -0
  113. package/dist/lang/ast/expressions/top-by.d.ts +10 -0
  114. package/dist/lang/ast/expressions/top-by.js +51 -0
  115. package/dist/lang/ast/expressions/unary.d.ts +5 -0
  116. package/dist/lang/ast/expressions/unary.js +34 -0
  117. package/dist/lang/ast/expressions/utils.d.ts +15 -0
  118. package/dist/lang/ast/expressions/utils.js +106 -0
  119. package/dist/lang/ast/expressions/when-clause.d.ts +10 -0
  120. package/dist/lang/ast/expressions/when-clause.js +17 -0
  121. package/dist/lang/ast/fragtype-utils.d.ts +39 -0
  122. package/dist/lang/ast/fragtype-utils.js +100 -0
  123. package/dist/lang/ast/import-elements/import-statement.d.ts +9 -0
  124. package/dist/lang/ast/import-elements/import-statement.js +78 -0
  125. package/dist/lang/ast/index.d.ts +94 -3
  126. package/dist/lang/ast/index.js +94 -3
  127. package/dist/lang/ast/json-elements/json-element.d.ts +6 -0
  128. package/dist/lang/ast/json-elements/json-element.js +41 -0
  129. package/dist/lang/ast/json-elements/json-struct-def.d.ts +10 -0
  130. package/dist/lang/ast/json-elements/json-struct-def.js +48 -0
  131. package/dist/lang/ast/nesting/nest-reference.d.ts +7 -0
  132. package/dist/lang/ast/nesting/nest-reference.js +35 -0
  133. package/dist/lang/ast/parameters/constant-parameter.d.ts +8 -0
  134. package/dist/lang/ast/parameters/constant-parameter.js +54 -0
  135. package/dist/lang/ast/parameters/has-parameter.d.ts +19 -0
  136. package/dist/lang/ast/parameters/has-parameter.js +64 -0
  137. package/dist/lang/ast/query-elements/anonymous-query.d.ts +9 -0
  138. package/dist/lang/ast/query-elements/anonymous-query.js +41 -0
  139. package/dist/lang/ast/query-elements/existing-query.d.ts +11 -0
  140. package/dist/lang/ast/query-elements/existing-query.js +79 -0
  141. package/dist/lang/ast/query-elements/full-query.d.ts +10 -0
  142. package/dist/lang/ast/query-elements/full-query.js +85 -0
  143. package/dist/lang/ast/query-elements/query-head-struct.d.ts +9 -0
  144. package/dist/lang/ast/query-elements/query-head-struct.js +48 -0
  145. package/dist/lang/ast/query-items/field-declaration.d.ts +31 -0
  146. package/dist/lang/ast/query-items/field-declaration.js +137 -0
  147. package/dist/lang/ast/query-items/field-references.d.ts +25 -0
  148. package/dist/lang/ast/query-items/field-references.js +80 -0
  149. package/dist/lang/ast/query-properties/aggregate.d.ts +5 -0
  150. package/dist/lang/ast/query-properties/aggregate.js +39 -0
  151. package/dist/lang/ast/query-properties/declare-fields.d.ts +5 -0
  152. package/dist/lang/ast/query-properties/declare-fields.js +33 -0
  153. package/dist/lang/ast/query-properties/dimmensions.d.ts +5 -0
  154. package/dist/lang/ast/query-properties/dimmensions.js +36 -0
  155. package/dist/lang/ast/query-properties/filters.d.ts +18 -0
  156. package/dist/lang/ast/query-properties/filters.js +89 -0
  157. package/dist/lang/ast/query-properties/group-by.d.ts +5 -0
  158. package/dist/lang/ast/query-properties/group-by.js +39 -0
  159. package/dist/lang/ast/query-properties/indexing.d.ts +10 -0
  160. package/dist/lang/ast/query-properties/indexing.js +39 -0
  161. package/dist/lang/ast/query-properties/joins.d.ts +36 -0
  162. package/dist/lang/ast/query-properties/joins.js +143 -0
  163. package/dist/lang/ast/query-properties/limit.d.ts +6 -0
  164. package/dist/lang/ast/query-properties/limit.js +35 -0
  165. package/dist/lang/ast/query-properties/measures.d.ts +5 -0
  166. package/dist/lang/ast/query-properties/measures.js +36 -0
  167. package/dist/lang/ast/query-properties/nests.d.ts +5 -0
  168. package/dist/lang/ast/query-properties/nests.js +33 -0
  169. package/dist/lang/ast/query-properties/ordering.d.ts +15 -0
  170. package/dist/lang/ast/query-properties/ordering.js +66 -0
  171. package/dist/lang/ast/query-properties/project-statement.d.ts +5 -0
  172. package/dist/lang/ast/query-properties/project-statement.js +33 -0
  173. package/dist/lang/ast/query-properties/qop-desc.d.ts +17 -0
  174. package/dist/lang/ast/query-properties/qop-desc.js +123 -0
  175. package/dist/lang/ast/query-properties/sampling.d.ts +8 -0
  176. package/dist/lang/ast/query-properties/sampling.js +38 -0
  177. package/dist/lang/ast/query-properties/top.d.ts +13 -0
  178. package/dist/lang/ast/query-properties/top.js +60 -0
  179. package/dist/lang/ast/result-spaces/index-field-space.d.ts +10 -0
  180. package/dist/lang/ast/result-spaces/index-field-space.js +57 -0
  181. package/dist/lang/ast/result-spaces/project-field-space.d.ts +6 -0
  182. package/dist/lang/ast/result-spaces/project-field-space.js +51 -0
  183. package/dist/lang/ast/result-spaces/reduce-field-space.d.ts +7 -0
  184. package/dist/lang/ast/result-spaces/reduce-field-space.js +37 -0
  185. package/dist/lang/ast/sources/named-source.d.ts +19 -0
  186. package/dist/lang/ast/sources/named-source.js +147 -0
  187. package/dist/lang/ast/sources/query-source.d.ts +9 -0
  188. package/dist/lang/ast/sources/query-source.js +41 -0
  189. package/dist/lang/ast/sources/sql-source.d.ts +7 -0
  190. package/dist/lang/ast/sources/sql-source.js +54 -0
  191. package/dist/lang/ast/sources/table-source.d.ts +8 -0
  192. package/dist/lang/ast/sources/table-source.js +60 -0
  193. package/dist/lang/ast/space-fields/column-space-field.d.ts +9 -0
  194. package/dist/lang/ast/space-fields/column-space-field.js +40 -0
  195. package/dist/lang/ast/space-fields/join-space-field.d.ts +8 -0
  196. package/dist/lang/ast/space-fields/join-space-field.js +35 -0
  197. package/dist/lang/ast/space-fields/query-field-struct.d.ts +10 -0
  198. package/dist/lang/ast/space-fields/query-field-struct.js +46 -0
  199. package/dist/lang/ast/space-fields/query-space-field.d.ts +11 -0
  200. package/dist/lang/ast/space-fields/query-space-field.js +37 -0
  201. package/dist/lang/ast/space-fields/reference-field.d.ts +11 -0
  202. package/dist/lang/ast/space-fields/reference-field.js +45 -0
  203. package/dist/lang/ast/space-fields/rename-space-field.d.ts +11 -0
  204. package/dist/lang/ast/space-fields/rename-space-field.js +50 -0
  205. package/dist/lang/ast/space-fields/wild-space-field.d.ts +10 -0
  206. package/dist/lang/ast/space-fields/wild-space-field.js +40 -0
  207. package/dist/lang/ast/space-parameters/abstract-parameter.d.ts +10 -0
  208. package/dist/lang/ast/space-parameters/abstract-parameter.js +41 -0
  209. package/dist/lang/ast/space-parameters/defined-parameter.d.ts +9 -0
  210. package/dist/lang/ast/space-parameters/defined-parameter.js +40 -0
  211. package/dist/lang/ast/space-seed.d.ts +17 -0
  212. package/dist/lang/ast/space-seed.js +59 -0
  213. package/dist/lang/ast/sql-elements/sql-statement.d.ts +19 -0
  214. package/dist/lang/ast/sql-elements/sql-statement.js +80 -0
  215. package/dist/lang/ast/sql-elements/sql-string.d.ts +12 -0
  216. package/dist/lang/ast/sql-elements/sql-string.js +60 -0
  217. package/dist/lang/ast/static-space.d.ts +33 -0
  218. package/dist/lang/ast/static-space.js +167 -0
  219. package/dist/lang/ast/struct-utils.d.ts +4 -0
  220. package/dist/lang/ast/struct-utils.js +48 -0
  221. package/dist/lang/ast/time-utils.d.ts +5 -2
  222. package/dist/lang/ast/time-utils.js +37 -1
  223. package/dist/lang/ast/types/comparison.d.ts +11 -0
  224. package/dist/lang/ast/types/comparison.js +41 -0
  225. package/dist/lang/ast/types/compart-types.d.ts +10 -0
  226. package/dist/lang/ast/types/compart-types.js +37 -0
  227. package/dist/lang/ast/types/document-compile-result.d.ts +8 -0
  228. package/dist/lang/ast/types/document-compile-result.js +25 -0
  229. package/dist/lang/ast/types/equality.d.ts +7 -0
  230. package/dist/lang/ast/types/equality.js +37 -0
  231. package/dist/lang/ast/types/executor.d.ts +9 -0
  232. package/dist/lang/ast/types/executor.js +25 -0
  233. package/dist/lang/ast/types/explore-desc.d.ts +5 -0
  234. package/dist/lang/ast/types/explore-desc.js +33 -0
  235. package/dist/lang/ast/types/explore-field.d.ts +5 -0
  236. package/dist/lang/ast/types/explore-field.js +32 -0
  237. package/dist/lang/ast/types/explore-property.d.ts +10 -0
  238. package/dist/lang/ast/types/explore-property.js +43 -0
  239. package/dist/lang/ast/types/expr-result.d.ts +5 -0
  240. package/dist/lang/ast/types/expr-result.js +25 -0
  241. package/dist/lang/ast/types/expr-value.d.ts +3 -0
  242. package/dist/lang/ast/types/expr-value.js +25 -0
  243. package/dist/lang/ast/types/expression-def.d.ts +69 -0
  244. package/dist/lang/ast/types/expression-def.js +346 -0
  245. package/dist/lang/ast/types/expression-value-type.d.ts +2 -0
  246. package/dist/lang/ast/types/expression-value-type.js +25 -0
  247. package/dist/lang/ast/types/field-collection-member.d.ts +5 -0
  248. package/dist/lang/ast/types/field-collection-member.js +34 -0
  249. package/dist/lang/ast/types/field-decl.d.ts +7 -0
  250. package/dist/lang/ast/types/field-decl.js +37 -0
  251. package/dist/lang/ast/types/field-map.d.ts +2 -0
  252. package/dist/lang/ast/types/field-map.js +25 -0
  253. package/dist/lang/ast/types/field-space.d.ts +26 -0
  254. package/dist/lang/ast/types/field-space.js +48 -0
  255. package/dist/lang/ast/types/field-type.d.ts +6 -0
  256. package/dist/lang/ast/types/field-type.js +25 -0
  257. package/dist/lang/ast/types/field-value-type.d.ts +3 -0
  258. package/dist/lang/ast/types/field-value-type.js +25 -0
  259. package/dist/lang/ast/types/frag-type.d.ts +6 -0
  260. package/dist/lang/ast/types/frag-type.js +25 -0
  261. package/dist/lang/ast/types/granular-result.d.ts +7 -0
  262. package/dist/lang/ast/types/granular-result.js +11 -0
  263. package/dist/lang/ast/types/lookup-result.d.ts +10 -0
  264. package/dist/lang/ast/types/lookup-result.js +25 -0
  265. package/dist/lang/ast/types/malloy-element.d.ts +105 -0
  266. package/dist/lang/ast/types/malloy-element.js +398 -0
  267. package/dist/lang/ast/types/model-entry.d.ts +6 -0
  268. package/dist/lang/ast/types/model-entry.js +25 -0
  269. package/dist/lang/ast/types/name-space.d.ts +5 -0
  270. package/dist/lang/ast/types/name-space.js +25 -0
  271. package/dist/lang/ast/types/nested-query.d.ts +3 -0
  272. package/dist/lang/ast/types/nested-query.js +25 -0
  273. package/dist/lang/ast/types/op-desc.d.ts +6 -0
  274. package/dist/lang/ast/types/op-desc.js +25 -0
  275. package/dist/lang/ast/types/query-comp.d.ts +5 -0
  276. package/dist/lang/ast/types/query-comp.js +25 -0
  277. package/dist/lang/ast/types/query-element.d.ts +5 -0
  278. package/dist/lang/ast/types/query-element.js +32 -0
  279. package/dist/lang/ast/types/query-item.d.ts +5 -0
  280. package/dist/lang/ast/types/query-item.js +25 -0
  281. package/dist/lang/ast/types/query-property.d.ts +17 -0
  282. package/dist/lang/ast/types/query-property.js +55 -0
  283. package/dist/lang/ast/types/space-entry.d.ts +5 -0
  284. package/dist/lang/ast/types/space-entry.js +29 -0
  285. package/dist/lang/ast/types/space-field.d.ts +10 -0
  286. package/dist/lang/ast/types/space-field.js +48 -0
  287. package/dist/lang/ast/types/space-param.d.ts +6 -0
  288. package/dist/lang/ast/types/space-param.js +34 -0
  289. package/dist/lang/ast/types/stage-field-type.d.ts +1 -0
  290. package/dist/lang/ast/types/stage-field-type.js +25 -0
  291. package/dist/lang/ast/types/time-result.d.ts +6 -0
  292. package/dist/lang/ast/types/time-result.js +25 -0
  293. package/dist/lang/ast/types/turtle-headed-pipe.d.ts +7 -0
  294. package/dist/lang/ast/types/turtle-headed-pipe.js +37 -0
  295. package/dist/lang/space-field.d.ts +4 -1
  296. package/dist/lang/space-field.js +4 -3
  297. package/dist/lang/test/field-symbols.spec.js +25 -21
  298. package/dist/lang/test/parse.spec.js +4 -3
  299. package/dist/lang/test/test-translator.d.ts +3 -1
  300. package/package.json +1 -1
  301. package/dist/lang/ast/apply-expr.d.ts +0 -3
  302. package/dist/lang/ast/ast-expr.d.ts +0 -206
  303. package/dist/lang/ast/ast-expr.js +0 -781
  304. package/dist/lang/ast/ast-time-expr.d.ts +0 -69
  305. package/dist/lang/ast/ast-time-expr.js +0 -389
  306. package/dist/lang/ast/ast-types.d.ts +0 -83
  307. package/dist/lang/ast/ast-types.js +0 -225
@@ -0,0 +1,10 @@
1
+ import { ExprValue } from "./types/expr-value";
2
+ /**
3
+ * When a translation hits an error, log and return one of these as a value.
4
+ * This will allow the rest of the translation walk to complete. The
5
+ * generated SQL will have a reference to an impossible variable name
6
+ * with the reason embedded in it.
7
+ * @param reason very short phrase, only read by implementers
8
+ * @returns Fragment[] which a debugging humnan will regognize
9
+ */
10
+ export declare function errorFor(reason: string): ExprValue;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.errorFor = void 0;
26
+ /**
27
+ * When a translation hits an error, log and return one of these as a value.
28
+ * This will allow the rest of the translation walk to complete. The
29
+ * generated SQL will have a reference to an impossible variable name
30
+ * with the reason embedded in it.
31
+ * @param reason very short phrase, only read by implementers
32
+ * @returns Fragment[] which a debugging humnan will regognize
33
+ */
34
+ function errorFor(reason) {
35
+ return {
36
+ dataType: "unknown",
37
+ expressionType: "scalar",
38
+ value: [`_ERROR_${reason.replace(/ /g, "_")}`],
39
+ };
40
+ }
41
+ exports.errorFor = errorFor;
42
+ //# sourceMappingURL=ast-utils.js.map
@@ -0,0 +1,17 @@
1
+ import { ModelDataRequest } from "../../parse-malloy";
2
+ import { DocStatement, Document, MalloyElement, RunList } from "../types/malloy-element";
3
+ import { HasParameter } from "../parameters/has-parameter";
4
+ import { Mallobj } from "./mallobj";
5
+ export declare class DefineExplore extends MalloyElement implements DocStatement {
6
+ readonly name: string;
7
+ readonly mallobj: Mallobj;
8
+ readonly exported: boolean;
9
+ elementType: string;
10
+ readonly parameters?: HasParameter[];
11
+ constructor(name: string, mallobj: Mallobj, exported: boolean, params?: MalloyElement[]);
12
+ execute(doc: Document): ModelDataRequest;
13
+ }
14
+ export declare class DefineSourceList extends RunList implements DocStatement {
15
+ constructor(sourceList: DefineExplore[]);
16
+ execute(doc: Document): ModelDataRequest;
17
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.DefineSourceList = exports.DefineExplore = void 0;
26
+ const malloy_element_1 = require("../types/malloy-element");
27
+ const has_parameter_1 = require("../parameters/has-parameter");
28
+ const error_factory_1 = require("../error-factory");
29
+ class DefineExplore extends malloy_element_1.MalloyElement {
30
+ constructor(name, mallobj, exported, params) {
31
+ super({ explore: mallobj });
32
+ this.name = name;
33
+ this.mallobj = mallobj;
34
+ this.exported = exported;
35
+ this.elementType = "defineExplore";
36
+ if (params) {
37
+ this.parameters = [];
38
+ for (const el of params) {
39
+ if (el instanceof has_parameter_1.HasParameter) {
40
+ this.parameters.push(el);
41
+ }
42
+ else {
43
+ this.log(`Unexpected element type in define statement: ${el.elementType}`);
44
+ }
45
+ }
46
+ this.has({ parameters: this.parameters });
47
+ }
48
+ }
49
+ execute(doc) {
50
+ if (doc.modelEntry(this.name)) {
51
+ this.log(`Cannot redefine '${this.name}'`);
52
+ }
53
+ else {
54
+ const structDef = this.mallobj.withParameters(this.parameters);
55
+ if (error_factory_1.ErrorFactory.isErrorStructDef(structDef)) {
56
+ return;
57
+ }
58
+ doc.setEntry(this.name, {
59
+ entry: {
60
+ ...structDef,
61
+ as: this.name,
62
+ location: this.location,
63
+ },
64
+ exported: this.exported,
65
+ });
66
+ }
67
+ }
68
+ }
69
+ exports.DefineExplore = DefineExplore;
70
+ class DefineSourceList extends malloy_element_1.RunList {
71
+ constructor(sourceList) {
72
+ super("defineSources", sourceList);
73
+ }
74
+ execute(doc) {
75
+ return this.executeList(doc);
76
+ }
77
+ }
78
+ exports.DefineSourceList = DefineSourceList;
79
+ //# sourceMappingURL=define-explore.js.map
@@ -0,0 +1,14 @@
1
+ import { ModelDataRequest } from "../../parse-malloy";
2
+ import { DocStatement, Document, MalloyElement, RunList } from "../types/malloy-element";
3
+ import { QueryElement } from "../types/query-element";
4
+ export declare class DefineQuery extends MalloyElement implements DocStatement {
5
+ readonly name: string;
6
+ readonly queryDetails: QueryElement;
7
+ elementType: string;
8
+ constructor(name: string, queryDetails: QueryElement);
9
+ execute(doc: Document): ModelDataRequest;
10
+ }
11
+ export declare class DefineQueryList extends RunList implements DocStatement {
12
+ constructor(queryList: DefineQuery[]);
13
+ execute(doc: Document): ModelDataRequest;
14
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.DefineQueryList = exports.DefineQuery = void 0;
26
+ const malloy_element_1 = require("../types/malloy-element");
27
+ class DefineQuery extends malloy_element_1.MalloyElement {
28
+ constructor(name, queryDetails) {
29
+ super({ queryDetails });
30
+ this.name = name;
31
+ this.queryDetails = queryDetails;
32
+ this.elementType = "defineQuery";
33
+ }
34
+ execute(doc) {
35
+ const entry = {
36
+ ...this.queryDetails.query(),
37
+ type: "query",
38
+ name: this.name,
39
+ location: this.location,
40
+ };
41
+ const exported = false;
42
+ doc.setEntry(this.name, { entry, exported });
43
+ return undefined;
44
+ }
45
+ }
46
+ exports.DefineQuery = DefineQuery;
47
+ class DefineQueryList extends malloy_element_1.RunList {
48
+ constructor(queryList) {
49
+ super("defineQueries", queryList);
50
+ }
51
+ execute(doc) {
52
+ return this.executeList(doc);
53
+ }
54
+ }
55
+ exports.DefineQueryList = DefineQueryList;
56
+ //# sourceMappingURL=define-query.js.map
@@ -0,0 +1,12 @@
1
+ import { StructDef, StructRef } from "../../../model/malloy_types";
2
+ import { MalloyElement } from "../types/malloy-element";
3
+ import { HasParameter } from "../parameters/has-parameter";
4
+ /**
5
+ * A "Mallobj" is a thing which you can run queries against, it has been called
6
+ * an "exploreable", or a "space".
7
+ */
8
+ export declare abstract class Mallobj extends MalloyElement {
9
+ abstract structDef(): StructDef;
10
+ structRef(): StructRef;
11
+ withParameters(pList: HasParameter[] | undefined): StructDef;
12
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.Mallobj = void 0;
26
+ const malloy_element_1 = require("../types/malloy-element");
27
+ /**
28
+ * A "Mallobj" is a thing which you can run queries against, it has been called
29
+ * an "exploreable", or a "space".
30
+ */
31
+ class Mallobj extends malloy_element_1.MalloyElement {
32
+ structRef() {
33
+ return this.structDef();
34
+ }
35
+ withParameters(pList) {
36
+ const before = this.structDef();
37
+ // TODO name collisions are flagged where?
38
+ if (pList) {
39
+ const parameters = { ...(before.parameters || {}) };
40
+ for (const hasP of pList) {
41
+ const pVal = hasP.parameter();
42
+ parameters[pVal.name] = pVal;
43
+ }
44
+ return {
45
+ ...before,
46
+ parameters,
47
+ };
48
+ }
49
+ return before;
50
+ }
51
+ }
52
+ exports.Mallobj = Mallobj;
53
+ //# sourceMappingURL=mallobj.js.map
@@ -0,0 +1,28 @@
1
+ import { DocumentLocation, Pipeline, PipeSegment, StructDef } from "../../../model/malloy_types";
2
+ import { FieldSpace } from "../types/field-space";
3
+ import { MalloyElement } from "../types/malloy-element";
4
+ import { QOPDesc } from "../query-properties/qop-desc";
5
+ import { QuerySpace } from "../ast-main";
6
+ /**
7
+ * Generic abstract for all pipelines, the first segment might be a reference
8
+ * to an existing pipeline (query or turtle), and if there is a refinement it
9
+ * is refers to the first segment of the composed pipeline.
10
+ */
11
+ export declare abstract class PipelineDesc extends MalloyElement {
12
+ elementType: string;
13
+ protected headRefinement?: QOPDesc;
14
+ protected qops: QOPDesc[];
15
+ nestedInQuerySpace?: QuerySpace;
16
+ refineHead(refinement: QOPDesc): void;
17
+ addSegments(...segDesc: QOPDesc[]): void;
18
+ protected appendOps(modelPipe: PipeSegment[], existingEndSpace: FieldSpace): {
19
+ opList: PipeSegment[];
20
+ structDef: StructDef;
21
+ };
22
+ protected refinePipeline(fs: FieldSpace, modelPipe: Pipeline): Pipeline;
23
+ protected expandTurtle(turtleName: string, fromStruct: StructDef): {
24
+ pipeline: PipeSegment[];
25
+ location: DocumentLocation | undefined;
26
+ };
27
+ protected getOutputStruct(walkStruct: StructDef, pipeline: PipeSegment[]): StructDef;
28
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.PipelineDesc = void 0;
26
+ const malloy_element_1 = require("../types/malloy-element");
27
+ const struct_utils_1 = require("../struct-utils");
28
+ /**
29
+ * Generic abstract for all pipelines, the first segment might be a reference
30
+ * to an existing pipeline (query or turtle), and if there is a refinement it
31
+ * is refers to the first segment of the composed pipeline.
32
+ */
33
+ class PipelineDesc extends malloy_element_1.MalloyElement {
34
+ constructor() {
35
+ super(...arguments);
36
+ this.elementType = "pipelineDesc";
37
+ this.qops = [];
38
+ }
39
+ refineHead(refinement) {
40
+ this.headRefinement = refinement;
41
+ this.has({ headRefinement: refinement });
42
+ }
43
+ addSegments(...segDesc) {
44
+ this.qops.push(...segDesc);
45
+ this.has({ segments: this.qops });
46
+ }
47
+ appendOps(modelPipe, existingEndSpace) {
48
+ let nextFS = existingEndSpace;
49
+ let returnPipe;
50
+ for (const qop of this.qops) {
51
+ const qopIsNested = modelPipe.length == 0;
52
+ const next = qop.getOp(nextFS, qopIsNested ? this : null);
53
+ if (returnPipe == undefined) {
54
+ returnPipe = [...modelPipe];
55
+ }
56
+ returnPipe.push(next.segment);
57
+ nextFS = next.outputSpace();
58
+ }
59
+ return {
60
+ opList: returnPipe || modelPipe,
61
+ structDef: nextFS.structDef(),
62
+ };
63
+ }
64
+ refinePipeline(fs, modelPipe) {
65
+ if (!this.headRefinement) {
66
+ return modelPipe;
67
+ }
68
+ const pipeline = [];
69
+ if (modelPipe.pipeHead) {
70
+ const { pipeline: turtlePipe } = this.expandTurtle(modelPipe.pipeHead.name, fs.structDef());
71
+ pipeline.push(...turtlePipe);
72
+ }
73
+ pipeline.push(...modelPipe.pipeline);
74
+ const firstSeg = pipeline[0];
75
+ if (firstSeg) {
76
+ this.headRefinement.refineFrom(firstSeg);
77
+ }
78
+ pipeline[0] = this.headRefinement.getOp(fs, this).segment;
79
+ return { pipeline };
80
+ }
81
+ expandTurtle(turtleName, fromStruct) {
82
+ const turtle = (0, struct_utils_1.getStructFieldDef)(fromStruct, turtleName);
83
+ if (!turtle) {
84
+ this.log(`Query '${turtleName}' is not defined in source`);
85
+ }
86
+ else if (turtle.type !== "turtle") {
87
+ this.log(`'${turtleName}' is not a query`);
88
+ }
89
+ else {
90
+ return { pipeline: turtle.pipeline, location: turtle.location };
91
+ }
92
+ return { pipeline: [], location: undefined };
93
+ }
94
+ getOutputStruct(walkStruct, pipeline) {
95
+ for (const modelQop of pipeline) {
96
+ walkStruct = (0, struct_utils_1.opOutputStruct)(this, walkStruct, modelQop);
97
+ }
98
+ return walkStruct;
99
+ }
100
+ }
101
+ exports.PipelineDesc = PipelineDesc;
102
+ //# sourceMappingURL=pipeline-desc.js.map
@@ -0,0 +1,15 @@
1
+ import { StructDef } from "../../../model/malloy_types";
2
+ import { ExploreDesc } from "../types/explore-desc";
3
+ import { HasParameter } from "../parameters/has-parameter";
4
+ import { Mallobj } from "./mallobj";
5
+ /**
6
+ * A Mallobj made from a source and a set of refinements
7
+ */
8
+ export declare class RefinedExplore extends Mallobj {
9
+ readonly source: Mallobj;
10
+ readonly refinement: ExploreDesc;
11
+ elementType: string;
12
+ constructor(source: Mallobj, refinement: ExploreDesc);
13
+ structDef(): StructDef;
14
+ withParameters(pList: HasParameter[] | undefined): StructDef;
15
+ }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.RefinedExplore = void 0;
26
+ const lodash_1 = require("lodash");
27
+ const malloy_types_1 = require("../../../model/malloy_types");
28
+ const field_list_edit_1 = require("../explore-properties/field-list-edit");
29
+ const primary_key_1 = require("../explore-properties/primary-key");
30
+ const renames_1 = require("../explore-properties/renames");
31
+ const turtles_1 = require("../explore-properties/turtles");
32
+ const mallobj_1 = require("./mallobj");
33
+ const declare_fields_1 = require("../query-properties/declare-fields");
34
+ const filters_1 = require("../query-properties/filters");
35
+ const joins_1 = require("../query-properties/joins");
36
+ const ast_main_1 = require("../ast-main");
37
+ /**
38
+ * A Mallobj made from a source and a set of refinements
39
+ */
40
+ class RefinedExplore extends mallobj_1.Mallobj {
41
+ constructor(source, refinement) {
42
+ super({ source, refinement });
43
+ this.source = source;
44
+ this.refinement = refinement;
45
+ this.elementType = "refinedExplore";
46
+ }
47
+ structDef() {
48
+ return this.withParameters([]);
49
+ }
50
+ withParameters(pList) {
51
+ let primaryKey;
52
+ let fieldListEdit;
53
+ const fields = [];
54
+ const filters = [];
55
+ for (const el of this.refinement.list) {
56
+ const errTo = el;
57
+ if (el instanceof primary_key_1.PrimaryKey) {
58
+ if (primaryKey) {
59
+ primaryKey.log("Primary key already defined");
60
+ el.log("Primary key redefined");
61
+ }
62
+ primaryKey = el;
63
+ }
64
+ else if (el instanceof field_list_edit_1.FieldListEdit) {
65
+ if (fieldListEdit) {
66
+ fieldListEdit.log("Too many accept/except statements");
67
+ el.log("Too many accept/except statements");
68
+ }
69
+ fieldListEdit = el;
70
+ }
71
+ else if (el instanceof declare_fields_1.DeclareFields ||
72
+ el instanceof joins_1.Joins ||
73
+ el instanceof turtles_1.Turtles ||
74
+ el instanceof renames_1.Renames) {
75
+ fields.push(...el.list);
76
+ }
77
+ else if (el instanceof filters_1.Filter) {
78
+ filters.push(el);
79
+ }
80
+ else {
81
+ errTo.log(`Unexpected explore property: '${errTo.elementType}'`);
82
+ }
83
+ }
84
+ const from = (0, lodash_1.cloneDeep)(this.source.structDef());
85
+ if (primaryKey) {
86
+ from.primaryKey = primaryKey.field.name;
87
+ }
88
+ const fs = ast_main_1.DynamicSpace.filteredFrom(from, fieldListEdit);
89
+ fs.addField(...fields);
90
+ if (pList) {
91
+ fs.addParameters(pList);
92
+ }
93
+ if (primaryKey) {
94
+ const keyDef = primaryKey.field.getField(fs);
95
+ if (keyDef.error) {
96
+ primaryKey.log(keyDef.error);
97
+ }
98
+ }
99
+ const retStruct = fs.structDef();
100
+ const filterList = retStruct.filterList || [];
101
+ let moreFilters = false;
102
+ for (const filter of filters) {
103
+ for (const el of filter.list) {
104
+ const fc = el.filterExpression(fs);
105
+ if ((0, malloy_types_1.expressionIsCalculation)(fc.expressionType)) {
106
+ el.log("Can't use aggregate computations in top level filters");
107
+ }
108
+ else {
109
+ filterList.push(fc);
110
+ moreFilters = true;
111
+ }
112
+ }
113
+ }
114
+ if (moreFilters) {
115
+ return { ...retStruct, filterList };
116
+ }
117
+ return retStruct;
118
+ }
119
+ }
120
+ exports.RefinedExplore = RefinedExplore;
121
+ //# sourceMappingURL=refined-explore.js.map
@@ -0,0 +1,9 @@
1
+ import { IndexSegment, ProjectSegment, Query, ReduceSegment, StructDef } from "../../model/malloy_types";
2
+ export declare class ErrorFactory {
3
+ static get structDef(): StructDef;
4
+ static isErrorStructDef(s: StructDef): boolean;
5
+ static get query(): Query;
6
+ static get reduceSegment(): ReduceSegment;
7
+ static get projectSegment(): ProjectSegment;
8
+ static get indexSegment(): IndexSegment;
9
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.ErrorFactory = void 0;
26
+ const theErrorStruct = {
27
+ type: "struct",
28
+ name: "~malformed~",
29
+ dialect: "~malformed~",
30
+ structSource: { type: "table", tablePath: "//undefined_error_table_path" },
31
+ structRelationship: {
32
+ type: "basetable",
33
+ connectionName: "//undefined_error_connection",
34
+ },
35
+ fields: [],
36
+ };
37
+ class ErrorFactory {
38
+ static get structDef() {
39
+ return { ...theErrorStruct };
40
+ }
41
+ static isErrorStructDef(s) {
42
+ return s.name.includes(theErrorStruct.name);
43
+ }
44
+ static get query() {
45
+ return {
46
+ structRef: ErrorFactory.structDef,
47
+ pipeline: [],
48
+ };
49
+ }
50
+ static get reduceSegment() {
51
+ return { type: "reduce", fields: [] };
52
+ }
53
+ static get projectSegment() {
54
+ return { type: "project", fields: [] };
55
+ }
56
+ static get indexSegment() {
57
+ return { type: "index", fields: [] };
58
+ }
59
+ }
60
+ exports.ErrorFactory = ErrorFactory;
61
+ //# sourceMappingURL=error-factory.js.map
@@ -0,0 +1,18 @@
1
+ import { FilterExpression, PipeSegment, Sampling } from "../../../model/malloy_types";
2
+ import { FieldName, FieldSpace } from "../types/field-space";
3
+ import { Limit } from "../query-properties/limit";
4
+ import { IndexFieldSpace } from "../result-spaces/index-field-space";
5
+ import { QueryProperty } from "../types/query-property";
6
+ import { Executor } from "../types/executor";
7
+ import { QuerySpace } from "../ast-main";
8
+ export declare class IndexExecutor implements Executor {
9
+ filters: FilterExpression[];
10
+ limit?: Limit;
11
+ indexOn?: FieldName;
12
+ sample?: Sampling;
13
+ resultFS: IndexFieldSpace;
14
+ inputFS: QuerySpace;
15
+ constructor(inputFS: FieldSpace);
16
+ execute(qp: QueryProperty): void;
17
+ finalize(from: PipeSegment | undefined): PipeSegment;
18
+ }