@loaders.gl/parquet 4.0.1 → 4.0.2

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/index.cjs CHANGED
@@ -7291,9 +7291,10 @@ var ParquetWriter = {
7291
7291
  version: VERSION2,
7292
7292
  extensions: ["parquet"],
7293
7293
  mimeTypes: ["application/octet-stream"],
7294
- encodeSync,
7295
7294
  binary: true,
7296
- options: {}
7295
+ options: {},
7296
+ encode: async (data, options) => encodeSync(data, options),
7297
+ encodeSync
7297
7298
  };
7298
7299
  function encodeSync(data, options) {
7299
7300
  return new ArrayBuffer(0);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Buffer","ParquetLoader","ParquetWorkerLoader","ParquetColumnarWorkerLoader","parseParquet","parseParquetFileInBatches","parseParquetInColumns","parseParquetFileInColumnarBatches","parse","parseFileInBatches","ParquetColumnarLoader","ParquetWriter","_ParquetWriter","preloadCompressions","ParquetSchema","ParquetReader","ParquetEncoder","convertParquetSchema","convertParquetToArrowSchema","BufferPolyfill","installBufferPolyfill"],"sources":["../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nexport {Buffer} from './buffer-polyfill/install-buffer-polyfill';\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {\n ObjectRowTable,\n ObjectRowTableBatch,\n ColumnarTable,\n ColumnarTableBatch,\n GeoJSONTable,\n GeoJSONTableBatch\n} from '@loaders.gl/schema';\n// import type {Table as ApacheArrowTable} from 'apache-arrow';\n\n// ParquetLoader\n\nimport {\n ParquetLoader as ParquetWorkerLoader,\n ParquetLoader as ParquetColumnarWorkerLoader,\n ParquetLoaderOptions\n} from './parquet-loader';\nimport {parseParquet, parseParquetFileInBatches} from './lib/parsers/parse-parquet-to-rows';\nimport {\n parseParquetInColumns,\n parseParquetFileInColumnarBatches\n} from './lib/parsers/parse-parquet-to-columns';\n\n// import type {ParquetWasmLoaderOptions} from './lib/wasm/parse-parquet-wasm';\n// import {parseParquetWasm} from './lib/wasm/parse-parquet-wasm';\n// import {ParquetWasmLoader as ParquetWasmWorkerLoader} from './parquet-wasm-loader';\n\nexport {ParquetWorkerLoader};\n// export {ParquetWasmWorkerLoader};\n\n/** ParquetJS table loader */\nexport const ParquetLoader: LoaderWithParser<\n ObjectRowTable | GeoJSONTable,\n ObjectRowTableBatch | GeoJSONTableBatch,\n ParquetLoaderOptions\n> = {\n ...ParquetWorkerLoader,\n parse: parseParquet,\n // @ts-expect-error\n parseFileInBatches: parseParquetFileInBatches\n};\n\n/** ParquetJS table loader */\nexport const ParquetColumnarLoader: LoaderWithParser<\n ColumnarTable,\n ColumnarTableBatch,\n ParquetLoaderOptions\n> = {\n ...ParquetColumnarWorkerLoader,\n parse: parseParquetInColumns,\n // @ts-expect-error\n parseFileInBatches: parseParquetFileInColumnarBatches\n};\n\n// export const ParquetWasmLoader: LoaderWithParser<\n// ApacheArrowTable,\n// never,\n// ParquetWasmLoaderOptions\n// > = {\n// ...ParquetWasmWorkerLoader,\n// // @ts-expect-error Getting strange errors in wasm\n// parse: () => {} // parseParquetWasm\n// };\n\n// ParquetWriter\n\nexport {ParquetWriter as _ParquetWriter} from './parquet-writer';\n// export {ParquetWasmWriter} from './parquet-wasm-writer';\n\n// EXPERIMENTAL - expose the internal parquetjs API\n\nexport {preloadCompressions} from './parquetjs/compression';\n\nexport {ParquetSchema} from './parquetjs/schema/schema';\nexport {ParquetReader} from './parquetjs/parser/parquet-reader';\nexport {ParquetEncoder} from './parquetjs/encoder/parquet-encoder';\n\nexport {\n convertParquetSchema,\n convertParquetSchema as convertParquetToArrowSchema\n} from './lib/arrow/convert-schema-from-parquet';\n\n// Experimental\nexport {BufferPolyfill, installBufferPolyfill} from './buffer-polyfill';\n"],"mappings":"SAGQA,MAAM;AAAA,SAgBZC,aAAa,IAAIC,mBAAmB,EACpCD,aAAa,IAAIE,2BAA2B;AAAA,SAGtCC,YAAY,EAAEC,yBAAyB;AAAA,SAE7CC,qBAAqB,EACrBC,iCAAiC;AAOnC,SAAQL,mBAAmB;AAI3B,OAAO,MAAMD,aAIZ,GAAG;EACF,GAAGC,mBAAmB;EACtBM,KAAK,EAAEJ,YAAY;EAEnBK,kBAAkB,EAAEJ;AACtB,CAAC;AAGD,OAAO,MAAMK,qBAIZ,GAAG;EACF,GAAGP,2BAA2B;EAC9BK,KAAK,EAAEF,qBAAqB;EAE5BG,kBAAkB,EAAEF;AACtB,CAAC;AAAC,SAcMI,aAAa,IAAIC,cAAc;AAAA,SAK/BC,mBAAmB;AAAA,SAEnBC,aAAa;AAAA,SACbC,aAAa;AAAA,SACbC,cAAc;AAAA,SAGpBC,oBAAoB,EACpBA,oBAAoB,IAAIC,2BAA2B;AAAA,SAI7CC,cAAc,EAAEC,qBAAqB"}
1
+ {"version":3,"file":"index.js","names":["Buffer","ParquetLoader","ParquetWorkerLoader","ParquetColumnarWorkerLoader","parseParquet","parseParquetFileInBatches","parseParquetInColumns","parseParquetFileInColumnarBatches","parse","parseFileInBatches","ParquetColumnarLoader","ParquetWriter","_ParquetWriter","preloadCompressions","ParquetSchema","ParquetReader","ParquetEncoder","convertParquetSchema","convertParquetToArrowSchema","BufferPolyfill","installBufferPolyfill"],"sources":["../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nexport {Buffer} from './buffer-polyfill/install-buffer-polyfill';\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {\n ObjectRowTable,\n ObjectRowTableBatch,\n ColumnarTable,\n ColumnarTableBatch,\n GeoJSONTable,\n GeoJSONTableBatch\n} from '@loaders.gl/schema';\n// import type * as arrow from 'apache-arrow';\n\n// ParquetLoader\n\nimport {\n ParquetLoader as ParquetWorkerLoader,\n ParquetLoader as ParquetColumnarWorkerLoader,\n ParquetLoaderOptions\n} from './parquet-loader';\nimport {parseParquet, parseParquetFileInBatches} from './lib/parsers/parse-parquet-to-rows';\nimport {\n parseParquetInColumns,\n parseParquetFileInColumnarBatches\n} from './lib/parsers/parse-parquet-to-columns';\n\n// import type {ParquetWasmLoaderOptions} from './lib/wasm/parse-parquet-wasm';\n// import {parseParquetWasm} from './lib/wasm/parse-parquet-wasm';\n// import {ParquetWasmLoader as ParquetWasmWorkerLoader} from './parquet-wasm-loader';\n\nexport {ParquetWorkerLoader};\n// export {ParquetWasmWorkerLoader};\n\n/** ParquetJS table loader */\nexport const ParquetLoader: LoaderWithParser<\n ObjectRowTable | GeoJSONTable,\n ObjectRowTableBatch | GeoJSONTableBatch,\n ParquetLoaderOptions\n> = {\n ...ParquetWorkerLoader,\n parse: parseParquet,\n // @ts-expect-error\n parseFileInBatches: parseParquetFileInBatches\n};\n\n/** ParquetJS table loader */\nexport const ParquetColumnarLoader: LoaderWithParser<\n ColumnarTable,\n ColumnarTableBatch,\n ParquetLoaderOptions\n> = {\n ...ParquetColumnarWorkerLoader,\n parse: parseParquetInColumns,\n // @ts-expect-error\n parseFileInBatches: parseParquetFileInColumnarBatches\n};\n\n// export const ParquetWasmLoader: LoaderWithParser<\n// arrow.Table,\n// never,\n// ParquetWasmLoaderOptions\n// > = {\n// ...ParquetWasmWorkerLoader,\n// // @ts-expect-error Getting strange errors in wasm\n// parse: () => {} // parseParquetWasm\n// };\n\n// ParquetWriter\n\nexport {ParquetWriter as _ParquetWriter} from './parquet-writer';\n// export {ParquetWasmWriter} from './parquet-wasm-writer';\n\n// EXPERIMENTAL - expose the internal parquetjs API\n\nexport {preloadCompressions} from './parquetjs/compression';\n\nexport {ParquetSchema} from './parquetjs/schema/schema';\nexport {ParquetReader} from './parquetjs/parser/parquet-reader';\nexport {ParquetEncoder} from './parquetjs/encoder/parquet-encoder';\n\nexport {\n convertParquetSchema,\n convertParquetSchema as convertParquetToArrowSchema\n} from './lib/arrow/convert-schema-from-parquet';\n\n// Experimental\nexport {BufferPolyfill, installBufferPolyfill} from './buffer-polyfill';\n"],"mappings":"SAGQA,MAAM;AAAA,SAgBZC,aAAa,IAAIC,mBAAmB,EACpCD,aAAa,IAAIE,2BAA2B;AAAA,SAGtCC,YAAY,EAAEC,yBAAyB;AAAA,SAE7CC,qBAAqB,EACrBC,iCAAiC;AAOnC,SAAQL,mBAAmB;AAI3B,OAAO,MAAMD,aAIZ,GAAG;EACF,GAAGC,mBAAmB;EACtBM,KAAK,EAAEJ,YAAY;EAEnBK,kBAAkB,EAAEJ;AACtB,CAAC;AAGD,OAAO,MAAMK,qBAIZ,GAAG;EACF,GAAGP,2BAA2B;EAC9BK,KAAK,EAAEF,qBAAqB;EAE5BG,kBAAkB,EAAEF;AACtB,CAAC;AAAC,SAcMI,aAAa,IAAIC,cAAc;AAAA,SAK/BC,mBAAmB;AAAA,SAEnBC,aAAa;AAAA,SACbC,aAAa;AAAA,SACbC,cAAc;AAAA,SAGpBC,oBAAoB,EACpBA,oBAAoB,IAAIC,2BAA2B;AAAA,SAI7CC,cAAc,EAAEC,qBAAqB"}
@@ -1,21 +1,20 @@
1
- import type { Table } from 'apache-arrow';
2
1
  import type { WriterOptions } from '@loaders.gl/loader-utils';
2
+ import * as arrow from 'apache-arrow';
3
3
  export type ParquetWriterOptions = WriterOptions & {
4
4
  parquet?: {
5
5
  wasmUrl?: string;
6
6
  };
7
7
  };
8
8
  /**
9
- * Encode Arrow Table to Parquet buffer
9
+ * Encode Arrow arrow.Table to Parquet buffer
10
10
  */
11
- export declare function encode(table: Table, options?: ParquetWriterOptions): Promise<ArrayBuffer>;
11
+ export declare function encode(table: arrow.Table, options?: ParquetWriterOptions): Promise<ArrayBuffer>;
12
12
  /**
13
- * Serialize a {@link Table} to the IPC format. This function is a convenience
14
- * wrapper for {@link RecordBatchStreamWriter} and {@link RecordBatchFileWriter}.
13
+ * Serialize a table to the IPC format. This function is a convenience
15
14
  * Opposite of {@link tableFromIPC}.
16
15
  *
17
- * @param table The Table to serialize.
18
- * @param type Whether to serialize the Table as a file or a stream.
16
+ * @param table The arrow.Table to serialize.
17
+ * @param type Whether to serialize the arrow.Table as a file or a stream.
19
18
  */
20
- export declare function tableToIPC(table: Table): Uint8Array;
19
+ export declare function tableToIPC(table: arrow.Table): Uint8Array;
21
20
  //# sourceMappingURL=encode-parquet-wasm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"encode-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/encode-parquet-wasm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAK5D,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAY/F;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAEnD"}
1
+ {"version":3,"file":"encode-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/encode-parquet-wasm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,UAAU,CAEzD"}
@@ -1,4 +1,4 @@
1
- import { RecordBatchStreamWriter } from 'apache-arrow';
1
+ import * as arrow from 'apache-arrow';
2
2
  import { loadWasm } from "./load-wasm/index.js";
3
3
  export async function encode(table, options) {
4
4
  var _options$parquet;
@@ -10,6 +10,6 @@ export async function encode(table, options) {
10
10
  return parquetBytes.buffer.slice(parquetBytes.byteOffset, parquetBytes.byteLength + parquetBytes.byteOffset);
11
11
  }
12
12
  export function tableToIPC(table) {
13
- return RecordBatchStreamWriter.writeAll(table).toUint8Array(true);
13
+ return arrow.RecordBatchStreamWriter.writeAll(table).toUint8Array(true);
14
14
  }
15
15
  //# sourceMappingURL=encode-parquet-wasm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"encode-parquet-wasm.js","names":["RecordBatchStreamWriter","loadWasm","encode","table","options","_options$parquet","wasmUrl","parquet","wasm","arrowIPCBytes","tableToIPC","writerProperties","WriterPropertiesBuilder","build","parquetBytes","writeParquet","buffer","slice","byteOffset","byteLength","writeAll","toUint8Array"],"sources":["../../../src/lib/wasm/encode-parquet-wasm.ts"],"sourcesContent":["import type {Table} from 'apache-arrow';\nimport type {WriterOptions} from '@loaders.gl/loader-utils';\n\nimport {RecordBatchStreamWriter} from 'apache-arrow';\nimport {loadWasm} from './load-wasm';\n\nexport type ParquetWriterOptions = WriterOptions & {\n parquet?: {\n wasmUrl?: string;\n };\n};\n\n/**\n * Encode Arrow Table to Parquet buffer\n */\nexport async function encode(table: Table, options?: ParquetWriterOptions): Promise<ArrayBuffer> {\n const wasmUrl = options?.parquet?.wasmUrl;\n const wasm = await loadWasm(wasmUrl);\n\n const arrowIPCBytes = tableToIPC(table);\n // TODO: provide options for how to write table.\n const writerProperties = new wasm.WriterPropertiesBuilder().build();\n const parquetBytes = wasm.writeParquet(arrowIPCBytes, writerProperties);\n return parquetBytes.buffer.slice(\n parquetBytes.byteOffset,\n parquetBytes.byteLength + parquetBytes.byteOffset\n );\n}\n\n/**\n * Serialize a {@link Table} to the IPC format. This function is a convenience\n * wrapper for {@link RecordBatchStreamWriter} and {@link RecordBatchFileWriter}.\n * Opposite of {@link tableFromIPC}.\n *\n * @param table The Table to serialize.\n * @param type Whether to serialize the Table as a file or a stream.\n */\nexport function tableToIPC(table: Table): Uint8Array {\n return RecordBatchStreamWriter.writeAll(table).toUint8Array(true);\n}\n"],"mappings":"AAGA,SAAQA,uBAAuB,QAAO,cAAc;AAAC,SAC7CC,QAAQ;AAWhB,OAAO,eAAeC,MAAMA,CAACC,KAAY,EAAEC,OAA8B,EAAwB;EAAA,IAAAC,gBAAA;EAC/F,MAAMC,OAAO,GAAGF,OAAO,aAAPA,OAAO,wBAAAC,gBAAA,GAAPD,OAAO,CAAEG,OAAO,cAAAF,gBAAA,uBAAhBA,gBAAA,CAAkBC,OAAO;EACzC,MAAME,IAAI,GAAG,MAAMP,QAAQ,CAACK,OAAO,CAAC;EAEpC,MAAMG,aAAa,GAAGC,UAAU,CAACP,KAAK,CAAC;EAEvC,MAAMQ,gBAAgB,GAAG,IAAIH,IAAI,CAACI,uBAAuB,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC;EACnE,MAAMC,YAAY,GAAGN,IAAI,CAACO,YAAY,CAACN,aAAa,EAAEE,gBAAgB,CAAC;EACvE,OAAOG,YAAY,CAACE,MAAM,CAACC,KAAK,CAC9BH,YAAY,CAACI,UAAU,EACvBJ,YAAY,CAACK,UAAU,GAAGL,YAAY,CAACI,UACzC,CAAC;AACH;AAUA,OAAO,SAASR,UAAUA,CAACP,KAAY,EAAc;EACnD,OAAOH,uBAAuB,CAACoB,QAAQ,CAACjB,KAAK,CAAC,CAACkB,YAAY,CAAC,IAAI,CAAC;AACnE"}
1
+ {"version":3,"file":"encode-parquet-wasm.js","names":["arrow","loadWasm","encode","table","options","_options$parquet","wasmUrl","parquet","wasm","arrowIPCBytes","tableToIPC","writerProperties","WriterPropertiesBuilder","build","parquetBytes","writeParquet","buffer","slice","byteOffset","byteLength","RecordBatchStreamWriter","writeAll","toUint8Array"],"sources":["../../../src/lib/wasm/encode-parquet-wasm.ts"],"sourcesContent":["import type {WriterOptions} from '@loaders.gl/loader-utils';\n\nimport * as arrow from 'apache-arrow';\nimport {loadWasm} from './load-wasm';\n\nexport type ParquetWriterOptions = WriterOptions & {\n parquet?: {\n wasmUrl?: string;\n };\n};\n\n/**\n * Encode Arrow arrow.Table to Parquet buffer\n */\nexport async function encode(\n table: arrow.Table,\n options?: ParquetWriterOptions\n): Promise<ArrayBuffer> {\n const wasmUrl = options?.parquet?.wasmUrl;\n const wasm = await loadWasm(wasmUrl);\n\n const arrowIPCBytes = tableToIPC(table);\n // TODO: provide options for how to write table.\n const writerProperties = new wasm.WriterPropertiesBuilder().build();\n const parquetBytes = wasm.writeParquet(arrowIPCBytes, writerProperties);\n return parquetBytes.buffer.slice(\n parquetBytes.byteOffset,\n parquetBytes.byteLength + parquetBytes.byteOffset\n );\n}\n\n/**\n * Serialize a table to the IPC format. This function is a convenience\n * Opposite of {@link tableFromIPC}.\n *\n * @param table The arrow.Table to serialize.\n * @param type Whether to serialize the arrow.Table as a file or a stream.\n */\nexport function tableToIPC(table: arrow.Table): Uint8Array {\n return arrow.RecordBatchStreamWriter.writeAll(table).toUint8Array(true);\n}\n"],"mappings":"AAEA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAAC,SAC9BC,QAAQ;AAWhB,OAAO,eAAeC,MAAMA,CAC1BC,KAAkB,EAClBC,OAA8B,EACR;EAAA,IAAAC,gBAAA;EACtB,MAAMC,OAAO,GAAGF,OAAO,aAAPA,OAAO,wBAAAC,gBAAA,GAAPD,OAAO,CAAEG,OAAO,cAAAF,gBAAA,uBAAhBA,gBAAA,CAAkBC,OAAO;EACzC,MAAME,IAAI,GAAG,MAAMP,QAAQ,CAACK,OAAO,CAAC;EAEpC,MAAMG,aAAa,GAAGC,UAAU,CAACP,KAAK,CAAC;EAEvC,MAAMQ,gBAAgB,GAAG,IAAIH,IAAI,CAACI,uBAAuB,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC;EACnE,MAAMC,YAAY,GAAGN,IAAI,CAACO,YAAY,CAACN,aAAa,EAAEE,gBAAgB,CAAC;EACvE,OAAOG,YAAY,CAACE,MAAM,CAACC,KAAK,CAC9BH,YAAY,CAACI,UAAU,EACvBJ,YAAY,CAACK,UAAU,GAAGL,YAAY,CAACI,UACzC,CAAC;AACH;AASA,OAAO,SAASR,UAAUA,CAACP,KAAkB,EAAc;EACzD,OAAOH,KAAK,CAACoB,uBAAuB,CAACC,QAAQ,CAAClB,KAAK,CAAC,CAACmB,YAAY,CAAC,IAAI,CAAC;AACzE"}
@@ -1,10 +1,10 @@
1
1
  import type { LoaderOptions } from '@loaders.gl/loader-utils';
2
- import { Table as ArrowTable } from 'apache-arrow';
2
+ import * as arrow from 'apache-arrow';
3
3
  export type ParquetWasmLoaderOptions = LoaderOptions & {
4
4
  parquet?: {
5
5
  type?: 'arrow-table';
6
6
  wasmUrl?: string;
7
7
  };
8
8
  };
9
- export declare function parseParquetWasm(arrayBuffer: ArrayBuffer, options?: ParquetWasmLoaderOptions): Promise<ArrowTable>;
9
+ export declare function parseParquetWasm(arrayBuffer: ArrayBuffer, options?: ParquetWasmLoaderOptions): Promise<arrow.Table>;
10
10
  //# sourceMappingURL=parse-parquet-wasm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/parse-parquet-wasm.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAC,KAAK,IAAI,UAAU,EAA0B,MAAM,cAAc,CAAC;AAG1E,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,aAAa,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,UAAU,CAAC,CAYrB"}
1
+ {"version":3,"file":"parse-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/parse-parquet-wasm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,aAAa,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAYtB"}
@@ -1,4 +1,4 @@
1
- import { Table as ArrowTable, RecordBatchStreamReader } from 'apache-arrow';
1
+ import * as arrow from 'apache-arrow';
2
2
  import { loadWasm } from "./load-wasm/load-wasm-node.js";
3
3
  export async function parseParquetWasm(arrayBuffer, options) {
4
4
  var _options$parquet;
@@ -11,11 +11,11 @@ export async function parseParquetWasm(arrayBuffer, options) {
11
11
  return arrowTable;
12
12
  }
13
13
  function tableFromIPC(input) {
14
- const reader = RecordBatchStreamReader.from(input);
14
+ const reader = arrow.RecordBatchStreamReader.from(input);
15
15
  const recordBatches = [];
16
16
  for (const recordBatch of reader) {
17
17
  recordBatches.push(recordBatch);
18
18
  }
19
- return new ArrowTable(recordBatches);
19
+ return new arrow.Table(recordBatches);
20
20
  }
21
21
  //# sourceMappingURL=parse-parquet-wasm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-parquet-wasm.js","names":["Table","ArrowTable","RecordBatchStreamReader","loadWasm","parseParquetWasm","arrayBuffer","options","_options$parquet","wasmUrl","parquet","wasm","arr","Uint8Array","arrowIPCUint8Arr","readParquet","arrowIPCBuffer","buffer","slice","byteOffset","byteLength","arrowTable","tableFromIPC","input","reader","from","recordBatches","recordBatch","push"],"sources":["../../../src/lib/wasm/parse-parquet-wasm.ts"],"sourcesContent":["// eslint-disable\nimport type {RecordBatch} from 'apache-arrow';\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {Table as ArrowTable, RecordBatchStreamReader} from 'apache-arrow';\nimport {loadWasm} from './load-wasm/load-wasm-node';\n\nexport type ParquetWasmLoaderOptions = LoaderOptions & {\n parquet?: {\n type?: 'arrow-table';\n wasmUrl?: string;\n };\n};\n\nexport async function parseParquetWasm(\n arrayBuffer: ArrayBuffer,\n options?: ParquetWasmLoaderOptions\n): Promise<ArrowTable> {\n const wasmUrl = options?.parquet?.wasmUrl;\n const wasm = await loadWasm(wasmUrl);\n\n const arr = new Uint8Array(arrayBuffer);\n const arrowIPCUint8Arr = wasm.readParquet(arr);\n const arrowIPCBuffer = arrowIPCUint8Arr.buffer.slice(\n arrowIPCUint8Arr.byteOffset,\n arrowIPCUint8Arr.byteLength + arrowIPCUint8Arr.byteOffset\n );\n const arrowTable = tableFromIPC(arrowIPCBuffer);\n return arrowTable;\n}\n\n/**\n * Deserialize the IPC format into a {@link Table}. This function is a\n * convenience wrapper for {@link RecordBatchReader}. Opposite of {@link tableToIPC}.\n */\nfunction tableFromIPC(input: ArrayBuffer): ArrowTable {\n const reader = RecordBatchStreamReader.from(input);\n const recordBatches: RecordBatch[] = [];\n for (const recordBatch of reader) {\n recordBatches.push(recordBatch);\n }\n return new ArrowTable(recordBatches);\n}\n"],"mappings":"AAGA,SAAQA,KAAK,IAAIC,UAAU,EAAEC,uBAAuB,QAAO,cAAc;AAAC,SAClEC,QAAQ;AAShB,OAAO,eAAeC,gBAAgBA,CACpCC,WAAwB,EACxBC,OAAkC,EACb;EAAA,IAAAC,gBAAA;EACrB,MAAMC,OAAO,GAAGF,OAAO,aAAPA,OAAO,wBAAAC,gBAAA,GAAPD,OAAO,CAAEG,OAAO,cAAAF,gBAAA,uBAAhBA,gBAAA,CAAkBC,OAAO;EACzC,MAAME,IAAI,GAAG,MAAMP,QAAQ,CAACK,OAAO,CAAC;EAEpC,MAAMG,GAAG,GAAG,IAAIC,UAAU,CAACP,WAAW,CAAC;EACvC,MAAMQ,gBAAgB,GAAGH,IAAI,CAACI,WAAW,CAACH,GAAG,CAAC;EAC9C,MAAMI,cAAc,GAAGF,gBAAgB,CAACG,MAAM,CAACC,KAAK,CAClDJ,gBAAgB,CAACK,UAAU,EAC3BL,gBAAgB,CAACM,UAAU,GAAGN,gBAAgB,CAACK,UACjD,CAAC;EACD,MAAME,UAAU,GAAGC,YAAY,CAACN,cAAc,CAAC;EAC/C,OAAOK,UAAU;AACnB;AAMA,SAASC,YAAYA,CAACC,KAAkB,EAAc;EACpD,MAAMC,MAAM,GAAGrB,uBAAuB,CAACsB,IAAI,CAACF,KAAK,CAAC;EAClD,MAAMG,aAA4B,GAAG,EAAE;EACvC,KAAK,MAAMC,WAAW,IAAIH,MAAM,EAAE;IAChCE,aAAa,CAACE,IAAI,CAACD,WAAW,CAAC;EACjC;EACA,OAAO,IAAIzB,UAAU,CAACwB,aAAa,CAAC;AACtC"}
1
+ {"version":3,"file":"parse-parquet-wasm.js","names":["arrow","loadWasm","parseParquetWasm","arrayBuffer","options","_options$parquet","wasmUrl","parquet","wasm","arr","Uint8Array","arrowIPCUint8Arr","readParquet","arrowIPCBuffer","buffer","slice","byteOffset","byteLength","arrowTable","tableFromIPC","input","reader","RecordBatchStreamReader","from","recordBatches","recordBatch","push","Table"],"sources":["../../../src/lib/wasm/parse-parquet-wasm.ts"],"sourcesContent":["// eslint-disable\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport * as arrow from 'apache-arrow';\nimport {loadWasm} from './load-wasm/load-wasm-node';\n\nexport type ParquetWasmLoaderOptions = LoaderOptions & {\n parquet?: {\n type?: 'arrow-table';\n wasmUrl?: string;\n };\n};\n\nexport async function parseParquetWasm(\n arrayBuffer: ArrayBuffer,\n options?: ParquetWasmLoaderOptions\n): Promise<arrow.Table> {\n const wasmUrl = options?.parquet?.wasmUrl;\n const wasm = await loadWasm(wasmUrl);\n\n const arr = new Uint8Array(arrayBuffer);\n const arrowIPCUint8Arr = wasm.readParquet(arr);\n const arrowIPCBuffer = arrowIPCUint8Arr.buffer.slice(\n arrowIPCUint8Arr.byteOffset,\n arrowIPCUint8Arr.byteLength + arrowIPCUint8Arr.byteOffset\n );\n const arrowTable = tableFromIPC(arrowIPCBuffer);\n return arrowTable;\n}\n\n/**\n * Deserialize the IPC format into a {@link Table}. This function is a\n * convenience wrapper for {@link RecordBatchReader}. Opposite of {@link tableToIPC}.\n */\nfunction tableFromIPC(input: ArrayBuffer): arrow.Table {\n const reader = arrow.RecordBatchStreamReader.from(input);\n const recordBatches: arrow.RecordBatch[] = [];\n for (const recordBatch of reader) {\n recordBatches.push(recordBatch);\n }\n return new arrow.Table(recordBatches);\n}\n"],"mappings":"AAEA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAAC,SAC9BC,QAAQ;AAShB,OAAO,eAAeC,gBAAgBA,CACpCC,WAAwB,EACxBC,OAAkC,EACZ;EAAA,IAAAC,gBAAA;EACtB,MAAMC,OAAO,GAAGF,OAAO,aAAPA,OAAO,wBAAAC,gBAAA,GAAPD,OAAO,CAAEG,OAAO,cAAAF,gBAAA,uBAAhBA,gBAAA,CAAkBC,OAAO;EACzC,MAAME,IAAI,GAAG,MAAMP,QAAQ,CAACK,OAAO,CAAC;EAEpC,MAAMG,GAAG,GAAG,IAAIC,UAAU,CAACP,WAAW,CAAC;EACvC,MAAMQ,gBAAgB,GAAGH,IAAI,CAACI,WAAW,CAACH,GAAG,CAAC;EAC9C,MAAMI,cAAc,GAAGF,gBAAgB,CAACG,MAAM,CAACC,KAAK,CAClDJ,gBAAgB,CAACK,UAAU,EAC3BL,gBAAgB,CAACM,UAAU,GAAGN,gBAAgB,CAACK,UACjD,CAAC;EACD,MAAME,UAAU,GAAGC,YAAY,CAACN,cAAc,CAAC;EAC/C,OAAOK,UAAU;AACnB;AAMA,SAASC,YAAYA,CAACC,KAAkB,EAAe;EACrD,MAAMC,MAAM,GAAGrB,KAAK,CAACsB,uBAAuB,CAACC,IAAI,CAACH,KAAK,CAAC;EACxD,MAAMI,aAAkC,GAAG,EAAE;EAC7C,KAAK,MAAMC,WAAW,IAAIJ,MAAM,EAAE;IAChCG,aAAa,CAACE,IAAI,CAACD,WAAW,CAAC;EACjC;EACA,OAAO,IAAIzB,KAAK,CAAC2B,KAAK,CAACH,aAAa,CAAC;AACvC"}
@@ -1,5 +1,5 @@
1
1
  import type { Loader, LoaderOptions } from '@loaders.gl/loader-utils';
2
- import type { Table as ArrowTable } from 'apache-arrow';
2
+ import type * as arrow from 'apache-arrow';
3
3
  /** Parquet WASM loader options */
4
4
  export type ParquetWasmLoaderOptions = LoaderOptions & {
5
5
  parquet?: {
@@ -8,5 +8,5 @@ export type ParquetWasmLoaderOptions = LoaderOptions & {
8
8
  };
9
9
  };
10
10
  /** Parquet WASM table loader */
11
- export declare const ParquetWasmLoader: Loader<ArrowTable, never, ParquetWasmLoaderOptions>;
11
+ export declare const ParquetWasmLoader: Loader<arrow.Table, never, ParquetWasmLoaderOptions>;
12
12
  //# sourceMappingURL=parquet-wasm-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parquet-wasm-loader.d.ts","sourceRoot":"","sources":["../src/parquet-wasm-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC;AAMtD,kCAAkC;AAClC,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,aAAa,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,gCAAgC;AAChC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,wBAAwB,CAiBjF,CAAC"}
1
+ {"version":3,"file":"parquet-wasm-loader.d.ts","sourceRoot":"","sources":["../src/parquet-wasm-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAM3C,kCAAkC;AAClC,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,aAAa,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,gCAAgC;AAChC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,wBAAwB,CAiBlF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parquet-wasm-loader.js","names":["VERSION","__VERSION__","ParquetWasmLoader","name","id","module","version","worker","category","extensions","mimeTypes","binary","tests","options","parquet","type","wasmUrl"],"sources":["../src/parquet-wasm-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {Table as ArrowTable} from 'apache-arrow';\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\n/** Parquet WASM loader options */\nexport type ParquetWasmLoaderOptions = LoaderOptions & {\n parquet?: {\n type?: 'arrow-table';\n wasmUrl?: string;\n };\n};\n\n/** Parquet WASM table loader */\nexport const ParquetWasmLoader: Loader<ArrowTable, never, ParquetWasmLoaderOptions> = {\n name: 'Apache Parquet',\n id: 'parquet-wasm',\n module: 'parquet',\n version: VERSION,\n worker: false,\n category: 'table',\n extensions: ['parquet'],\n mimeTypes: ['application/octet-stream'],\n binary: true,\n tests: ['PAR1', 'PARE'],\n options: {\n parquet: {\n type: 'arrow-table',\n wasmUrl: 'https://unpkg.com/parquet-wasm@0.3.1/esm2/arrow1_bg.wasm'\n }\n }\n};\n"],"mappings":"AAQA,MAAMA,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAW3E,OAAO,MAAMC,iBAAsE,GAAG;EACpFC,IAAI,EAAE,gBAAgB;EACtBC,EAAE,EAAE,cAAc;EAClBC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEN,OAAO;EAChBO,MAAM,EAAE,KAAK;EACbC,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;EACvBC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,IAAI,EAAE,aAAa;MACnBC,OAAO,EAAE;IACX;EACF;AACF,CAAC"}
1
+ {"version":3,"file":"parquet-wasm-loader.js","names":["VERSION","__VERSION__","ParquetWasmLoader","name","id","module","version","worker","category","extensions","mimeTypes","binary","tests","options","parquet","type","wasmUrl"],"sources":["../src/parquet-wasm-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type * as arrow from 'apache-arrow';\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\n/** Parquet WASM loader options */\nexport type ParquetWasmLoaderOptions = LoaderOptions & {\n parquet?: {\n type?: 'arrow-table';\n wasmUrl?: string;\n };\n};\n\n/** Parquet WASM table loader */\nexport const ParquetWasmLoader: Loader<arrow.Table, never, ParquetWasmLoaderOptions> = {\n name: 'Apache Parquet',\n id: 'parquet-wasm',\n module: 'parquet',\n version: VERSION,\n worker: false,\n category: 'table',\n extensions: ['parquet'],\n mimeTypes: ['application/octet-stream'],\n binary: true,\n tests: ['PAR1', 'PARE'],\n options: {\n parquet: {\n type: 'arrow-table',\n wasmUrl: 'https://unpkg.com/parquet-wasm@0.3.1/esm2/arrow1_bg.wasm'\n }\n }\n};\n"],"mappings":"AAQA,MAAMA,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAW3E,OAAO,MAAMC,iBAAuE,GAAG;EACrFC,IAAI,EAAE,gBAAgB;EACtBC,EAAE,EAAE,cAAc;EAClBC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEN,OAAO;EAChBO,MAAM,EAAE,KAAK;EACbC,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;EACvBC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,IAAI,EAAE,aAAa;MACnBC,OAAO,EAAE;IACX;EACF;AACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { Writer } from '@loaders.gl/loader-utils';
2
2
  import { ParquetWriterOptions } from './lib/wasm/encode-parquet-wasm';
3
- import type { Table as ArrowTable } from 'apache-arrow';
3
+ import type * as arrow from 'apache-arrow';
4
4
  /** Parquet WASM writer */
5
- export declare const ParquetWasmWriter: Writer<ArrowTable, never, ParquetWriterOptions>;
5
+ export declare const ParquetWasmWriter: Writer<arrow.Table, never, ParquetWriterOptions>;
6
6
  //# sourceMappingURL=parquet-wasm-writer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parquet-wasm-writer.d.ts","sourceRoot":"","sources":["../src/parquet-wasm-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAS,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC;AAMtD,0BAA0B;AAC1B,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,oBAAoB,CAc7E,CAAC"}
1
+ {"version":3,"file":"parquet-wasm-writer.d.ts","sourceRoot":"","sources":["../src/parquet-wasm-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAS,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAM3C,0BAA0B;AAC1B,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,oBAAoB,CAc9E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parquet-wasm-writer.js","names":["encode","VERSION","__VERSION__","ParquetWasmWriter","name","id","module","version","extensions","mimeTypes","binary","options","parquet","wasmUrl"],"sources":["../src/parquet-wasm-writer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Writer} from '@loaders.gl/loader-utils';\nimport {encode, ParquetWriterOptions} from './lib/wasm/encode-parquet-wasm';\nimport type {Table as ArrowTable} from 'apache-arrow';\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\n/** Parquet WASM writer */\nexport const ParquetWasmWriter: Writer<ArrowTable, never, ParquetWriterOptions> = {\n name: 'Apache Parquet',\n id: 'parquet-wasm',\n module: 'parquet',\n version: VERSION,\n extensions: ['parquet'],\n mimeTypes: ['application/octet-stream'],\n encode,\n binary: true,\n options: {\n parquet: {\n wasmUrl: 'https://unpkg.com/parquet-wasm@0.3.1/esm2/arrow1_bg.wasm'\n }\n }\n};\n"],"mappings":"SAIQA,MAAM;AAKd,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAG3E,OAAO,MAAMC,iBAAkE,GAAG;EAChFC,IAAI,EAAE,gBAAgB;EACtBC,EAAE,EAAE,cAAc;EAClBC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCT,MAAM;EACNU,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,OAAO,EAAE;IACX;EACF;AACF,CAAC"}
1
+ {"version":3,"file":"parquet-wasm-writer.js","names":["encode","VERSION","__VERSION__","ParquetWasmWriter","name","id","module","version","extensions","mimeTypes","binary","options","parquet","wasmUrl"],"sources":["../src/parquet-wasm-writer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Writer} from '@loaders.gl/loader-utils';\nimport {encode, ParquetWriterOptions} from './lib/wasm/encode-parquet-wasm';\nimport type * as arrow from 'apache-arrow';\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\n/** Parquet WASM writer */\nexport const ParquetWasmWriter: Writer<arrow.Table, never, ParquetWriterOptions> = {\n name: 'Apache Parquet',\n id: 'parquet-wasm',\n module: 'parquet',\n version: VERSION,\n extensions: ['parquet'],\n mimeTypes: ['application/octet-stream'],\n encode,\n binary: true,\n options: {\n parquet: {\n wasmUrl: 'https://unpkg.com/parquet-wasm@0.3.1/esm2/arrow1_bg.wasm'\n }\n }\n};\n"],"mappings":"SAIQA,MAAM;AAKd,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAG3E,OAAO,MAAMC,iBAAmE,GAAG;EACjFC,IAAI,EAAE,gBAAgB;EACtBC,EAAE,EAAE,cAAc;EAClBC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCT,MAAM;EACNU,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,OAAO,EAAE;IACX;EACF;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parquet-writer.d.ts","sourceRoot":"","sources":["../src/parquet-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAMrD,MAAM,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEtC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,oBAAoB,CAUzE,CAAC"}
1
+ {"version":3,"file":"parquet-writer.d.ts","sourceRoot":"","sources":["../src/parquet-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAMrD,MAAM,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEtC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,oBAAoB,CAWzE,CAAC"}
@@ -6,9 +6,10 @@ export const ParquetWriter = {
6
6
  version: VERSION,
7
7
  extensions: ['parquet'],
8
8
  mimeTypes: ['application/octet-stream'],
9
- encodeSync,
10
9
  binary: true,
11
- options: {}
10
+ options: {},
11
+ encode: async (data, options) => encodeSync(data, options),
12
+ encodeSync
12
13
  };
13
14
  function encodeSync(data, options) {
14
15
  return new ArrayBuffer(0);
@@ -1 +1 @@
1
- {"version":3,"file":"parquet-writer.js","names":["VERSION","__VERSION__","ParquetWriter","name","id","module","version","extensions","mimeTypes","encodeSync","binary","options","data","ArrayBuffer"],"sources":["../src/parquet-writer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Writer} from '@loaders.gl/loader-utils';\nimport {Table, TableBatch} from '@loaders.gl/schema';\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 ParquetWriterOptions = {};\n\nexport const ParquetWriter: Writer<Table, TableBatch, ParquetWriterOptions> = {\n name: 'Apache Parquet',\n id: 'parquet',\n module: 'parquet',\n version: VERSION,\n extensions: ['parquet'],\n mimeTypes: ['application/octet-stream'],\n encodeSync,\n binary: true,\n options: {}\n};\n\nfunction encodeSync(data, options?: ParquetWriterOptions) {\n return new ArrayBuffer(0);\n}\n"],"mappings":"AAQA,MAAMA,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAI3E,OAAO,MAAMC,aAA8D,GAAG;EAC5EC,IAAI,EAAE,gBAAgB;EACtBC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,UAAU;EACVC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAASF,UAAUA,CAACG,IAAI,EAAED,OAA8B,EAAE;EACxD,OAAO,IAAIE,WAAW,CAAC,CAAC,CAAC;AAC3B"}
1
+ {"version":3,"file":"parquet-writer.js","names":["VERSION","__VERSION__","ParquetWriter","name","id","module","version","extensions","mimeTypes","binary","options","encode","data","encodeSync","ArrayBuffer"],"sources":["../src/parquet-writer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Writer} from '@loaders.gl/loader-utils';\nimport {Table, TableBatch} from '@loaders.gl/schema';\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 ParquetWriterOptions = {};\n\nexport const ParquetWriter: Writer<Table, TableBatch, ParquetWriterOptions> = {\n name: 'Apache Parquet',\n id: 'parquet',\n module: 'parquet',\n version: VERSION,\n extensions: ['parquet'],\n mimeTypes: ['application/octet-stream'],\n binary: true,\n options: {},\n encode: async (data, options) => encodeSync(data, options),\n encodeSync\n};\n\nfunction encodeSync(data, options?: ParquetWriterOptions) {\n return new ArrayBuffer(0);\n}\n"],"mappings":"AAQA,MAAMA,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAI3E,OAAO,MAAMC,aAA8D,GAAG;EAC5EC,IAAI,EAAE,gBAAgB;EACtBC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,MAAAA,CAAOC,IAAI,EAAEF,OAAO,KAAKG,UAAU,CAACD,IAAI,EAAEF,OAAO,CAAC;EAC1DG;AACF,CAAC;AAED,SAASA,UAAUA,CAACD,IAAI,EAAEF,OAA8B,EAAE;EACxD,OAAO,IAAII,WAAW,CAAC,CAAC,CAAC;AAC3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/parquet",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Framework-independent loader for Apache Parquet files",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,12 +57,12 @@
57
57
  "base64-js and ieee754 are used by buffer polyfill"
58
58
  ],
59
59
  "dependencies": {
60
- "@loaders.gl/bson": "4.0.1",
61
- "@loaders.gl/compression": "4.0.1",
62
- "@loaders.gl/gis": "4.0.1",
63
- "@loaders.gl/loader-utils": "4.0.1",
64
- "@loaders.gl/schema": "4.0.1",
65
- "@loaders.gl/wkt": "4.0.1",
60
+ "@loaders.gl/bson": "4.0.2",
61
+ "@loaders.gl/compression": "4.0.2",
62
+ "@loaders.gl/gis": "4.0.2",
63
+ "@loaders.gl/loader-utils": "4.0.2",
64
+ "@loaders.gl/schema": "4.0.2",
65
+ "@loaders.gl/wkt": "4.0.2",
66
66
  "async-mutex": "^0.2.2",
67
67
  "base64-js": "^1.3.1",
68
68
  "brotli": "^1.3.2",
@@ -88,5 +88,5 @@
88
88
  "@types/varint": "^5.0.0",
89
89
  "apache-arrow": "^13.0.0"
90
90
  },
91
- "gitHead": "765e5a26a6bf3f2cc02cabffc4a1e3665ec92a53"
91
+ "gitHead": "471058d109d5652f28c32c1f296fd632f9a5c806"
92
92
  }
package/src/index.ts CHANGED
@@ -12,7 +12,7 @@ import type {
12
12
  GeoJSONTable,
13
13
  GeoJSONTableBatch
14
14
  } from '@loaders.gl/schema';
15
- // import type {Table as ApacheArrowTable} from 'apache-arrow';
15
+ // import type * as arrow from 'apache-arrow';
16
16
 
17
17
  // ParquetLoader
18
18
 
@@ -59,7 +59,7 @@ export const ParquetColumnarLoader: LoaderWithParser<
59
59
  };
60
60
 
61
61
  // export const ParquetWasmLoader: LoaderWithParser<
62
- // ApacheArrowTable,
62
+ // arrow.Table,
63
63
  // never,
64
64
  // ParquetWasmLoaderOptions
65
65
  // > = {
@@ -1,7 +1,6 @@
1
- import type {Table} from 'apache-arrow';
2
1
  import type {WriterOptions} from '@loaders.gl/loader-utils';
3
2
 
4
- import {RecordBatchStreamWriter} from 'apache-arrow';
3
+ import * as arrow from 'apache-arrow';
5
4
  import {loadWasm} from './load-wasm';
6
5
 
7
6
  export type ParquetWriterOptions = WriterOptions & {
@@ -11,9 +10,12 @@ export type ParquetWriterOptions = WriterOptions & {
11
10
  };
12
11
 
13
12
  /**
14
- * Encode Arrow Table to Parquet buffer
13
+ * Encode Arrow arrow.Table to Parquet buffer
15
14
  */
16
- export async function encode(table: Table, options?: ParquetWriterOptions): Promise<ArrayBuffer> {
15
+ export async function encode(
16
+ table: arrow.Table,
17
+ options?: ParquetWriterOptions
18
+ ): Promise<ArrayBuffer> {
17
19
  const wasmUrl = options?.parquet?.wasmUrl;
18
20
  const wasm = await loadWasm(wasmUrl);
19
21
 
@@ -28,13 +30,12 @@ export async function encode(table: Table, options?: ParquetWriterOptions): Prom
28
30
  }
29
31
 
30
32
  /**
31
- * Serialize a {@link Table} to the IPC format. This function is a convenience
32
- * wrapper for {@link RecordBatchStreamWriter} and {@link RecordBatchFileWriter}.
33
+ * Serialize a table to the IPC format. This function is a convenience
33
34
  * Opposite of {@link tableFromIPC}.
34
35
  *
35
- * @param table The Table to serialize.
36
- * @param type Whether to serialize the Table as a file or a stream.
36
+ * @param table The arrow.Table to serialize.
37
+ * @param type Whether to serialize the arrow.Table as a file or a stream.
37
38
  */
38
- export function tableToIPC(table: Table): Uint8Array {
39
- return RecordBatchStreamWriter.writeAll(table).toUint8Array(true);
39
+ export function tableToIPC(table: arrow.Table): Uint8Array {
40
+ return arrow.RecordBatchStreamWriter.writeAll(table).toUint8Array(true);
40
41
  }
@@ -1,7 +1,6 @@
1
1
  // eslint-disable
2
- import type {RecordBatch} from 'apache-arrow';
3
2
  import type {LoaderOptions} from '@loaders.gl/loader-utils';
4
- import {Table as ArrowTable, RecordBatchStreamReader} from 'apache-arrow';
3
+ import * as arrow from 'apache-arrow';
5
4
  import {loadWasm} from './load-wasm/load-wasm-node';
6
5
 
7
6
  export type ParquetWasmLoaderOptions = LoaderOptions & {
@@ -14,7 +13,7 @@ export type ParquetWasmLoaderOptions = LoaderOptions & {
14
13
  export async function parseParquetWasm(
15
14
  arrayBuffer: ArrayBuffer,
16
15
  options?: ParquetWasmLoaderOptions
17
- ): Promise<ArrowTable> {
16
+ ): Promise<arrow.Table> {
18
17
  const wasmUrl = options?.parquet?.wasmUrl;
19
18
  const wasm = await loadWasm(wasmUrl);
20
19
 
@@ -32,11 +31,11 @@ export async function parseParquetWasm(
32
31
  * Deserialize the IPC format into a {@link Table}. This function is a
33
32
  * convenience wrapper for {@link RecordBatchReader}. Opposite of {@link tableToIPC}.
34
33
  */
35
- function tableFromIPC(input: ArrayBuffer): ArrowTable {
36
- const reader = RecordBatchStreamReader.from(input);
37
- const recordBatches: RecordBatch[] = [];
34
+ function tableFromIPC(input: ArrayBuffer): arrow.Table {
35
+ const reader = arrow.RecordBatchStreamReader.from(input);
36
+ const recordBatches: arrow.RecordBatch[] = [];
38
37
  for (const recordBatch of reader) {
39
38
  recordBatches.push(recordBatch);
40
39
  }
41
- return new ArrowTable(recordBatches);
40
+ return new arrow.Table(recordBatches);
42
41
  }
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) vis.gl contributors
3
3
 
4
4
  import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
5
- import type {Table as ArrowTable} from 'apache-arrow';
5
+ import type * as arrow from 'apache-arrow';
6
6
 
7
7
  // __VERSION__ is injected by babel-plugin-version-inline
8
8
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -17,7 +17,7 @@ export type ParquetWasmLoaderOptions = LoaderOptions & {
17
17
  };
18
18
 
19
19
  /** Parquet WASM table loader */
20
- export const ParquetWasmLoader: Loader<ArrowTable, never, ParquetWasmLoaderOptions> = {
20
+ export const ParquetWasmLoader: Loader<arrow.Table, never, ParquetWasmLoaderOptions> = {
21
21
  name: 'Apache Parquet',
22
22
  id: 'parquet-wasm',
23
23
  module: 'parquet',
@@ -3,14 +3,14 @@
3
3
 
4
4
  import type {Writer} from '@loaders.gl/loader-utils';
5
5
  import {encode, ParquetWriterOptions} from './lib/wasm/encode-parquet-wasm';
6
- import type {Table as ArrowTable} from 'apache-arrow';
6
+ import type * as arrow from 'apache-arrow';
7
7
 
8
8
  // __VERSION__ is injected by babel-plugin-version-inline
9
9
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
10
10
  const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
11
11
 
12
12
  /** Parquet WASM writer */
13
- export const ParquetWasmWriter: Writer<ArrowTable, never, ParquetWriterOptions> = {
13
+ export const ParquetWasmWriter: Writer<arrow.Table, never, ParquetWriterOptions> = {
14
14
  name: 'Apache Parquet',
15
15
  id: 'parquet-wasm',
16
16
  module: 'parquet',
@@ -17,9 +17,10 @@ export const ParquetWriter: Writer<Table, TableBatch, ParquetWriterOptions> = {
17
17
  version: VERSION,
18
18
  extensions: ['parquet'],
19
19
  mimeTypes: ['application/octet-stream'],
20
- encodeSync,
21
20
  binary: true,
22
- options: {}
21
+ options: {},
22
+ encode: async (data, options) => encodeSync(data, options),
23
+ encodeSync
23
24
  };
24
25
 
25
26
  function encodeSync(data, options?: ParquetWriterOptions) {