@malloydata/malloy 0.0.39-dev230613161129 → 0.0.39

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/dialect/dialect.d.ts +9 -13
  2. package/dist/dialect/dialect.js +16 -3
  3. package/dist/dialect/dialect_map.d.ts +2 -0
  4. package/dist/dialect/dialect_map.js +61 -1
  5. package/dist/dialect/{duckdb.d.ts → duckdb/duckdb.d.ts} +8 -5
  6. package/dist/dialect/{duckdb.js → duckdb/duckdb.js} +21 -9
  7. package/dist/dialect/duckdb/functions/byte_length.d.ts +2 -0
  8. package/dist/dialect/duckdb/functions/byte_length.js +33 -0
  9. package/dist/dialect/duckdb/functions/div.d.ts +2 -0
  10. package/dist/dialect/duckdb/functions/div.js +38 -0
  11. package/dist/dialect/duckdb/functions/duckdb_functions.d.ts +1 -0
  12. package/dist/dialect/duckdb/functions/duckdb_functions.js +52 -0
  13. package/dist/dialect/duckdb/functions/ends_with.d.ts +2 -0
  14. package/dist/dialect/duckdb/functions/ends_with.js +35 -0
  15. package/dist/dialect/duckdb/functions/greatest_and_least.d.ts +3 -0
  16. package/dist/dialect/duckdb/functions/greatest_and_least.js +58 -0
  17. package/dist/dialect/duckdb/functions/index.d.ts +1 -0
  18. package/dist/dialect/duckdb/functions/index.js +28 -0
  19. package/dist/dialect/duckdb/functions/is_inf.d.ts +2 -0
  20. package/dist/dialect/duckdb/functions/is_inf.js +33 -0
  21. package/dist/dialect/duckdb/functions/is_nan.d.ts +2 -0
  22. package/dist/dialect/duckdb/functions/is_nan.js +33 -0
  23. package/dist/dialect/duckdb/functions/log.d.ts +2 -0
  24. package/dist/dialect/duckdb/functions/log.js +38 -0
  25. package/dist/dialect/duckdb/functions/rand.d.ts +2 -0
  26. package/dist/dialect/duckdb/functions/rand.js +31 -0
  27. package/dist/dialect/duckdb/functions/replace.d.ts +2 -0
  28. package/dist/dialect/duckdb/functions/replace.js +40 -0
  29. package/dist/dialect/duckdb/functions/trunc.d.ts +2 -0
  30. package/dist/dialect/duckdb/functions/trunc.js +39 -0
  31. package/dist/dialect/duckdb/functions/unicode.d.ts +2 -0
  32. package/dist/dialect/duckdb/functions/unicode.js +35 -0
  33. package/dist/dialect/duckdb/index.d.ts +1 -0
  34. package/dist/dialect/duckdb/index.js +40 -0
  35. package/dist/dialect/functions/all_functions.d.ts +8 -0
  36. package/dist/dialect/functions/all_functions.js +135 -0
  37. package/dist/dialect/functions/atan2.d.ts +2 -0
  38. package/dist/dialect/functions/atan2.js +33 -0
  39. package/dist/dialect/functions/avg_moving.d.ts +2 -0
  40. package/dist/dialect/functions/avg_moving.js +46 -0
  41. package/dist/dialect/functions/chr.d.ts +4 -0
  42. package/dist/dialect/functions/chr.js +45 -0
  43. package/dist/dialect/functions/coalesce.d.ts +2 -0
  44. package/dist/dialect/functions/coalesce.js +38 -0
  45. package/dist/dialect/functions/concat.d.ts +2 -0
  46. package/dist/dialect/functions/concat.js +38 -0
  47. package/dist/dialect/functions/div.d.ts +2 -0
  48. package/dist/dialect/functions/div.js +36 -0
  49. package/dist/dialect/functions/first_value_window.d.ts +3 -0
  50. package/dist/dialect/functions/first_value_window.js +49 -0
  51. package/dist/dialect/functions/function_map.d.ts +16 -0
  52. package/dist/dialect/functions/function_map.js +50 -0
  53. package/dist/dialect/functions/greatest_and_least.d.ts +3 -0
  54. package/dist/dialect/functions/greatest_and_least.js +44 -0
  55. package/dist/dialect/functions/ifnull.d.ts +2 -0
  56. package/dist/dialect/functions/ifnull.js +38 -0
  57. package/dist/dialect/functions/index.d.ts +2 -0
  58. package/dist/dialect/functions/index.js +28 -0
  59. package/dist/dialect/functions/is_inf.d.ts +2 -0
  60. package/dist/dialect/functions/is_inf.js +33 -0
  61. package/dist/dialect/functions/is_nan.d.ts +2 -0
  62. package/dist/dialect/functions/is_nan.js +33 -0
  63. package/dist/dialect/functions/lag.d.ts +2 -0
  64. package/dist/dialect/functions/lag.js +53 -0
  65. package/dist/dialect/functions/lead.d.ts +2 -0
  66. package/dist/dialect/functions/lead.js +50 -0
  67. package/dist/dialect/functions/length.d.ts +3 -0
  68. package/dist/dialect/functions/length.js +39 -0
  69. package/dist/dialect/functions/log.d.ts +2 -0
  70. package/dist/dialect/functions/log.js +35 -0
  71. package/dist/dialect/functions/lower.d.ts +2 -0
  72. package/dist/dialect/functions/lower.js +34 -0
  73. package/dist/dialect/functions/nullif.d.ts +2 -0
  74. package/dist/dialect/functions/nullif.js +42 -0
  75. package/dist/dialect/functions/pi.d.ts +2 -0
  76. package/dist/{lang/ast/types/type-desc.js → dialect/functions/pi.js} +7 -1
  77. package/dist/dialect/functions/pow.d.ts +2 -0
  78. package/dist/dialect/functions/pow.js +35 -0
  79. package/dist/dialect/functions/rand.d.ts +2 -0
  80. package/dist/dialect/functions/rand.js +31 -0
  81. package/dist/dialect/functions/rank.d.ts +2 -0
  82. package/dist/dialect/functions/rank.js +36 -0
  83. package/dist/dialect/functions/regexp_extract.d.ts +2 -0
  84. package/dist/dialect/functions/regexp_extract.js +41 -0
  85. package/dist/dialect/functions/repeat.d.ts +2 -0
  86. package/dist/dialect/functions/repeat.js +35 -0
  87. package/dist/dialect/functions/replace.d.ts +2 -0
  88. package/dist/dialect/functions/replace.js +42 -0
  89. package/dist/dialect/functions/reverse.d.ts +2 -0
  90. package/dist/dialect/functions/reverse.js +34 -0
  91. package/dist/dialect/functions/round.d.ts +2 -0
  92. package/dist/dialect/functions/round.js +40 -0
  93. package/dist/dialect/functions/row_number.d.ts +2 -0
  94. package/dist/dialect/functions/row_number.js +40 -0
  95. package/dist/dialect/functions/simple_numeric_functions.d.ts +15 -0
  96. package/dist/dialect/functions/simple_numeric_functions.js +60 -0
  97. package/dist/dialect/functions/starts_ends_with.d.ts +3 -0
  98. package/dist/dialect/functions/starts_ends_with.js +43 -0
  99. package/dist/dialect/functions/stddev.d.ts +2 -0
  100. package/dist/dialect/functions/stddev.js +34 -0
  101. package/dist/dialect/functions/strpos.d.ts +2 -0
  102. package/dist/dialect/functions/strpos.js +35 -0
  103. package/dist/dialect/functions/substr.d.ts +2 -0
  104. package/dist/dialect/functions/substr.js +37 -0
  105. package/dist/dialect/functions/sum_min_max_window.d.ts +7 -0
  106. package/dist/dialect/functions/sum_min_max_window.js +94 -0
  107. package/dist/dialect/functions/trim_functions.d.ts +4 -0
  108. package/dist/dialect/functions/trim_functions.js +42 -0
  109. package/dist/dialect/functions/trunc.d.ts +2 -0
  110. package/dist/dialect/functions/trunc.js +38 -0
  111. package/dist/dialect/functions/upper.d.ts +2 -0
  112. package/dist/dialect/functions/upper.js +34 -0
  113. package/dist/dialect/functions/util.d.ts +45 -0
  114. package/dist/dialect/functions/util.js +187 -0
  115. package/dist/dialect/index.d.ts +1 -1
  116. package/dist/dialect/index.js +2 -1
  117. package/dist/dialect/postgres/functions/byte_length.d.ts +2 -0
  118. package/dist/dialect/postgres/functions/byte_length.js +33 -0
  119. package/dist/dialect/postgres/functions/ends_with.d.ts +2 -0
  120. package/dist/dialect/postgres/functions/ends_with.js +38 -0
  121. package/dist/dialect/postgres/functions/greatest_and_least.d.ts +3 -0
  122. package/dist/dialect/postgres/functions/greatest_and_least.js +45 -0
  123. package/dist/dialect/postgres/functions/ifnull.d.ts +2 -0
  124. package/dist/dialect/postgres/functions/ifnull.js +40 -0
  125. package/dist/dialect/postgres/functions/index.d.ts +1 -0
  126. package/dist/dialect/postgres/functions/index.js +28 -0
  127. package/dist/dialect/postgres/functions/is_inf.d.ts +2 -0
  128. package/dist/dialect/postgres/functions/is_inf.js +34 -0
  129. package/dist/dialect/postgres/functions/is_nan.d.ts +2 -0
  130. package/dist/dialect/postgres/functions/is_nan.js +33 -0
  131. package/dist/dialect/postgres/functions/log.d.ts +2 -0
  132. package/dist/dialect/postgres/functions/log.js +37 -0
  133. package/dist/dialect/postgres/functions/postgres_functions.d.ts +1 -0
  134. package/dist/dialect/postgres/functions/postgres_functions.js +60 -0
  135. package/dist/dialect/postgres/functions/rand.d.ts +2 -0
  136. package/dist/dialect/postgres/functions/rand.js +31 -0
  137. package/dist/dialect/postgres/functions/regexp_extract.d.ts +2 -0
  138. package/dist/dialect/postgres/functions/regexp_extract.js +35 -0
  139. package/dist/dialect/postgres/functions/replace.d.ts +2 -0
  140. package/dist/dialect/postgres/functions/replace.js +40 -0
  141. package/dist/dialect/postgres/functions/round.d.ts +2 -0
  142. package/dist/dialect/postgres/functions/round.js +39 -0
  143. package/dist/dialect/postgres/functions/stddev.d.ts +2 -0
  144. package/dist/dialect/postgres/functions/stddev.js +37 -0
  145. package/dist/dialect/postgres/functions/substr.d.ts +2 -0
  146. package/dist/dialect/postgres/functions/substr.js +38 -0
  147. package/dist/dialect/postgres/functions/trunc.d.ts +2 -0
  148. package/dist/dialect/postgres/functions/trunc.js +40 -0
  149. package/dist/dialect/postgres/functions/unicode.d.ts +2 -0
  150. package/dist/dialect/postgres/functions/unicode.js +34 -0
  151. package/dist/dialect/postgres/index.d.ts +1 -0
  152. package/dist/dialect/postgres/index.js +40 -0
  153. package/dist/dialect/{postgres.d.ts → postgres/postgres.d.ts} +9 -5
  154. package/dist/dialect/{postgres.js → postgres/postgres.js} +24 -10
  155. package/dist/dialect/standardsql/functions/chr.d.ts +2 -0
  156. package/dist/dialect/standardsql/functions/chr.js +37 -0
  157. package/dist/dialect/standardsql/functions/index.d.ts +1 -0
  158. package/dist/dialect/standardsql/functions/index.js +28 -0
  159. package/dist/dialect/standardsql/functions/pi.d.ts +2 -0
  160. package/dist/dialect/standardsql/functions/pi.js +32 -0
  161. package/dist/dialect/standardsql/functions/standardsql_functions.d.ts +1 -0
  162. package/dist/dialect/standardsql/functions/standardsql_functions.js +33 -0
  163. package/dist/dialect/standardsql/index.d.ts +1 -0
  164. package/dist/dialect/standardsql/index.js +40 -0
  165. package/dist/dialect/{standardsql.d.ts → standardsql/standardsql.d.ts} +7 -4
  166. package/dist/dialect/{standardsql.js → standardsql/standardsql.js} +13 -11
  167. package/dist/index.d.ts +1 -1
  168. package/dist/lang/ast/ast-utils.js +1 -0
  169. package/dist/lang/ast/elements/define-query.js +1 -1
  170. package/dist/lang/ast/elements/import-statement.js +6 -1
  171. package/dist/lang/ast/executors/index-executor.d.ts +1 -1
  172. package/dist/lang/ast/executors/index-executor.js +2 -2
  173. package/dist/lang/ast/executors/project-executor.d.ts +1 -1
  174. package/dist/lang/ast/executors/project-executor.js +2 -2
  175. package/dist/lang/ast/executors/reduce-executor.d.ts +2 -4
  176. package/dist/lang/ast/executors/reduce-executor.js +8 -4
  177. package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
  178. package/dist/lang/ast/expressions/binary-boolean.js +2 -0
  179. package/dist/lang/ast/expressions/constant-sub-expression.js +10 -0
  180. package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +2 -2
  181. package/dist/lang/ast/expressions/expr-aggregate-function.js +28 -2
  182. package/dist/lang/ast/expressions/expr-alternation-tree.js +1 -0
  183. package/dist/lang/ast/expressions/expr-cast.js +1 -0
  184. package/dist/lang/ast/expressions/expr-coalesce.d.ts +1 -1
  185. package/dist/lang/ast/expressions/expr-coalesce.js +1 -0
  186. package/dist/lang/ast/expressions/expr-count-distinct.d.ts +1 -1
  187. package/dist/lang/ast/expressions/expr-count.js +1 -0
  188. package/dist/lang/ast/expressions/expr-filter.d.ts +1 -1
  189. package/dist/lang/ast/expressions/expr-filter.js +1 -1
  190. package/dist/lang/ast/expressions/expr-func.d.ts +6 -1
  191. package/dist/lang/ast/expressions/expr-func.js +266 -16
  192. package/dist/lang/ast/expressions/expr-granular-time.d.ts +1 -1
  193. package/dist/lang/ast/expressions/expr-id-reference.js +12 -0
  194. package/dist/lang/ast/expressions/expr-logical-op.d.ts +1 -1
  195. package/dist/lang/ast/expressions/expr-max.d.ts +2 -2
  196. package/dist/lang/ast/expressions/expr-min.d.ts +2 -2
  197. package/dist/lang/ast/expressions/expr-not.d.ts +1 -1
  198. package/dist/lang/ast/expressions/expr-now.js +2 -0
  199. package/dist/lang/ast/expressions/expr-null.js +1 -0
  200. package/dist/lang/ast/expressions/expr-number.js +5 -1
  201. package/dist/lang/ast/expressions/expr-regex.js +4 -1
  202. package/dist/lang/ast/expressions/expr-string.js +1 -0
  203. package/dist/lang/ast/expressions/expr-time-extract.js +2 -0
  204. package/dist/lang/ast/expressions/expr-time.js +1 -0
  205. package/dist/lang/ast/expressions/expr-ungroup.d.ts +2 -2
  206. package/dist/lang/ast/expressions/expr-ungroup.js +15 -7
  207. package/dist/lang/ast/expressions/for-range.d.ts +1 -1
  208. package/dist/lang/ast/expressions/pick-when.js +7 -0
  209. package/dist/lang/ast/expressions/range.js +1 -0
  210. package/dist/lang/ast/expressions/time-literal.js +9 -3
  211. package/dist/lang/ast/field-space/column-space-field.d.ts +1 -2
  212. package/dist/lang/ast/field-space/dynamic-space.js +6 -4
  213. package/dist/lang/ast/field-space/field-definition-value.d.ts +1 -1
  214. package/dist/lang/ast/field-space/project-field-space.d.ts +2 -2
  215. package/dist/lang/ast/field-space/project-field-space.js +12 -13
  216. package/dist/lang/ast/field-space/query-space-field.d.ts +1 -2
  217. package/dist/lang/ast/field-space/query-space-field.js +1 -1
  218. package/dist/lang/ast/field-space/query-spaces.d.ts +16 -2
  219. package/dist/lang/ast/field-space/query-spaces.js +175 -10
  220. package/dist/lang/ast/field-space/reference-field.d.ts +3 -2
  221. package/dist/lang/ast/field-space/reference-field.js +8 -1
  222. package/dist/lang/ast/field-space/rename-space-field.d.ts +1 -2
  223. package/dist/lang/ast/field-space/static-space.d.ts +4 -3
  224. package/dist/lang/ast/field-space/static-space.js +4 -0
  225. package/dist/lang/ast/field-space/struct-space-field-base.d.ts +1 -2
  226. package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
  227. package/dist/lang/ast/field-space/wild-space-field.d.ts +1 -2
  228. package/dist/lang/ast/fragtype-utils.d.ts +1 -1
  229. package/dist/lang/ast/fragtype-utils.js +4 -3
  230. package/dist/lang/ast/index.d.ts +1 -0
  231. package/dist/lang/ast/index.js +1 -0
  232. package/dist/lang/ast/query-items/field-declaration.d.ts +40 -4
  233. package/dist/lang/ast/query-items/field-declaration.js +102 -3
  234. package/dist/lang/ast/query-items/field-references.d.ts +44 -2
  235. package/dist/lang/ast/query-items/field-references.js +110 -2
  236. package/dist/lang/ast/query-items/typecheck_utils.d.ts +10 -0
  237. package/dist/lang/ast/query-items/typecheck_utils.js +177 -0
  238. package/dist/lang/ast/query-properties/aggregate.js +0 -6
  239. package/dist/lang/ast/query-properties/calculate.d.ts +5 -0
  240. package/dist/lang/ast/query-properties/calculate.js +33 -0
  241. package/dist/lang/ast/query-properties/dimmensions.js +0 -3
  242. package/dist/lang/ast/query-properties/filters.js +6 -3
  243. package/dist/lang/ast/query-properties/group-by.js +0 -6
  244. package/dist/lang/ast/query-properties/measures.js +0 -3
  245. package/dist/lang/ast/query-properties/nest-reference.d.ts +2 -0
  246. package/dist/lang/ast/query-properties/nest-reference.js +23 -0
  247. package/dist/lang/ast/query-properties/ordering.d.ts +1 -1
  248. package/dist/lang/ast/query-properties/ordering.js +18 -8
  249. package/dist/lang/ast/query-properties/qop-desc.js +8 -4
  250. package/dist/lang/ast/query-properties/top.js +20 -6
  251. package/dist/lang/ast/sources/named-source.js +4 -0
  252. package/dist/lang/ast/sources/sql-source.js +5 -1
  253. package/dist/lang/ast/time-utils.d.ts +1 -2
  254. package/dist/lang/ast/types/expr-result.d.ts +1 -2
  255. package/dist/lang/ast/types/expression-def.d.ts +3 -4
  256. package/dist/lang/ast/types/expression-def.js +10 -2
  257. package/dist/lang/ast/types/field-space.d.ts +7 -0
  258. package/dist/lang/ast/types/global-name-space.d.ts +12 -0
  259. package/dist/lang/ast/types/global-name-space.js +51 -0
  260. package/dist/lang/ast/types/malloy-element.d.ts +1 -0
  261. package/dist/lang/ast/types/malloy-element.js +15 -2
  262. package/dist/lang/ast/types/query-property.d.ts +1 -2
  263. package/dist/lang/ast/types/query-property.js +2 -0
  264. package/dist/lang/ast/types/space-entry.d.ts +1 -1
  265. package/dist/lang/ast/types/space-field.d.ts +1 -2
  266. package/dist/lang/ast/types/space-field.js +5 -1
  267. package/dist/lang/ast/types/space-param.d.ts +1 -2
  268. package/dist/lang/ast/types/space-param.js +10 -2
  269. package/dist/lang/lib/Malloy/MalloyLexer.d.ts +138 -135
  270. package/dist/lang/lib/Malloy/MalloyLexer.js +1135 -1103
  271. package/dist/lang/lib/Malloy/MalloyParser.d.ts +252 -275
  272. package/dist/lang/lib/Malloy/MalloyParser.js +1753 -1905
  273. package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +40 -103
  274. package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +25 -64
  275. package/dist/lang/malloy-to-ast.d.ts +11 -7
  276. package/dist/lang/malloy-to-ast.js +90 -51
  277. package/dist/lang/parse-tree-walkers/document-symbol-walker.js +5 -2
  278. package/dist/lang/test/parse.spec.js +399 -18
  279. package/dist/lang/test/test-translator.d.ts +1 -0
  280. package/dist/lang/test/test-translator.js +5 -0
  281. package/dist/model/malloy_query.d.ts +13 -4
  282. package/dist/model/malloy_query.js +240 -76
  283. package/dist/model/malloy_types.d.ts +89 -18
  284. package/dist/model/malloy_types.js +88 -61
  285. package/dist/model/utils.d.ts +4 -0
  286. package/dist/model/utils.js +118 -1
  287. package/package.json +1 -1
  288. package/dist/lang/ast/types/type-desc.d.ts +0 -8
