df-script 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +269 -0
  3. package/dist/api.d.ts +39 -0
  4. package/dist/api.js +18 -0
  5. package/dist/bundle.min.js +1 -0
  6. package/dist/columnExpressions/ColumnExpr.d.ts +368 -0
  7. package/dist/columnExpressions/ColumnExpr.js +23 -0
  8. package/dist/columnExpressions/ExprBase.d.ts +24 -0
  9. package/dist/columnExpressions/ExprBase.js +133 -0
  10. package/dist/columnExpressions/constants.d.ts +2 -0
  11. package/dist/columnExpressions/constants.js +5 -0
  12. package/dist/columnExpressions/functions/all.d.ts +5 -0
  13. package/dist/columnExpressions/functions/all.js +11 -0
  14. package/dist/columnExpressions/functions/coalesce.d.ts +3 -0
  15. package/dist/columnExpressions/functions/coalesce.js +40 -0
  16. package/dist/columnExpressions/functions/exclude.d.ts +5 -0
  17. package/dist/columnExpressions/functions/exclude.js +13 -0
  18. package/dist/columnExpressions/functions/lit.d.ts +5 -0
  19. package/dist/columnExpressions/functions/lit.js +22 -0
  20. package/dist/columnExpressions/functions/when.d.ts +24 -0
  21. package/dist/columnExpressions/functions/when.js +81 -0
  22. package/dist/columnExpressions/index.d.ts +19 -0
  23. package/dist/columnExpressions/index.js +81 -0
  24. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +50 -0
  25. package/dist/columnExpressions/mixins/AggregationExpr.js +172 -0
  26. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +67 -0
  27. package/dist/columnExpressions/mixins/ArithmeticExpr.js +143 -0
  28. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +60 -0
  29. package/dist/columnExpressions/mixins/ComparisonExpr.js +389 -0
  30. package/dist/columnExpressions/mixins/ListExpr.d.ts +63 -0
  31. package/dist/columnExpressions/mixins/ListExpr.js +248 -0
  32. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +33 -0
  33. package/dist/columnExpressions/mixins/LogicalExpr.js +54 -0
  34. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +31 -0
  35. package/dist/columnExpressions/mixins/ManipulationExpr.js +35 -0
  36. package/dist/columnExpressions/mixins/StringExpr.d.ts +79 -0
  37. package/dist/columnExpressions/mixins/StringExpr.js +249 -0
  38. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +69 -0
  39. package/dist/columnExpressions/mixins/TemporalExpr.js +127 -0
  40. package/dist/columnExpressions/mixins/WindowExpr.d.ts +50 -0
  41. package/dist/columnExpressions/mixins/WindowExpr.js +281 -0
  42. package/dist/columnExpressions/types.d.ts +7 -0
  43. package/dist/columnExpressions/types.js +2 -0
  44. package/dist/dataframe/constants.d.ts +1 -0
  45. package/dist/dataframe/constants.js +4 -0
  46. package/dist/dataframe/dataframe.d.ts +42 -0
  47. package/dist/dataframe/dataframe.js +749 -0
  48. package/dist/dataframe/grouped/grouped.d.ts +15 -0
  49. package/dist/dataframe/grouped/grouped.js +113 -0
  50. package/dist/dataframe/index.d.ts +4 -0
  51. package/dist/dataframe/index.js +20 -0
  52. package/dist/dataframe/types.d.ts +33 -0
  53. package/dist/dataframe/types.js +2 -0
  54. package/dist/dataframe/utils.d.ts +11 -0
  55. package/dist/dataframe/utils.js +215 -0
  56. package/dist/datatypes/DataType.d.ts +40 -0
  57. package/dist/datatypes/DataType.js +47 -0
  58. package/dist/datatypes/index.d.ts +29 -0
  59. package/dist/datatypes/index.js +46 -0
  60. package/dist/datatypes/types/Binary.d.ts +9 -0
  61. package/dist/datatypes/types/Binary.js +18 -0
  62. package/dist/datatypes/types/Boolean.d.ts +9 -0
  63. package/dist/datatypes/types/Boolean.js +19 -0
  64. package/dist/datatypes/types/Date.d.ts +8 -0
  65. package/dist/datatypes/types/Date.js +21 -0
  66. package/dist/datatypes/types/Datetime.d.ts +8 -0
  67. package/dist/datatypes/types/Datetime.js +17 -0
  68. package/dist/datatypes/types/Decimal.d.ts +10 -0
  69. package/dist/datatypes/types/Decimal.js +28 -0
  70. package/dist/datatypes/types/Duration.d.ts +8 -0
  71. package/dist/datatypes/types/Duration.js +17 -0
  72. package/dist/datatypes/types/Float32.d.ts +8 -0
  73. package/dist/datatypes/types/Float32.js +17 -0
  74. package/dist/datatypes/types/Float64.d.ts +8 -0
  75. package/dist/datatypes/types/Float64.js +17 -0
  76. package/dist/datatypes/types/Int16.d.ts +8 -0
  77. package/dist/datatypes/types/Int16.js +17 -0
  78. package/dist/datatypes/types/Int32.d.ts +8 -0
  79. package/dist/datatypes/types/Int32.js +17 -0
  80. package/dist/datatypes/types/Int64.d.ts +8 -0
  81. package/dist/datatypes/types/Int64.js +17 -0
  82. package/dist/datatypes/types/Int8.d.ts +8 -0
  83. package/dist/datatypes/types/Int8.js +17 -0
  84. package/dist/datatypes/types/List.d.ts +10 -0
  85. package/dist/datatypes/types/List.js +31 -0
  86. package/dist/datatypes/types/Null.d.ts +9 -0
  87. package/dist/datatypes/types/Null.js +17 -0
  88. package/dist/datatypes/types/Object.d.ts +9 -0
  89. package/dist/datatypes/types/Object.js +17 -0
  90. package/dist/datatypes/types/Struct.d.ts +14 -0
  91. package/dist/datatypes/types/Struct.js +39 -0
  92. package/dist/datatypes/types/Time.d.ts +8 -0
  93. package/dist/datatypes/types/Time.js +29 -0
  94. package/dist/datatypes/types/UInt16.d.ts +8 -0
  95. package/dist/datatypes/types/UInt16.js +17 -0
  96. package/dist/datatypes/types/UInt32.d.ts +8 -0
  97. package/dist/datatypes/types/UInt32.js +17 -0
  98. package/dist/datatypes/types/UInt64.d.ts +8 -0
  99. package/dist/datatypes/types/UInt64.js +17 -0
  100. package/dist/datatypes/types/UInt8.d.ts +8 -0
  101. package/dist/datatypes/types/UInt8.js +17 -0
  102. package/dist/datatypes/types/Utf8.d.ts +10 -0
  103. package/dist/datatypes/types/Utf8.js +20 -0
  104. package/dist/datatypes/types.d.ts +172 -0
  105. package/dist/datatypes/types.js +286 -0
  106. package/dist/exceptions/index.d.ts +13 -0
  107. package/dist/exceptions/index.js +43 -0
  108. package/dist/exceptions/utils.d.ts +2 -0
  109. package/dist/exceptions/utils.js +9 -0
  110. package/dist/functions/concat.d.ts +4 -0
  111. package/dist/functions/concat.js +248 -0
  112. package/dist/functions/index.d.ts +1 -0
  113. package/dist/functions/index.js +17 -0
  114. package/dist/index.d.ts +7 -0
  115. package/dist/index.js +1 -0
  116. package/dist/types.d.ts +47 -0
  117. package/dist/types.js +2 -0
  118. package/dist/utils/boolean.d.ts +1 -0
  119. package/dist/utils/boolean.js +18 -0
  120. package/dist/utils/date.d.ts +57 -0
  121. package/dist/utils/date.js +349 -0
  122. package/dist/utils/guards.d.ts +14 -0
  123. package/dist/utils/guards.js +143 -0
  124. package/dist/utils/index.d.ts +5 -0
  125. package/dist/utils/index.js +21 -0
  126. package/dist/utils/json.d.ts +2 -0
  127. package/dist/utils/json.js +33 -0
  128. package/dist/utils/list.d.ts +23 -0
  129. package/dist/utils/list.js +128 -0
  130. package/dist/utils/number.d.ts +86 -0
  131. package/dist/utils/number.js +223 -0
  132. package/dist/utils/string.d.ts +52 -0
  133. package/dist/utils/string.js +120 -0
  134. package/package.json +34 -0
