@loaders.gl/parquet 4.2.0-alpha.4 → 4.2.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/index.cjs +269 -616
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/lib/arrow/convert-columns-to-row-group.js +1 -2
- package/dist/lib/arrow/convert-row-group-to-columns.js +8 -6
- package/dist/lib/arrow/convert-schema-from-parquet.d.ts +3 -3
- package/dist/lib/arrow/convert-schema-from-parquet.d.ts.map +1 -1
- package/dist/lib/arrow/convert-schema-from-parquet.js +71 -82
- package/dist/lib/arrow/convert-schema-to-parquet.d.ts +1 -1
- package/dist/lib/arrow/convert-schema-to-parquet.d.ts.map +1 -1
- package/dist/lib/arrow/convert-schema-to-parquet.js +65 -35
- package/dist/lib/constants.js +14 -1
- package/dist/lib/parsers/get-parquet-schema.d.ts +1 -1
- package/dist/lib/parsers/get-parquet-schema.d.ts.map +1 -1
- package/dist/lib/parsers/get-parquet-schema.js +9 -7
- package/dist/lib/parsers/parse-geoparquet.d.ts +1 -1
- package/dist/lib/parsers/parse-geoparquet.d.ts.map +1 -1
- package/dist/lib/parsers/parse-geoparquet.js +47 -45
- package/dist/lib/parsers/parse-parquet-to-columns.d.ts +1 -1
- package/dist/lib/parsers/parse-parquet-to-columns.d.ts.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-columns.js +36 -25
- package/dist/lib/parsers/parse-parquet.d.ts +1 -1
- package/dist/lib/parsers/parse-parquet.d.ts.map +1 -1
- package/dist/lib/parsers/parse-parquet.js +62 -50
- package/dist/lib/wasm/encode-parquet-wasm.d.ts +1 -1
- package/dist/lib/wasm/encode-parquet-wasm.d.ts.map +1 -1
- package/dist/lib/wasm/encode-parquet-wasm.js +49 -12
- package/dist/lib/wasm/load-wasm.js +13 -10
- package/dist/lib/wasm/parse-parquet-wasm.d.ts +1 -1
- package/dist/lib/wasm/parse-parquet-wasm.d.ts.map +1 -1
- package/dist/lib/wasm/parse-parquet-wasm.js +19 -15
- package/dist/parquet-loader.d.ts +1 -1
- package/dist/parquet-loader.d.ts.map +1 -1
- package/dist/parquet-loader.js +77 -64
- package/dist/parquet-wasm-loader.js +25 -28
- package/dist/parquet-wasm-writer.js +19 -23
- package/dist/parquet-writer.js +16 -12
- package/dist/parquetjs/codecs/declare.d.ts +1 -1
- package/dist/parquetjs/codecs/declare.d.ts.map +1 -1
- package/dist/parquetjs/codecs/declare.js +0 -1
- package/dist/parquetjs/codecs/dictionary.js +4 -8
- package/dist/parquetjs/codecs/index.d.ts +3 -3
- package/dist/parquetjs/codecs/index.d.ts.map +1 -1
- package/dist/parquetjs/codecs/index.js +20 -17
- package/dist/parquetjs/codecs/plain.d.ts +2 -2
- package/dist/parquetjs/codecs/plain.d.ts.map +1 -1
- package/dist/parquetjs/codecs/plain.js +166 -162
- package/dist/parquetjs/codecs/rle.d.ts +2 -2
- package/dist/parquetjs/codecs/rle.d.ts.map +1 -1
- package/dist/parquetjs/codecs/rle.js +124 -105
- package/dist/parquetjs/compression.d.ts +1 -1
- package/dist/parquetjs/compression.d.ts.map +1 -1
- package/dist/parquetjs/compression.js +157 -43
- package/dist/parquetjs/encoder/parquet-encoder.d.ts +3 -3
- package/dist/parquetjs/encoder/parquet-encoder.d.ts.map +1 -1
- package/dist/parquetjs/encoder/parquet-encoder.js +406 -275
- package/dist/parquetjs/parquet-thrift/BoundaryOrder.js +12 -7
- package/dist/parquetjs/parquet-thrift/BsonType.js +31 -27
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnChunk.js +175 -166
- package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnIndex.js +178 -166
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts +6 -6
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.js +359 -333
- package/dist/parquetjs/parquet-thrift/ColumnOrder.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnOrder.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnOrder.js +73 -68
- package/dist/parquetjs/parquet-thrift/CompressionCodec.js +17 -12
- package/dist/parquetjs/parquet-thrift/ConvertedType.js +31 -26
- package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.js +136 -124
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.js +198 -181
- package/dist/parquetjs/parquet-thrift/DateType.js +31 -27
- package/dist/parquetjs/parquet-thrift/DecimalType.js +76 -69
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.js +93 -86
- package/dist/parquetjs/parquet-thrift/Encoding.js +17 -12
- package/dist/parquetjs/parquet-thrift/EnumType.js +31 -27
- package/dist/parquetjs/parquet-thrift/FieldRepetitionType.js +12 -7
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts +4 -4
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/FileMetaData.js +217 -205
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.js +31 -27
- package/dist/parquetjs/parquet-thrift/IntType.js +76 -69
- package/dist/parquetjs/parquet-thrift/JsonType.js +31 -27
- package/dist/parquetjs/parquet-thrift/KeyValue.js +73 -67
- package/dist/parquetjs/parquet-thrift/ListType.js +31 -27
- package/dist/parquetjs/parquet-thrift/LogicalType.d.ts +13 -13
- package/dist/parquetjs/parquet-thrift/LogicalType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.js +325 -344
- package/dist/parquetjs/parquet-thrift/MapType.js +31 -27
- package/dist/parquetjs/parquet-thrift/MicroSeconds.js +31 -27
- package/dist/parquetjs/parquet-thrift/MilliSeconds.js +31 -27
- package/dist/parquetjs/parquet-thrift/NullType.js +31 -27
- package/dist/parquetjs/parquet-thrift/OffsetIndex.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/OffsetIndex.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/OffsetIndex.js +66 -60
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.js +98 -88
- package/dist/parquetjs/parquet-thrift/PageHeader.d.ts +5 -5
- package/dist/parquetjs/parquet-thrift/PageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.js +185 -175
- package/dist/parquetjs/parquet-thrift/PageLocation.js +108 -96
- package/dist/parquetjs/parquet-thrift/PageType.js +13 -8
- package/dist/parquetjs/parquet-thrift/RowGroup.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/RowGroup.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/RowGroup.js +145 -133
- package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts +4 -4
- package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.js +211 -205
- package/dist/parquetjs/parquet-thrift/SortingColumn.js +98 -88
- package/dist/parquetjs/parquet-thrift/Statistics.js +143 -137
- package/dist/parquetjs/parquet-thrift/StringType.js +31 -27
- package/dist/parquetjs/parquet-thrift/TimeType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/TimeType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimeType.js +76 -69
- package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.js +94 -91
- package/dist/parquetjs/parquet-thrift/TimestampType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/TimestampType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimestampType.js +76 -69
- package/dist/parquetjs/parquet-thrift/Type.js +17 -12
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.js +31 -27
- package/dist/parquetjs/parquet-thrift/UUIDType.js +31 -27
- package/dist/parquetjs/parquet-thrift/index.d.ts +44 -44
- package/dist/parquetjs/parquet-thrift/index.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/index.js +6 -1
- package/dist/parquetjs/parser/decoders.d.ts +3 -3
- package/dist/parquetjs/parser/decoders.d.ts.map +1 -1
- package/dist/parquetjs/parser/decoders.js +306 -242
- package/dist/parquetjs/parser/parquet-reader.d.ts +3 -3
- package/dist/parquetjs/parser/parquet-reader.d.ts.map +1 -1
- package/dist/parquetjs/parser/parquet-reader.js +179 -157
- package/dist/parquetjs/schema/declare.d.ts +1 -1
- package/dist/parquetjs/schema/declare.d.ts.map +1 -1
- package/dist/parquetjs/schema/declare.js +6 -9
- package/dist/parquetjs/schema/schema.d.ts +1 -1
- package/dist/parquetjs/schema/schema.d.ts.map +1 -1
- package/dist/parquetjs/schema/schema.js +139 -120
- package/dist/parquetjs/schema/shred.d.ts +2 -2
- package/dist/parquetjs/schema/shred.d.ts.map +1 -1
- package/dist/parquetjs/schema/shred.js +301 -204
- package/dist/parquetjs/schema/types.d.ts +1 -1
- package/dist/parquetjs/schema/types.d.ts.map +1 -1
- package/dist/parquetjs/schema/types.js +328 -314
- package/dist/parquetjs/utils/file-utils.js +24 -23
- package/dist/parquetjs/utils/read-utils.d.ts +1 -1
- package/dist/parquetjs/utils/read-utils.d.ts.map +1 -1
- package/dist/parquetjs/utils/read-utils.js +79 -69
- package/dist/polyfills/buffer/buffer-polyfill.browser.js +8 -3
- package/dist/polyfills/buffer/buffer-polyfill.node.js +13 -8
- package/dist/polyfills/buffer/buffer.js +1750 -1367
- package/dist/polyfills/buffer/index.d.ts +3 -3
- package/dist/polyfills/buffer/index.d.ts.map +1 -1
- package/dist/polyfills/buffer/index.js +5 -1
- package/dist/polyfills/buffer/install-buffer-polyfill.js +2 -1
- package/dist/polyfills/util.js +4 -1
- package/dist/workers/parquet-worker.js +3 -1
- package/package.json +15 -13
- package/src/index.ts +1 -1
- package/src/lib/parsers/parse-parquet-to-columns.ts +1 -1
- package/src/lib/parsers/parse-parquet.ts +1 -1
- package/src/parquetjs/encoder/parquet-encoder.ts +2 -2
- package/src/parquetjs/parser/decoders.ts +2 -2
- package/src/parquetjs/parser/parquet-reader.ts +1 -1
- package/src/parquetjs/schema/schema.ts +1 -1
- package/src/parquetjs/utils/read-utils.ts +2 -2
- package/dist/index.js.map +0 -1
- package/dist/lib/arrow/convert-columns-to-row-group.js.map +0 -1
- package/dist/lib/arrow/convert-row-group-to-columns.js.map +0 -1
- package/dist/lib/arrow/convert-schema-from-parquet.js.map +0 -1
- package/dist/lib/arrow/convert-schema-to-parquet.js.map +0 -1
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/parsers/get-parquet-schema.js.map +0 -1
- package/dist/lib/parsers/parse-geoparquet.js.map +0 -1
- package/dist/lib/parsers/parse-parquet-to-columns.js.map +0 -1
- package/dist/lib/parsers/parse-parquet.js.map +0 -1
- package/dist/lib/wasm/encode-parquet-wasm.js.map +0 -1
- package/dist/lib/wasm/load-wasm.js.map +0 -1
- package/dist/lib/wasm/parse-parquet-wasm.js.map +0 -1
- package/dist/lib/wip/convert-schema-deep.java.disabled +0 -910
- package/dist/lib/wip/convert-schema-deep.rs.disabled +0 -976
- package/dist/parquet-loader.js.map +0 -1
- package/dist/parquet-wasm-loader.js.map +0 -1
- package/dist/parquet-wasm-writer.js.map +0 -1
- package/dist/parquet-writer.js.map +0 -1
- package/dist/parquetjs/LICENSE +0 -20
- package/dist/parquetjs/codecs/declare.js.map +0 -1
- package/dist/parquetjs/codecs/dictionary.js.map +0 -1
- package/dist/parquetjs/codecs/index.js.map +0 -1
- package/dist/parquetjs/codecs/plain.js.map +0 -1
- package/dist/parquetjs/codecs/rle.js.map +0 -1
- package/dist/parquetjs/compression.js.map +0 -1
- package/dist/parquetjs/encoder/parquet-encoder.js.map +0 -1
- package/dist/parquetjs/modules.d.ts +0 -21
- package/dist/parquetjs/parquet-thrift/BoundaryOrder.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/BsonType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/ColumnChunk.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/ColumnIndex.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/ColumnOrder.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/CompressionCodec.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/ConvertedType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/DateType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/Encoding.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/EnumType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/FieldRepetitionType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/FileMetaData.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/IntType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/JsonType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/ListType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/MapType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/NullType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/OffsetIndex.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/PageLocation.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/PageType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/RowGroup.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/Statistics.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/StringType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/TimeType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/TimestampType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/Type.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.js.map +0 -1
- package/dist/parquetjs/parquet-thrift/index.js.map +0 -1
- package/dist/parquetjs/parser/decoders.js.map +0 -1
- package/dist/parquetjs/parser/parquet-reader.js.map +0 -1
- package/dist/parquetjs/schema/declare.js.map +0 -1
- package/dist/parquetjs/schema/schema.js.map +0 -1
- package/dist/parquetjs/schema/shred.js.map +0 -1
- package/dist/parquetjs/schema/types.js.map +0 -1
- package/dist/parquetjs/utils/file-utils.js.map +0 -1
- package/dist/parquetjs/utils/read-utils.js.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.browser.js.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.node.js.map +0 -1
- package/dist/polyfills/buffer/buffer.js.map +0 -1
- package/dist/polyfills/buffer/index.js.map +0 -1
- package/dist/polyfills/buffer/install-buffer-polyfill.js.map +0 -1
- package/dist/polyfills/util.js.map +0 -1
- package/dist/workers/parquet-worker.js.map +0 -1
|
@@ -1,35 +1,46 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { ParquetReader } from "../../parquetjs/parser/parquet-reader.js";
|
|
2
5
|
import { materializeColumns } from "../../parquetjs/schema/shred.js";
|
|
3
6
|
import { getSchemaFromParquetReader } from "./get-parquet-schema.js";
|
|
4
7
|
import { installBufferPolyfill } from "../../polyfills/buffer/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
5
11
|
export async function parseParquetFileInColumns(file, options) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
installBufferPolyfill();
|
|
13
|
+
for await (const batch of parseParquetFileInColumnarBatches(file, options)) {
|
|
14
|
+
return {
|
|
15
|
+
shape: 'columnar-table',
|
|
16
|
+
schema: batch.schema,
|
|
17
|
+
data: batch.data
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
throw new Error('empty table');
|
|
15
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated
|
|
24
|
+
*/
|
|
16
25
|
export async function* parseParquetFileInColumnarBatches(file, options) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
const reader = new ParquetReader(file);
|
|
27
|
+
// Extract schema and geo metadata
|
|
28
|
+
const schema = await getSchemaFromParquetReader(reader);
|
|
29
|
+
const parquetSchema = await reader.getSchema();
|
|
30
|
+
// Iterate over row batches
|
|
31
|
+
const rowGroups = reader.rowGroupIterator(options?.parquet);
|
|
32
|
+
for await (const rowGroup of rowGroups) {
|
|
33
|
+
yield convertRowGroupToTableBatch(rowGroup, parquetSchema, schema);
|
|
34
|
+
}
|
|
24
35
|
}
|
|
25
36
|
function convertRowGroupToTableBatch(rowGroup, parquetSchema, schema) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
// const data = convertParquetRowGroupToColumns(schema, rowGroup);
|
|
38
|
+
const data = materializeColumns(parquetSchema, rowGroup);
|
|
39
|
+
return {
|
|
40
|
+
shape: 'columnar-table',
|
|
41
|
+
batchType: 'data',
|
|
42
|
+
schema,
|
|
43
|
+
data,
|
|
44
|
+
length: rowGroup.rowCount
|
|
45
|
+
};
|
|
34
46
|
}
|
|
35
|
-
//# sourceMappingURL=parse-parquet-to-columns.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReadableFile } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { ObjectRowTable, ObjectRowTableBatch } from '@loaders.gl/schema';
|
|
3
|
-
import type { ParquetLoaderOptions } from
|
|
3
|
+
import type { ParquetLoaderOptions } from "../../parquet-loader.js";
|
|
4
4
|
/**
|
|
5
5
|
* * Parse a parquet file using parquetjs
|
|
6
6
|
* @param file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-parquet.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-parquet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAE5E,OAAO,KAAK,EAAC,oBAAoB,EAAC,
|
|
1
|
+
{"version":3,"file":"parse-parquet.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-parquet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAE5E,OAAO,KAAK,EAAC,oBAAoB,EAAC,gCAA6B;AAM/D;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,cAAc,CAAC,CA0BzB;AAED;;;;GAIG;AACH,wBAAuB,yBAAyB,CAC9C,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,aAAa,CAAC,mBAAmB,CAAC,CAuBpC"}
|
|
@@ -1,60 +1,72 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { ParquetReader } from "../../parquetjs/parser/parquet-reader.js";
|
|
2
5
|
import { getSchemaFromParquetReader } from "./get-parquet-schema.js";
|
|
3
6
|
import { installBufferPolyfill } from "../../polyfills/buffer/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* * Parse a parquet file using parquetjs
|
|
9
|
+
* @param file
|
|
10
|
+
* @param options
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
4
13
|
export async function parseParquetFile(file, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
installBufferPolyfill();
|
|
15
|
+
const reader = new ParquetReader(file, {
|
|
16
|
+
preserveBinary: options?.parquet?.preserveBinary
|
|
17
|
+
});
|
|
18
|
+
const schema = await getSchemaFromParquetReader(reader);
|
|
19
|
+
const rows = [];
|
|
20
|
+
const rowBatches = reader.rowBatchIterator(options?.parquet);
|
|
21
|
+
for await (const rowBatch of rowBatches) {
|
|
22
|
+
// we have only one input batch so return
|
|
23
|
+
for (const row of rowBatch) {
|
|
24
|
+
rows.push(row);
|
|
25
|
+
}
|
|
16
26
|
}
|
|
17
|
-
}
|
|
18
|
-
const objectRowTable = {
|
|
19
|
-
shape: 'object-row-table',
|
|
20
|
-
schema,
|
|
21
|
-
data: rows
|
|
22
|
-
};
|
|
23
|
-
const shape = options === null || options === void 0 ? void 0 : (_options$parquet2 = options.parquet) === null || _options$parquet2 === void 0 ? void 0 : _options$parquet2.shape;
|
|
24
|
-
return convertTable(objectRowTable, shape);
|
|
25
|
-
}
|
|
26
|
-
export async function* parseParquetFileInBatches(file, options) {
|
|
27
|
-
var _options$parquet3;
|
|
28
|
-
const reader = new ParquetReader(file, {
|
|
29
|
-
preserveBinary: options === null || options === void 0 ? void 0 : (_options$parquet3 = options.parquet) === null || _options$parquet3 === void 0 ? void 0 : _options$parquet3.preserveBinary
|
|
30
|
-
});
|
|
31
|
-
const schema = await getSchemaFromParquetReader(reader);
|
|
32
|
-
const rowBatches = reader.rowBatchIterator(options === null || options === void 0 ? void 0 : options.parquet);
|
|
33
|
-
for await (const rows of rowBatches) {
|
|
34
|
-
var _options$parquet4;
|
|
35
27
|
const objectRowTable = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
shape: 'object-row-table',
|
|
29
|
+
schema,
|
|
30
|
+
data: rows
|
|
39
31
|
};
|
|
40
|
-
const shape = options
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
const shape = options?.parquet?.shape;
|
|
33
|
+
return convertTable(objectRowTable, shape);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Parse a parquet file in batches using parquetjs
|
|
37
|
+
* @param file
|
|
38
|
+
* @param options
|
|
39
|
+
*/
|
|
40
|
+
export async function* parseParquetFileInBatches(file, options) {
|
|
41
|
+
const reader = new ParquetReader(file, {
|
|
42
|
+
preserveBinary: options?.parquet?.preserveBinary
|
|
43
|
+
});
|
|
44
|
+
const schema = await getSchemaFromParquetReader(reader);
|
|
45
|
+
const rowBatches = reader.rowBatchIterator(options?.parquet);
|
|
46
|
+
for await (const rows of rowBatches) {
|
|
47
|
+
const objectRowTable = {
|
|
48
|
+
shape: 'object-row-table',
|
|
49
|
+
schema,
|
|
50
|
+
data: rows
|
|
51
|
+
};
|
|
52
|
+
const shape = options?.parquet?.shape;
|
|
53
|
+
const table = convertTable(objectRowTable, shape);
|
|
54
|
+
yield {
|
|
55
|
+
batchType: 'data',
|
|
56
|
+
schema,
|
|
57
|
+
...table,
|
|
58
|
+
length: rows.length
|
|
59
|
+
};
|
|
60
|
+
}
|
|
49
61
|
}
|
|
50
62
|
function convertTable(objectRowTable, shape) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
switch (shape) {
|
|
64
|
+
case 'object-row-table':
|
|
65
|
+
return objectRowTable;
|
|
66
|
+
// Hack until geoparquet fixes up forwarded shape
|
|
67
|
+
case 'geojson-table':
|
|
68
|
+
return objectRowTable;
|
|
69
|
+
default:
|
|
70
|
+
throw new Error(shape);
|
|
71
|
+
}
|
|
59
72
|
}
|
|
60
|
-
//# sourceMappingURL=parse-parquet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/encode-parquet-wasm.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAKlD,OAAO,KAAK,EAAC,oBAAoB,EAAC,
|
|
1
|
+
{"version":3,"file":"encode-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/encode-parquet-wasm.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAKlD,OAAO,KAAK,EAAC,oBAAoB,EAAC,qCAAkC;AAEpE;;GAEG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,WAAW,CAAC,CAsBtB"}
|
|
@@ -1,16 +1,53 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import * as arrow from 'apache-arrow';
|
|
2
5
|
import { loadWasm } from "./load-wasm.js";
|
|
6
|
+
/**
|
|
7
|
+
* Encode Arrow arrow.Table to Parquet buffer
|
|
8
|
+
*/
|
|
3
9
|
export async function encode(table, options) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const wasmUrl = options.parquet?.wasmUrl;
|
|
11
|
+
const wasm = await loadWasm(wasmUrl);
|
|
12
|
+
// Serialize the table to the IPC format.
|
|
13
|
+
const arrowTable = table.data;
|
|
14
|
+
const ipcStream = arrow.tableToIPC(arrowTable);
|
|
15
|
+
// Pass the IPC stream to the Parquet writer.
|
|
16
|
+
const wasmTable = wasm.Table.fromIPCStream(ipcStream);
|
|
17
|
+
const wasmProperties = new wasm.WriterPropertiesBuilder().build();
|
|
18
|
+
try {
|
|
19
|
+
const parquetBytes = wasm.writeParquet(wasmTable, wasmProperties);
|
|
20
|
+
// const parquetBytes = wasm.writeParquet(wasmTable, wasmProperties);
|
|
21
|
+
return parquetBytes.buffer.slice(parquetBytes.byteOffset, parquetBytes.byteLength + parquetBytes.byteOffset);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
// wasmTable.free();
|
|
25
|
+
// wasmProperties.free();
|
|
26
|
+
}
|
|
15
27
|
}
|
|
16
|
-
|
|
28
|
+
// type WriteOptions = {
|
|
29
|
+
// compression?: number;
|
|
30
|
+
// dictionaryEnabled?: boolean;
|
|
31
|
+
// encoding?: number;
|
|
32
|
+
// maxRowGroupSize?: number;
|
|
33
|
+
// maxStatisticsSize?: number;
|
|
34
|
+
// statisticsEnabled?: boolean;
|
|
35
|
+
// writeBatchSize?: number;
|
|
36
|
+
// dataPageSizeLimit?: number;
|
|
37
|
+
// dictionaryPageSizeLimit?: number;
|
|
38
|
+
// };
|
|
39
|
+
// columnCompression: Record<string, number>;
|
|
40
|
+
// columnDictionaryEnabled: Record<string, boolean>;
|
|
41
|
+
// columnEncoding: Record<string, number>;
|
|
42
|
+
// columnMaxStatisticsSize
|
|
43
|
+
// compression:Record<string, number>;
|
|
44
|
+
// setCreatedBy
|
|
45
|
+
// setDataPageSizeLimit
|
|
46
|
+
// setDictionaryEnabled
|
|
47
|
+
// setDictionaryPageSizeLimit
|
|
48
|
+
// setEncoding
|
|
49
|
+
// setMaxRowGroupSize
|
|
50
|
+
// setMaxStatisticsSize
|
|
51
|
+
// setStatisticsEnabled
|
|
52
|
+
// setWriteBatchSize
|
|
53
|
+
// setWriterVersion
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// eslint-disable-next-line import/default
|
|
1
5
|
import initWasm from 'parquet-wasm';
|
|
2
6
|
import * as parquetWasm from 'parquet-wasm';
|
|
3
7
|
import { PARQUET_WASM_URL } from "../constants.js";
|
|
4
8
|
let initializePromise;
|
|
5
|
-
export async function loadWasm() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
export async function loadWasm(wasmUrl = PARQUET_WASM_URL) {
|
|
10
|
+
if (!initializePromise && typeof initWasm === 'function') {
|
|
11
|
+
if (!wasmUrl) {
|
|
12
|
+
throw new Error('ParquetLoader: No wasmUrl provided');
|
|
13
|
+
}
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
initializePromise = initWasm(wasmUrl);
|
|
10
16
|
}
|
|
11
|
-
initializePromise
|
|
12
|
-
|
|
13
|
-
await initializePromise;
|
|
14
|
-
return parquetWasm;
|
|
17
|
+
await initializePromise;
|
|
18
|
+
return parquetWasm;
|
|
15
19
|
}
|
|
16
|
-
//# sourceMappingURL=load-wasm.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ArrowTable } from '@loaders.gl/arrow';
|
|
2
|
-
import type { ParquetWasmLoaderOptions } from
|
|
2
|
+
import type { ParquetWasmLoaderOptions } from "../../parquet-wasm-loader.js";
|
|
3
3
|
export declare function parseParquetWasm(arrayBuffer: ArrayBuffer, options: ParquetWasmLoaderOptions): Promise<ArrowTable>;
|
|
4
4
|
//# 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":"AAKA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAC,wBAAwB,EAAC,
|
|
1
|
+
{"version":3,"file":"parse-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/parse-parquet-wasm.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAC,wBAAwB,EAAC,qCAAkC;AAIxE,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,UAAU,CAAC,CAkBrB"}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { serializeArrowSchema } from '@loaders.gl/arrow';
|
|
2
5
|
import { loadWasm } from "./load-wasm.js";
|
|
3
6
|
import * as arrow from 'apache-arrow';
|
|
4
7
|
export async function parseParquetWasm(arrayBuffer, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
8
|
+
const arr = new Uint8Array(arrayBuffer);
|
|
9
|
+
const wasmUrl = options?.parquet?.wasmUrl;
|
|
10
|
+
const wasm = await loadWasm(wasmUrl);
|
|
11
|
+
const wasmTable = wasm.readParquet(arr);
|
|
12
|
+
try {
|
|
13
|
+
const ipcStream = wasmTable.intoIPCStream();
|
|
14
|
+
const arrowTable = arrow.tableFromIPC(ipcStream);
|
|
15
|
+
return {
|
|
16
|
+
shape: 'arrow-table',
|
|
17
|
+
schema: serializeArrowSchema(arrowTable.schema),
|
|
18
|
+
data: arrowTable
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
// wasmTable.free();
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
|
-
//# sourceMappingURL=parse-parquet-wasm.js.map
|
package/dist/parquet-loader.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Loader, LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { ObjectRowTable, ObjectRowTableBatch, GeoJSONTable, GeoJSONTableBatch, ColumnarTable, ColumnarTableBatch } from '@loaders.gl/schema';
|
|
3
|
-
export { Buffer } from
|
|
3
|
+
export { Buffer } from "./polyfills/buffer/install-buffer-polyfill.js";
|
|
4
4
|
/** Options for the parquet loader */
|
|
5
5
|
export type ParquetLoaderOptions = LoaderOptions & {
|
|
6
6
|
/** Options for the parquet loader */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parquet-loader.d.ts","sourceRoot":"","sources":["../src/parquet-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAC,MAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"parquet-loader.d.ts","sourceRoot":"","sources":["../src/parquet-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAC,MAAM,EAAC,sDAAmD;AAMlE,qCAAqC;AACrC,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,qCAAqC;IACrC,OAAO,CAAC,EAAE;QACR,qCAAqC;QACrC,KAAK,CAAC,EAAE,kBAAkB,GAAG,eAAe,CAAC;QAC7C,0FAA0F;QAC1F,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QACnC,0DAA0D;QAC1D,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,qFAAqF;QACrF,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gEAAgE;QAChE,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,cAAc,EACd,mBAAmB,EACnB,oBAAoB,CAqBrB,CAAC;AAEF,6BAA6B;AAC7B,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAC1C,cAAc,GAAG,YAAY,EAC7B,mBAAmB,GAAG,iBAAiB,EACvC,oBAAoB,CAQrB,CAAC;AAMF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,CAqB9F,CAAC;AAEJ,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAC7C,cAAc,GAAG,YAAY,EAC7B,mBAAmB,GAAG,iBAAiB,EACvC,oBAAoB,CAQrB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CAarB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAClD,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CAQrB,CAAC"}
|
package/dist/parquet-loader.js
CHANGED
|
@@ -1,85 +1,98 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { BlobFile } from '@loaders.gl/loader-utils';
|
|
2
5
|
import { parseParquetFile, parseParquetFileInBatches } from "./lib/parsers/parse-parquet.js";
|
|
3
6
|
import { parseGeoParquetFile, parseGeoParquetFileInBatches } from "./lib/parsers/parse-geoparquet.js";
|
|
4
7
|
import { parseParquetFileInColumns, parseParquetFileInColumnarBatches } from "./lib/parsers/parse-parquet-to-columns.js";
|
|
5
8
|
export { Buffer } from "./polyfills/buffer/install-buffer-polyfill.js";
|
|
9
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
11
|
const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
|
|
12
|
+
/**
|
|
13
|
+
* ParquetJS table loader
|
|
14
|
+
*/
|
|
7
15
|
export const ParquetWorkerLoader = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
name: 'Apache Parquet',
|
|
17
|
+
id: 'parquet',
|
|
18
|
+
module: 'parquet',
|
|
19
|
+
version: VERSION,
|
|
20
|
+
worker: true,
|
|
21
|
+
category: 'table',
|
|
22
|
+
extensions: ['parquet'],
|
|
23
|
+
mimeTypes: ['application/octet-stream'],
|
|
24
|
+
binary: true,
|
|
25
|
+
tests: ['PAR1', 'PARE'],
|
|
26
|
+
options: {
|
|
27
|
+
parquet: {
|
|
28
|
+
shape: 'object-row-table',
|
|
29
|
+
columnList: [],
|
|
30
|
+
geoparquet: true,
|
|
31
|
+
url: undefined,
|
|
32
|
+
preserveBinary: false
|
|
33
|
+
}
|
|
25
34
|
}
|
|
26
|
-
}
|
|
27
35
|
};
|
|
36
|
+
/** ParquetJS table loader */
|
|
28
37
|
export const ParquetLoader = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
...ParquetWorkerLoader,
|
|
39
|
+
parse: (arrayBuffer, options) => parseParquetFile(new BlobFile(arrayBuffer), options),
|
|
40
|
+
parseFile: parseParquetFile,
|
|
41
|
+
parseFileInBatches: parseParquetFileInBatches
|
|
33
42
|
};
|
|
43
|
+
// Defeat tree shaking
|
|
44
|
+
// @ts-ignore
|
|
34
45
|
ParquetLoader.Buffer = Buffer;
|
|
35
46
|
export const GeoParquetWorkerLoader = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
name: 'Apache Parquet',
|
|
48
|
+
id: 'parquet',
|
|
49
|
+
module: 'parquet',
|
|
50
|
+
version: VERSION,
|
|
51
|
+
worker: true,
|
|
52
|
+
category: 'table',
|
|
53
|
+
extensions: ['parquet'],
|
|
54
|
+
mimeTypes: ['application/octet-stream'],
|
|
55
|
+
binary: true,
|
|
56
|
+
tests: ['PAR1', 'PARE'],
|
|
57
|
+
options: {
|
|
58
|
+
parquet: {
|
|
59
|
+
shape: 'geojson-table',
|
|
60
|
+
columnList: [],
|
|
61
|
+
geoparquet: true,
|
|
62
|
+
url: undefined,
|
|
63
|
+
preserveBinary: false
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
|
-
}
|
|
55
66
|
};
|
|
67
|
+
/** ParquetJS table loader */
|
|
56
68
|
export const GeoParquetLoader = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
...GeoParquetWorkerLoader,
|
|
70
|
+
parse(arrayBuffer, options) {
|
|
71
|
+
return parseGeoParquetFile(new BlobFile(arrayBuffer), options);
|
|
72
|
+
},
|
|
73
|
+
parseFile: parseGeoParquetFile,
|
|
74
|
+
parseFileInBatches: parseGeoParquetFileInBatches
|
|
63
75
|
};
|
|
76
|
+
/** @deprecated Test to see if we can improve perf of parquetjs loader */
|
|
64
77
|
export const ParquetColumnarWorkerLoader = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
name: 'Apache Parquet',
|
|
79
|
+
id: 'parquet',
|
|
80
|
+
module: 'parquet',
|
|
81
|
+
version: VERSION,
|
|
82
|
+
worker: true,
|
|
83
|
+
category: 'table',
|
|
84
|
+
extensions: ['parquet'],
|
|
85
|
+
mimeTypes: ['application/octet-stream'],
|
|
86
|
+
binary: true,
|
|
87
|
+
tests: ['PAR1', 'PARE'],
|
|
88
|
+
options: ParquetLoader.options
|
|
76
89
|
};
|
|
90
|
+
/** @deprecated Test to see if we can improve perf of parquetjs loader */
|
|
77
91
|
export const ParquetColumnarLoader = {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
...ParquetColumnarWorkerLoader,
|
|
93
|
+
parse(arrayBuffer, options) {
|
|
94
|
+
return parseParquetFileInColumns(new BlobFile(arrayBuffer), options);
|
|
95
|
+
},
|
|
96
|
+
parseFile: parseParquetFileInColumns,
|
|
97
|
+
parseFileInBatches: parseParquetFileInColumnarBatches
|
|
84
98
|
};
|
|
85
|
-
//# sourceMappingURL=parquet-loader.js.map
|
|
@@ -1,35 +1,32 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { parseParquetWasm } from "./lib/wasm/parse-parquet-wasm.js";
|
|
2
5
|
import { VERSION, PARQUET_WASM_URL } from "./lib/constants.js";
|
|
6
|
+
/** Parquet WASM table loader */
|
|
3
7
|
export const ParquetWasmWorkerLoader = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
name: 'Apache Parquet',
|
|
9
|
+
id: 'parquet-wasm',
|
|
10
|
+
module: 'parquet',
|
|
11
|
+
version: VERSION,
|
|
12
|
+
worker: false,
|
|
13
|
+
category: 'table',
|
|
14
|
+
extensions: ['parquet'],
|
|
15
|
+
mimeTypes: ['application/octet-stream'],
|
|
16
|
+
binary: true,
|
|
17
|
+
tests: ['PAR1', 'PARE'],
|
|
18
|
+
options: {
|
|
19
|
+
parquet: {
|
|
20
|
+
type: 'arrow-table',
|
|
21
|
+
wasmUrl: PARQUET_WASM_URL
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
|
-
}
|
|
20
24
|
};
|
|
25
|
+
/** Parquet WASM table loader */
|
|
21
26
|
export const ParquetWasmLoader = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...ParquetWasmLoader.options.parquet,
|
|
28
|
-
...((_options = options) === null || _options === void 0 ? void 0 : _options.parquet)
|
|
29
|
-
},
|
|
30
|
-
...options
|
|
31
|
-
};
|
|
32
|
-
return parseParquetWasm(arrayBuffer, options);
|
|
33
|
-
}
|
|
27
|
+
...ParquetWasmWorkerLoader,
|
|
28
|
+
parse(arrayBuffer, options) {
|
|
29
|
+
options = { parquet: { ...ParquetWasmLoader.options.parquet, ...options?.parquet }, ...options };
|
|
30
|
+
return parseParquetWasm(arrayBuffer, options);
|
|
31
|
+
}
|
|
34
32
|
};
|
|
35
|
-
//# sourceMappingURL=parquet-wasm-loader.js.map
|