@slexisvn/query-engine 0.1.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/dist/binder/binder.d.ts +130 -0
- package/dist/binder/expression-binder.d.ts +168 -0
- package/dist/binder/scope.d.ts +40 -0
- package/dist/browser.d.ts +8 -0
- package/dist/catalog/catalog.d.ts +53 -0
- package/dist/catalog/function-registry.d.ts +26 -0
- package/dist/catalog/statistics-cache.d.ts +39 -0
- package/dist/catalog/statistics.d.ts +72 -0
- package/dist/catalog/tpch-schema.d.ts +15 -0
- package/dist/cli/cli-common.d.ts +11 -0
- package/dist/cli/coordinator.d.ts +1 -0
- package/dist/cli/format.d.ts +8 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/loaders/csv-loader.d.ts +17 -0
- package/dist/cli/loaders/data-loader.d.ts +7 -0
- package/dist/cli/loaders/json-loader.d.ts +13 -0
- package/dist/cli/loaders/loader-factory.d.ts +4 -0
- package/dist/cli/repl.d.ts +6 -0
- package/dist/cli/worker.d.ts +1 -0
- package/dist/config.d.ts +42 -0
- package/dist/core.wasm +0 -0
- package/dist/dataframe/column-expr.d.ts +67 -0
- package/dist/dataframe/dataframe.d.ts +96 -0
- package/dist/dataframe/expr-types.d.ts +6 -0
- package/dist/dataframe/in-memory-relation.d.ts +31 -0
- package/dist/dataframe/index.d.ts +4 -0
- package/dist/dataframe/schema.d.ts +35 -0
- package/dist/dataframe/sql-expr-binder.d.ts +17 -0
- package/dist/dataframe/type-inference.d.ts +8 -0
- package/dist/distributed/cluster/cluster-manager.d.ts +54 -0
- package/dist/distributed/cluster/heartbeat-monitor.d.ts +27 -0
- package/dist/distributed/cluster/node-descriptor.d.ts +41 -0
- package/dist/distributed/distributed-types.d.ts +336 -0
- package/dist/distributed/execution/coordinator.d.ts +53 -0
- package/dist/distributed/execution/exchange-operator.d.ts +44 -0
- package/dist/distributed/execution/fragment-executor.d.ts +48 -0
- package/dist/distributed/execution/merge-exchange.d.ts +55 -0
- package/dist/distributed/optimizer/distributed-sort.d.ts +6 -0
- package/dist/distributed/optimizer/distribution-aware-join.d.ts +28 -0
- package/dist/distributed/optimizer/partial-aggregate.d.ts +9 -0
- package/dist/distributed/partition/partition-map.d.ts +27 -0
- package/dist/distributed/partition/partition-pruner.d.ts +33 -0
- package/dist/distributed/partition/partition-strategy.d.ts +43 -0
- package/dist/distributed/planner/distributed-planner.d.ts +71 -0
- package/dist/distributed/planner/exchange-placement.d.ts +19 -0
- package/dist/distributed/planner/expr-utils.d.ts +2 -0
- package/dist/distributed/planner/fragment.d.ts +47 -0
- package/dist/distributed/transport/chunk-codec.d.ts +18 -0
- package/dist/distributed/transport/http-transport.d.ts +49 -0
- package/dist/distributed/transport/transport.d.ts +13 -0
- package/dist/engine/query-engine.d.ts +142 -0
- package/dist/engine-entry.d.ts +12 -0
- package/dist/execution/builders/aggregate-builder.d.ts +46 -0
- package/dist/execution/builders/builder-utils.d.ts +5 -0
- package/dist/execution/builders/cte-builders.d.ts +20 -0
- package/dist/execution/builders/exchange-builders.d.ts +33 -0
- package/dist/execution/builders/join-builder.d.ts +67 -0
- package/dist/execution/builders/pipeline-builders.d.ts +30 -0
- package/dist/execution/builders/source-builders.d.ts +23 -0
- package/dist/execution/column-resolve.d.ts +7 -0
- package/dist/execution/execution-types.d.ts +33 -0
- package/dist/execution/expression-eval.d.ts +13 -0
- package/dist/execution/fragment-spec.d.ts +125 -0
- package/dist/execution/join-utils.d.ts +14 -0
- package/dist/execution/operator-registry.d.ts +9 -0
- package/dist/execution/operators/agg-wasm.d.ts +16 -0
- package/dist/execution/operators/dedup-core.d.ts +10 -0
- package/dist/execution/operators/dependent-join.d.ts +14 -0
- package/dist/execution/operators/distinct.d.ts +12 -0
- package/dist/execution/operators/filter.d.ts +87 -0
- package/dist/execution/operators/hash-aggregate.d.ts +121 -0
- package/dist/execution/operators/hash-join.d.ts +74 -0
- package/dist/execution/operators/index-scan.d.ts +34 -0
- package/dist/execution/operators/join-core.d.ts +47 -0
- package/dist/execution/operators/merge-join.d.ts +38 -0
- package/dist/execution/operators/nested-loop-join.d.ts +28 -0
- package/dist/execution/operators/projection.d.ts +20 -0
- package/dist/execution/operators/scan.d.ts +17 -0
- package/dist/execution/operators/sort.d.ts +48 -0
- package/dist/execution/operators/stream-aggregate.d.ts +30 -0
- package/dist/execution/operators/union.d.ts +13 -0
- package/dist/execution/operators/vector-aggregate.d.ts +73 -0
- package/dist/execution/operators/window.d.ts +22 -0
- package/dist/execution/physical-plan.d.ts +14 -0
- package/dist/execution/pipeline.d.ts +28 -0
- package/dist/execution/query-executor.d.ts +70 -0
- package/dist/execution/query-result.d.ts +15 -0
- package/dist/execution/result-sink.d.ts +26 -0
- package/dist/execution/scheduler.d.ts +8 -0
- package/dist/execution/vector-ops.d.ts +32 -0
- package/dist/execution/wasm-expr-eval.d.ts +7 -0
- package/dist/index.browser.js +17999 -0
- package/dist/index.cli.js +1002 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.node.js +21432 -0
- package/dist/optimizer/dphyp/cardinality.d.ts +69 -0
- package/dist/optimizer/dphyp/cost-model.d.ts +47 -0
- package/dist/optimizer/dphyp/dphyp.d.ts +32 -0
- package/dist/optimizer/dphyp/hypergraph.d.ts +38 -0
- package/dist/optimizer/optimizer.d.ts +12 -0
- package/dist/optimizer/pass.d.ts +5 -0
- package/dist/optimizer/passes/aggregate-pushdown.d.ts +6 -0
- package/dist/optimizer/passes/cte-optimization.d.ts +6 -0
- package/dist/optimizer/passes/empty-propagation.d.ts +6 -0
- package/dist/optimizer/passes/expr-walk.d.ts +20 -0
- package/dist/optimizer/passes/expression-simplifier.d.ts +8 -0
- package/dist/optimizer/passes/filter-ordering.d.ts +13 -0
- package/dist/optimizer/passes/having-pushdown.d.ts +6 -0
- package/dist/optimizer/passes/index-selection.d.ts +24 -0
- package/dist/optimizer/passes/join-elimination.d.ts +6 -0
- package/dist/optimizer/passes/join-reorder.d.ts +12 -0
- package/dist/optimizer/passes/join-residual-split.d.ts +6 -0
- package/dist/optimizer/passes/limit-pushdown.d.ts +6 -0
- package/dist/optimizer/passes/node-merge.d.ts +6 -0
- package/dist/optimizer/passes/outer-to-inner.d.ts +6 -0
- package/dist/optimizer/passes/physical-design.d.ts +12 -0
- package/dist/optimizer/passes/plan-refs.d.ts +22 -0
- package/dist/optimizer/passes/predicate-dedup.d.ts +6 -0
- package/dist/optimizer/passes/predicate-inference.d.ts +6 -0
- package/dist/optimizer/passes/predicate-pushdown.d.ts +9 -0
- package/dist/optimizer/passes/projection-pushdown.d.ts +6 -0
- package/dist/optimizer/passes/sort-elimination.d.ts +6 -0
- package/dist/optimizer/passes/subquery-unnesting.d.ts +6 -0
- package/dist/optimizer/passes/topn-fusion.d.ts +6 -0
- package/dist/parallel/chunk-transport.d.ts +24 -0
- package/dist/parallel/fragment-pool.d.ts +49 -0
- package/dist/parallel/fragment-worker.d.ts +1 -0
- package/dist/parallel/morsel-scheduler.d.ts +11 -0
- package/dist/parallel/parallel-dispatch.d.ts +69 -0
- package/dist/parallel/partial-spill.d.ts +3 -0
- package/dist/parallel/worker-messages.d.ts +243 -0
- package/dist/parallel/worker-pool.d.ts +62 -0
- package/dist/parallel/worker-thread.d.ts +1 -0
- package/dist/parser/ast.d.ts +298 -0
- package/dist/parser/lexer.d.ts +135 -0
- package/dist/parser/parser.d.ts +64 -0
- package/dist/planner/logical-plan.d.ts +250 -0
- package/dist/planner/logical-planner.d.ts +23 -0
- package/dist/planner/plan-formatter.d.ts +4 -0
- package/dist/planner/plan-visitor.d.ts +58 -0
- package/dist/runtime/platform.d.ts +4 -0
- package/dist/storage/backend/memory-storage-backend.d.ts +14 -0
- package/dist/storage/backend/node-storage-backend.d.ts +11 -0
- package/dist/storage/btree.d.ts +34 -0
- package/dist/storage/buffer-pool.d.ts +17 -0
- package/dist/storage/chunk.d.ts +26 -0
- package/dist/storage/column.d.ts +38 -0
- package/dist/storage/data-type.d.ts +54 -0
- package/dist/storage/dictionary-column.d.ts +33 -0
- package/dist/storage/page-store/file-page-store.d.ts +13 -0
- package/dist/storage/page-store/memory-page-store.d.ts +9 -0
- package/dist/storage/sab-arena.d.ts +26 -0
- package/dist/storage/serializer.d.ts +6 -0
- package/dist/storage/spill-manager/fs-storage.d.ts +11 -0
- package/dist/storage/spill-manager/memory-storage.d.ts +10 -0
- package/dist/storage/spill-manager/spill-manager.d.ts +17 -0
- package/dist/storage/storage-constants.d.ts +3 -0
- package/dist/storage/table.d.ts +31 -0
- package/dist/storage/temp-space/memory-temp-space.d.ts +11 -0
- package/dist/storage/temp-space/temp-directory-manager.d.ts +14 -0
- package/dist/utils/bitmap.d.ts +11 -0
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/lru-cache.d.ts +24 -0
- package/dist/utils/priority-queue.d.ts +18 -0
- package/dist/wasm/dispatch.d.ts +13 -0
- package/dist/wasm/fetch-byte-source.d.ts +2 -0
- package/dist/wasm/kernels/core-instance.d.ts +6 -0
- package/dist/wasm/kernels/kernel-factory.d.ts +8 -0
- package/dist/wasm/kernels/wasm-aggregate.d.ts +6 -0
- package/dist/wasm/kernels/wasm-arithmetic.d.ts +13 -0
- package/dist/wasm/kernels/wasm-filter-f64.d.ts +8 -0
- package/dist/wasm/kernels/wasm-filter.d.ts +5 -0
- package/dist/wasm/loader.d.ts +17 -0
- package/dist/wasm/node-byte-source.d.ts +1 -0
- package/dist/wasm/region-allocator.d.ts +23 -0
- package/dist/wasm/register-kernels.d.ts +1 -0
- package/dist/wasm/wasm-loader-base.d.ts +33 -0
- package/dist/wasm/wasm-types.d.ts +103 -0
- package/package.json +60 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const DEFAULT_CHUNK_SIZE = 2048;
|
|
2
|
+
export declare const Config: {
|
|
3
|
+
memoryLimit: number;
|
|
4
|
+
hashJoinPartitions: number;
|
|
5
|
+
flushBatchSize: number;
|
|
6
|
+
bufferPoolPages: number;
|
|
7
|
+
wasmMinChunkSize: number;
|
|
8
|
+
sinkQueueCapacity: number;
|
|
9
|
+
btreeOrder: number;
|
|
10
|
+
indexScanSelectivityThreshold: number;
|
|
11
|
+
dependentJoinConcurrency: number;
|
|
12
|
+
parallelWorkers: number;
|
|
13
|
+
parallelThreshold: number;
|
|
14
|
+
parallelAggThreshold: number;
|
|
15
|
+
aggMorselRows: number;
|
|
16
|
+
sabColumns: boolean;
|
|
17
|
+
sabArenaSegmentBytes: number;
|
|
18
|
+
parallelAggMemoryBytes: number;
|
|
19
|
+
parallelCombineMinGroups: number;
|
|
20
|
+
aggSpillGroups: number;
|
|
21
|
+
vectorGroupRange: number;
|
|
22
|
+
parallelJoinThreshold: number;
|
|
23
|
+
transportMaxBuffers: number;
|
|
24
|
+
aggRadixMultiplier: number;
|
|
25
|
+
regionSize: number;
|
|
26
|
+
morselSize: number;
|
|
27
|
+
clusterPort: number;
|
|
28
|
+
coordinatorSchemaSampleRows: number;
|
|
29
|
+
heartbeatIntervalMs: number;
|
|
30
|
+
heartbeatTimeoutMs: number;
|
|
31
|
+
defaultPartitionCount: number;
|
|
32
|
+
broadcastThreshold: number;
|
|
33
|
+
exchangeBatchSize: number;
|
|
34
|
+
exchangeBufferCapacity: number;
|
|
35
|
+
fragmentRetryLimit: number;
|
|
36
|
+
coordinatorTimeoutMs: number;
|
|
37
|
+
codecCompression: number;
|
|
38
|
+
distributedWorkers: number;
|
|
39
|
+
phiAccrualWindowSize: number;
|
|
40
|
+
phiAccrualThreshold: number;
|
|
41
|
+
networkCostPerByte: number;
|
|
42
|
+
};
|
package/dist/core.wasm
ADDED
|
Binary file
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { BoundExpr } from '../binder/expression-binder.js';
|
|
2
|
+
import { DataType } from '../storage/data-type.js';
|
|
3
|
+
import type { ColumnValue } from '../storage/data-type.js';
|
|
4
|
+
import type { CatalogLike } from '../binder/binder.js';
|
|
5
|
+
type LiteralInput = ColumnValue | Date | undefined;
|
|
6
|
+
type ColInput = Col | LiteralInput;
|
|
7
|
+
interface SchemaFieldLike {
|
|
8
|
+
tableAlias: string;
|
|
9
|
+
name: string;
|
|
10
|
+
index: number;
|
|
11
|
+
dataType: string | null;
|
|
12
|
+
}
|
|
13
|
+
interface SchemaLike {
|
|
14
|
+
fields: SchemaFieldLike[];
|
|
15
|
+
resolve(name: string, tableAlias: string | null): SchemaFieldLike;
|
|
16
|
+
}
|
|
17
|
+
interface BindContextLike {
|
|
18
|
+
catalog: CatalogLike;
|
|
19
|
+
functionRegistry: object;
|
|
20
|
+
}
|
|
21
|
+
type BuildFn = (schema: SchemaLike, ctx: BindContextLike) => BoundExpr;
|
|
22
|
+
type BinaryTypeFn = (left: DataType, right: DataType) => DataType;
|
|
23
|
+
interface ColBindResult {
|
|
24
|
+
expr: BoundExpr;
|
|
25
|
+
outputName: string | null;
|
|
26
|
+
dataType: string | null;
|
|
27
|
+
}
|
|
28
|
+
export declare class Col {
|
|
29
|
+
_build: BuildFn;
|
|
30
|
+
_name: string | null;
|
|
31
|
+
_alias: string | null;
|
|
32
|
+
constructor(buildFn: BuildFn, name?: string | null);
|
|
33
|
+
alias(name: string): Col;
|
|
34
|
+
as(name: string): Col;
|
|
35
|
+
bind(schema: SchemaLike, ctx: BindContextLike): ColBindResult;
|
|
36
|
+
_binary(op: string, other: ColInput, typeFn: BinaryTypeFn): Col;
|
|
37
|
+
add(other: ColInput): Col;
|
|
38
|
+
sub(other: ColInput): Col;
|
|
39
|
+
mul(other: ColInput): Col;
|
|
40
|
+
div(other: ColInput): Col;
|
|
41
|
+
eq(other: ColInput): Col;
|
|
42
|
+
ne(other: ColInput): Col;
|
|
43
|
+
lt(other: ColInput): Col;
|
|
44
|
+
le(other: ColInput): Col;
|
|
45
|
+
gt(other: ColInput): Col;
|
|
46
|
+
ge(other: ColInput): Col;
|
|
47
|
+
and(other: ColInput): Col;
|
|
48
|
+
or(other: ColInput): Col;
|
|
49
|
+
not(): Col;
|
|
50
|
+
isNull(): Col;
|
|
51
|
+
isNotNull(): Col;
|
|
52
|
+
like(pattern: string): Col;
|
|
53
|
+
between(low: ColInput, high: ColInput): Col;
|
|
54
|
+
isin(...values: ColInput[]): Col;
|
|
55
|
+
cast(targetType: DataType): Col;
|
|
56
|
+
}
|
|
57
|
+
export declare function toCol(value: ColInput): Col;
|
|
58
|
+
export declare function col(spec: string): Col;
|
|
59
|
+
export declare function lit(value: LiteralInput): Col;
|
|
60
|
+
export declare function expr(sqlString: string): Col;
|
|
61
|
+
export declare const sum: (column: Col | string) => Col;
|
|
62
|
+
export declare const avg: (column: Col | string) => Col;
|
|
63
|
+
export declare const min: (column: Col | string) => Col;
|
|
64
|
+
export declare const max: (column: Col | string) => Col;
|
|
65
|
+
export declare const count: (column: Col | string) => Col;
|
|
66
|
+
export declare function countStar(): Col;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { LogicalPlanNode } from '../planner/logical-plan.js';
|
|
2
|
+
import type { BoundExpr } from '../binder/expression-binder.js';
|
|
3
|
+
import { DataType } from '../storage/data-type.js';
|
|
4
|
+
import type { ColumnValue } from '../storage/data-type.js';
|
|
5
|
+
import type { DataChunk } from '../storage/chunk.js';
|
|
6
|
+
import { DFSchema } from './schema.js';
|
|
7
|
+
import { Col } from './column-expr.js';
|
|
8
|
+
import type { CatalogLike } from '../binder/binder.js';
|
|
9
|
+
import type { Catalog } from '../catalog/catalog.js';
|
|
10
|
+
import type { defaultFunctionRegistry } from '../catalog/function-registry.js';
|
|
11
|
+
type FunctionRegistry = typeof defaultFunctionRegistry;
|
|
12
|
+
type CteMap = Map<string, LogicalPlanNode>;
|
|
13
|
+
interface BindContext {
|
|
14
|
+
catalog: CatalogLike;
|
|
15
|
+
functionRegistry: FunctionRegistry;
|
|
16
|
+
}
|
|
17
|
+
interface BoundColumn {
|
|
18
|
+
expr: BoundExpr;
|
|
19
|
+
outputName: string | null;
|
|
20
|
+
dataType: string | null;
|
|
21
|
+
}
|
|
22
|
+
interface OutputColumnLike {
|
|
23
|
+
name: string;
|
|
24
|
+
expr: BoundExpr | null;
|
|
25
|
+
dataType: DataType | string | null;
|
|
26
|
+
}
|
|
27
|
+
interface ResultLike {
|
|
28
|
+
toArray(): Promise<Record<string, ColumnValue>[]>;
|
|
29
|
+
chunks(): AsyncGenerator<DataChunk>;
|
|
30
|
+
}
|
|
31
|
+
interface SqlFrameLike {
|
|
32
|
+
name: string;
|
|
33
|
+
columns: {
|
|
34
|
+
name: string;
|
|
35
|
+
dataType: DataType;
|
|
36
|
+
}[];
|
|
37
|
+
plan: LogicalPlanNode;
|
|
38
|
+
cteMap: CteMap | null;
|
|
39
|
+
}
|
|
40
|
+
interface EngineLike {
|
|
41
|
+
catalog: Catalog;
|
|
42
|
+
functionRegistry: FunctionRegistry;
|
|
43
|
+
sql(sqlString: string, options: {
|
|
44
|
+
frames: SqlFrameLike[];
|
|
45
|
+
}): DataFrame;
|
|
46
|
+
_nextDfId(): number;
|
|
47
|
+
_runPlan(plan: LogicalPlanNode, outputColumns: OutputColumnLike[], streaming: boolean, cteMap: CteMap | null): Promise<ResultLike>;
|
|
48
|
+
}
|
|
49
|
+
interface OrderByDescriptor {
|
|
50
|
+
col: Col | string;
|
|
51
|
+
desc?: boolean;
|
|
52
|
+
}
|
|
53
|
+
type OrderBySpec = OrderByDescriptor | Col | string;
|
|
54
|
+
export declare class DataFrame {
|
|
55
|
+
_engine: EngineLike;
|
|
56
|
+
_plan: LogicalPlanNode;
|
|
57
|
+
_schema: DFSchema;
|
|
58
|
+
_cteMap: CteMap | null;
|
|
59
|
+
constructor(engine: EngineLike, plan: LogicalPlanNode, schema: DFSchema, cteMap?: CteMap | null);
|
|
60
|
+
_ctx(): BindContext;
|
|
61
|
+
_derive(plan: LogicalPlanNode, schema: DFSchema, extraCteMap?: CteMap | null): DataFrame;
|
|
62
|
+
columns(): string[];
|
|
63
|
+
schema(): DFSchema;
|
|
64
|
+
explain(): string;
|
|
65
|
+
sql(sqlString: string): DataFrame;
|
|
66
|
+
select(...items: (Col | string)[]): DataFrame;
|
|
67
|
+
filter(condition: Col | string): DataFrame;
|
|
68
|
+
where(condition: Col | string): DataFrame;
|
|
69
|
+
withColumn(name: string, column: Col | string): DataFrame;
|
|
70
|
+
drop(...names: string[]): DataFrame;
|
|
71
|
+
groupBy(...items: (Col | string)[]): GroupedData;
|
|
72
|
+
orderBy(...specs: OrderBySpec[]): DataFrame;
|
|
73
|
+
sort(...specs: OrderBySpec[]): DataFrame;
|
|
74
|
+
limit(count: number, offset?: number): DataFrame;
|
|
75
|
+
distinct(): DataFrame;
|
|
76
|
+
union(other: DataFrame): DataFrame;
|
|
77
|
+
unionAll(other: DataFrame): DataFrame;
|
|
78
|
+
_union(other: DataFrame, all: boolean): DataFrame;
|
|
79
|
+
join(other: DataFrame, on: string | string[], joinType?: string): DataFrame;
|
|
80
|
+
_outputColumns(): OutputColumnLike[];
|
|
81
|
+
collect(): Promise<Record<string, ColumnValue>[]>;
|
|
82
|
+
toArray(): Promise<Record<string, ColumnValue>[]>;
|
|
83
|
+
count(): Promise<number>;
|
|
84
|
+
chunks(): AsyncGenerator<DataChunk>;
|
|
85
|
+
show(n?: number): Promise<string>;
|
|
86
|
+
}
|
|
87
|
+
export declare class GroupedData {
|
|
88
|
+
_engine: EngineLike;
|
|
89
|
+
_childPlan: LogicalPlanNode;
|
|
90
|
+
_childSchema: DFSchema;
|
|
91
|
+
_groupBounds: BoundColumn[];
|
|
92
|
+
_cteMap: CteMap | null;
|
|
93
|
+
constructor(engine: EngineLike, childPlan: LogicalPlanNode, childSchema: DFSchema, groupBounds: BoundColumn[], cteMap: CteMap | null);
|
|
94
|
+
agg(...aggColumns: Col[]): DataFrame;
|
|
95
|
+
}
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DataType } from '../storage/data-type.js';
|
|
2
|
+
export declare function inferArithmeticType(left: DataType, right: DataType): DataType;
|
|
3
|
+
export declare function inferComparisonType(): DataType;
|
|
4
|
+
export declare function inferLogicalType(): DataType;
|
|
5
|
+
export declare function inferConcatType(): DataType;
|
|
6
|
+
export declare function inferAggregateResultType(name: string, argType?: DataType): DataType;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DataChunk } from '../storage/chunk.js';
|
|
2
|
+
import type { ColumnSchema, ColumnValue } from '../storage/data-type.js';
|
|
3
|
+
type RowInput = Record<string, ColumnValue> | ColumnValue[];
|
|
4
|
+
type ColumnsInput = Record<string, ColumnValue[]>;
|
|
5
|
+
export declare class InMemoryRelation {
|
|
6
|
+
schema: ColumnSchema[];
|
|
7
|
+
chunks: DataChunk[];
|
|
8
|
+
_rowCount: number;
|
|
9
|
+
constructor(schema: ColumnSchema[], chunks: DataChunk[]);
|
|
10
|
+
getSchema(): ColumnSchema[];
|
|
11
|
+
rowCount(): number;
|
|
12
|
+
getColumnIndex(name: string): number;
|
|
13
|
+
scan(): AsyncGenerator<DataChunk, void, void>;
|
|
14
|
+
static fromRows(rows: RowInput[], declaredSchema?: ColumnSchema[] | null): InMemoryRelation;
|
|
15
|
+
static fromColumns(columns: ColumnsInput, declaredSchema?: ColumnSchema[] | null): InMemoryRelation;
|
|
16
|
+
static builder(declaredSchema?: ColumnSchema[] | null): RelationBuilder;
|
|
17
|
+
}
|
|
18
|
+
export declare class RelationBuilder {
|
|
19
|
+
_declaredSchema: ColumnSchema[] | null;
|
|
20
|
+
schema: ColumnSchema[] | null;
|
|
21
|
+
_names: string[] | null;
|
|
22
|
+
_extractByIndex: boolean;
|
|
23
|
+
_chunks: DataChunk[];
|
|
24
|
+
_chunk: DataChunk | null;
|
|
25
|
+
_finished: boolean;
|
|
26
|
+
constructor(declaredSchema?: ColumnSchema[] | null);
|
|
27
|
+
_initFrom(rows: RowInput[]): void;
|
|
28
|
+
appendRows(rows: RowInput[]): this;
|
|
29
|
+
finish(): InMemoryRelation;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { DataFrame, GroupedData } from './dataframe.js';
|
|
2
|
+
export { Col, col, lit, expr, sum, avg, min, max, count, countStar } from './column-expr.js';
|
|
3
|
+
export { DFSchema, DFField, UnknownColumnError, AmbiguousColumnError } from './schema.js';
|
|
4
|
+
export { InMemoryRelation } from './in-memory-relation.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DataType, ColumnSchema } from '../storage/data-type.js';
|
|
2
|
+
interface FieldLike {
|
|
3
|
+
name: string;
|
|
4
|
+
dataType: DataType;
|
|
5
|
+
tableAlias?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class UnknownColumnError extends Error {
|
|
8
|
+
}
|
|
9
|
+
export declare class AmbiguousColumnError extends Error {
|
|
10
|
+
}
|
|
11
|
+
export declare class DFField {
|
|
12
|
+
name: string;
|
|
13
|
+
dataType: DataType;
|
|
14
|
+
index: number;
|
|
15
|
+
tableAlias: string;
|
|
16
|
+
constructor(name: string, dataType: DataType, index: number, tableAlias?: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class DFSchema {
|
|
19
|
+
_fields: DFField[];
|
|
20
|
+
constructor(fields: DFField[]);
|
|
21
|
+
static fromStorageSchema(storageSchema: ColumnSchema[], alias?: string): DFSchema;
|
|
22
|
+
static fromFields(fields: FieldLike[]): DFSchema;
|
|
23
|
+
get fields(): DFField[];
|
|
24
|
+
get length(): number;
|
|
25
|
+
field(i: number): DFField;
|
|
26
|
+
names(): string[];
|
|
27
|
+
resolve(name: string, tableAlias?: string | null): DFField;
|
|
28
|
+
has(name: string, tableAlias?: string | null): boolean;
|
|
29
|
+
project(fields: FieldLike[]): DFSchema;
|
|
30
|
+
drop(names: string[]): DFSchema;
|
|
31
|
+
append(other: DFSchema): DFSchema;
|
|
32
|
+
requalify(alias: string): DFSchema;
|
|
33
|
+
static aggregateOutput(groupFields: DFField[], aggFields: DFField[]): DFSchema;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CatalogLike } from '../binder/binder.js';
|
|
2
|
+
import type { BoundExpr } from '../binder/expression-binder.js';
|
|
3
|
+
interface SchemaFieldLike {
|
|
4
|
+
name: string;
|
|
5
|
+
dataType: string | null;
|
|
6
|
+
tableAlias?: string | null;
|
|
7
|
+
}
|
|
8
|
+
interface SchemaLike {
|
|
9
|
+
fields: SchemaFieldLike[];
|
|
10
|
+
}
|
|
11
|
+
interface ScalarBindResult {
|
|
12
|
+
expr: BoundExpr;
|
|
13
|
+
dataType: string | null;
|
|
14
|
+
outputName: string | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function bindScalarSql(sqlString: string, schema: SchemaLike, catalog: CatalogLike, functionRegistry: object): ScalarBindResult;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataType } from '../storage/data-type.js';
|
|
2
|
+
import type { ColumnValue } from '../storage/data-type.js';
|
|
3
|
+
type InferableValue = ColumnValue | Date | undefined;
|
|
4
|
+
export declare function inferValueType(value: InferableValue): DataType | null;
|
|
5
|
+
export declare function reconcileTypes(a: DataType | null, b: DataType | null): DataType | null;
|
|
6
|
+
export declare function inferColumnType(values: Iterable<InferableValue>): DataType;
|
|
7
|
+
export declare function coerceForColumn(value: InferableValue, dataType: DataType): ColumnValue;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { NodeStatus } from './node-descriptor.js';
|
|
2
|
+
import type { NodeRoleValue } from './node-descriptor.js';
|
|
3
|
+
import { HeartbeatMonitor } from './heartbeat-monitor.js';
|
|
4
|
+
import type { NodeId, PartitionId, NodeCapacity, NodeDescriptorJSON, ClusterSnapshot } from '../distributed-types.js';
|
|
5
|
+
type NodeStatusValue = (typeof NodeStatus)[keyof typeof NodeStatus];
|
|
6
|
+
interface NodeDescriptorLike {
|
|
7
|
+
nodeId: NodeId;
|
|
8
|
+
host: string;
|
|
9
|
+
port: number;
|
|
10
|
+
role: NodeRoleValue;
|
|
11
|
+
capacity: NodeCapacity;
|
|
12
|
+
status: NodeStatusValue;
|
|
13
|
+
canExecuteFragments(): boolean;
|
|
14
|
+
hasPartition(partitionId: string | PartitionId): boolean;
|
|
15
|
+
assignPartition(partitionId: string | PartitionId): void;
|
|
16
|
+
toJSON(): NodeDescriptorJSON;
|
|
17
|
+
}
|
|
18
|
+
interface PartitionAssignmentLive {
|
|
19
|
+
node: NodeDescriptorLike;
|
|
20
|
+
partitionIds: PartitionId[];
|
|
21
|
+
}
|
|
22
|
+
interface ClusterManagerOptions {
|
|
23
|
+
phiWindowSize?: number;
|
|
24
|
+
phiThreshold?: number;
|
|
25
|
+
heartbeatIntervalMs?: number;
|
|
26
|
+
}
|
|
27
|
+
type NodeFailureCallbackLive = (node: NodeDescriptorLike) => void;
|
|
28
|
+
type NodeJoinCallbackLive = (descriptor: NodeDescriptorLike) => void;
|
|
29
|
+
export declare class ClusterManager {
|
|
30
|
+
_localNode: NodeDescriptorLike;
|
|
31
|
+
_nodeMap: Map<NodeId, NodeDescriptorLike>;
|
|
32
|
+
_failureCallbacks: NodeFailureCallbackLive[];
|
|
33
|
+
_joinCallbacks: NodeJoinCallbackLive[];
|
|
34
|
+
_heartbeat: HeartbeatMonitor;
|
|
35
|
+
constructor(localNode: NodeDescriptorLike, options?: ClusterManagerOptions);
|
|
36
|
+
get localNode(): NodeDescriptorLike;
|
|
37
|
+
get nodeCount(): number;
|
|
38
|
+
addNode(descriptor: NodeDescriptorLike): NodeDescriptorLike;
|
|
39
|
+
removeNode(nodeId: NodeId): boolean;
|
|
40
|
+
getNode(nodeId: NodeId): NodeDescriptorLike | null;
|
|
41
|
+
getAliveNodes(): NodeDescriptorLike[];
|
|
42
|
+
getWorkerNodes(): NodeDescriptorLike[];
|
|
43
|
+
getNodesForPartitions(partitionIds: PartitionId[]): Map<PartitionId, NodeDescriptorLike>;
|
|
44
|
+
getNodesByPartition(tableName: string, partitionIds: PartitionId[]): Map<NodeId, PartitionAssignmentLive>;
|
|
45
|
+
recordHeartbeat(nodeId: NodeId, timestamp: number): void;
|
|
46
|
+
onNodeFailure(callback: NodeFailureCallbackLive): void;
|
|
47
|
+
onNodeJoin(callback: NodeJoinCallbackLive): void;
|
|
48
|
+
startMonitoring(): void;
|
|
49
|
+
stopMonitoring(): void;
|
|
50
|
+
_handleStatusChange(nodeId: NodeId, newStatus: NodeStatusValue): void;
|
|
51
|
+
assignPartition(nodeId: NodeId, partitionKey: string | PartitionId): void;
|
|
52
|
+
snapshot(): ClusterSnapshot;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { NodeId, NodeStatus as NodeStatusType, NodeStatusChange } from '../distributed-types.js';
|
|
2
|
+
export interface HeartbeatMonitorOptions {
|
|
3
|
+
windowSize?: number;
|
|
4
|
+
threshold?: number;
|
|
5
|
+
intervalMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export type HeartbeatSendFn = () => void;
|
|
8
|
+
export declare class HeartbeatMonitor {
|
|
9
|
+
private _windowSize;
|
|
10
|
+
private _threshold;
|
|
11
|
+
private _interval;
|
|
12
|
+
private _windows;
|
|
13
|
+
private _timer;
|
|
14
|
+
private _sendFn;
|
|
15
|
+
private _statusCallback;
|
|
16
|
+
constructor(options?: HeartbeatMonitorOptions);
|
|
17
|
+
onSend(fn: HeartbeatSendFn): void;
|
|
18
|
+
onStatusChange(callback: NodeStatusChange): void;
|
|
19
|
+
start(): void;
|
|
20
|
+
stop(): void;
|
|
21
|
+
recordHeartbeat(nodeId: NodeId, timestamp: number): void;
|
|
22
|
+
phi(nodeId: NodeId, now: number): number;
|
|
23
|
+
getStatus(nodeId: NodeId, now: number): NodeStatusType;
|
|
24
|
+
removeNode(nodeId: NodeId): void;
|
|
25
|
+
_tick(): void;
|
|
26
|
+
_evaluateAll(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { NodeId, NodeCapacity, NodeDescriptorJSON } from '../distributed-types.js';
|
|
2
|
+
export declare const NodeRole: {
|
|
3
|
+
readonly COORDINATOR: "coordinator";
|
|
4
|
+
readonly WORKER: "worker";
|
|
5
|
+
readonly HYBRID: "hybrid";
|
|
6
|
+
};
|
|
7
|
+
export type NodeRoleValue = (typeof NodeRole)[keyof typeof NodeRole];
|
|
8
|
+
export declare const NodeStatus: {
|
|
9
|
+
readonly ALIVE: "alive";
|
|
10
|
+
readonly SUSPECT: "suspect";
|
|
11
|
+
readonly DEAD: "dead";
|
|
12
|
+
};
|
|
13
|
+
export type NodeStatusValue = (typeof NodeStatus)[keyof typeof NodeStatus];
|
|
14
|
+
export interface NodeDescriptorParams {
|
|
15
|
+
nodeId: NodeId;
|
|
16
|
+
host: string;
|
|
17
|
+
port: number;
|
|
18
|
+
role?: NodeRoleValue;
|
|
19
|
+
capacity?: NodeCapacity;
|
|
20
|
+
status?: NodeStatusValue;
|
|
21
|
+
partitions?: string[];
|
|
22
|
+
}
|
|
23
|
+
export declare class NodeDescriptor {
|
|
24
|
+
nodeId: NodeId;
|
|
25
|
+
host: string;
|
|
26
|
+
port: number;
|
|
27
|
+
role: NodeRoleValue;
|
|
28
|
+
capacity: NodeCapacity;
|
|
29
|
+
status: NodeStatusValue;
|
|
30
|
+
partitions: Set<string>;
|
|
31
|
+
constructor({ nodeId, host, port, role, capacity, status }: NodeDescriptorParams);
|
|
32
|
+
get address(): string;
|
|
33
|
+
isAlive(): boolean;
|
|
34
|
+
canExecuteFragments(): boolean;
|
|
35
|
+
canCoordinate(): boolean;
|
|
36
|
+
assignPartition(partitionId: string): void;
|
|
37
|
+
removePartition(partitionId: string): void;
|
|
38
|
+
hasPartition(partitionId: string): boolean;
|
|
39
|
+
toJSON(): NodeDescriptorJSON;
|
|
40
|
+
static fromJSON(json: NodeDescriptorJSON): NodeDescriptor;
|
|
41
|
+
}
|