@@ -0,0 +1,60 @@
1
+ import type { ExprConstructor } from "../types";
2
+ export declare const ComparisonExpr: <TBase extends ExprConstructor>(Base: TBase) => {
3
+ new (...args: any[]): {
4
+ between(lower: any, upper: any, closed?: "both" | "left" | "right" | "none"): /*elided*/ any;
5
+ eq(val: any): /*elided*/ any;
6
+ eq_missing(val: any): /*elided*/ any;
7
+ ge(val: any): /*elided*/ any;
8
+ gt(val: any): /*elided*/ any;
9
+ has_nulls(): any;
10
+ is_close(other: any, options?: {
11
+ abs_tol?: number;
12
+ rel_tol?: number;
13
+ nans_equal?: boolean;
14
+ }): /*elided*/ any;
15
+ is_duplicated(): /*elided*/ any;
16
+ is_empty(options?: {
17
+ ignoreNulls?: boolean;
18
+ }): /*elided*/ any;
19
+ is_finite(): /*elided*/ any;
20
+ is_first_distinct(): /*elided*/ any;
21
+ is_in(values: any[] | any): /*elided*/ any;
22
+ is_infinite(): /*elided*/ any;
23
+ is_last_distinct(): /*elided*/ any;
24
+ is_n_distinct(n: number): any;
25
+ is_nan(): /*elided*/ any;
26
+ is_not_nan(): /*elided*/ any;
27
+ is_not_null(): /*elided*/ any;
28
+ is_null(): /*elided*/ any;
29
+ is_unique(): /*elided*/ any;
30
+ le(val: any): /*elided*/ any;
31
+ lt(val: any): /*elided*/ any;
32
+ ne(val: any): /*elided*/ any;
33
+ ne_missing(val: any): /*elided*/ any;
34
+ not_in(values: any[] | any): /*elided*/ any;
35
+ ops: import("../..").OpFn[];
36
+ colName?: string;
37
+ outputName?: string;
38
+ isLiteral?: boolean;
39
+ literalValue?: any;
40
+ aggFn?: import("../..").AggFn<any> | null;
41
+ groupingOpsIndex?: number;
42
+ partitionOpsIndex?: number;
43
+ partitionBy?: (string | import("../..").IExpr)[] | null;
44
+ windowOp?: {
45
+ type: string;
46
+ [key: string]: any;
47
+ } | null;
48
+ isWindow?: boolean;
49
+ alias(name: string): /*elided*/ any;
50
+ cast(dataType: any): /*elided*/ any;
51
+ _resolve(val: any, columns: import("../..").ColumnDict, height: number): import("../..").ColumnData | any;
52
+ evaluate(columns: import("../..").ColumnDict, height: number): import("../..").ColumnData;
53
+ evaluatePreGrouping(columns: import("../..").ColumnDict, height: number): import("../..").ColumnData;
54
+ evaluatePostGrouping(aggregatedArray: any[], columns: import("../..").ColumnDict): import("../..").ColumnData;
55
+ evaluatePrePartition(columns: import("../..").ColumnDict, height: number): import("../..").ColumnData;
56
+ evaluatePostPartition(aggregatedArray: any[], columns: import("../..").ColumnDict): import("../..").ColumnData;
57
+ evaluateWindow?(groupPreValues: any[], partitionIndices: number[], currentIndex: number): any;
58
+ debug(label?: string): /*elided*/ any;
59
+ };
60
+ } & TBase;
@@ -0,0 +1,389 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComparisonExpr = void 0;
4
+ const ExprBase_1 = require("../ExprBase");
5
+ const utils_1 = require("../../utils");
6
+ function getCacheKey(val) {
7
+ if (val == null) {
8
+ return val;
9
+ }
10
+ if (val instanceof Date) {
11
+ return `d:${val.getTime()}`;
12
+ }
13
+ if (val instanceof Uint8Array) {
14
+ return `u:${val.toString()}`;
15
+ }
16
+ if (typeof val === "object" || typeof val === "function") {
17
+ return String(val);
18
+ }
19
+ return val;
20
+ }
21
+ const ComparisonExpr = (Base) => {
22
+ return class extends Base {
23
+ between(lower, upper, closed = "both") {
24
+ return (0, ExprBase_1.derive)(this, (vArray, columns) => {
25
+ const height = vArray.length;
26
+ const lResolved = this._resolve(lower, columns, height);
27
+ const uResolved = this._resolve(upper, columns, height);
28
+ const result = new Array(height);
29
+ const isLArray = (0, utils_1.isArrayOrTypedArray)(lResolved);
30
+ const isUArray = (0, utils_1.isArrayOrTypedArray)(uResolved);
31
+ for (let i = 0; i < height; i++) {
32
+ const v = vArray[i];
33
+ const l = isLArray ? lResolved[i] : lResolved;
34
+ const u = isUArray ? uResolved[i] : uResolved;
35
+ if (v == null || l == null || u == null) {
36
+ result[i] = null;
37
+ }
38
+ else {
39
+ const geLower = closed === "both" || closed === "left" ? v >= l : v > l;
40
+ const leUpper = closed === "both" || closed === "right" ? v <= u : v < u;
41
+ result[i] = geLower && leUpper;
42
+ }
43
+ }
44
+ return result;
45
+ });
46
+ }
47
+ eq(val) {
48
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneBinary)(this, val, (v, r) => v === r));
49
+ }
50
+ eq_missing(val) {
51
+ return (0, ExprBase_1.derive)(this, (vArray, columns) => {
52
+ const height = vArray.length;
53
+ const rResolved = this._resolve(val, columns, height);
54
+ const result = new Array(height);
55
+ if ((0, utils_1.isArrayOrTypedArray)(rResolved)) {
56
+ for (let i = 0; i < height; i++) {
57
+ const v = vArray[i];
58
+ const r = rResolved[i];
59
+ if (v == null && r == null)
60
+ result[i] = true;
61
+ else if (v == null || r == null)
62
+ result[i] = false;
63
+ else
64
+ result[i] = v === r;
65
+ }
66
+ }
67
+ else {
68
+ for (let i = 0; i < height; i++) {
69
+ const v = vArray[i];
70
+ if (v == null && rResolved == null)
71
+ result[i] = true;
72
+ else if (v == null || rResolved == null)
73
+ result[i] = false;
74
+ else
75
+ result[i] = v === rResolved;
76
+ }
77
+ }
78
+ return result;
79
+ });
80
+ }
81
+ ge(val) {
82
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneBinary)(this, val, (v, r) => v >= r));
83
+ }
84
+ gt(val) {
85
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneBinary)(this, val, (v, r) => v > r));
86
+ }
87
+ has_nulls() {
88
+ return this._deriveAgg((v) => {
89
+ for (let i = 0; i < v.length; i++) {
90
+ if (v[i] == null)
91
+ return true;
92
+ }
93
+ return false;
94
+ });
95
+ }
96
+ is_close(other, options = {}) {
97
+ const { abs_tol = 1e-8, rel_tol = 1e-8, nans_equal = false } = options;
98
+ return (0, ExprBase_1.derive)(this, (vArray, columns) => {
99
+ const height = vArray.length;
100
+ const otherVal = this._resolve(other, columns, height);
101
+ const isOtherArray = (0, utils_1.isArrayOrTypedArray)(otherVal);
102
+ const result = new Array(height);
103
+ for (let i = 0; i < height; i++) {
104
+ const v = vArray[i];
105
+ const o = isOtherArray ? otherVal[i] : otherVal;
106
+ if (v == null || o == null) {
107
+ result[i] = null;
108
+ }
109
+ else if (Number.isNaN(v) || Number.isNaN(o)) {
110
+ if (nans_equal && Number.isNaN(v) && Number.isNaN(o)) {
111
+ result[i] = true;
112
+ }
113
+ else {
114
+ result[i] = false;
115
+ }
116
+ }
117
+ else if (!Number.isFinite(v) || !Number.isFinite(o)) {
118
+ result[i] = (v === o);
119
+ }
120
+ else {
121
+ const absDiff = Math.abs(v - o);
122
+ const threshold = Math.max(rel_tol * Math.max(Math.abs(v), Math.abs(o)), abs_tol);
123
+ result[i] = absDiff <= threshold;
124
+ }
125
+ }
126
+ return result;
127
+ });
128
+ }
129
+ is_duplicated() {
130
+ return (0, ExprBase_1.derive)(this, (vArray) => {
131
+ const height = vArray.length;
132
+ const counts = new Map();
133
+ const keys = new Array(height);
134
+ for (let i = 0; i < height; i++) {
135
+ const k = getCacheKey(vArray[i]);
136
+ keys[i] = k;
137
+ counts.set(k, (counts.get(k) || 0) + 1);
138
+ }
139
+ const result = new Array(height);
140
+ for (let i = 0; i < height; i++) {
141
+ result[i] = (counts.get(keys[i]) || 0) > 1;
142
+ }
143
+ return result;
144
+ });
145
+ }
146
+ is_empty(options = {}) {
147
+ const { ignoreNulls = false } = options;
148
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneUnary)((v) => {
149
+ if (typeof v === "string") {
150
+ return v.length === 0;
151
+ }
152
+ if ((0, utils_1.isArrayOrTypedArray)(v)) {
153
+ if (ignoreNulls) {
154
+ const len = v.length;
155
+ let nonNullCount = 0;
156
+ for (let i = 0; i < len; i++) {
157
+ if (v[i] != null) {
158
+ nonNullCount++;
159
+ }
160
+ }
161
+ return nonNullCount === 0;
162
+ }
163
+ return v.length === 0;
164
+ }
165
+ return null;
166
+ }));
167
+ }
168
+ is_finite() {
169
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneUnary)(Number.isFinite));
170
+ }
171
+ is_first_distinct() {
172
+ return (0, ExprBase_1.derive)(this, (vArray) => {
173
+ const height = vArray.length;
174
+ const seen = new Set();
175
+ const result = new Array(height);
176
+ for (let i = 0; i < height; i++) {
177
+ const k = getCacheKey(vArray[i]);
178
+ if (seen.has(k)) {
179
+ result[i] = false;
180
+ }
181
+ else {
182
+ seen.add(k);
183
+ result[i] = true;
184
+ }
185
+ }
186
+ return result;
187
+ });
188
+ }
189
+ is_in(values) {
190
+ return (0, ExprBase_1.derive)(this, (vArray, columns) => {
191
+ const height = vArray.length;
192
+ const result = new Array(height);
193
+ if (values && typeof values === 'object' && 'evaluate' in values) {
194
+ const resolved = values.evaluate(columns, height);
195
+ for (let i = 0; i < height; i++) {
196
+ const v = vArray[i];
197
+ if (v == null) {
198
+ result[i] = null;
199
+ }
200
+ else {
201
+ const candidates = resolved[i];
202
+ const set = new Set();
203
+ if ((0, utils_1.isArrayOrTypedArray)(candidates)) {
204
+ const cLen = candidates.length;
205
+ for (let j = 0; j < cLen; j++) {
206
+ set.add(getCacheKey(candidates[j]));
207
+ }
208
+ }
209
+ else {
210
+ set.add(getCacheKey(candidates));
211
+ }
212
+ result[i] = set.has(getCacheKey(v));
213
+ }
214
+ }
215
+ }
216
+ else {
217
+ const arr = (0, utils_1.isArrayOrTypedArray)(values) ? values : [];
218
+ const set = new Set();
219
+ const arrLen = arr.length;
220
+ for (let j = 0; j < arrLen; j++) {
221
+ set.add(getCacheKey(arr[j]));
222
+ }
223
+ for (let i = 0; i < height; i++) {
224
+ const v = vArray[i];
225
+ result[i] = v == null ? null : set.has(getCacheKey(v));
226
+ }
227
+ }
228
+ return result;
229
+ });
230
+ }
231
+ is_infinite() {
232
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneUnary)((v) => v === Infinity || v === -Infinity));
233
+ }
234
+ is_last_distinct() {
235
+ return (0, ExprBase_1.derive)(this, (vArray) => {
236
+ const height = vArray.length;
237
+ const seen = new Set();
238
+ const result = new Array(height);
239
+ for (let i = height - 1; i >= 0; i--) {
240
+ const k = getCacheKey(vArray[i]);
241
+ if (seen.has(k)) {
242
+ result[i] = false;
243
+ }
244
+ else {
245
+ seen.add(k);
246
+ result[i] = true;
247
+ }
248
+ }
249
+ return result;
250
+ });
251
+ }
252
+ is_n_distinct(n) {
253
+ return this._deriveAgg((v) => {
254
+ const set = new Set();
255
+ const len = v.length;
256
+ for (let i = 0; i < len; i++) {
257
+ set.add(getCacheKey(v[i]));
258
+ }
259
+ return set.size === n;
260
+ });
261
+ }
262
+ is_nan() {
263
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneUnary)(Number.isNaN));
264
+ }
265
+ is_not_nan() {
266
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneUnary)((v) => !Number.isNaN(v)));
267
+ }
268
+ is_not_null() {
269
+ return (0, ExprBase_1.derive)(this, (vArray) => {
270
+ const height = vArray.length;
271
+ const result = new Array(height);
272
+ for (let i = 0; i < height; i++) {
273
+ result[i] = vArray[i] != null;
274
+ }
275
+ return result;
276
+ });
277
+ }
278
+ is_null() {
279
+ return (0, ExprBase_1.derive)(this, (vArray) => {
280
+ const height = vArray.length;
281
+ const result = new Array(height);
282
+ for (let i = 0; i < height; i++) {
283
+ result[i] = vArray[i] == null;
284
+ }
285
+ return result;
286
+ });
287
+ }
288
+ is_unique() {
289
+ return (0, ExprBase_1.derive)(this, (vArray) => {
290
+ const height = vArray.length;
291
+ const counts = new Map();
292
+ const keys = new Array(height);
293
+ for (let i = 0; i < height; i++) {
294
+ const k = getCacheKey(vArray[i]);
295
+ keys[i] = k;
296
+ counts.set(k, (counts.get(k) || 0) + 1);
297
+ }
298
+ const result = new Array(height);
299
+ for (let i = 0; i < height; i++) {
300
+ result[i] = counts.get(keys[i]) === 1;
301
+ }
302
+ return result;
303
+ });
304
+ }
305
+ le(val) {
306
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneBinary)(this, val, (v, r) => v <= r));
307
+ }
308
+ lt(val) {
309
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneBinary)(this, val, (v, r) => v < r));
310
+ }
311
+ ne(val) {
312
+ return (0, ExprBase_1.derive)(this, (0, ExprBase_1.kleeneBinary)(this, val, (v, r) => v !== r));
313
+ }
314
+ ne_missing(val) {
315
+ return (0, ExprBase_1.derive)(this, (vArray, columns) => {
316
+ const height = vArray.length;
317
+ const rResolved = this._resolve(val, columns, height);
318
+ const result = new Array(height);
319
+ if ((0, utils_1.isArrayOrTypedArray)(rResolved)) {
320
+ for (let i = 0; i < height; i++) {
321
+ const v = vArray[i];
322
+ const r = rResolved[i];
323
+ if (v == null && r == null)
324
+ result[i] = false;
325
+ else if (v == null || r == null)
326
+ result[i] = true;
327
+ else
328
+ result[i] = v !== r;
329
+ }
330
+ }
331
+ else {
332
+ for (let i = 0; i < height; i++) {
333
+ const v = vArray[i];
334
+ if (v == null && rResolved == null)
335
+ result[i] = false;
336
+ else if (v == null || rResolved == null)
337
+ result[i] = true;
338
+ else
339
+ result[i] = v !== rResolved;
340
+ }
341
+ }
342
+ return result;
343
+ });
344
+ }
345
+ not_in(values) {
346
+ return (0, ExprBase_1.derive)(this, (vArray, columns) => {
347
+ const height = vArray.length;
348
+ const result = new Array(height);
349
+ if (values && typeof values === 'object' && 'evaluate' in values) {
350
+ const resolved = values.evaluate(columns, height);
351
+ for (let i = 0; i < height; i++) {
352
+ const v = vArray[i];
353
+ if (v == null) {
354
+ result[i] = null;
355
+ }
356
+ else {
357
+ const candidates = resolved[i];
358
+ const set = new Set();
359
+ if ((0, utils_1.isArrayOrTypedArray)(candidates)) {
360
+ const cLen = candidates.length;
361
+ for (let j = 0; j < cLen; j++) {
362
+ set.add(getCacheKey(candidates[j]));
363
+ }
364
+ }
365
+ else {
366
+ set.add(getCacheKey(candidates));
367
+ }
368
+ result[i] = !set.has(getCacheKey(v));
369
+ }
370
+ }
371
+ }
372
+ else {
373
+ const arr = (0, utils_1.isArrayOrTypedArray)(values) ? values : [];
374
+ const set = new Set();
375
+ const arrLen = arr.length;
376
+ for (let j = 0; j < arrLen; j++) {
377
+ set.add(getCacheKey(arr[j]));
378
+ }
379
+ for (let i = 0; i < height; i++) {
380
+ const v = vArray[i];
381
+ result[i] = v == null ? null : !set.has(getCacheKey(v));
382
+ }
383
+ }
384
+ return result;
385
+ });
386
+ }
387
+ };
388
+ };
389
+ exports.ComparisonExpr = ComparisonExpr;
@@ -0,0 +1,63 @@
1
+ import type { ExprConstructor } from "../types";
2
+ export declare class ListExprNamespace {
3
+ expr: any;
4
+ constructor(expr: any);
5
+ _deriveList(fn: (arr: any[] | ArrayBufferView) => any): any;
6
+ all(): any;
7
+ any(): any;
8
+ contains(item: any): any;
9
+ contains_all(items: any[]): any;
10
+ contains_any(items: any[]): any;
11
+ count_matches(item: any): any;
12
+ drop_nulls(): any;
13
+ first(null_on_oob?: boolean): any;
14
+ gather(indices: number | number[], null_on_oob?: boolean): any;
15
+ gather_every(n: number, offset?: number): any;
16
+ get(index: number, null_on_oob?: boolean): any;
17
+ join(separator: string, { ignoreNulls }?: {
18
+ ignoreNulls?: boolean;
19
+ }): any;
20
+ last(null_on_oob?: boolean): any;
21
+ len(): any;
22
+ lengths(): any;
23
+ max(): any;
24
+ mean(): any;
25
+ median(): any;
26
+ min(): any;
27
+ mode(): any;
28
+ n_unique(): any;
29
+ reverse(): any;
30
+ slice(offset: number, length?: number): any;
31
+ sort(descending?: boolean): any;
32
+ sum(): any;
33
+ unique(): any;
34
+ }
35
+ export declare const ListExpr: <TBase extends ExprConstructor>(Base: TBase) => {
36
+ new (...args: any[]): {
37
+ get list(): ListExprNamespace;
38
+ ops: import("../..").OpFn[];
39
+ colName?: string;
40
+ outputName?: string;
41
+ isLiteral?: boolean;
42
+ literalValue?: any;
43
+ aggFn?: import("../..").AggFn<any> | null;
44
+ groupingOpsIndex?: number;
45
+ partitionOpsIndex?: number;
46
+ partitionBy?: (string | import("../..").IExpr)[] | null;
47
+ windowOp?: {
48
+ type: string;
49
+ [key: string]: any;
50
+ } | null;
51
+ isWindow?: boolean;
52
+ alias(name: string): /*elided*/ any;
53
+ cast(dataType: any): /*elided*/ any;
54
+ _resolve(val: any, columns: import("../..").ColumnDict, height: number): import("../..").ColumnData | any;
55
+ evaluate(columns: import("../..").ColumnDict, height: number): import("../..").ColumnData;
56
+ evaluatePreGrouping(columns: import("../..").ColumnDict, height: number): import("../..").ColumnData;
57
+ evaluatePostGrouping(aggregatedArray: any[], columns: import("../..").ColumnDict): import("../..").ColumnData;
58
+ evaluatePrePartition(columns: import("../..").ColumnDict, height: number): import("../..").ColumnData;
59
+ evaluatePostPartition(aggregatedArray: any[], columns: import("../..").ColumnDict): import("../..").ColumnData;
60
+ evaluateWindow?(groupPreValues: any[], partitionIndices: number[], currentIndex: number): any;
61
+ debug(label?: string): /*elided*/ any;
62
+ };
63
+ } & TBase;