squirreling 0.16.4 → 0.16.5
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/package.json +2 -2
- package/src/expression/batch.js +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "squirreling",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.5",
|
|
4
4
|
"description": "Squirreling Async SQL Engine",
|
|
5
5
|
"author": "Hyperparam",
|
|
6
6
|
"homepage": "https://hyperparam.app",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@eslint/js": "10.0.1",
|
|
43
|
-
"@types/node": "26.
|
|
43
|
+
"@types/node": "26.5.0",
|
|
44
44
|
"@vitest/coverage-v8": "5.0.0",
|
|
45
45
|
"eslint": "10.10.0",
|
|
46
46
|
"eslint-plugin-jsdoc": "64.3.6",
|
package/src/expression/batch.js
CHANGED
|
@@ -206,6 +206,31 @@ function compileValueKernel(node, state) {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
if (node.type === 'in valuelist') {
|
|
210
|
+
// Later list entries are conditional reads. Keep those on the row path
|
|
211
|
+
// until they have a selection-aware evaluator, just like lazy functions.
|
|
212
|
+
if (node.values.some(readsIdentifier)) return undefined
|
|
213
|
+
const argument = compileValueKernel(node.expr, state)
|
|
214
|
+
if (!argument) return undefined
|
|
215
|
+
/** @type {ValueKernel[]} */
|
|
216
|
+
const values = []
|
|
217
|
+
for (const valueNode of node.values) {
|
|
218
|
+
const value = compileValueKernel(valueNode, state)
|
|
219
|
+
if (!value) return undefined
|
|
220
|
+
values.push(value)
|
|
221
|
+
}
|
|
222
|
+
return function inValue(vectors, rowIndex, streamRowIndex) {
|
|
223
|
+
const input = argument(vectors, rowIndex, streamRowIndex)
|
|
224
|
+
let sawNull = input == null
|
|
225
|
+
for (const value of values) {
|
|
226
|
+
const candidate = value(vectors, rowIndex, streamRowIndex)
|
|
227
|
+
if (candidate == null) sawNull = true
|
|
228
|
+
else if (input != null && sqlEquals(input, candidate)) return true
|
|
229
|
+
}
|
|
230
|
+
return sawNull ? null : false
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
209
234
|
if (node.type === 'cast') {
|
|
210
235
|
const argument = compileValueKernel(node.expr, state)
|
|
211
236
|
if (!argument) return undefined
|
|
@@ -652,6 +677,7 @@ function readsIdentifier(node) {
|
|
|
652
677
|
if (node.type === 'unary') return readsIdentifier(node.argument)
|
|
653
678
|
if (node.type === 'binary') return readsIdentifier(node.left) || readsIdentifier(node.right)
|
|
654
679
|
if (node.type === 'cast') return readsIdentifier(node.expr)
|
|
680
|
+
if (node.type === 'in valuelist') return readsIdentifier(node.expr) || node.values.some(readsIdentifier)
|
|
655
681
|
if (node.type === 'function') return node.args.some(readsIdentifier)
|
|
656
682
|
return false
|
|
657
683
|
}
|