@@ -0,0 +1 @@
1
+ export { POSTGRES_FUNCTIONS } from './postgres_functions';
@@ -0,0 +1,28 @@
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.POSTGRES_FUNCTIONS = void 0;
26
+ var postgres_functions_1 = require("./postgres_functions");
27
+ Object.defineProperty(exports, "POSTGRES_FUNCTIONS", { enumerable: true, get: function () { return postgres_functions_1.POSTGRES_FUNCTIONS; } });
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnIsInf(): DialectFunctionOverloadDef[];
@@ -0,0 +1,34 @@
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.fnIsInf = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnIsInf() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('number'));
29
+ return [
30
+ (0, util_1.overload)((0, util_1.minScalar)('boolean'), [value.param], (0, util_1.sql) `COALESCE(${value.arg} = DOUBLE PRECISION 'Infinity' OR ${value.arg} = DOUBLE PRECISION '-Infinity', false)`),
31
+ ];
32
+ }
33
+ exports.fnIsInf = fnIsInf;
34
+ //# sourceMappingURL=is_inf.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnIsNan(): DialectFunctionOverloadDef[];
@@ -0,0 +1,33 @@
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.fnIsNan = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnIsNan() {
28
+ return [
29
+ (0, util_1.overload)((0, util_1.minScalar)('boolean'), [(0, util_1.param)('value', (0, util_1.anyExprType)('number'))], (0, util_1.sql) `COALESCE(${(0, util_1.arg)('value')} = NUMERIC 'NaN', false)`),
30
+ ];
31
+ }
32
+ exports.fnIsNan = fnIsNan;
33
+ //# sourceMappingURL=is_nan.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnLog(): DialectFunctionOverloadDef[];
@@ -0,0 +1,37 @@
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.fnLog = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnLog() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('number'));
29
+ const base = (0, util_1.makeParam)('base', (0, util_1.anyExprType)('number'));
30
+ return [
31
+ (0, util_1.overload)((0, util_1.minScalar)('number'), [value.param, base.param],
32
+ // Parameter order is backwards in Postgres.
33
+ (0, util_1.sql) `LOG(${base.arg}, ${value.arg})`),
34
+ ];
35
+ }
36
+ exports.fnLog = fnLog;
37
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ export declare const POSTGRES_FUNCTIONS: import("../../functions/function_map").FunctionMap;
@@ -0,0 +1,60 @@
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.POSTGRES_FUNCTIONS = void 0;
26
+ const functions_1 = require("../../functions");
27
+ const byte_length_1 = require("./byte_length");
28
+ const ends_with_1 = require("./ends_with");
29
+ const greatest_and_least_1 = require("./greatest_and_least");
30
+ const ifnull_1 = require("./ifnull");
31
+ const is_inf_1 = require("./is_inf");
32
+ const is_nan_1 = require("./is_nan");
33
+ const log_1 = require("./log");
34
+ const rand_1 = require("./rand");
35
+ const regexp_extract_1 = require("./regexp_extract");
36
+ const replace_1 = require("./replace");
37
+ const round_1 = require("./round");
38
+ const stddev_1 = require("./stddev");
39
+ const substr_1 = require("./substr");
40
+ const trunc_1 = require("./trunc");
41
+ const unicode_1 = require("./unicode");
42
+ exports.POSTGRES_FUNCTIONS = functions_1.FUNCTIONS.clone();
43
+ exports.POSTGRES_FUNCTIONS.add('regexp_extract', regexp_extract_1.fnRegexpExtract);
44
+ exports.POSTGRES_FUNCTIONS.add('stddev', stddev_1.fnStddev);
45
+ exports.POSTGRES_FUNCTIONS.add('rand', rand_1.fnRand);
46
+ exports.POSTGRES_FUNCTIONS.add('greatest', greatest_and_least_1.fnGreatest);
47
+ exports.POSTGRES_FUNCTIONS.add('least', greatest_and_least_1.fnLeast);
48
+ exports.POSTGRES_FUNCTIONS.add('is_nan', is_nan_1.fnIsNan);
49
+ exports.POSTGRES_FUNCTIONS.add('is_inf', is_inf_1.fnIsInf);
50
+ exports.POSTGRES_FUNCTIONS.add('round', round_1.fnRound);
51
+ exports.POSTGRES_FUNCTIONS.add('byte_length', byte_length_1.fnByteLength);
52
+ exports.POSTGRES_FUNCTIONS.add('unicode', unicode_1.fnUnicode);
53
+ exports.POSTGRES_FUNCTIONS.add('ifnull', ifnull_1.fnIfnull);
54
+ exports.POSTGRES_FUNCTIONS.add('trunc', trunc_1.fnTrunc);
55
+ exports.POSTGRES_FUNCTIONS.add('substr', substr_1.fnSubstr);
56
+ exports.POSTGRES_FUNCTIONS.add('replace', replace_1.fnReplace);
57
+ exports.POSTGRES_FUNCTIONS.add('ends_with', ends_with_1.fnEndsWith);
58
+ exports.POSTGRES_FUNCTIONS.add('log', log_1.fnLog);
59
+ exports.POSTGRES_FUNCTIONS.seal();
60
+ //# sourceMappingURL=postgres_functions.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnRand(): DialectFunctionOverloadDef[];
@@ -0,0 +1,31 @@
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.fnRand = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnRand() {
28
+ return [(0, util_1.overload)((0, util_1.minScalar)('number'), [], (0, util_1.sql) `RANDOM()`)];
29
+ }
30
+ exports.fnRand = fnRand;
31
+ //# sourceMappingURL=rand.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnRegexpExtract(): DialectFunctionOverloadDef[];
@@ -0,0 +1,35 @@
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.fnRegexpExtract = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnRegexpExtract() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
29
+ const pattern = (0, util_1.makeParam)('pattern', (0, util_1.anyExprType)('regular expression'));
30
+ return [
31
+ (0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, pattern.param], (0, util_1.sql) `SUBSTRING(${value.arg}, ${pattern.arg})`),
32
+ ];
33
+ }
34
+ exports.fnRegexpExtract = fnRegexpExtract;
35
+ //# sourceMappingURL=regexp_extract.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnReplace(): DialectFunctionOverloadDef[];
@@ -0,0 +1,40 @@
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.fnReplace = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnReplace() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
29
+ const stringPattern = (0, util_1.makeParam)('pattern', (0, util_1.anyExprType)('string'));
30
+ const regexPattern = (0, util_1.makeParam)('pattern', (0, util_1.anyExprType)('regular expression'));
31
+ const replacement = (0, util_1.makeParam)('replacement', (0, util_1.anyExprType)('string'));
32
+ return [
33
+ (0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, stringPattern.param, replacement.param], (0, util_1.sql) `REPLACE(${value.arg}, ${stringPattern.arg}, ${replacement.arg})`),
34
+ (0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, regexPattern.param, replacement.param],
35
+ // In Postgres we need to specifically say that it's a global replacement.
36
+ (0, util_1.sql) `REGEXP_REPLACE(${value.arg}, ${regexPattern.arg}, ${replacement.arg}, 'g')`),
37
+ ];
38
+ }
39
+ exports.fnReplace = fnReplace;
40
+ //# sourceMappingURL=replace.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnRound(): DialectFunctionOverloadDef[];
@@ -0,0 +1,39 @@
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.fnRound = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnRound() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('number'));
29
+ const precision = (0, util_1.makeParam)('precision', (0, util_1.anyExprType)('number'));
30
+ return [
31
+ (0, util_1.overload)((0, util_1.minScalar)('number'), [value.param], (0, util_1.sql) `ROUND((${value.arg})::NUMERIC)`),
32
+ // Postgres doesn't let you ROUND a FLOAT to a particular number of decimal places,
33
+ // so we cast to NUMERIC first...
34
+ // TODO it would be nice not to have to do this cast if it was already NUMERIC type...
35
+ (0, util_1.overload)((0, util_1.minScalar)('number'), [value.param, precision.param], (0, util_1.sql) `ROUND((${value.arg})::NUMERIC, ${precision.arg})`),
36
+ ];
37
+ }
38
+ exports.fnRound = fnRound;
39
+ //# sourceMappingURL=round.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnStddev(): DialectFunctionOverloadDef[];
@@ -0,0 +1,37 @@
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.fnStddev = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnStddev() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.maxScalar)('number'));
29
+ return [
30
+ (0, util_1.overload)((0, util_1.minAggregate)('number'), [value.param],
31
+ // TODO this is a bit of a hack in order to make the arrayAggUnnest work for Postgres,
32
+ // as we don't currently have a good way of doing this while preserving types
33
+ (0, util_1.sql) `STDDEV(${value.arg}::DOUBLE PRECISION)`),
34
+ ];
35
+ }
36
+ exports.fnStddev = fnStddev;
37
+ //# sourceMappingURL=stddev.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnSubstr(): DialectFunctionOverloadDef[];
@@ -0,0 +1,38 @@
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.fnSubstr = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnSubstr() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
29
+ const position = (0, util_1.makeParam)('position', (0, util_1.anyExprType)('number'));
30
+ const length = (0, util_1.makeParam)('length', (0, util_1.anyExprType)('number'));
31
+ return [
32
+ // We do some fancy footwork here to make Postgres support negative indexing for the position parameter
33
+ (0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, position.param], (0, util_1.sql) `SUBSTR(${value.arg}, CASE WHEN ${position.arg} < 0 THEN LENGTH(${value.arg}) + ${position.arg} + 1 ELSE ${position.arg} END)`),
34
+ (0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, position.param, length.param], (0, util_1.sql) `SUBSTR(${value.arg}, CASE WHEN ${position.arg} < 0 THEN LENGTH(${value.arg}) + ${position.arg} + 1 ELSE ${position.arg} END, ${length.arg})`),
35
+ ];
36
+ }
37
+ exports.fnSubstr = fnSubstr;
38
+ //# sourceMappingURL=substr.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnTrunc(): DialectFunctionOverloadDef[];
@@ -0,0 +1,40 @@
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.fnTrunc = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnTrunc() {
28
+ const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('number'));
29
+ const precision = (0, util_1.makeParam)('precision', (0, util_1.anyExprType)('number'));
30
+ // Postgres doesn't let you TRUNC a FLOAT with a precision, so we cast to NUMERIC first
31
+ // Also, TRUNC(NULL) doesn't compile because PG doesn't know the type of NULL, so we cast to
32
+ // NUMERIC there too...
33
+ // TODO Maybe there's a way we don't have to cast to NUMERIC.
34
+ return [
35
+ (0, util_1.overload)((0, util_1.minScalar)('number'), [value.param], (0, util_1.sql) `TRUNC(${value.arg}::NUMERIC)`),
36
+ (0, util_1.overload)((0, util_1.minScalar)('number'), [value.param, precision.param], (0, util_1.sql) `TRUNC((${value.arg}::NUMERIC), ${precision.arg})`),
37
+ ];
38
+ }
39
+ exports.fnTrunc = fnTrunc;
40
+ //# sourceMappingURL=trunc.js.map
@@ -0,0 +1,2 @@
1
+ import { DialectFunctionOverloadDef } from '../../functions/util';
2
+ export declare function fnUnicode(): DialectFunctionOverloadDef[];
@@ -0,0 +1,34 @@
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.fnUnicode = void 0;
26
+ const util_1 = require("../../functions/util");
27
+ function fnUnicode() {
28
+ // Aparently the ASCII function also works for unicode code points...
29
+ return [
30
+ (0, util_1.overload)((0, util_1.minScalar)('number'), [(0, util_1.param)('value', (0, util_1.anyExprType)('string'))], (0, util_1.sql) `ASCII(${(0, util_1.arg)('value')})`),
31
+ ];
32
+ }
33
+ exports.fnUnicode = fnUnicode;
34
+ //# sourceMappingURL=unicode.js.map
@@ -0,0 +1 @@
1
+ export * from './postgres';
@@ -0,0 +1,40 @@
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ var desc = Object.getOwnPropertyDescriptor(m, k);
27
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
28
+ desc = { enumerable: true, get: function() { return m[k]; } };
29
+ }
30
+ Object.defineProperty(o, k2, desc);
31
+ }) : (function(o, m, k, k2) {
32
+ if (k2 === undefined) k2 = k;
33
+ o[k2] = m[k];
34
+ }));
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ __exportStar(require("./postgres"), exports);
40
+ //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
- import { DateUnit, Expr, ExtractUnit, Sampling, TimeFieldType, TimeValue, TimestampUnit, TypecastFragment } from '../model/malloy_types';
2
- import { Dialect, DialectFieldList, FunctionInfo, QueryInfo } from './dialect';
1
+ import { DateUnit, Expr, ExtractUnit, Sampling, TimeFieldType, TimeValue, TimestampUnit, TypecastFragment } from '../../model/malloy_types';
2
+ import { DialectFunctionOverloadDef } from '../functions';
3
+ import { Dialect, DialectFieldList, QueryInfo } from '../dialect';
3
4
  export declare class PostgresDialect extends Dialect {
4
5
  name: string;
5
6
  defaultNumberType: string;
@@ -13,10 +14,11 @@ export declare class PostgresDialect extends Dialect {
13
14
  rows: number;
14
15
  };
15
16
  supportUnnestArrayAgg: boolean;
17
+ supportsAggDistinct: boolean;
16
18
  supportsCTEinCoorelatedSubQueries: boolean;
17
19
  dontUnionIndex: boolean;
18
20
  supportsQualify: boolean;
19
- functionInfo: Record<string, FunctionInfo>;
21
+ globalFunctions: import("../functions/function_map").FunctionMap;
20
22
  quoteTablePath(tablePath: string): string;
21
23
  sqlGroupSetTable(groupSetCount: number): string;
22
24
  sqlAnyValue(groupSet: number, fieldName: string): string;
@@ -41,12 +43,14 @@ export declare class PostgresDialect extends Dialect {
41
43
  sqlExtract(qi: QueryInfo, from: TimeValue, units: ExtractUnit): Expr;
42
44
  sqlAlterTime(op: '+' | '-', expr: TimeValue, n: Expr, timeframe: DateUnit): Expr;
43
45
  sqlCast(qi: QueryInfo, cast: TypecastFragment): Expr;
44
- sqlRegexpMatch(expr: Expr, regexp: string): Expr;
46
+ sqlRegexpMatch(expr: Expr, regexp: Expr): Expr;
45
47
  sqlLiteralTime(qi: QueryInfo, timeString: string, type: TimeFieldType, timezone: string | undefined): string;
46
- getFunctionInfo(functionName: string): FunctionInfo | undefined;
47
48
  sqlMeasureTime(from: TimeValue, to: TimeValue, units: string): Expr;
48
49
  sqlSumDistinct(key: string, value: string, funcName: string): string;
50
+ sqlAggDistinct(key: string, values: string[], func: (valNames: string[]) => string): string;
49
51
  sqlSampleTable(tableSQL: string, sample: Sampling | undefined): string;
50
52
  sqlOrderBy(orderTerms: string[]): string;
51
53
  sqlLiteralString(literal: string): string;
54
+ sqlLiteralRegexp(literal: string): string;
55
+ getGlobalFunctionDef(name: string): DialectFunctionOverloadDef[] | undefined;
52
56
  }