@minnowdb/core 0.4.1 → 0.6.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.
- package/README.md +5 -5
- package/dist/engine/cancellation.d.ts +2 -0
- package/dist/engine/cancellation.js +4 -0
- package/dist/engine/catalog.d.ts +5 -1
- package/dist/engine/catalog.js +5 -1
- package/dist/engine/client.d.ts +34 -6
- package/dist/engine/client.js +87 -19
- package/dist/engine/database.d.ts +43 -20
- package/dist/engine/database.js +823 -164
- package/dist/engine/defaults.js +11 -0
- package/dist/engine/errors.d.ts +19 -0
- package/dist/engine/errors.js +31 -0
- package/dist/engine/fts.d.ts +2 -15
- package/dist/engine/live.d.ts +1 -7
- package/dist/engine/live.js +12 -13
- package/dist/engine/optimizer.js +546 -39
- package/dist/engine/query-cache.js +1 -0
- package/dist/engine/query.d.ts +16 -278
- package/dist/engine/query.js +260 -74
- package/dist/engine/result-wire.d.ts +2 -0
- package/dist/engine/result-wire.js +21 -5
- package/dist/engine/schema-wire.d.ts +14 -1
- package/dist/engine/schema-wire.js +7 -1
- package/dist/engine/schema.d.ts +83 -32
- package/dist/engine/schema.js +180 -14
- package/dist/engine/sql-domains.d.ts +11 -0
- package/dist/engine/sql-domains.js +65 -1
- package/dist/engine/sql-json.js +22 -3
- package/dist/engine/sql-semantics.js +21 -3
- package/dist/engine/vector.d.ts +2 -2
- package/dist/engine/vector.js +328 -79
- package/dist/engine/worker-host.js +119 -44
- package/dist/plan/index.d.ts +5 -4
- package/dist/plan/index.js +3 -3
- package/dist/plan/model.d.ts +218 -0
- package/dist/plan/model.js +1 -0
- package/dist/storage/indexeddb.js +4 -12
- package/dist/storage/toolkit/record-core.js +7 -22
- package/dist/storage/types.d.ts +26 -8
- package/dist/storage/types.js +85 -0
- package/dist/transactions/index.d.ts +5 -3
- package/dist/transactions/index.js +58 -8
- package/dist/worker-protocol/index.d.ts +6 -1
- package/dist/worker-protocol/index.js +5 -2
- package/package.json +1 -1
- package/postgres-feature-profile.json +5 -0
- package/sql-feature-matrix.json +75 -19
|
@@ -38,6 +38,7 @@ export function copyQueryResult(result) {
|
|
|
38
38
|
const columns = result.columns;
|
|
39
39
|
const copy = {
|
|
40
40
|
columns: [...columns],
|
|
41
|
+
columnDomains: structuredClone(result.columnDomains),
|
|
41
42
|
rows: result.rows.map((row) => {
|
|
42
43
|
const copy = { ...row };
|
|
43
44
|
for (const name of columns) {
|
package/dist/engine/query.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import type { DatabaseRow } from "./database.js";
|
|
2
|
-
import type { ColumnDefault, SqlDomain } from "../storage/types.js";
|
|
3
|
-
import {
|
|
2
|
+
import type { ColumnDefault, ColumnGenerated, SqlDomain } from "../storage/types.js";
|
|
3
|
+
import type { AggregateName, ComparisonOperator, CompiledQuery, Expression, FtsStats, JoinPlan, Predicate, PredicateOperator, QueryResult, QueryRow, QueryValue, ScalarFunctionName, SelectItem, SelectTail, SetOperator, TableSource, WindowSpec } from "../plan/model.js";
|
|
4
|
+
export type { AggregateName, BinaryOperator, ComparisonOperator, CompiledQuery, Expression, JoinPlan, Predicate, PredicateOperator, QueryResult, QueryRow, QueryValue, RecursiveCte, ScalarFunctionName, SelectItem, SelectTail, SetOperator, TableSource, WindowFrame, WindowFrameBound, WindowFrameExclusion, WindowFunctionName, WindowSpec, } from "../plan/model.js";
|
|
4
5
|
import { QueryMemoryContext, type QueryMemoryUsage } from "./memory.js";
|
|
5
6
|
import { type ColumnarTable, type AsyncQueryExecutionOptions, type QueryBatchExecutionOptions } from "./vector.js";
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export interface QueryResult {
|
|
9
|
-
columns: string[];
|
|
10
|
-
rows: QueryRow[];
|
|
11
|
-
}
|
|
7
|
+
/** Domain metadata for an execution path that has no catalog-backed type information. */
|
|
8
|
+
export declare function unknownColumnDomains(columns: readonly string[]): null[];
|
|
12
9
|
export interface PreparedQuery {
|
|
13
10
|
readonly sql: string;
|
|
14
11
|
readonly tables: string[];
|
|
@@ -31,14 +28,6 @@ export interface QueryExecutionOptions {
|
|
|
31
28
|
*/
|
|
32
29
|
readonly executionMemoryBudgetBytes?: number;
|
|
33
30
|
}
|
|
34
|
-
export type BinaryOperator = "+" | "-" | "*" | "/" | "%" | "||";
|
|
35
|
-
export type ComparisonOperator = "=" | "!=" | "<>" | ">" | ">=" | "<" | "<=";
|
|
36
|
-
export type AggregateName = "COUNT" | "SUM" | "AVG" | "MIN" | "MAX" | "JSON_ARRAYAGG" | "STRING_AGG";
|
|
37
|
-
export type ScalarFunctionName = "ROUND" | "COALESCE" | "DATE_TRUNC" | "DATE_ADD" | "UPPER" | "LOWER" | "LENGTH" | "ABS" | "TRIM" | "LTRIM" | "RTRIM" | "SUBSTR" | "REPLACE" | "INSTR" | "NULLIF" | "GREATEST" | "LEAST" | "FLOOR" | "CEIL" | "MOD" | "POWER" | "SQRT" | "EXTRACT" | "CAST" | "OCTET_LENGTH" | "LPAD" | "RPAD" | "OVERLAY" | "CURRENT_DATE" | "CURRENT_TIMESTAMP" | "LOCALTIME" | "GROUPING" | "JSON_VALUE" | "JSON_QUERY" | "JSON_EXISTS" | "JSON_OBJECT" | "JSON_ARRAY" | "IS_JSON" | "ARRAY"
|
|
38
|
-
/** Optimizer-only, prefix-free equality key for hashable multi-column decorrelation. */
|
|
39
|
-
| "MINNOW_TUPLE_KEY"
|
|
40
|
-
/** Parser-produced wrapper carrying one explicit collation through ordering/comparison. */
|
|
41
|
-
| "MINNOW_COLLATE" | "NEXTVAL" | "CURRVAL" | "RANDOM" | "GEN_RANDOM_UUID";
|
|
42
31
|
export declare const scalarFunctionNames: ReadonlySet<string>;
|
|
43
32
|
/** Functions whose answer can change without any catalog or input-row change. */
|
|
44
33
|
export declare const volatileScalarFunctionNames: ReadonlySet<string>;
|
|
@@ -72,271 +61,12 @@ export declare function intervalLiteral(text: string): {
|
|
|
72
61
|
* does not exist in the target month clamps to that month's last day, which is what both SQLite
|
|
73
62
|
* and PostgreSQL do with 31 January plus a month.
|
|
74
63
|
*/
|
|
75
|
-
export declare function dateAddValue(value: unknown, months: unknown, milliseconds: unknown): Date | null;
|
|
64
|
+
export declare function dateAddValue(value: unknown, months: unknown, milliseconds: unknown): Date | string | null;
|
|
76
65
|
export declare function dateTruncValue(unit: unknown, value: unknown): Date | null;
|
|
77
|
-
export type Expression = {
|
|
78
|
-
kind: "literal";
|
|
79
|
-
value: QueryValue;
|
|
80
|
-
internalSqlValue?: true;
|
|
81
|
-
sqlDomain?: SqlDomain;
|
|
82
|
-
}
|
|
83
|
-
/** A `?` or `$n` placeholder; `index` is 0-based. Replaced by a literal at bind time. */
|
|
84
|
-
| {
|
|
85
|
-
kind: "parameter";
|
|
86
|
-
index: number;
|
|
87
|
-
} | {
|
|
88
|
-
kind: "column";
|
|
89
|
-
reference: string;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* `*`, or `alias.*` when `table` is set (E051-07). A qualified wildcard names one source and
|
|
93
|
-
* may sit beside other select items; every executor entry expands it into that source's
|
|
94
|
-
* columns, so past the entry only a bare wildcard — the whole-row projection — survives.
|
|
95
|
-
*/
|
|
96
|
-
| {
|
|
97
|
-
kind: "wildcard";
|
|
98
|
-
table?: string;
|
|
99
|
-
} | {
|
|
100
|
-
kind: "binary";
|
|
101
|
-
operator: BinaryOperator;
|
|
102
|
-
left: Expression;
|
|
103
|
-
right: Expression;
|
|
104
|
-
} | {
|
|
105
|
-
kind: "call";
|
|
106
|
-
name: AggregateName | ScalarFunctionName;
|
|
107
|
-
arguments: Expression[];
|
|
108
|
-
distinct?: boolean;
|
|
109
|
-
aggregateOrderBy?: Array<{
|
|
110
|
-
expression: Expression;
|
|
111
|
-
direction: "asc" | "desc";
|
|
112
|
-
nulls?: "first" | "last";
|
|
113
|
-
}>;
|
|
114
|
-
} | {
|
|
115
|
-
kind: "list";
|
|
116
|
-
items: Expression[];
|
|
117
|
-
} | {
|
|
118
|
-
kind: "subquery";
|
|
119
|
-
block: CompiledQuery;
|
|
120
|
-
} | {
|
|
121
|
-
kind: "condition";
|
|
122
|
-
operator: PredicateOperator;
|
|
123
|
-
left: Expression;
|
|
124
|
-
right: Expression;
|
|
125
|
-
/** LIKE/ILIKE escape character, from LIKE ... ESCAPE 'c'. */
|
|
126
|
-
escape?: string;
|
|
127
|
-
} | {
|
|
128
|
-
kind: "logical";
|
|
129
|
-
operator: "and" | "or";
|
|
130
|
-
left: Expression;
|
|
131
|
-
right: Expression;
|
|
132
|
-
} | {
|
|
133
|
-
kind: "not";
|
|
134
|
-
operand: Expression;
|
|
135
|
-
} | {
|
|
136
|
-
kind: "exists";
|
|
137
|
-
block: CompiledQuery;
|
|
138
|
-
negated: boolean;
|
|
139
|
-
} | {
|
|
140
|
-
kind: "case";
|
|
141
|
-
branches: Array<{
|
|
142
|
-
when: Expression;
|
|
143
|
-
then: Expression;
|
|
144
|
-
}>;
|
|
145
|
-
otherwise?: Expression;
|
|
146
|
-
} | {
|
|
147
|
-
kind: "window";
|
|
148
|
-
name: WindowFunctionName;
|
|
149
|
-
partitionBy: Expression[];
|
|
150
|
-
orderBy: Array<{
|
|
151
|
-
expression: Expression;
|
|
152
|
-
direction: "asc" | "desc";
|
|
153
|
-
nulls?: "first" | "last";
|
|
154
|
-
}>;
|
|
155
|
-
argument?: Expression;
|
|
156
|
-
/** LAG/LEAD row distance; parsed as a literal non-negative integer, defaulting to 1. */
|
|
157
|
-
offset?: number;
|
|
158
|
-
/** LAG/LEAD default when the offset row falls outside the partition; NULL when absent. */
|
|
159
|
-
fallback?: QueryValue;
|
|
160
|
-
frame?: WindowFrame;
|
|
161
|
-
} | {
|
|
162
|
-
kind: "fts";
|
|
163
|
-
op: "match" | "bm25";
|
|
164
|
-
/**
|
|
165
|
-
* Column references forming the document, or "*" for every searchable column of the
|
|
166
|
-
* single scan source. "*" stays unexpanded through compilation (both front ends emit the
|
|
167
|
-
* identical node — plan parity), and the engine expands it against the catalog at
|
|
168
|
-
* prepare time via expandFtsColumns.
|
|
169
|
-
*/
|
|
170
|
-
columns: Expression[] | "*";
|
|
171
|
-
query: string;
|
|
172
|
-
/** Placeholder used by parameterized SQL; replaced with `query` before execution. */
|
|
173
|
-
queryParameter?: number;
|
|
174
|
-
/**
|
|
175
|
-
* Corpus statistics for BM25, annotated by the executor onto its cloned plan before
|
|
176
|
-
* evaluation; never set by compilation.
|
|
177
|
-
*/
|
|
178
|
-
stats?: FtsStats;
|
|
179
|
-
};
|
|
180
|
-
export type WindowFunctionName = "ROW_NUMBER" | "RANK" | "DENSE_RANK" | "PERCENT_RANK" | "CUME_DIST" | "NTILE" | "LAG" | "LEAD" | "FIRST_VALUE" | "LAST_VALUE" | "NTH_VALUE" | AggregateName;
|
|
181
|
-
export interface WindowFrameBound {
|
|
182
|
-
kind: "unbounded-preceding" | "preceding" | "current-row" | "following" | "unbounded-following";
|
|
183
|
-
/** Row distance for preceding/following bounds (ROWS unit only). */
|
|
184
|
-
offset?: number;
|
|
185
|
-
}
|
|
186
|
-
/** How a frame's rows are excluded around the current row (T612). */
|
|
187
|
-
export type WindowFrameExclusion = "no-others" | "current-row" | "group" | "ties";
|
|
188
|
-
/** An explicit frame clause; absent means the SQL default for the window's ordering. */
|
|
189
|
-
export interface WindowFrame {
|
|
190
|
-
unit: "rows" | "range" | "groups";
|
|
191
|
-
start: WindowFrameBound;
|
|
192
|
-
end: WindowFrameBound;
|
|
193
|
-
/** Rows excluded around the current row; absent means EXCLUDE NO OTHERS. */
|
|
194
|
-
exclude?: WindowFrameExclusion;
|
|
195
|
-
}
|
|
196
|
-
export interface WindowSpec {
|
|
197
|
-
alias: string;
|
|
198
|
-
name: WindowFunctionName;
|
|
199
|
-
partitionAliases: string[];
|
|
200
|
-
orderAliases: Array<{
|
|
201
|
-
alias: string;
|
|
202
|
-
direction: "asc" | "desc";
|
|
203
|
-
nulls?: "first" | "last";
|
|
204
|
-
}>;
|
|
205
|
-
/** Hidden inner alias of an aggregate window's argument; absent for COUNT(*) and rankings. */
|
|
206
|
-
argumentAlias?: string;
|
|
207
|
-
/** LAG/LEAD row distance. */
|
|
208
|
-
offset?: number;
|
|
209
|
-
/** LAG/LEAD default when the offset row falls outside the partition. */
|
|
210
|
-
fallback?: QueryValue;
|
|
211
|
-
frame?: WindowFrame;
|
|
212
|
-
}
|
|
213
66
|
/** The output column type of one window: rankings and most aggregates count, MIN/MAX carry. */
|
|
214
67
|
export declare function windowOutputType(window: WindowSpec, innerSchema: readonly SqlColumnSchema[]): SqlColumnType;
|
|
215
68
|
/** Logical domain carried or produced by a window result, when its physical type is not enough. */
|
|
216
69
|
export declare function windowOutputDomain(window: WindowSpec, innerSchema: readonly SqlColumnSchema[]): SqlDomain | undefined;
|
|
217
|
-
export interface SelectItem {
|
|
218
|
-
expression: Expression;
|
|
219
|
-
alias: string;
|
|
220
|
-
}
|
|
221
|
-
export interface TableSource {
|
|
222
|
-
table: string;
|
|
223
|
-
alias: string;
|
|
224
|
-
/** A parenthesized SELECT or expanded CTE body; `table` is then a unique synthetic name. */
|
|
225
|
-
derived?: CompiledQuery;
|
|
226
|
-
/** A top-level set operation; members combine positionally under the first member's schema. */
|
|
227
|
-
union?: {
|
|
228
|
-
blocks: CompiledQuery[];
|
|
229
|
-
ops: SetOperator[];
|
|
230
|
-
};
|
|
231
|
-
recursive?: RecursiveCte;
|
|
232
|
-
/** A window-function desugar: the inner block executes, then window columns append. */
|
|
233
|
-
windowed?: {
|
|
234
|
-
block: CompiledQuery;
|
|
235
|
-
windows: WindowSpec[];
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
* `FROM t AS y(a, b)`: positional new names for a base table's columns (E051-09). Every
|
|
239
|
-
* executor entry turns the source into a derived projection, so past that point the rename
|
|
240
|
-
* is an ordinary select list and nothing else has to know about it.
|
|
241
|
-
*/
|
|
242
|
-
columnAliases?: string[];
|
|
243
|
-
/** Parser marker for a derived source allowed to reference sources to its left. */
|
|
244
|
-
lateral?: true;
|
|
245
|
-
}
|
|
246
|
-
export interface JoinPlan extends TableSource {
|
|
247
|
-
kind: "inner" | "left" | "semi" | "anti";
|
|
248
|
-
left: Expression;
|
|
249
|
-
right: Expression;
|
|
250
|
-
/** General ON condition for non-equi or multi-key joins; left/right are inert placeholders. */
|
|
251
|
-
on?: Expression;
|
|
252
|
-
/** Parser marker: FULL OUTER JOIN. Assembly desugars it into a union of two left joins. */
|
|
253
|
-
full?: boolean;
|
|
254
|
-
/**
|
|
255
|
-
* Parser marker: NATURAL JOIN. Every execution entry replaces it with the equality
|
|
256
|
-
* conjunction over the columns this source shares with the ones before it, so no executor
|
|
257
|
-
* ever sees the marker (F401-01).
|
|
258
|
-
*/
|
|
259
|
-
natural?: boolean;
|
|
260
|
-
}
|
|
261
|
-
export type SetOperator = "union" | "union all" | "intersect" | "intersect all" | "except" | "except all";
|
|
262
|
-
/**
|
|
263
|
-
* A WITH RECURSIVE source: the base block seeds the working set, then the step block re-executes
|
|
264
|
-
* with `reference` bound to the previous iteration's new rows (linear delta recursion) until no
|
|
265
|
-
* new rows appear. UNION deduplicates against everything seen; UNION ALL appends raw.
|
|
266
|
-
*/
|
|
267
|
-
export interface RecursiveCte {
|
|
268
|
-
reference: string;
|
|
269
|
-
base: CompiledQuery;
|
|
270
|
-
step: CompiledQuery;
|
|
271
|
-
all: boolean;
|
|
272
|
-
}
|
|
273
|
-
export type PredicateOperator = ComparisonOperator | `${ComparisonOperator} ANY` | `${ComparisonOperator} ALL` | "IN" | "NOT IN" | "IS NULL" | "IS NOT NULL" | "LIKE" | "NOT LIKE" | "ILIKE" | "NOT ILIKE" | "SIMILAR TO" | "NOT SIMILAR TO" | "IS DISTINCT FROM" | "IS NOT DISTINCT FROM" | "IS TRUE";
|
|
274
|
-
export interface Predicate {
|
|
275
|
-
left: Expression;
|
|
276
|
-
operator: PredicateOperator;
|
|
277
|
-
right: Expression;
|
|
278
|
-
/** LIKE/ILIKE escape character, carried from the parsed condition. */
|
|
279
|
-
escape?: string;
|
|
280
|
-
}
|
|
281
|
-
export interface CompiledQuery {
|
|
282
|
-
sql: string;
|
|
283
|
-
base: TableSource;
|
|
284
|
-
joins: JoinPlan[];
|
|
285
|
-
select: SelectItem[];
|
|
286
|
-
predicates: Predicate[];
|
|
287
|
-
groupBy: Expression[];
|
|
288
|
-
having: Predicate[];
|
|
289
|
-
orderBy: Array<{
|
|
290
|
-
expression: Expression;
|
|
291
|
-
direction: "asc" | "desc";
|
|
292
|
-
/**
|
|
293
|
-
* Explicit NULL placement, absolute regardless of direction. Absent keeps PostgreSQL's
|
|
294
|
-
* default: NULLS LAST for ASC and NULLS FIRST for DESC.
|
|
295
|
-
*/
|
|
296
|
-
nulls?: "first" | "last";
|
|
297
|
-
}>;
|
|
298
|
-
limit?: number;
|
|
299
|
-
offset?: number;
|
|
300
|
-
/**
|
|
301
|
-
* SELECT DISTINCT * awaiting expansion: the wildcard's columns are unknown until input
|
|
302
|
-
* schemas exist, so every executor entry expands this into a concrete select list plus a
|
|
303
|
-
* matching GROUP BY exactly once (see expandDistinctWildcard), like MATCH(*).
|
|
304
|
-
*/
|
|
305
|
-
distinctWildcard?: boolean;
|
|
306
|
-
/** Parameter slots for LIMIT ? / OFFSET ?; binding resolves them into limit/offset. */
|
|
307
|
-
limitParameter?: number;
|
|
308
|
-
offsetParameter?: number;
|
|
309
|
-
/**
|
|
310
|
-
* FETCH FIRST n ROWS WITH TIES (F866): rows tying with the last retained row under the
|
|
311
|
-
* ORDER BY are kept too. The limit cannot be pushed into a scan then, so every execution
|
|
312
|
-
* entry runs the query unlimited and trims the ordered result.
|
|
313
|
-
*/
|
|
314
|
-
limitWithTies?: boolean;
|
|
315
|
-
/**
|
|
316
|
-
* Number of `?`/`$n` placeholders in the whole statement; set only on the top-level plan.
|
|
317
|
-
* A plan with placeholders must pass through bindPlanParameters before it prepares.
|
|
318
|
-
*/
|
|
319
|
-
parameterCount?: number;
|
|
320
|
-
/**
|
|
321
|
-
* CURRENT_DATE / CURRENT_TIMESTAMP / LOCALTIME appear somewhere in the statement. Every
|
|
322
|
-
* executor entry replaces them with one instant per execution, and results never memoize,
|
|
323
|
-
* because the answer depends on the clock rather than on the data.
|
|
324
|
-
*/
|
|
325
|
-
usesStatementDatetime?: boolean;
|
|
326
|
-
/** NEXTVAL/CURRVAL appear in this parsed statement and need connection-local resolution. */
|
|
327
|
-
usesSequenceCalls?: boolean;
|
|
328
|
-
/** RANDOM/GEN_RANDOM_UUID appear and make result memoization unsafe. */
|
|
329
|
-
usesVolatileFunctions?: boolean;
|
|
330
|
-
}
|
|
331
|
-
/** ORDER BY / LIMIT / OFFSET tail of a select or set operation. */
|
|
332
|
-
export interface SelectTail {
|
|
333
|
-
orderBy: CompiledQuery["orderBy"];
|
|
334
|
-
limit?: number;
|
|
335
|
-
offset?: number;
|
|
336
|
-
limitParameter?: number;
|
|
337
|
-
offsetParameter?: number;
|
|
338
|
-
limitWithTies?: boolean;
|
|
339
|
-
}
|
|
340
70
|
/**
|
|
341
71
|
* The virtual one-row source behind a FROM-less SELECT. The name cannot collide with a real
|
|
342
72
|
* table (parentheses never survive identifier parsing unquoted), and its single hidden column
|
|
@@ -387,6 +117,8 @@ export interface ForeignKeyDefinition {
|
|
|
387
117
|
parentColumn?: string;
|
|
388
118
|
parentColumns?: string[];
|
|
389
119
|
onDelete: "restrict" | "cascade" | "set null";
|
|
120
|
+
/** False is reserved for schema/catalog declarations; SQL-created keys are enforced. */
|
|
121
|
+
enforced?: boolean;
|
|
390
122
|
}
|
|
391
123
|
export interface UniqueConstraintDefinition {
|
|
392
124
|
name: string;
|
|
@@ -467,6 +199,7 @@ export type CompiledStatement = {
|
|
|
467
199
|
sqlDomain?: SqlDomain;
|
|
468
200
|
nullable?: boolean;
|
|
469
201
|
defaultValue?: ColumnDefault;
|
|
202
|
+
generatedValue?: ColumnGenerated;
|
|
470
203
|
enumValues?: readonly string[];
|
|
471
204
|
backfill?: Exclude<QueryValue, null>;
|
|
472
205
|
}>;
|
|
@@ -591,6 +324,7 @@ export type CompiledStatement = {
|
|
|
591
324
|
sqlDomain?: SqlDomain;
|
|
592
325
|
nullable?: boolean;
|
|
593
326
|
defaultValue?: ColumnDefault;
|
|
327
|
+
generatedValue?: ColumnGenerated;
|
|
594
328
|
enumValues?: readonly string[];
|
|
595
329
|
backfill?: Exclude<QueryValue, null>;
|
|
596
330
|
};
|
|
@@ -687,15 +421,19 @@ export interface SqlColumnSchema {
|
|
|
687
421
|
* derived table always has concrete column types even when its result is empty.
|
|
688
422
|
*/
|
|
689
423
|
export declare function inferBlockSchema(plan: CompiledQuery, schemas: ReadonlyMap<string, readonly SqlColumnSchema[]>): SqlColumnSchema[];
|
|
424
|
+
/** Best-effort logical domains for a public result without making execution a new typecheck. */
|
|
425
|
+
export declare function inferResultColumnDomains(plan: CompiledQuery, schemas: ReadonlyMap<string, readonly SqlColumnSchema[]>): Array<SqlDomain | null>;
|
|
690
426
|
/** Whether a final result can contain one of the engine's tagged string-domain values. */
|
|
691
427
|
export declare function queryResultNeedsExternalization(plan: CompiledQuery, schemas: ReadonlyMap<string, readonly SqlColumnSchema[]>): boolean;
|
|
692
428
|
export declare function referencedColumns(plan: CompiledQuery, schemas: ReadonlyMap<string, readonly string[]>): Map<string, string[]>;
|
|
693
429
|
export declare function createPreparedQuery(plan: CompiledQuery, tables: ReadonlyMap<string, DatabaseRow[]>, options?: QueryExecutionOptions): PreparedQuery;
|
|
694
430
|
/** Internal columnar entry point used after MinnowDatabase materializes a stable snapshot. */
|
|
695
|
-
export declare function createPreparedColumnarQuery(plan: CompiledQuery, tables: ReadonlyMap<string, ColumnarTable>, memory?: QueryMemoryContext,
|
|
431
|
+
export declare function createPreparedColumnarQuery(plan: CompiledQuery, tables: ReadonlyMap<string, ColumnarTable>, memory?: QueryMemoryContext, preparedOptions?: {
|
|
696
432
|
ftsStats?: ReadonlyMap<string, FtsStats>;
|
|
697
433
|
/** False only when catalog-backed schema inference proves every output is already public. */
|
|
698
434
|
outputNeedsExternalization?: boolean;
|
|
435
|
+
/** Catalog-inferred logical domains, positionally aligned with the visible output. */
|
|
436
|
+
outputColumnDomains?: ReadonlyArray<SqlDomain | null>;
|
|
699
437
|
}): PreparedQuery;
|
|
700
438
|
export declare function executeQuery(plan: CompiledQuery, tables: ReadonlyMap<string, DatabaseRow[]>, options?: QueryExecutionOptions): QueryResult;
|
|
701
439
|
/**
|
|
@@ -843,6 +581,7 @@ export declare function distinctFromComparison(left: unknown, right: unknown): b
|
|
|
843
581
|
* Leaf values come from the executor-specific callback so both executors share these semantics.
|
|
844
582
|
*/
|
|
845
583
|
export declare function evaluateBooleanExpression(expression: Expression, evaluateValue: (expression: Expression) => unknown): boolean | null;
|
|
584
|
+
export declare function comparisonHolds(operator: PredicateOperator, leftValue: unknown, rightValue: unknown): boolean;
|
|
846
585
|
export declare function hasAggregate(expression: Expression): boolean;
|
|
847
586
|
/** The column references inside one expression; a subquery contributes none (its own scope). */
|
|
848
587
|
export declare function expressionColumnNames(expression: Expression): string[];
|
|
@@ -958,4 +697,3 @@ export declare function validateOffset(offset: number): number;
|
|
|
958
697
|
* boolean expression becomes a single IS TRUE predicate evaluated with three-valued logic.
|
|
959
698
|
*/
|
|
960
699
|
export declare function splitCondition(expression: Expression): Predicate[];
|
|
961
|
-
export {};
|