@loaders.gl/scan 5.0.0-alpha.3
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/LICENSE +52 -0
- package/README.md +219 -0
- package/dist/delta.cjs +24246 -0
- package/dist/delta.cjs.map +6 -0
- package/dist/delta.d.ts +11 -0
- package/dist/delta.d.ts.map +1 -0
- package/dist/delta.js +12 -0
- package/dist/delta.js.map +1 -0
- package/dist/dist.min.js +18475 -0
- package/dist/federated-table-scan-source.d.ts +116 -0
- package/dist/federated-table-scan-source.d.ts.map +1 -0
- package/dist/federated-table-scan-source.js +691 -0
- package/dist/federated-table-scan-source.js.map +1 -0
- package/dist/hudi.cjs +24065 -0
- package/dist/hudi.cjs.map +6 -0
- package/dist/hudi.d.ts +54 -0
- package/dist/hudi.d.ts.map +1 -0
- package/dist/hudi.js +124 -0
- package/dist/hudi.js.map +1 -0
- package/dist/iceberg.cjs +25862 -0
- package/dist/iceberg.cjs.map +6 -0
- package/dist/iceberg.d.ts +12 -0
- package/dist/iceberg.d.ts.map +1 -0
- package/dist/iceberg.js +12 -0
- package/dist/iceberg.js.map +1 -0
- package/dist/index.cjs +3485 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/scan-engine.d.ts +44 -0
- package/dist/scan-engine.d.ts.map +1 -0
- package/dist/scan-engine.js +49 -0
- package/dist/scan-engine.js.map +1 -0
- package/dist/scan-query.d.ts +24 -0
- package/dist/scan-query.d.ts.map +1 -0
- package/dist/scan-query.js +5 -0
- package/dist/scan-query.js.map +1 -0
- package/dist/vector-table-scan-source.d.ts +90 -0
- package/dist/vector-table-scan-source.d.ts.map +1 -0
- package/dist/vector-table-scan-source.js +215 -0
- package/dist/vector-table-scan-source.js.map +1 -0
- package/package.json +66 -0
- package/src/delta.ts +18 -0
- package/src/federated-table-scan-source.ts +991 -0
- package/src/hudi.ts +200 -0
- package/src/iceberg.ts +36 -0
- package/src/index.ts +97 -0
- package/src/scan-engine.ts +96 -0
- package/src/scan-query.ts +27 -0
- package/src/vector-table-scan-source.ts +294 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type DataSourceManager, type ScanQueryMetadata, type ScanQueryMetadataOptions, type TableQueryCapabilities, type TableQueryExplain, type TableScanReadOptions, type TableScanSource } from '@loaders.gl/loader-utils';
|
|
2
|
+
import type { ArrowTableBatch, DataType, Schema } from '@loaders.gl/schema';
|
|
3
|
+
import { type SQLPredicate } from '@loaders.gl/sql';
|
|
4
|
+
/** Schema reconciliation modes supported by ordered append federation. */
|
|
5
|
+
export type FederatedTableSchemaPolicy = 'strict' | 'union';
|
|
6
|
+
/** One named table source participating in an ordered federated append. */
|
|
7
|
+
export type FederatedTableSourceEntry = Readonly<{
|
|
8
|
+
/** Stable id resolved through the shared {@link DataSourceManager}. */
|
|
9
|
+
dataSourceId: string;
|
|
10
|
+
/** Source-local predicate, projection, and limit applied before schema reconciliation. */
|
|
11
|
+
query?: Omit<TableScanReadOptions<SQLPredicate>, 'signal' | 'onTelemetry'>;
|
|
12
|
+
/** Source-column to federated-column renames applied before compatibility checks. */
|
|
13
|
+
columnMapping?: Readonly<Record<string, string>>;
|
|
14
|
+
}>;
|
|
15
|
+
/** Options for an ordered federated table source. */
|
|
16
|
+
export type FederatedTableScanSourceOptions = Readonly<{
|
|
17
|
+
/** Named sources appended in caller-specified order. */
|
|
18
|
+
sources: readonly FederatedTableSourceEntry[];
|
|
19
|
+
/** Strict requires matching columns; union null-fills missing columns. Defaults to strict. */
|
|
20
|
+
schemaPolicy?: FederatedTableSchemaPolicy;
|
|
21
|
+
/** Explicit federated schema used to validate, order, and safely normalize physical columns. */
|
|
22
|
+
outputSchema?: Schema;
|
|
23
|
+
/** Optional display name reported through scan metadata. */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** Optional description reported through scan metadata. */
|
|
26
|
+
description?: string;
|
|
27
|
+
}>;
|
|
28
|
+
/** Provenance attached to every federated Arrow batch. */
|
|
29
|
+
export type FederatedTableBatchProvenance = Readonly<{
|
|
30
|
+
/** Manager id of the source that emitted this batch. */
|
|
31
|
+
sourceId: string;
|
|
32
|
+
/** Zero-based source position in append order. */
|
|
33
|
+
sourceIndex: number;
|
|
34
|
+
/** Zero-based data-batch position within the source. */
|
|
35
|
+
sourceBatchIndex: number;
|
|
36
|
+
/** Original batch metadata supplied by the physical source. */
|
|
37
|
+
sourceMetadata?: unknown;
|
|
38
|
+
}>;
|
|
39
|
+
/** Arrow batch emitted by an ordered federated scan. */
|
|
40
|
+
export type FederatedTableBatch = ArrowTableBatch<FederatedTableBatchProvenance> & Readonly<{
|
|
41
|
+
/** Manager id of the source that emitted this batch. */
|
|
42
|
+
sourceId: string;
|
|
43
|
+
/** Zero-based source position in append order. */
|
|
44
|
+
sourceIndex: number;
|
|
45
|
+
/** Zero-based data-batch position within the source. */
|
|
46
|
+
sourceBatchIndex: number;
|
|
47
|
+
}>;
|
|
48
|
+
/** Per-source diagnostics included in a federated explanation. */
|
|
49
|
+
export type FederatedTableSourceExplain = Readonly<{
|
|
50
|
+
/** Manager id resolved for this source. */
|
|
51
|
+
sourceId: string;
|
|
52
|
+
/** Zero-based source position in append order. */
|
|
53
|
+
sourceIndex: number;
|
|
54
|
+
/** Physical source type reported by metadata discovery. */
|
|
55
|
+
sourceType: string;
|
|
56
|
+
/** Source columns visible after the source-local projection. */
|
|
57
|
+
sourceColumns: readonly string[];
|
|
58
|
+
/** Federated column names produced after explicit mappings. */
|
|
59
|
+
outputColumns: readonly string[];
|
|
60
|
+
/** Explicit source-column to federated-column mappings. */
|
|
61
|
+
columnMapping: Readonly<Record<string, string>>;
|
|
62
|
+
/** Output types that require an explicit lossless normalization for this source. */
|
|
63
|
+
normalizedTypes: Readonly<Record<string, DataType>>;
|
|
64
|
+
}>;
|
|
65
|
+
/** Serializable logical explanation for an ordered federated table scan. */
|
|
66
|
+
export type FederatedTableScanExplain = TableQueryExplain<SQLPredicate> & Readonly<{
|
|
67
|
+
/** Schema policy used to reconcile child sources. */
|
|
68
|
+
schemaPolicy: FederatedTableSchemaPolicy;
|
|
69
|
+
/** Sources in physical append order. */
|
|
70
|
+
sources: readonly FederatedTableSourceExplain[];
|
|
71
|
+
}>;
|
|
72
|
+
/** Correctness capabilities of the federated append executor. */
|
|
73
|
+
export declare const FEDERATED_TABLE_QUERY_CAPABILITIES: TableQueryCapabilities;
|
|
74
|
+
/**
|
|
75
|
+
* Resolves managed table sources and appends their results as one ordered Arrow stream.
|
|
76
|
+
*
|
|
77
|
+
* `DataSourceManager` remains the single registry and lifecycle owner. This adapter subscribes for
|
|
78
|
+
* the duration of metadata discovery or iteration, so deferred and non-persistent sources use the
|
|
79
|
+
* same replacement, retention, and cleanup system as the rest of loaders.gl.
|
|
80
|
+
*/
|
|
81
|
+
export declare class FederatedTableScanSource implements TableScanSource<FederatedTableBatch, SQLPredicate> {
|
|
82
|
+
/** Shared manager used as the authoritative named-source registry. */
|
|
83
|
+
readonly dataSourceManager: DataSourceManager;
|
|
84
|
+
/** Immutable sources in physical append order. */
|
|
85
|
+
readonly sources: readonly FederatedTableSourceEntry[];
|
|
86
|
+
/** Schema reconciliation policy. */
|
|
87
|
+
readonly schemaPolicy: FederatedTableSchemaPolicy;
|
|
88
|
+
/** Optional caller-declared normalized output schema. */
|
|
89
|
+
readonly outputSchema?: Schema;
|
|
90
|
+
/** Optional display name reported through scan metadata. */
|
|
91
|
+
readonly name?: string;
|
|
92
|
+
/** Human-readable description reported through scan metadata. */
|
|
93
|
+
readonly description: string;
|
|
94
|
+
/** Stable id used to isolate this adapter's manager subscriptions. */
|
|
95
|
+
private readonly instanceId;
|
|
96
|
+
/** Monotonic id used to isolate overlapping operations on this adapter. */
|
|
97
|
+
private nextOperationId;
|
|
98
|
+
/** Creates an ordered federated source backed by one shared DataSourceManager. */
|
|
99
|
+
constructor(dataSourceManager: DataSourceManager, options: FederatedTableScanSourceOptions);
|
|
100
|
+
/** Discovers and reconciles every child schema without reading federated result batches. */
|
|
101
|
+
getQueryMetadata(options?: ScanQueryMetadataOptions): Promise<ScanQueryMetadata>;
|
|
102
|
+
/** Explains source resolution, schema reconciliation, and the global table query. */
|
|
103
|
+
explain(options?: TableScanReadOptions<SQLPredicate>): Promise<FederatedTableScanExplain>;
|
|
104
|
+
/**
|
|
105
|
+
* Emits source and batch ordered Arrow results with one global limit and batch provenance.
|
|
106
|
+
*
|
|
107
|
+
* Returning early from the iterator closes the active child iterator and releases every manager
|
|
108
|
+
* subscription. Later sources are never read once the global limit has been satisfied.
|
|
109
|
+
*/
|
|
110
|
+
read(options?: TableScanReadOptions<SQLPredicate>): AsyncIterableIterator<FederatedTableBatch>;
|
|
111
|
+
/** Resolves managed sources, discovers their schemas, and creates one compatibility plan. */
|
|
112
|
+
private resolvePlan;
|
|
113
|
+
/** Returns a collision-free manager consumer id for one operation. */
|
|
114
|
+
private createConsumerId;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=federated-table-scan-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federated-table-scan-source.d.ts","sourceRoot":"","sources":["../src/federated-table-scan-source.ts"],"names":[],"mappings":"AAKA,OAAO,EAML,KAAK,iBAAiB,EAEtB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAI7B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAEV,eAAe,EACf,QAAQ,EAER,MAAM,EAEP,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAkB,KAAK,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAEnE,0EAA0E;AAC1E,MAAM,MAAM,0BAA0B,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5D,2EAA2E;AAC3E,MAAM,MAAM,yBAAyB,GAAG,QAA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