@uwdata/mosaic-sql 0.13.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/ast/aggregate.d.ts +5 -4
- package/dist/types/ast/case.d.ts +6 -7
- package/dist/types/ast/column-param.d.ts +7 -7
- package/dist/types/ast/column-ref.d.ts +7 -6
- package/dist/types/ast/param.d.ts +5 -4
- package/dist/types/ast/query.d.ts +46 -39
- package/dist/types/ast/window.d.ts +15 -12
- package/dist/types/functions/aggregate.d.ts +89 -88
- package/dist/types/functions/case.d.ts +6 -8
- package/dist/types/functions/column.d.ts +5 -3
- package/dist/types/functions/datetime.d.ts +12 -11
- package/dist/types/functions/numeric.d.ts +48 -46
- package/dist/types/functions/operators.d.ts +80 -78
- package/dist/types/functions/order-by.d.ts +5 -4
- package/dist/types/functions/spatial.d.ts +14 -13
- package/dist/types/functions/sql-template-tag.d.ts +4 -5
- package/dist/types/functions/string.d.ts +22 -20
- package/dist/types/functions/util.d.ts +8 -0
- package/dist/types/functions/window.d.ts +18 -16
- package/dist/types/index.d.ts +5 -0
- package/dist/types/transforms/bin-1d.d.ts +3 -2
- package/dist/types/transforms/bin-2d.d.ts +6 -5
- package/dist/types/transforms/bin-date.d.ts +44 -0
- package/dist/types/transforms/bin-histogram.d.ts +51 -0
- package/dist/types/transforms/bin-linear-1d.d.ts +6 -4
- package/dist/types/transforms/bin-linear-2d.d.ts +6 -5
- package/dist/types/transforms/line-density.d.ts +5 -4
- package/dist/types/transforms/m4.d.ts +7 -4
- package/dist/types/transforms/util/bin-step.d.ts +61 -0
- package/dist/types/transforms/util/time-interval.d.ts +13 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/util/ast.d.ts +6 -5
- package/dist/types/util/function.d.ts +6 -4
- package/dist/types/util/type-check.d.ts +6 -2
- package/dist/types/visit/visitors.d.ts +3 -2
- package/dist/types/visit/walk.d.ts +7 -4
- package/package.json +2 -2
- package/src/ast/aggregate.js +5 -2
- package/src/ast/case.js +6 -5
- package/src/ast/column-param.js +7 -5
- package/src/ast/column-ref.js +6 -3
- package/src/ast/param.js +5 -2
- package/src/ast/query.js +23 -19
- package/src/ast/window.js +10 -6
- package/src/functions/aggregate.js +55 -52
- package/src/functions/case.js +7 -7
- package/src/functions/column.js +6 -2
- package/src/functions/datetime.js +9 -6
- package/src/functions/numeric.js +35 -31
- package/src/functions/operators.js +53 -50
- package/src/functions/order-by.js +5 -2
- package/src/functions/spatial.js +10 -7
- package/src/functions/sql-template-tag.js +5 -5
- package/src/functions/string.js +16 -13
- package/src/functions/util.js +14 -0
- package/src/functions/window.js +13 -10
- package/src/index.js +6 -0
- package/src/transforms/bin-1d.js +4 -1
- package/src/transforms/bin-2d.js +7 -4
- package/src/transforms/bin-date.js +37 -0
- package/src/transforms/bin-histogram.js +52 -0
- package/src/transforms/bin-linear-1d.js +7 -3
- package/src/transforms/bin-linear-2d.js +12 -8
- package/src/transforms/line-density.js +7 -3
- package/src/transforms/m4.js +7 -3
- package/src/transforms/util/bin-step.js +79 -0
- package/src/transforms/util/time-interval.js +97 -0
- package/src/types.ts +11 -0
- package/src/util/ast.js +6 -3
- package/src/util/function.js +6 -2
- package/src/util/type-check.js +5 -1
- package/src/visit/visitors.js +6 -2
- package/src/visit/walk.js +8 -3
|
@@ -1,195 +1,197 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Logical and (AND) operator.
|
|
3
|
-
* @param {...
|
|
3
|
+
* @param {...ExprVarArgs} clauses The input expressions.
|
|
4
4
|
* @returns {AndNode}
|
|
5
5
|
*/
|
|
6
|
-
export function and(...clauses:
|
|
6
|
+
export function and(...clauses: ExprVarArgs[]): AndNode<any>;
|
|
7
7
|
/**
|
|
8
8
|
* Logical or (OR) operator.
|
|
9
|
-
* @param {...
|
|
9
|
+
* @param {...ExprVarArgs} clauses The input expressions.
|
|
10
10
|
* @returns {OrNode}
|
|
11
11
|
*/
|
|
12
|
-
export function or(...clauses:
|
|
12
|
+
export function or(...clauses: ExprVarArgs[]): OrNode<any>;
|
|
13
13
|
/**
|
|
14
14
|
* Logical not (NOT) operator.
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {ExprValue} expr The expression to negate.
|
|
16
16
|
* @returns {UnaryOpNode}
|
|
17
17
|
*/
|
|
18
|
-
export function not(expr:
|
|
18
|
+
export function not(expr: ExprValue): UnaryOpNode;
|
|
19
19
|
/**
|
|
20
20
|
* Null check (IS NULL) operator.
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {ExprValue} expr The expression to test.
|
|
22
22
|
* @returns {UnaryPosftixOpNode}
|
|
23
23
|
*/
|
|
24
|
-
export function isNull(expr:
|
|
24
|
+
export function isNull(expr: ExprValue): UnaryPosftixOpNode;
|
|
25
25
|
/**
|
|
26
26
|
* Non-null check (IS NOT NULL) operator.
|
|
27
|
-
* @param {
|
|
27
|
+
* @param {ExprValue} expr The expression to test.
|
|
28
28
|
* @returns {UnaryPosftixOpNode}
|
|
29
29
|
*/
|
|
30
|
-
export function isNotNull(expr:
|
|
30
|
+
export function isNotNull(expr: ExprValue): UnaryPosftixOpNode;
|
|
31
31
|
/**
|
|
32
32
|
* Bitwise not (~) operator.
|
|
33
|
-
* @param {
|
|
33
|
+
* @param {ExprValue} expr The input expression.
|
|
34
34
|
* @returns {UnaryOpNode}
|
|
35
35
|
*/
|
|
36
|
-
export function bitNot(expr:
|
|
36
|
+
export function bitNot(expr: ExprValue): UnaryOpNode;
|
|
37
37
|
/**
|
|
38
38
|
* Bitwise and (&) operator.
|
|
39
|
-
* @param {
|
|
40
|
-
* @param {
|
|
39
|
+
* @param {ExprValue} left The left argument.
|
|
40
|
+
* @param {ExprValue} right The right argument.
|
|
41
41
|
* @returns {BinaryOpNode}
|
|
42
42
|
*/
|
|
43
|
-
export function bitAnd(left:
|
|
43
|
+
export function bitAnd(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
44
44
|
/**
|
|
45
45
|
* Bitwise or (|) operator.
|
|
46
|
-
* @param {
|
|
47
|
-
* @param {
|
|
46
|
+
* @param {ExprValue} left The left argument.
|
|
47
|
+
* @param {ExprValue} right The right argument.
|
|
48
48
|
* @returns {BinaryOpNode}
|
|
49
49
|
*/
|
|
50
|
-
export function bitOr(left:
|
|
50
|
+
export function bitOr(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
51
51
|
/**
|
|
52
52
|
* Bit shift left (<<) operator.
|
|
53
|
-
* @param {
|
|
54
|
-
* @param {
|
|
53
|
+
* @param {ExprValue} left The left argument.
|
|
54
|
+
* @param {ExprValue} right The right argument.
|
|
55
55
|
* @returns {BinaryOpNode}
|
|
56
56
|
*/
|
|
57
|
-
export function bitLeft(left:
|
|
57
|
+
export function bitLeft(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
58
58
|
/**
|
|
59
59
|
* Bit shift right (>>) operator.
|
|
60
|
-
* @param {
|
|
61
|
-
* @param {
|
|
60
|
+
* @param {ExprValue} left The left argument.
|
|
61
|
+
* @param {ExprValue} right The right argument.
|
|
62
62
|
* @returns {BinaryOpNode}
|
|
63
63
|
*/
|
|
64
|
-
export function bitRight(left:
|
|
64
|
+
export function bitRight(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
65
65
|
/**
|
|
66
66
|
* Addition (+) operator.
|
|
67
|
-
* @param {
|
|
68
|
-
* @param {
|
|
67
|
+
* @param {ExprValue} left The left argument.
|
|
68
|
+
* @param {ExprValue} right The right argument.
|
|
69
69
|
* @returns {BinaryOpNode}
|
|
70
70
|
*/
|
|
71
|
-
export function add(left:
|
|
71
|
+
export function add(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
72
72
|
/**
|
|
73
73
|
* Subtraction (-) operator.
|
|
74
|
-
* @param {
|
|
75
|
-
* @param {
|
|
74
|
+
* @param {ExprValue} left The left argument.
|
|
75
|
+
* @param {ExprValue} right The right argument.
|
|
76
76
|
* @returns {BinaryOpNode}
|
|
77
77
|
*/
|
|
78
|
-
export function sub(left:
|
|
78
|
+
export function sub(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
79
79
|
/**
|
|
80
80
|
* Multiplication (*) operator.
|
|
81
|
-
* @param {
|
|
82
|
-
* @param {
|
|
81
|
+
* @param {ExprValue} left The left argument.
|
|
82
|
+
* @param {ExprValue} right The right argument.
|
|
83
83
|
* @returns {BinaryOpNode}
|
|
84
84
|
*/
|
|
85
|
-
export function mul(left:
|
|
85
|
+
export function mul(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
86
86
|
/**
|
|
87
87
|
* Division (/) operator.
|
|
88
|
-
* @param {
|
|
89
|
-
* @param {
|
|
88
|
+
* @param {ExprValue} left The left argument.
|
|
89
|
+
* @param {ExprValue} right The right argument.
|
|
90
90
|
* @returns {BinaryOpNode}
|
|
91
91
|
*/
|
|
92
|
-
export function div(left:
|
|
92
|
+
export function div(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
93
93
|
/**
|
|
94
94
|
* Integer division (//) operator.
|
|
95
|
-
* @param {
|
|
96
|
-
* @param {
|
|
95
|
+
* @param {ExprValue} left The left argument.
|
|
96
|
+
* @param {ExprValue} right The right argument.
|
|
97
97
|
* @returns {BinaryOpNode}
|
|
98
98
|
*/
|
|
99
|
-
export function idiv(left:
|
|
99
|
+
export function idiv(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
100
100
|
/**
|
|
101
101
|
* Modulo (%) operator.
|
|
102
|
-
* @param {
|
|
103
|
-
* @param {
|
|
102
|
+
* @param {ExprValue} left The left argument.
|
|
103
|
+
* @param {ExprValue} right The right argument.
|
|
104
104
|
* @returns {BinaryOpNode}
|
|
105
105
|
*/
|
|
106
|
-
export function mod(left:
|
|
106
|
+
export function mod(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
107
107
|
/**
|
|
108
108
|
* Exponentiation (**) operator.
|
|
109
|
-
* @param {
|
|
110
|
-
* @param {
|
|
109
|
+
* @param {ExprValue} left The left argument.
|
|
110
|
+
* @param {ExprValue} right The right argument.
|
|
111
111
|
* @returns {BinaryOpNode}
|
|
112
112
|
*/
|
|
113
|
-
export function pow(left:
|
|
113
|
+
export function pow(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
114
114
|
/**
|
|
115
115
|
* Equality comparision (=) operator.
|
|
116
|
-
* @param {
|
|
117
|
-
* @param {
|
|
116
|
+
* @param {ExprValue} left The left argument.
|
|
117
|
+
* @param {ExprValue} right The right argument.
|
|
118
118
|
* @returns {BinaryOpNode}
|
|
119
119
|
*/
|
|
120
|
-
export function eq(left:
|
|
120
|
+
export function eq(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
121
121
|
/**
|
|
122
122
|
* Non-equality comparision (<>) operator.
|
|
123
|
-
* @param {
|
|
124
|
-
* @param {
|
|
123
|
+
* @param {ExprValue} left The left argument.
|
|
124
|
+
* @param {ExprValue} right The right argument.
|
|
125
125
|
* @returns {BinaryOpNode}
|
|
126
126
|
*/
|
|
127
|
-
export function neq(left:
|
|
127
|
+
export function neq(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
128
128
|
/**
|
|
129
129
|
* Less-than comparision (<) operator.
|
|
130
|
-
* @param {
|
|
131
|
-
* @param {
|
|
130
|
+
* @param {ExprValue} left The left argument.
|
|
131
|
+
* @param {ExprValue} right The right argument.
|
|
132
132
|
* @returns {BinaryOpNode}
|
|
133
133
|
*/
|
|
134
|
-
export function lt(left:
|
|
134
|
+
export function lt(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
135
135
|
/**
|
|
136
136
|
* Greater-than comparision (>) operator.
|
|
137
|
-
* @param {
|
|
138
|
-
* @param {
|
|
137
|
+
* @param {ExprValue} left The left argument.
|
|
138
|
+
* @param {ExprValue} right The right argument.
|
|
139
139
|
* @returns {BinaryOpNode}
|
|
140
140
|
*/
|
|
141
|
-
export function gt(left:
|
|
141
|
+
export function gt(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
142
142
|
/**
|
|
143
143
|
* Less-than or equal comparision (<=) operator.
|
|
144
|
-
* @param {
|
|
145
|
-
* @param {
|
|
144
|
+
* @param {ExprValue} left The left argument.
|
|
145
|
+
* @param {ExprValue} right The right argument.
|
|
146
146
|
* @returns {BinaryOpNode}
|
|
147
147
|
*/
|
|
148
|
-
export function lte(left:
|
|
148
|
+
export function lte(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
149
149
|
/**
|
|
150
150
|
* Greater-than or equal comparision (>=) operator.
|
|
151
|
-
* @param {
|
|
152
|
-
* @param {
|
|
151
|
+
* @param {ExprValue} left The left argument.
|
|
152
|
+
* @param {ExprValue} right The right argument.
|
|
153
153
|
* @returns {BinaryOpNode}
|
|
154
154
|
*/
|
|
155
|
-
export function gte(left:
|
|
155
|
+
export function gte(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
156
156
|
/**
|
|
157
157
|
* Null-inclusive non-equality (IS DISTINCT FROM) operator.
|
|
158
|
-
* @param {
|
|
159
|
-
* @param {
|
|
158
|
+
* @param {ExprValue} left The left argument.
|
|
159
|
+
* @param {ExprValue} right The right argument.
|
|
160
160
|
* @returns {BinaryOpNode}
|
|
161
161
|
*/
|
|
162
|
-
export function isDistinct(left:
|
|
162
|
+
export function isDistinct(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
163
163
|
/**
|
|
164
164
|
* Null-inclusive equality (IS NOT DISTINCT FROM) operator.
|
|
165
|
-
* @param {
|
|
166
|
-
* @param {
|
|
165
|
+
* @param {ExprValue} left The left argument.
|
|
166
|
+
* @param {ExprValue} right The right argument.
|
|
167
167
|
* @returns {BinaryOpNode}
|
|
168
168
|
*/
|
|
169
|
-
export function isNotDistinct(left:
|
|
169
|
+
export function isNotDistinct(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
170
170
|
/**
|
|
171
171
|
* Range inclusion (BETWEEN) operator.
|
|
172
|
-
* @param {
|
|
173
|
-
* @param {
|
|
172
|
+
* @param {ExprValue} expr The expression to test.
|
|
173
|
+
* @param {ExprValue[]} extent The range extent.
|
|
174
174
|
* @returns {BetweenOpNode}
|
|
175
175
|
*/
|
|
176
|
-
export function isBetween(expr:
|
|
176
|
+
export function isBetween(expr: ExprValue, extent: ExprValue[]): BetweenOpNode;
|
|
177
177
|
/**
|
|
178
178
|
* Range exclusion (NOT BETWEEN) operator.
|
|
179
|
-
* @param {
|
|
180
|
-
* @param {
|
|
179
|
+
* @param {ExprValue} expr The expression to test.
|
|
180
|
+
* @param {ExprValue[]} extent The range extent.
|
|
181
181
|
* @returns {NotBetweenOpNode}
|
|
182
182
|
*/
|
|
183
|
-
export function isNotBetween(expr:
|
|
183
|
+
export function isNotBetween(expr: ExprValue, extent: ExprValue[]): NotBetweenOpNode;
|
|
184
184
|
/**
|
|
185
185
|
* Set inclusion (IN) operator.
|
|
186
|
-
* @param {
|
|
187
|
-
* @param {
|
|
186
|
+
* @param {ExprValue} expr The expression to test.
|
|
187
|
+
* @param {ExprValue[]} values The included values.
|
|
188
188
|
* @returns {InOpNode}
|
|
189
189
|
*/
|
|
190
|
-
export function isIn(expr:
|
|
190
|
+
export function isIn(expr: ExprValue, values: ExprValue[]): InOpNode;
|
|
191
|
+
import type { ExprVarArgs } from '../types.js';
|
|
191
192
|
import { AndNode } from '../ast/logical-op.js';
|
|
192
193
|
import { OrNode } from '../ast/logical-op.js';
|
|
194
|
+
import type { ExprValue } from '../types.js';
|
|
193
195
|
import { UnaryOpNode } from '../ast/unary-op.js';
|
|
194
196
|
import { UnaryPosftixOpNode } from '../ast/unary-op.js';
|
|
195
197
|
import { BinaryOpNode } from '../ast/binary-op.js';
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Indicate ascending sort order for an expression.
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {ExprValue} expr An expression to order by.
|
|
4
4
|
* @param {boolean | undefined} [nullsFirst] Flag indicating if null values
|
|
5
5
|
* should be sorted first.
|
|
6
6
|
* @returns {OrderByNode}
|
|
7
7
|
*/
|
|
8
|
-
export function asc(expr:
|
|
8
|
+
export function asc(expr: ExprValue, nullsFirst?: boolean | undefined): OrderByNode;
|
|
9
9
|
/**
|
|
10
10
|
* Indicate descending sort order for an expression.
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {ExprValue} expr An expression to order by.
|
|
12
12
|
* @param {boolean | undefined} [nullsFirst] Flag indicating if null values
|
|
13
13
|
* should be sorted first.
|
|
14
14
|
* @returns {OrderByNode}
|
|
15
15
|
*/
|
|
16
|
-
export function desc(expr:
|
|
16
|
+
export function desc(expr: ExprValue, nullsFirst?: boolean | undefined): OrderByNode;
|
|
17
|
+
import type { ExprValue } from '../types.js';
|
|
17
18
|
import { OrderByNode } from '../ast/order-by.js';
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Function that converts geometry data to GeoJSON format.
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {ExprValue} expr The input expression.
|
|
4
4
|
* @returns {FunctionNode}
|
|
5
5
|
*/
|
|
6
|
-
export function geojson(expr:
|
|
6
|
+
export function geojson(expr: ExprValue): FunctionNode;
|
|
7
7
|
/**
|
|
8
8
|
* Function that returns a spatial x position (using ST_X).
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {ExprValue} expr The input expression.
|
|
10
10
|
* @returns {FunctionNode}
|
|
11
11
|
*/
|
|
12
|
-
export function x(expr:
|
|
12
|
+
export function x(expr: ExprValue): FunctionNode;
|
|
13
13
|
/**
|
|
14
14
|
* Function that returns a spatial y position (using ST_Y).
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {ExprValue} expr The input expression.
|
|
16
16
|
* @returns {FunctionNode}
|
|
17
17
|
*/
|
|
18
|
-
export function y(expr:
|
|
18
|
+
export function y(expr: ExprValue): FunctionNode;
|
|
19
19
|
/**
|
|
20
20
|
* Function that returns the centroid point for geometry data.
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {ExprValue} expr The input expression.
|
|
22
22
|
* @returns {FunctionNode}
|
|
23
23
|
*/
|
|
24
|
-
export function centroid(expr:
|
|
24
|
+
export function centroid(expr: ExprValue): FunctionNode;
|
|
25
25
|
/**
|
|
26
26
|
* Function that returns the centroid x-coordinate for geometry data.
|
|
27
|
-
* @param {
|
|
27
|
+
* @param {ExprValue} expr The input expression.
|
|
28
28
|
* @returns {FunctionNode}
|
|
29
29
|
*/
|
|
30
|
-
export function centroidX(expr:
|
|
30
|
+
export function centroidX(expr: ExprValue): FunctionNode;
|
|
31
31
|
/**
|
|
32
32
|
* Function that returns yhe centroid y-coordinate for geometry data.
|
|
33
|
-
* @param {
|
|
33
|
+
* @param {ExprValue} expr The input expression.
|
|
34
34
|
* @returns {FunctionNode}
|
|
35
35
|
*/
|
|
36
|
-
export function centroidY(expr:
|
|
37
|
-
import {
|
|
36
|
+
export function centroidY(expr: ExprValue): FunctionNode;
|
|
37
|
+
import type { ExprValue } from '../types.js';
|
|
38
|
+
import type { FunctionNode } from '../ast/function.js';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {
|
|
3
|
-
* | import('../types.js').ParamLike
|
|
4
|
-
* | string | number | boolean | Date
|
|
5
|
-
* } TemplateValue
|
|
2
|
+
* @typedef { ExprNode | ParamLike | string | number | boolean | Date } TemplateValue
|
|
6
3
|
*/
|
|
7
4
|
/**
|
|
8
5
|
* Template tag function for SQL fragments. Interpolated values
|
|
@@ -12,5 +9,7 @@
|
|
|
12
9
|
* @param {...TemplateValue} exprs Template expression values.
|
|
13
10
|
*/
|
|
14
11
|
export function sql(strings: TemplateStringsArray, ...exprs: TemplateValue[]): FragmentNode;
|
|
15
|
-
export type TemplateValue =
|
|
12
|
+
export type TemplateValue = ExprNode | ParamLike | string | number | boolean | Date;
|
|
16
13
|
import { FragmentNode } from '../ast/fragment.js';
|
|
14
|
+
import type { ExprNode } from '../ast/node.js';
|
|
15
|
+
import type { ParamLike } from '../types.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Function that returns true if a string contains a regexp pattern,
|
|
3
3
|
* false otherwise.
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
4
|
+
* @param {ExprValue} string The string match against.
|
|
5
|
+
* @param {StringValue} pattern The regular expression pattern to match.
|
|
6
|
+
* @param {StringValue} [options] Regular expression options:
|
|
7
7
|
* 'c': case-sensitive matching
|
|
8
8
|
* 'i': case-insensitive matching
|
|
9
9
|
* 'l': match literals instead of regular expression tokens
|
|
@@ -12,44 +12,46 @@
|
|
|
12
12
|
* 's': non-newline sensitive matching
|
|
13
13
|
* @returns {FunctionNode}
|
|
14
14
|
*/
|
|
15
|
-
export function regexp_matches(string:
|
|
15
|
+
export function regexp_matches(string: ExprValue, pattern: StringValue, options?: StringValue): FunctionNode;
|
|
16
16
|
/**
|
|
17
17
|
* Function that returns true if search_string is found within string.
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
18
|
+
* @param {ExprValue} string The string to match against.
|
|
19
|
+
* @param {StringValue} search_string The substring to search for.
|
|
20
20
|
* @returns {FunctionNode}
|
|
21
21
|
*/
|
|
22
|
-
export function contains(string:
|
|
22
|
+
export function contains(string: ExprValue, search_string: StringValue): FunctionNode;
|
|
23
23
|
/**
|
|
24
24
|
* Function that returns true if string begins with search_string.
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {
|
|
25
|
+
* @param {ExprValue} string The string to match against.
|
|
26
|
+
* @param {StringValue} search_string The substring to search for.
|
|
27
27
|
* @returns {FunctionNode}
|
|
28
28
|
*/
|
|
29
|
-
export function prefix(string:
|
|
29
|
+
export function prefix(string: ExprValue, search_string: StringValue): FunctionNode;
|
|
30
30
|
/**
|
|
31
31
|
* Function that returns true if string ends with search_string.
|
|
32
|
-
* @param {
|
|
33
|
-
* @param {
|
|
32
|
+
* @param {ExprValue} string The string to match against.
|
|
33
|
+
* @param {StringValue} search_string The substring to search for.
|
|
34
34
|
* @returns {FunctionNode}
|
|
35
35
|
*/
|
|
36
|
-
export function suffix(string:
|
|
36
|
+
export function suffix(string: ExprValue, search_string: StringValue): FunctionNode;
|
|
37
37
|
/**
|
|
38
38
|
* Function that converts string to lower case.
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {ExprValue} string The string to convert.
|
|
40
40
|
* @returns {FunctionNode}
|
|
41
41
|
*/
|
|
42
|
-
export function lower(string:
|
|
42
|
+
export function lower(string: ExprValue): FunctionNode;
|
|
43
43
|
/**
|
|
44
44
|
* Function that converts string to upper case.
|
|
45
|
-
* @param {
|
|
45
|
+
* @param {ExprValue} string The string to convert.
|
|
46
46
|
* @returns {FunctionNode}
|
|
47
47
|
*/
|
|
48
|
-
export function upper(string:
|
|
48
|
+
export function upper(string: ExprValue): FunctionNode;
|
|
49
49
|
/**
|
|
50
50
|
* Function that returns the number of characters in string.
|
|
51
|
-
* @param {
|
|
51
|
+
* @param {ExprValue} value The string to measure.
|
|
52
52
|
* @returns {FunctionNode}
|
|
53
53
|
*/
|
|
54
|
-
export function length(value:
|
|
55
|
-
import {
|
|
54
|
+
export function length(value: ExprValue): FunctionNode;
|
|
55
|
+
import type { ExprValue } from '../types.js';
|
|
56
|
+
import type { StringValue } from '../types.js';
|
|
57
|
+
import type { FunctionNode } from '../ast/function.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the first non-null argument.
|
|
3
|
+
* @param {...ExprValue} expr The input expressions.
|
|
4
|
+
* @returns {FunctionNode}
|
|
5
|
+
*/
|
|
6
|
+
export function coalesce(...expr: ExprValue[]): FunctionNode;
|
|
7
|
+
import type { ExprValue } from '../types.js';
|
|
8
|
+
import type { FunctionNode } from '../ast/function.js';
|
|
@@ -31,57 +31,59 @@ export function cume_dist(): WindowNode;
|
|
|
31
31
|
/**
|
|
32
32
|
* Create a window function that returns an integer ranging from 1 to the
|
|
33
33
|
* argument value, dividing the partition as equally as possible.
|
|
34
|
-
* @param {
|
|
34
|
+
* @param {NumberValue} num_buckets The number of
|
|
35
35
|
* quantile buckets.
|
|
36
36
|
* @returns {WindowNode}
|
|
37
37
|
*/
|
|
38
|
-
export function ntile(num_buckets:
|
|
38
|
+
export function ntile(num_buckets: NumberValue): WindowNode;
|
|
39
39
|
/**
|
|
40
40
|
* Create a window function that returns the expression evaluated at the row
|
|
41
41
|
* that is offset rows before the current row within the partition.
|
|
42
42
|
* If there is no such row, instead return default (which must be of the same
|
|
43
43
|
* type as the expression). Both offset and default are evaluated with respect
|
|
44
44
|
* to the current row. If omitted, offset defaults to 1 and default to null.
|
|
45
|
-
* @param {
|
|
46
|
-
* @param {
|
|
45
|
+
* @param {ExprValue} expr The expression to evaluate.
|
|
46
|
+
* @param {NumberValue} [offset] The row offset
|
|
47
47
|
* (default `1`).
|
|
48
48
|
* @param {*} [defaultValue] The default value (default `null`).
|
|
49
49
|
* @returns {WindowNode}
|
|
50
50
|
*/
|
|
51
|
-
export function lag(expr:
|
|
51
|
+
export function lag(expr: ExprValue, offset?: NumberValue, defaultValue?: any): WindowNode;
|
|
52
52
|
/**
|
|
53
53
|
* Create a window function that returns the expression evaluated at the row
|
|
54
54
|
* that is offset rows after the current row within the partition.
|
|
55
55
|
* If there is no such row, instead return default (which must be of the same
|
|
56
56
|
* type as the expression). Both offset and default are evaluated with respect
|
|
57
57
|
* to the current row. If omitted, offset defaults to 1 and default to null.
|
|
58
|
-
* @param {
|
|
59
|
-
* @param {
|
|
58
|
+
* @param {ExprValue} expr The expression to evaluate.
|
|
59
|
+
* @param {NumberValue} [offset] The row offset
|
|
60
60
|
* (default `1`).
|
|
61
61
|
* @param {*} [defaultValue] The default value (default `null`).
|
|
62
62
|
* @returns {WindowNode}
|
|
63
63
|
*/
|
|
64
|
-
export function lead(expr:
|
|
64
|
+
export function lead(expr: ExprValue, offset?: NumberValue, defaultValue?: any): WindowNode;
|
|
65
65
|
/**
|
|
66
66
|
* Create a window function that returns the expression evaluated at the row
|
|
67
67
|
* that is the first row of the window frame.
|
|
68
|
-
* @param {
|
|
68
|
+
* @param {ExprValue} expr The expression to evaluate.
|
|
69
69
|
* @returns {WindowNode}
|
|
70
70
|
*/
|
|
71
|
-
export function first_value(expr:
|
|
71
|
+
export function first_value(expr: ExprValue): WindowNode;
|
|
72
72
|
/**
|
|
73
73
|
* Create a window function that returns the expression evaluated at the row
|
|
74
74
|
* that is the last row of the window frame.
|
|
75
|
-
* @param {
|
|
75
|
+
* @param {ExprValue} expr The expression to evaluate.
|
|
76
76
|
* @returns {WindowNode}
|
|
77
77
|
*/
|
|
78
|
-
export function last_value(expr:
|
|
78
|
+
export function last_value(expr: ExprValue): WindowNode;
|
|
79
79
|
/**
|
|
80
80
|
* Create a window function that returns the expression evaluated at the
|
|
81
81
|
* nth row of the window frame (counting from 1), or null if no such row.
|
|
82
|
-
* @param {
|
|
83
|
-
* @param {
|
|
82
|
+
* @param {ExprValue} expr The expression to evaluate.
|
|
83
|
+
* @param {NumberValue} nth The 1-based window frame index.
|
|
84
84
|
* @returns {WindowNode}
|
|
85
85
|
*/
|
|
86
|
-
export function nth_value(expr:
|
|
87
|
-
import { WindowNode } from '../ast/window.js';
|
|
86
|
+
export function nth_value(expr: ExprValue, nth: NumberValue): WindowNode;
|
|
87
|
+
import type { WindowNode } from '../ast/window.js';
|
|
88
|
+
import type { NumberValue } from '../types.js';
|
|
89
|
+
import type { ExprValue } from '../types.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,17 +18,21 @@ export { column } from "./functions/column.js";
|
|
|
18
18
|
export { cte } from "./functions/cte.js";
|
|
19
19
|
export { literal } from "./functions/literal.js";
|
|
20
20
|
export { sql } from "./functions/sql-template-tag.js";
|
|
21
|
+
export { coalesce } from "./functions/util.js";
|
|
21
22
|
export { rewrite } from "./visit/rewrite.js";
|
|
22
23
|
export { walk } from "./visit/walk.js";
|
|
23
24
|
export { loadExtension } from "./load/extension.js";
|
|
24
25
|
export { bin1d } from "./transforms/bin-1d.js";
|
|
25
26
|
export { bin2d } from "./transforms/bin-2d.js";
|
|
27
|
+
export { binDate } from "./transforms/bin-date.js";
|
|
28
|
+
export { binHistogram } from "./transforms/bin-histogram.js";
|
|
26
29
|
export { binLinear1d } from "./transforms/bin-linear-1d.js";
|
|
27
30
|
export { binLinear2d } from "./transforms/bin-linear-2d.js";
|
|
28
31
|
export { lineDensity } from "./transforms/line-density.js";
|
|
29
32
|
export { m4 } from "./transforms/m4.js";
|
|
30
33
|
export { scaleTransform } from "./transforms/scales.js";
|
|
31
34
|
export { isParamLike } from "./util/type-check.js";
|
|
35
|
+
export { timeInterval } from "./transforms/util/time-interval.js";
|
|
32
36
|
export { BetweenOpNode, NotBetweenOpNode } from "./ast/between-op.js";
|
|
33
37
|
export { CaseNode, WhenNode } from "./ast/case.js";
|
|
34
38
|
export { ColumnParamNode, isColumnParam } from "./ast/column-param.js";
|
|
@@ -52,3 +56,4 @@ export { collectAggregates, collectColumns, collectParams, isAggregateExpression
|
|
|
52
56
|
export { createTable, createSchema } from "./load/create.js";
|
|
53
57
|
export { loadCSV, loadJSON, loadObjects, loadParquet, loadSpatial } from "./load/load.js";
|
|
54
58
|
export { asLiteral, asNode, asTableRef, asVerbatim, over } from "./util/ast.js";
|
|
59
|
+
export { binSpec, binStep } from "./transforms/util/bin-step.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compute binned values over a one-dimensional extent.
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {ExprValue} x The expression to bin.
|
|
4
4
|
* The expression must return numeric values. For example, to bin
|
|
5
5
|
* datetime values, the input expression might map them to numeric
|
|
6
6
|
* values such as milliseconds since the epoch.
|
|
@@ -11,4 +11,5 @@
|
|
|
11
11
|
* @param {boolean} [reverse] Flag indicating if bins should be
|
|
12
12
|
* produced in reverse order from *hi* to *lo* (default `false`).
|
|
13
13
|
*/
|
|
14
|
-
export function bin1d(x:
|
|
14
|
+
export function bin1d(x: ExprValue, lo: number, hi: number, bins: number, reverse?: boolean): import("../index.js").BinaryOpNode;
|
|
15
|
+
import type { ExprValue } from '../types.js';
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* and uses a 2D integer bin index of the form (xbin + num_xbins * ybin).
|
|
7
7
|
* @param {SelectQuery} q The input query. The FROM and WHERE clauses should
|
|
8
8
|
* be added to the query separately, either before or after this method.
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {Record<string,
|
|
9
|
+
* @param {ExprValue} xp The x bin expression.
|
|
10
|
+
* @param {ExprValue} yp The y bin expression.
|
|
11
|
+
* @param {Record<string, ExprValue>} aggs Named
|
|
12
12
|
* aggregate expressions over bins.
|
|
13
13
|
* @param {number} xn The number of bins along the x dimension
|
|
14
14
|
* @param {string[]} groupby Group by expressions.
|
|
15
15
|
* @returns {SelectQuery} The input query, with binning expressions added.
|
|
16
16
|
*/
|
|
17
|
-
export function bin2d(q: SelectQuery, xp:
|
|
18
|
-
import { SelectQuery } from '../ast/query.js';
|
|
17
|
+
export function bin2d(q: SelectQuery, xp: ExprValue, yp: ExprValue, aggs: Record<string, ExprValue>, xn: number, groupby: string[]): SelectQuery;
|
|
18
|
+
import type { SelectQuery } from '../ast/query.js';
|
|
19
|
+
import type { ExprValue } from '../types.js';
|