@loaders.gl/arrow 4.1.0-alpha.3 → 4.1.0-alpha.5
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/arrow-loader.d.ts +1 -0
- package/dist/arrow-loader.d.ts.map +1 -1
- package/dist/arrow-loader.js +1 -1
- package/dist/arrow-loader.js.map +1 -1
- package/dist/arrow-worker.js +5 -2
- package/dist/arrow-writer.js +1 -1
- package/dist/dist.dev.js +9 -6
- package/dist/geoarrow-writer.js +1 -1
- package/dist/index.cjs +8 -1
- package/dist/parsers/parse-arrow-in-batches.d.ts +2 -1
- package/dist/parsers/parse-arrow-in-batches.d.ts.map +1 -1
- package/dist/parsers/parse-arrow-in-batches.js +8 -1
- package/dist/parsers/parse-arrow-in-batches.js.map +1 -1
- package/dist/triangulate-on-worker.js +1 -1
- package/package.json +6 -6
- package/src/arrow-loader.ts +1 -0
- package/src/parsers/parse-arrow-in-batches.ts +7 -1
package/dist/arrow-loader.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ArrowTable } from './lib/arrow-table';
|
|
|
4
4
|
export type ArrowLoaderOptions = LoaderOptions & {
|
|
5
5
|
arrow?: {
|
|
6
6
|
shape: 'arrow-table' | 'columnar-table' | 'array-row-table' | 'object-row-table';
|
|
7
|
+
batchDebounceMs?: number;
|
|
7
8
|
};
|
|
8
9
|
};
|
|
9
10
|
/** ArrowJS table loader */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-loader.d.ts","sourceRoot":"","sources":["../src/arrow-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAQlD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"arrow-loader.d.ts","sourceRoot":"","sources":["../src/arrow-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAQlD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;QACjF,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAoB3E,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,WAAW,EAAE,gBAAgB,CACxC,UAAU,GAAG,aAAa,GAAG,cAAc,GAAG,aAAa,EAC3D,eAAe,EACf,kBAAkB,CAQnB,CAAC"}
|
package/dist/arrow-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArrowSync } from "./parsers/parse-arrow-sync.js";
|
|
2
2
|
import { parseArrowInBatches } from "./parsers/parse-arrow-in-batches.js";
|
|
3
|
-
const VERSION = typeof "4.1.0-alpha.
|
|
3
|
+
const VERSION = typeof "4.1.0-alpha.5" !== 'undefined' ? "4.1.0-alpha.5" : 'latest';
|
|
4
4
|
export const ArrowWorkerLoader = {
|
|
5
5
|
name: 'Apache Arrow',
|
|
6
6
|
id: 'arrow',
|
package/dist/arrow-loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-loader.js","names":["parseArrowSync","parseArrowInBatches","VERSION","ArrowWorkerLoader","name","id","module","version","category","extensions","mimeTypes","binary","tests","options","arrow","shape","ArrowLoader","parse","arraybuffer","parseSync","parseInBatches"],"sources":["../src/arrow-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {\n ArrayRowTable,\n ArrowTableBatch,\n ColumnarTable,\n ObjectRowTable\n} from '@loaders.gl/schema';\nimport type {ArrowTable} from './lib/arrow-table';\nimport {parseArrowSync} from './parsers/parse-arrow-sync';\nimport {parseArrowInBatches} from './parsers/parse-arrow-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArrowLoaderOptions = LoaderOptions & {\n arrow?: {\n shape: 'arrow-table' | 'columnar-table' | 'array-row-table' | 'object-row-table';\n };\n};\n\n/** ArrowJS table loader */\nexport const ArrowWorkerLoader: Loader<ArrowTable, never, ArrowLoaderOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n // worker: true,\n category: 'table',\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n tests: ['ARROW'],\n options: {\n arrow: {\n shape: 'columnar-table'\n }\n }\n};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: LoaderWithParser<\n ArrowTable | ColumnarTable | ObjectRowTable | ArrayRowTable,\n ArrowTableBatch,\n ArrowLoaderOptions\n> = {\n ...ArrowWorkerLoader,\n parse: async (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>\n parseArrowSync(arraybuffer, options?.arrow),\n parseSync: (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>\n parseArrowSync(arraybuffer, options?.arrow),\n parseInBatches: parseArrowInBatches\n};\n"],"mappings":"SAYQA,cAAc;AAAA,SACdC,mBAAmB;AAI3B,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;
|
|
1
|
+
{"version":3,"file":"arrow-loader.js","names":["parseArrowSync","parseArrowInBatches","VERSION","ArrowWorkerLoader","name","id","module","version","category","extensions","mimeTypes","binary","tests","options","arrow","shape","ArrowLoader","parse","arraybuffer","parseSync","parseInBatches"],"sources":["../src/arrow-loader.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {\n ArrayRowTable,\n ArrowTableBatch,\n ColumnarTable,\n ObjectRowTable\n} from '@loaders.gl/schema';\nimport type {ArrowTable} from './lib/arrow-table';\nimport {parseArrowSync} from './parsers/parse-arrow-sync';\nimport {parseArrowInBatches} from './parsers/parse-arrow-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArrowLoaderOptions = LoaderOptions & {\n arrow?: {\n shape: 'arrow-table' | 'columnar-table' | 'array-row-table' | 'object-row-table';\n batchDebounceMs?: number;\n };\n};\n\n/** ArrowJS table loader */\nexport const ArrowWorkerLoader: Loader<ArrowTable, never, ArrowLoaderOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n // worker: true,\n category: 'table',\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n tests: ['ARROW'],\n options: {\n arrow: {\n shape: 'columnar-table'\n }\n }\n};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: LoaderWithParser<\n ArrowTable | ColumnarTable | ObjectRowTable | ArrayRowTable,\n ArrowTableBatch,\n ArrowLoaderOptions\n> = {\n ...ArrowWorkerLoader,\n parse: async (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>\n parseArrowSync(arraybuffer, options?.arrow),\n parseSync: (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>\n parseArrowSync(arraybuffer, options?.arrow),\n parseInBatches: parseArrowInBatches\n};\n"],"mappings":"SAYQA,cAAc;AAAA,SACdC,mBAAmB;AAI3B,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAU3E,OAAO,MAAMC,iBAAgE,GAAG;EAC9EC,IAAI,EAAE,cAAc;EACpBC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEL,OAAO;EAEhBM,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;EAChCC,SAAS,EAAE,CACT,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,CAC3B;EACDC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,OAAO,CAAC;EAChBC,OAAO,EAAE;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE;IACT;EACF;AACF,CAAC;AAGD,OAAO,MAAMC,WAIZ,GAAG;EACF,GAAGb,iBAAiB;EACpBc,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEL,OAA4B,KAClEb,cAAc,CAACkB,WAAW,EAAEL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,CAAC;EAC7CK,SAAS,EAAEA,CAACD,WAAwB,EAAEL,OAA4B,KAChEb,cAAc,CAACkB,WAAW,EAAEL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,CAAC;EAC7CM,cAAc,EAAEnB;AAClB,CAAC"}
|
package/dist/arrow-worker.js
CHANGED
|
@@ -12154,11 +12154,14 @@ return true;`);
|
|
|
12154
12154
|
}
|
|
12155
12155
|
|
|
12156
12156
|
// src/parsers/parse-arrow-in-batches.ts
|
|
12157
|
-
function parseArrowInBatches(asyncIterator) {
|
|
12157
|
+
function parseArrowInBatches(asyncIterator, options) {
|
|
12158
12158
|
async function* makeArrowAsyncIterator() {
|
|
12159
12159
|
const readers = RecordBatchReader.readAll(asyncIterator);
|
|
12160
12160
|
for await (const reader of readers) {
|
|
12161
12161
|
for await (const recordBatch of reader) {
|
|
12162
|
+
if (options?.arrow?.batchDebounceMs !== void 0 && options?.arrow?.batchDebounceMs > 0) {
|
|
12163
|
+
await new Promise((resolve) => setTimeout(resolve, options.arrow?.batchDebounceMs || 0));
|
|
12164
|
+
}
|
|
12162
12165
|
const arrowTabledBatch = {
|
|
12163
12166
|
shape: "arrow-table",
|
|
12164
12167
|
batchType: "data",
|
|
@@ -12174,7 +12177,7 @@ return true;`);
|
|
|
12174
12177
|
}
|
|
12175
12178
|
|
|
12176
12179
|
// src/arrow-loader.ts
|
|
12177
|
-
var VERSION = true ? "4.1.0-alpha.
|
|
12180
|
+
var VERSION = true ? "4.1.0-alpha.5" : "latest";
|
|
12178
12181
|
var ArrowWorkerLoader = {
|
|
12179
12182
|
name: "Apache Arrow",
|
|
12180
12183
|
id: "arrow",
|
package/dist/arrow-writer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeArrowSync } from "./lib/encode-arrow.js";
|
|
2
|
-
const VERSION = typeof "4.1.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.1.0-alpha.5" !== 'undefined' ? "4.1.0-alpha.5" : 'latest';
|
|
3
3
|
export const ArrowWriter = {
|
|
4
4
|
name: 'Apache Arrow',
|
|
5
5
|
id: 'arrow',
|
package/dist/dist.dev.js
CHANGED
|
@@ -12736,11 +12736,14 @@ return true;`);
|
|
|
12736
12736
|
}
|
|
12737
12737
|
|
|
12738
12738
|
// src/parsers/parse-arrow-in-batches.ts
|
|
12739
|
-
function parseArrowInBatches(asyncIterator) {
|
|
12739
|
+
function parseArrowInBatches(asyncIterator, options) {
|
|
12740
12740
|
async function* makeArrowAsyncIterator() {
|
|
12741
12741
|
const readers = RecordBatchReader.readAll(asyncIterator);
|
|
12742
12742
|
for await (const reader of readers) {
|
|
12743
12743
|
for await (const recordBatch of reader) {
|
|
12744
|
+
if (options?.arrow?.batchDebounceMs !== void 0 && options?.arrow?.batchDebounceMs > 0) {
|
|
12745
|
+
await new Promise((resolve) => setTimeout(resolve, options.arrow?.batchDebounceMs || 0));
|
|
12746
|
+
}
|
|
12744
12747
|
const arrowTabledBatch = {
|
|
12745
12748
|
shape: "arrow-table",
|
|
12746
12749
|
batchType: "data",
|
|
@@ -12756,7 +12759,7 @@ return true;`);
|
|
|
12756
12759
|
}
|
|
12757
12760
|
|
|
12758
12761
|
// src/arrow-loader.ts
|
|
12759
|
-
var VERSION = true ? "4.1.0-alpha.
|
|
12762
|
+
var VERSION = true ? "4.1.0-alpha.5" : "latest";
|
|
12760
12763
|
var ArrowWorkerLoader = {
|
|
12761
12764
|
name: "Apache Arrow",
|
|
12762
12765
|
id: "arrow",
|
|
@@ -12802,7 +12805,7 @@ return true;`);
|
|
|
12802
12805
|
}
|
|
12803
12806
|
|
|
12804
12807
|
// src/arrow-writer.ts
|
|
12805
|
-
var VERSION2 = true ? "4.1.0-alpha.
|
|
12808
|
+
var VERSION2 = true ? "4.1.0-alpha.5" : "latest";
|
|
12806
12809
|
var ArrowWriter = {
|
|
12807
12810
|
name: "Apache Arrow",
|
|
12808
12811
|
id: "arrow",
|
|
@@ -13934,7 +13937,7 @@ return true;`);
|
|
|
13934
13937
|
}
|
|
13935
13938
|
|
|
13936
13939
|
// ../wkt/src/lib/utils/version.ts
|
|
13937
|
-
var VERSION3 = true ? "4.1.0-alpha.
|
|
13940
|
+
var VERSION3 = true ? "4.1.0-alpha.5" : "latest";
|
|
13938
13941
|
|
|
13939
13942
|
// ../wkt/src/lib/parse-wkt.ts
|
|
13940
13943
|
var numberRegexp = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/;
|
|
@@ -14773,7 +14776,7 @@ return true;`);
|
|
|
14773
14776
|
console.warn("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
14774
14777
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
14775
14778
|
} else {
|
|
14776
|
-
globalThis._loadersgl_.version = "4.1.0-alpha.
|
|
14779
|
+
globalThis._loadersgl_.version = "4.1.0-alpha.5";
|
|
14777
14780
|
}
|
|
14778
14781
|
}
|
|
14779
14782
|
return globalThis._loadersgl_.version;
|
|
@@ -15315,7 +15318,7 @@ return true;`);
|
|
|
15315
15318
|
}
|
|
15316
15319
|
|
|
15317
15320
|
// src/triangulate-on-worker.ts
|
|
15318
|
-
var VERSION5 = true ? "4.1.0-alpha.
|
|
15321
|
+
var VERSION5 = true ? "4.1.0-alpha.5" : "latest";
|
|
15319
15322
|
var TriangulationWorker = {
|
|
15320
15323
|
id: "triangulation",
|
|
15321
15324
|
name: "Triangulate",
|
package/dist/geoarrow-writer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeGeoArrowSync } from "./lib/encode-geoarrow.js";
|
|
2
|
-
const VERSION = typeof "4.1.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.1.0-alpha.5" !== 'undefined' ? "4.1.0-alpha.5" : 'latest';
|
|
3
3
|
export const GeoArrowWriter = {
|
|
4
4
|
name: 'Apache Arrow',
|
|
5
5
|
id: 'arrow',
|
package/dist/index.cjs
CHANGED
|
@@ -467,11 +467,18 @@ function parseArrowSync(arrayBuffer, options) {
|
|
|
467
467
|
|
|
468
468
|
// src/parsers/parse-arrow-in-batches.ts
|
|
469
469
|
var arrow5 = __toESM(require("apache-arrow"), 1);
|
|
470
|
-
function parseArrowInBatches(asyncIterator) {
|
|
470
|
+
function parseArrowInBatches(asyncIterator, options) {
|
|
471
471
|
async function* makeArrowAsyncIterator() {
|
|
472
|
+
var _a, _b;
|
|
472
473
|
const readers = arrow5.RecordBatchReader.readAll(asyncIterator);
|
|
473
474
|
for await (const reader of readers) {
|
|
474
475
|
for await (const recordBatch of reader) {
|
|
476
|
+
if (((_a = options == null ? void 0 : options.arrow) == null ? void 0 : _a.batchDebounceMs) !== void 0 && ((_b = options == null ? void 0 : options.arrow) == null ? void 0 : _b.batchDebounceMs) > 0) {
|
|
477
|
+
await new Promise((resolve) => {
|
|
478
|
+
var _a2;
|
|
479
|
+
return setTimeout(resolve, ((_a2 = options.arrow) == null ? void 0 : _a2.batchDebounceMs) || 0);
|
|
480
|
+
});
|
|
481
|
+
}
|
|
475
482
|
const arrowTabledBatch = {
|
|
476
483
|
shape: "arrow-table",
|
|
477
484
|
batchType: "data",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ArrowTableBatch } from '../lib/arrow-table';
|
|
2
|
+
import { ArrowLoaderOptions } from '../arrow-loader';
|
|
2
3
|
/**
|
|
3
4
|
*/
|
|
4
|
-
export declare function parseArrowInBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer
|
|
5
|
+
export declare function parseArrowInBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>, options?: ArrowLoaderOptions): AsyncIterable<ArrowTableBatch>;
|
|
5
6
|
//# sourceMappingURL=parse-arrow-in-batches.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-arrow-in-batches.d.ts","sourceRoot":"","sources":["../../src/parsers/parse-arrow-in-batches.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-arrow-in-batches.d.ts","sourceRoot":"","sources":["../../src/parsers/parse-arrow-in-batches.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAGnD;GACG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,EACjE,OAAO,CAAC,EAAE,kBAAkB,GAC3B,aAAa,CAAC,eAAe,CAAC,CA0ChC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import * as arrow from 'apache-arrow';
|
|
2
|
-
export function parseArrowInBatches(asyncIterator) {
|
|
2
|
+
export function parseArrowInBatches(asyncIterator, options) {
|
|
3
3
|
async function* makeArrowAsyncIterator() {
|
|
4
4
|
const readers = arrow.RecordBatchReader.readAll(asyncIterator);
|
|
5
5
|
for await (const reader of readers) {
|
|
6
6
|
for await (const recordBatch of reader) {
|
|
7
|
+
var _options$arrow, _options$arrow2;
|
|
8
|
+
if ((options === null || options === void 0 ? void 0 : (_options$arrow = options.arrow) === null || _options$arrow === void 0 ? void 0 : _options$arrow.batchDebounceMs) !== undefined && (options === null || options === void 0 ? void 0 : (_options$arrow2 = options.arrow) === null || _options$arrow2 === void 0 ? void 0 : _options$arrow2.batchDebounceMs) > 0) {
|
|
9
|
+
await new Promise(resolve => {
|
|
10
|
+
var _options$arrow3;
|
|
11
|
+
return setTimeout(resolve, ((_options$arrow3 = options.arrow) === null || _options$arrow3 === void 0 ? void 0 : _options$arrow3.batchDebounceMs) || 0);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
7
14
|
const arrowTabledBatch = {
|
|
8
15
|
shape: 'arrow-table',
|
|
9
16
|
batchType: 'data',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-arrow-in-batches.js","names":["arrow","parseArrowInBatches","asyncIterator","makeArrowAsyncIterator","readers","RecordBatchReader","readAll","reader","recordBatch","arrowTabledBatch","shape","batchType","data","Table","length"],"sources":["../../src/parsers/parse-arrow-in-batches.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ArrowTableBatch} from '../lib/arrow-table';\nimport * as arrow from 'apache-arrow';\n// import {isIterable} from '@loaders.gl/core';\n\n/**\n */\nexport function parseArrowInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer
|
|
1
|
+
{"version":3,"file":"parse-arrow-in-batches.js","names":["arrow","parseArrowInBatches","asyncIterator","options","makeArrowAsyncIterator","readers","RecordBatchReader","readAll","reader","recordBatch","_options$arrow","_options$arrow2","batchDebounceMs","undefined","Promise","resolve","_options$arrow3","setTimeout","arrowTabledBatch","shape","batchType","data","Table","length"],"sources":["../../src/parsers/parse-arrow-in-batches.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ArrowTableBatch} from '../lib/arrow-table';\nimport * as arrow from 'apache-arrow';\nimport {ArrowLoaderOptions} from '../arrow-loader';\n// import {isIterable} from '@loaders.gl/core';\n\n/**\n */\nexport function parseArrowInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: ArrowLoaderOptions\n): AsyncIterable<ArrowTableBatch> {\n // Creates the appropriate arrow.RecordBatchReader subclasses from the input\n // This will also close the underlying source in case of early termination or errors\n\n // As an optimization, return a non-async iterator\n /*\n if (isIterable(readers)) {\n function* makeArrowIterator() {\n for (const reader of readers) {\n for (const batch of reader) {\n yield processBatch(batch, reader);\n }\n break; // only processing one stream of batches\n }\n }\n const arrowIterator = makeArrowIterator();\n }\n */\n\n async function* makeArrowAsyncIterator(): AsyncIterator<ArrowTableBatch> {\n // @ts-ignore\n const readers = arrow.RecordBatchReader.readAll(asyncIterator);\n for await (const reader of readers) {\n for await (const recordBatch of reader) {\n // use options.batchDebounceMs to add a delay between batches if needed (use case: incremental loading)\n if (options?.arrow?.batchDebounceMs !== undefined && options?.arrow?.batchDebounceMs > 0) {\n await new Promise((resolve) => setTimeout(resolve, options.arrow?.batchDebounceMs || 0));\n }\n const arrowTabledBatch: ArrowTableBatch = {\n shape: 'arrow-table',\n batchType: 'data',\n data: new arrow.Table([recordBatch]),\n length: recordBatch.data.length\n };\n // processBatch(recordBatch);\n yield arrowTabledBatch;\n }\n break; // only processing one stream of batches\n }\n }\n\n return makeArrowAsyncIterator() as any; // as AsyncIterator<ArrowTableBatch>;\n}\n\n// function processBatch(batch: RecordBatch): ArrowTableBatch {\n// const values = {};\n// batch.schema.fields.forEach(({name}, index) => {\n// values[name] = batch.getChildAt(index)?.toArray();\n// });\n// return {\n// };\n// }\n"],"mappings":"AAKA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAMrC,OAAO,SAASC,mBAAmBA,CACjCC,aAAiE,EACjEC,OAA4B,EACI;EAmBhC,gBAAgBC,sBAAsBA,CAAA,EAAmC;IAEvE,MAAMC,OAAO,GAAGL,KAAK,CAACM,iBAAiB,CAACC,OAAO,CAACL,aAAa,CAAC;IAC9D,WAAW,MAAMM,MAAM,IAAIH,OAAO,EAAE;MAClC,WAAW,MAAMI,WAAW,IAAID,MAAM,EAAE;QAAA,IAAAE,cAAA,EAAAC,eAAA;QAEtC,IAAI,CAAAR,OAAO,aAAPA,OAAO,wBAAAO,cAAA,GAAPP,OAAO,CAAEH,KAAK,cAAAU,cAAA,uBAAdA,cAAA,CAAgBE,eAAe,MAAKC,SAAS,IAAI,CAAAV,OAAO,aAAPA,OAAO,wBAAAQ,eAAA,GAAPR,OAAO,CAAEH,KAAK,cAAAW,eAAA,uBAAdA,eAAA,CAAgBC,eAAe,IAAG,CAAC,EAAE;UACxF,MAAM,IAAIE,OAAO,CAAEC,OAAO;YAAA,IAAAC,eAAA;YAAA,OAAKC,UAAU,CAACF,OAAO,EAAE,EAAAC,eAAA,GAAAb,OAAO,CAACH,KAAK,cAAAgB,eAAA,uBAAbA,eAAA,CAAeJ,eAAe,KAAI,CAAC,CAAC;UAAA,EAAC;QAC1F;QACA,MAAMM,gBAAiC,GAAG;UACxCC,KAAK,EAAE,aAAa;UACpBC,SAAS,EAAE,MAAM;UACjBC,IAAI,EAAE,IAAIrB,KAAK,CAACsB,KAAK,CAAC,CAACb,WAAW,CAAC,CAAC;UACpCc,MAAM,EAAEd,WAAW,CAACY,IAAI,CAACE;QAC3B,CAAC;QAED,MAAML,gBAAgB;MACxB;MACA;IACF;EACF;EAEA,OAAOd,sBAAsB,CAAC,CAAC;AACjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { processOnWorker } from '@loaders.gl/worker-utils';
|
|
2
|
-
const VERSION = typeof "4.1.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.1.0-alpha.5" !== 'undefined' ? "4.1.0-alpha.5" : 'latest';
|
|
3
3
|
export const TriangulationWorker = {
|
|
4
4
|
id: 'triangulation',
|
|
5
5
|
name: 'Triangulate',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/arrow",
|
|
3
|
-
"version": "4.1.0-alpha.
|
|
3
|
+
"version": "4.1.0-alpha.5",
|
|
4
4
|
"description": "Simple columnar table loader for the Apache Arrow format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"build-worker2": "esbuild src/workers/arrow-worker.ts --bundle --outfile=dist/arrow-worker.js --platform=browser --external:{stream}"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@loaders.gl/gis": "4.1.0-alpha.
|
|
56
|
-
"@loaders.gl/loader-utils": "4.1.0-alpha.
|
|
57
|
-
"@loaders.gl/schema": "4.1.0-alpha.
|
|
58
|
-
"@loaders.gl/wkt": "4.1.0-alpha.
|
|
55
|
+
"@loaders.gl/gis": "4.1.0-alpha.5",
|
|
56
|
+
"@loaders.gl/loader-utils": "4.1.0-alpha.5",
|
|
57
|
+
"@loaders.gl/schema": "4.1.0-alpha.5",
|
|
58
|
+
"@loaders.gl/wkt": "4.1.0-alpha.5",
|
|
59
59
|
"@math.gl/polygon": "4.0.0",
|
|
60
60
|
"apache-arrow": "^13.0.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "3250842d8cc0fc8b76a575168c1fd57e5a66b6ba"
|
|
63
63
|
}
|
package/src/arrow-loader.ts
CHANGED
|
@@ -20,6 +20,7 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
|
20
20
|
export type ArrowLoaderOptions = LoaderOptions & {
|
|
21
21
|
arrow?: {
|
|
22
22
|
shape: 'arrow-table' | 'columnar-table' | 'array-row-table' | 'object-row-table';
|
|
23
|
+
batchDebounceMs?: number;
|
|
23
24
|
};
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import type {ArrowTableBatch} from '../lib/arrow-table';
|
|
6
6
|
import * as arrow from 'apache-arrow';
|
|
7
|
+
import {ArrowLoaderOptions} from '../arrow-loader';
|
|
7
8
|
// import {isIterable} from '@loaders.gl/core';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
*/
|
|
11
12
|
export function parseArrowInBatches(
|
|
12
|
-
asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer
|
|
13
|
+
asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,
|
|
14
|
+
options?: ArrowLoaderOptions
|
|
13
15
|
): AsyncIterable<ArrowTableBatch> {
|
|
14
16
|
// Creates the appropriate arrow.RecordBatchReader subclasses from the input
|
|
15
17
|
// This will also close the underlying source in case of early termination or errors
|
|
@@ -34,6 +36,10 @@ export function parseArrowInBatches(
|
|
|
34
36
|
const readers = arrow.RecordBatchReader.readAll(asyncIterator);
|
|
35
37
|
for await (const reader of readers) {
|
|
36
38
|
for await (const recordBatch of reader) {
|
|
39
|
+
// use options.batchDebounceMs to add a delay between batches if needed (use case: incremental loading)
|
|
40
|
+
if (options?.arrow?.batchDebounceMs !== undefined && options?.arrow?.batchDebounceMs > 0) {
|
|
41
|
+
await new Promise((resolve) => setTimeout(resolve, options.arrow?.batchDebounceMs || 0));
|
|
42
|
+
}
|
|
37
43
|
const arrowTabledBatch: ArrowTableBatch = {
|
|
38
44
|
shape: 'arrow-table',
|
|
39
45
|
batchType: 'data',
|