@loaders.gl/scan 5.0.0-alpha.6 → 5.0.0-alpha.7
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/delta.cjs +63 -23
- package/dist/delta.cjs.map +2 -2
- package/dist/dist.min.js +34 -12
- package/dist/hudi.cjs +63 -23
- package/dist/hudi.cjs.map +2 -2
- package/dist/iceberg.cjs +63 -23
- package/dist/iceberg.cjs.map +2 -2
- package/dist/index.cjs +29 -12
- package/dist/index.cjs.map +1 -1
- package/package.json +8 -8
package/dist/delta.cjs
CHANGED
|
@@ -593,6 +593,7 @@ var init_worker_pool = __esm({
|
|
|
593
593
|
props = {};
|
|
594
594
|
jobQueue = [];
|
|
595
595
|
idleQueue = [];
|
|
596
|
+
activeJobs = /* @__PURE__ */ new Set();
|
|
596
597
|
count = 0;
|
|
597
598
|
isDestroyed = false;
|
|
598
599
|
/** Checks if workers are supported on this platform */
|
|
@@ -611,10 +612,14 @@ var init_worker_pool = __esm({
|
|
|
611
612
|
this.setProps(props);
|
|
612
613
|
}
|
|
613
614
|
/**
|
|
614
|
-
* Terminates all workers in the pool
|
|
615
|
+
* Terminates all workers in the pool and aborts active jobs.
|
|
616
|
+
* @param reason Optional error delivered to active jobs.
|
|
615
617
|
* @note Can free up significant memory
|
|
616
618
|
*/
|
|
617
|
-
destroy() {
|
|
619
|
+
destroy(reason = new Error("Worker pool was destroyed")) {
|
|
620
|
+
this.activeJobs.forEach((job) => job.abort(reason));
|
|
621
|
+
const queuedJobs = this.jobQueue.splice(0);
|
|
622
|
+
queuedJobs.forEach((queuedJob) => queuedJob.onReject(reason));
|
|
618
623
|
this.idleQueue.forEach((worker) => worker.destroy());
|
|
619
624
|
this.isDestroyed = true;
|
|
620
625
|
}
|
|
@@ -637,8 +642,11 @@ var init_worker_pool = __esm({
|
|
|
637
642
|
}
|
|
638
643
|
}
|
|
639
644
|
async startJob(name, onMessage2 = (job, type, data) => job.done(data), onError = (job, error) => job.error(error)) {
|
|
640
|
-
|
|
641
|
-
|
|
645
|
+
if (this.isDestroyed) {
|
|
646
|
+
return Promise.reject(new Error("Worker pool was destroyed"));
|
|
647
|
+
}
|
|
648
|
+
const startPromise = new Promise((onStart, onReject) => {
|
|
649
|
+
this.jobQueue.push({ name, onMessage: onMessage2, onError, onStart, onReject });
|
|
642
650
|
return this;
|
|
643
651
|
});
|
|
644
652
|
this._startQueuedJob();
|
|
@@ -666,6 +674,7 @@ var init_worker_pool = __esm({
|
|
|
666
674
|
backlog: this.jobQueue.length
|
|
667
675
|
});
|
|
668
676
|
const job = new WorkerJob(queuedJob.name, workerThread);
|
|
677
|
+
this.activeJobs.add(job);
|
|
669
678
|
workerThread.ref();
|
|
670
679
|
workerThread.onMessage = (data) => queuedJob.onMessage(job, data.type, data.payload);
|
|
671
680
|
workerThread.onError = (error) => queuedJob.onError(job, error);
|
|
@@ -674,6 +683,7 @@ var init_worker_pool = __esm({
|
|
|
674
683
|
await job.result;
|
|
675
684
|
} catch {
|
|
676
685
|
} finally {
|
|
686
|
+
this.activeJobs.delete(job);
|
|
677
687
|
this.returnWorkerToQueue(workerThread);
|
|
678
688
|
}
|
|
679
689
|
}
|
|
@@ -787,12 +797,13 @@ var init_worker_farm = __esm({
|
|
|
787
797
|
this.workerPools = /* @__PURE__ */ new Map();
|
|
788
798
|
}
|
|
789
799
|
/**
|
|
790
|
-
* Terminate all workers in the farm
|
|
800
|
+
* Terminate all workers in the farm and abort active jobs.
|
|
801
|
+
* @param reason Optional error delivered to active jobs.
|
|
791
802
|
* @note Can free up significant memory
|
|
792
803
|
*/
|
|
793
|
-
destroy() {
|
|
804
|
+
destroy(reason) {
|
|
794
805
|
for (const workerPool of this.workerPools.values()) {
|
|
795
|
-
workerPool.destroy();
|
|
806
|
+
workerPool.destroy(reason);
|
|
796
807
|
}
|
|
797
808
|
this.workerPools = /* @__PURE__ */ new Map();
|
|
798
809
|
}
|
|
@@ -1036,13 +1047,13 @@ var init_src = __esm({
|
|
|
1036
1047
|
|
|
1037
1048
|
// ../loader-utils/src/lib/worker-loader-utils/parse-with-worker.ts
|
|
1038
1049
|
function canParseWithWorker(loader, options) {
|
|
1039
|
-
var _a
|
|
1050
|
+
var _a;
|
|
1040
1051
|
const workerOptions = getWorkerOptions(options);
|
|
1041
1052
|
const nodeWorkers = workerOptions._nodeWorkers;
|
|
1042
1053
|
if (!isBrowser2 && !nodeWorkers) {
|
|
1043
1054
|
return false;
|
|
1044
1055
|
}
|
|
1045
|
-
if (loader.id === "
|
|
1056
|
+
if (loader.id === "las" && (((_a = options == null ? void 0 : options.las) == null ? void 0 : _a.shape) ?? "arrow-table") === "arrow-table") {
|
|
1046
1057
|
return false;
|
|
1047
1058
|
}
|
|
1048
1059
|
if (loader.id === "csv" && !shouldParseCSVWithWorker(options)) {
|
|
@@ -2986,6 +2997,9 @@ function getDataTypeFromArray(array) {
|
|
|
2986
2997
|
return { type: "null", nullable: true };
|
|
2987
2998
|
}
|
|
2988
2999
|
function getDataTypeFromTypedArray(array) {
|
|
3000
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
3001
|
+
return "float16";
|
|
3002
|
+
}
|
|
2989
3003
|
switch (array.constructor) {
|
|
2990
3004
|
case Int8Array:
|
|
2991
3005
|
return "int8";
|
|
@@ -3027,15 +3041,19 @@ function getArrayTypeFromDataType(type, nullable) {
|
|
|
3027
3041
|
return Float32Array;
|
|
3028
3042
|
case "float64":
|
|
3029
3043
|
return Float64Array;
|
|
3044
|
+
case "float16":
|
|
3045
|
+
return (0, import_types.getFloat16ArrayConstructor)();
|
|
3030
3046
|
default:
|
|
3031
3047
|
break;
|
|
3032
3048
|
}
|
|
3033
3049
|
}
|
|
3034
3050
|
return Array;
|
|
3035
3051
|
}
|
|
3052
|
+
var import_types;
|
|
3036
3053
|
var init_data_type = __esm({
|
|
3037
3054
|
"../schema-utils/src/lib/schema/data-type.ts"() {
|
|
3038
3055
|
"use strict";
|
|
3056
|
+
import_types = require("@math.gl/types");
|
|
3039
3057
|
}
|
|
3040
3058
|
});
|
|
3041
3059
|
|
|
@@ -3084,6 +3102,13 @@ function serializeArrowType(arrowType) {
|
|
|
3084
3102
|
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
3085
3103
|
return "utf8-view";
|
|
3086
3104
|
}
|
|
3105
|
+
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
3106
|
+
const largeListType = arrowType;
|
|
3107
|
+
return {
|
|
3108
|
+
type: "large-list",
|
|
3109
|
+
children: [serializeArrowField(largeListType.valueField)]
|
|
3110
|
+
};
|
|
3111
|
+
}
|
|
3087
3112
|
switch (arrowType.constructor) {
|
|
3088
3113
|
case arrow.Null:
|
|
3089
3114
|
return "null";
|
|
@@ -3222,12 +3247,6 @@ function serializeArrowType(arrowType) {
|
|
|
3222
3247
|
type: "list",
|
|
3223
3248
|
children: [serializeArrowField(listField)]
|
|
3224
3249
|
};
|
|
3225
|
-
case arrow.LargeList:
|
|
3226
|
-
const largeListType = arrowType;
|
|
3227
|
-
return {
|
|
3228
|
-
type: "large-list",
|
|
3229
|
-
children: [serializeArrowField(largeListType.valueField)]
|
|
3230
|
-
};
|
|
3231
3250
|
case arrow.FixedSizeList:
|
|
3232
3251
|
const fixedSizeList = arrowType;
|
|
3233
3252
|
return {
|
|
@@ -3280,7 +3299,13 @@ function deserializeArrowType(dataType, options) {
|
|
|
3280
3299
|
}
|
|
3281
3300
|
case "large-list": {
|
|
3282
3301
|
const field = deserializeArrowField(dataType.children[0], options);
|
|
3283
|
-
|
|
3302
|
+
const LargeList = getOptionalArrowConstructor("LargeList");
|
|
3303
|
+
if (!LargeList) {
|
|
3304
|
+
throw new Error(
|
|
3305
|
+
"LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
|
|
3306
|
+
);
|
|
3307
|
+
}
|
|
3308
|
+
return new LargeList(field);
|
|
3284
3309
|
}
|
|
3285
3310
|
case "fixed-size-list": {
|
|
3286
3311
|
const child = deserializeArrowField(dataType.children[0], options);
|
|
@@ -3376,11 +3401,11 @@ function deserializeArrowType(dataType, options) {
|
|
|
3376
3401
|
throw new Error("array type not supported");
|
|
3377
3402
|
}
|
|
3378
3403
|
}
|
|
3379
|
-
function
|
|
3380
|
-
return arrow;
|
|
3404
|
+
function getOptionalArrowConstructor(typeName) {
|
|
3405
|
+
return arrow[typeName];
|
|
3381
3406
|
}
|
|
3382
3407
|
function isArrowViewType(arrowType, viewTypeName) {
|
|
3383
|
-
const constructor =
|
|
3408
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
3384
3409
|
if (constructor && arrowType instanceof constructor) {
|
|
3385
3410
|
return true;
|
|
3386
3411
|
}
|
|
@@ -3388,12 +3413,16 @@ function isArrowViewType(arrowType, viewTypeName) {
|
|
|
3388
3413
|
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
3389
3414
|
return Boolean(guard == null ? void 0 : guard(arrowType));
|
|
3390
3415
|
}
|
|
3416
|
+
function isOptionalArrowType(arrowType, typeName) {
|
|
3417
|
+
const constructor = getOptionalArrowConstructor(typeName);
|
|
3418
|
+
return Boolean(constructor && arrowType instanceof constructor);
|
|
3419
|
+
}
|
|
3391
3420
|
function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
3392
3421
|
const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
|
|
3393
3422
|
if (viewTypeMode === "never") {
|
|
3394
3423
|
return fallbackType;
|
|
3395
3424
|
}
|
|
3396
|
-
const constructor =
|
|
3425
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
3397
3426
|
if (constructor) {
|
|
3398
3427
|
return new constructor();
|
|
3399
3428
|
}
|
|
@@ -3405,7 +3434,7 @@ function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
|
3405
3434
|
return fallbackType;
|
|
3406
3435
|
}
|
|
3407
3436
|
function makeRequiredArrowViewType(viewTypeName) {
|
|
3408
|
-
const constructor =
|
|
3437
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
3409
3438
|
if (!constructor) {
|
|
3410
3439
|
throw new Error(
|
|
3411
3440
|
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
@@ -13295,7 +13324,7 @@ var init_parquet_loader_options = __esm({
|
|
|
13295
13324
|
PARQUET_LOADER_DEFAULT_OPTIONS = {
|
|
13296
13325
|
columns: void 0,
|
|
13297
13326
|
preserveBinary: false,
|
|
13298
|
-
shape: "
|
|
13327
|
+
shape: "arrow-table"
|
|
13299
13328
|
};
|
|
13300
13329
|
}
|
|
13301
13330
|
});
|
|
@@ -13324,6 +13353,15 @@ var init_parquet_loader_base = __esm({
|
|
|
13324
13353
|
}
|
|
13325
13354
|
});
|
|
13326
13355
|
|
|
13356
|
+
// ../parquet/src/parquet-source-worker-factory.ts
|
|
13357
|
+
var PARQUET_SOURCE_WORKER_LOAD_WORKER;
|
|
13358
|
+
var init_parquet_source_worker_factory = __esm({
|
|
13359
|
+
"../parquet/src/parquet-source-worker-factory.ts"() {
|
|
13360
|
+
"use strict";
|
|
13361
|
+
PARQUET_SOURCE_WORKER_LOAD_WORKER = void 0;
|
|
13362
|
+
}
|
|
13363
|
+
});
|
|
13364
|
+
|
|
13327
13365
|
// ../parquet/src/parquet-source-worker-url.ts
|
|
13328
13366
|
function resolveParquetSourceWorkerUrl() {
|
|
13329
13367
|
if (!import_meta.url) {
|
|
@@ -13364,12 +13402,14 @@ var init_parquet_source_worker_client = __esm({
|
|
|
13364
13402
|
"use strict";
|
|
13365
13403
|
init_src2();
|
|
13366
13404
|
init_parquet_loader_base();
|
|
13405
|
+
init_parquet_source_worker_factory();
|
|
13367
13406
|
init_parquet_source_worker_url();
|
|
13368
13407
|
PARQUET_SOURCE_WORKER = {
|
|
13369
13408
|
...PARQUET_LOADER_BASE,
|
|
13370
13409
|
id: "parquet-source",
|
|
13371
13410
|
name: "ParquetSource",
|
|
13372
|
-
worker: PARQUET_SOURCE_WORKER_URL
|
|
13411
|
+
worker: PARQUET_SOURCE_WORKER_URL,
|
|
13412
|
+
loadWorker: PARQUET_SOURCE_WORKER_LOAD_WORKER
|
|
13373
13413
|
};
|
|
13374
13414
|
}
|
|
13375
13415
|
});
|