@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/iceberg.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)) {
|
|
@@ -6680,6 +6691,9 @@ function getDataTypeFromArray(array) {
|
|
|
6680
6691
|
return { type: "null", nullable: true };
|
|
6681
6692
|
}
|
|
6682
6693
|
function getDataTypeFromTypedArray(array) {
|
|
6694
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
6695
|
+
return "float16";
|
|
6696
|
+
}
|
|
6683
6697
|
switch (array.constructor) {
|
|
6684
6698
|
case Int8Array:
|
|
6685
6699
|
return "int8";
|
|
@@ -6721,15 +6735,19 @@ function getArrayTypeFromDataType(type, nullable) {
|
|
|
6721
6735
|
return Float32Array;
|
|
6722
6736
|
case "float64":
|
|
6723
6737
|
return Float64Array;
|
|
6738
|
+
case "float16":
|
|
6739
|
+
return (0, import_types.getFloat16ArrayConstructor)();
|
|
6724
6740
|
default:
|
|
6725
6741
|
break;
|
|
6726
6742
|
}
|
|
6727
6743
|
}
|
|
6728
6744
|
return Array;
|
|
6729
6745
|
}
|
|
6746
|
+
var import_types;
|
|
6730
6747
|
var init_data_type = __esm({
|
|
6731
6748
|
"../schema-utils/src/lib/schema/data-type.ts"() {
|
|
6732
6749
|
"use strict";
|
|
6750
|
+
import_types = require("@math.gl/types");
|
|
6733
6751
|
}
|
|
6734
6752
|
});
|
|
6735
6753
|
|
|
@@ -6778,6 +6796,13 @@ function serializeArrowType(arrowType) {
|
|
|
6778
6796
|
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
6779
6797
|
return "utf8-view";
|
|
6780
6798
|
}
|
|
6799
|
+
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
6800
|
+
const largeListType = arrowType;
|
|
6801
|
+
return {
|
|
6802
|
+
type: "large-list",
|
|
6803
|
+
children: [serializeArrowField(largeListType.valueField)]
|
|
6804
|
+
};
|
|
6805
|
+
}
|
|
6781
6806
|
switch (arrowType.constructor) {
|
|
6782
6807
|
case arrow2.Null:
|
|
6783
6808
|
return "null";
|
|
@@ -6916,12 +6941,6 @@ function serializeArrowType(arrowType) {
|
|
|
6916
6941
|
type: "list",
|
|
6917
6942
|
children: [serializeArrowField(listField)]
|
|
6918
6943
|
};
|
|
6919
|
-
case arrow2.LargeList:
|
|
6920
|
-
const largeListType = arrowType;
|
|
6921
|
-
return {
|
|
6922
|
-
type: "large-list",
|
|
6923
|
-
children: [serializeArrowField(largeListType.valueField)]
|
|
6924
|
-
};
|
|
6925
6944
|
case arrow2.FixedSizeList:
|
|
6926
6945
|
const fixedSizeList = arrowType;
|
|
6927
6946
|
return {
|
|
@@ -6974,7 +6993,13 @@ function deserializeArrowType(dataType, options) {
|
|
|
6974
6993
|
}
|
|
6975
6994
|
case "large-list": {
|
|
6976
6995
|
const field = deserializeArrowField(dataType.children[0], options);
|
|
6977
|
-
|
|
6996
|
+
const LargeList = getOptionalArrowConstructor("LargeList");
|
|
6997
|
+
if (!LargeList) {
|
|
6998
|
+
throw new Error(
|
|
6999
|
+
"LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
|
|
7000
|
+
);
|
|
7001
|
+
}
|
|
7002
|
+
return new LargeList(field);
|
|
6978
7003
|
}
|
|
6979
7004
|
case "fixed-size-list": {
|
|
6980
7005
|
const child = deserializeArrowField(dataType.children[0], options);
|
|
@@ -7070,11 +7095,11 @@ function deserializeArrowType(dataType, options) {
|
|
|
7070
7095
|
throw new Error("array type not supported");
|
|
7071
7096
|
}
|
|
7072
7097
|
}
|
|
7073
|
-
function
|
|
7074
|
-
return arrow2;
|
|
7098
|
+
function getOptionalArrowConstructor(typeName) {
|
|
7099
|
+
return arrow2[typeName];
|
|
7075
7100
|
}
|
|
7076
7101
|
function isArrowViewType(arrowType, viewTypeName) {
|
|
7077
|
-
const constructor =
|
|
7102
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
7078
7103
|
if (constructor && arrowType instanceof constructor) {
|
|
7079
7104
|
return true;
|
|
7080
7105
|
}
|
|
@@ -7082,12 +7107,16 @@ function isArrowViewType(arrowType, viewTypeName) {
|
|
|
7082
7107
|
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
7083
7108
|
return Boolean(guard == null ? void 0 : guard(arrowType));
|
|
7084
7109
|
}
|
|
7110
|
+
function isOptionalArrowType(arrowType, typeName) {
|
|
7111
|
+
const constructor = getOptionalArrowConstructor(typeName);
|
|
7112
|
+
return Boolean(constructor && arrowType instanceof constructor);
|
|
7113
|
+
}
|
|
7085
7114
|
function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
7086
7115
|
const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
|
|
7087
7116
|
if (viewTypeMode === "never") {
|
|
7088
7117
|
return fallbackType;
|
|
7089
7118
|
}
|
|
7090
|
-
const constructor =
|
|
7119
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
7091
7120
|
if (constructor) {
|
|
7092
7121
|
return new constructor();
|
|
7093
7122
|
}
|
|
@@ -7099,7 +7128,7 @@ function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
|
7099
7128
|
return fallbackType;
|
|
7100
7129
|
}
|
|
7101
7130
|
function makeRequiredArrowViewType(viewTypeName) {
|
|
7102
|
-
const constructor =
|
|
7131
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
7103
7132
|
if (!constructor) {
|
|
7104
7133
|
throw new Error(
|
|
7105
7134
|
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
@@ -16596,7 +16625,7 @@ var init_parquet_loader_options = __esm({
|
|
|
16596
16625
|
PARQUET_LOADER_DEFAULT_OPTIONS = {
|
|
16597
16626
|
columns: void 0,
|
|
16598
16627
|
preserveBinary: false,
|
|
16599
|
-
shape: "
|
|
16628
|
+
shape: "arrow-table"
|
|
16600
16629
|
};
|
|
16601
16630
|
}
|
|
16602
16631
|
});
|
|
@@ -16625,6 +16654,15 @@ var init_parquet_loader_base = __esm({
|
|
|
16625
16654
|
}
|
|
16626
16655
|
});
|
|
16627
16656
|
|
|
16657
|
+
// ../parquet/src/parquet-source-worker-factory.ts
|
|
16658
|
+
var PARQUET_SOURCE_WORKER_LOAD_WORKER;
|
|
16659
|
+
var init_parquet_source_worker_factory = __esm({
|
|
16660
|
+
"../parquet/src/parquet-source-worker-factory.ts"() {
|
|
16661
|
+
"use strict";
|
|
16662
|
+
PARQUET_SOURCE_WORKER_LOAD_WORKER = void 0;
|
|
16663
|
+
}
|
|
16664
|
+
});
|
|
16665
|
+
|
|
16628
16666
|
// ../parquet/src/parquet-source-worker-url.ts
|
|
16629
16667
|
function resolveParquetSourceWorkerUrl() {
|
|
16630
16668
|
if (!import_meta.url) {
|
|
@@ -16665,12 +16703,14 @@ var init_parquet_source_worker_client = __esm({
|
|
|
16665
16703
|
"use strict";
|
|
16666
16704
|
init_src2();
|
|
16667
16705
|
init_parquet_loader_base();
|
|
16706
|
+
init_parquet_source_worker_factory();
|
|
16668
16707
|
init_parquet_source_worker_url();
|
|
16669
16708
|
PARQUET_SOURCE_WORKER = {
|
|
16670
16709
|
...PARQUET_LOADER_BASE,
|
|
16671
16710
|
id: "parquet-source",
|
|
16672
16711
|
name: "ParquetSource",
|
|
16673
|
-
worker: PARQUET_SOURCE_WORKER_URL
|
|
16712
|
+
worker: PARQUET_SOURCE_WORKER_URL,
|
|
16713
|
+
loadWorker: PARQUET_SOURCE_WORKER_LOAD_WORKER
|
|
16674
16714
|
};
|
|
16675
16715
|
}
|
|
16676
16716
|
});
|