@loaders.gl/parquet 4.4.5 → 5.0.0-alpha.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/LICENSE +14 -3
- package/dist/bundled.d.ts +9 -0
- package/dist/bundled.d.ts.map +1 -0
- package/dist/bundled.js +10 -0
- package/dist/bundled.js.map +1 -0
- package/dist/geoparquet-loader-with-parser.d.ts +33 -0
- package/dist/geoparquet-loader-with-parser.d.ts.map +1 -0
- package/dist/geoparquet-loader-with-parser.js +52 -0
- package/dist/geoparquet-loader-with-parser.js.map +1 -0
- package/dist/geoparquet-loader.d.ts +59 -0
- package/dist/geoparquet-loader.d.ts.map +1 -0
- package/dist/geoparquet-loader.js +30 -0
- package/dist/geoparquet-loader.js.map +1 -0
- package/dist/index.cjs +25873 -4776
- package/dist/index.cjs.map +3 -4
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -11
- package/dist/index.js.map +1 -1
- package/dist/lib/arrow/convert-columns-to-row-group.js +3 -0
- package/dist/lib/arrow/convert-columns-to-row-group.js.map +1 -1
- package/dist/lib/arrow/convert-schema-from-parquet.d.ts.map +1 -1
- package/dist/lib/arrow/convert-schema-from-parquet.js +86 -26
- package/dist/lib/arrow/convert-schema-from-parquet.js.map +1 -1
- package/dist/lib/arrow/convert-schema-to-parquet.d.ts.map +1 -1
- package/dist/lib/arrow/convert-schema-to-parquet.js +16 -7
- package/dist/lib/arrow/convert-schema-to-parquet.js.map +1 -1
- package/dist/lib/arrow/create-nested-arrow-vector.d.ts +8 -0
- package/dist/lib/arrow/create-nested-arrow-vector.d.ts.map +1 -0
- package/dist/lib/arrow/create-nested-arrow-vector.js +396 -0
- package/dist/lib/arrow/create-nested-arrow-vector.js.map +1 -0
- package/dist/lib/constants.d.ts +0 -1
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +1 -2
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/encoders/encode-arrow-to-parquet.d.ts +2 -2
- package/dist/lib/encoders/encode-arrow-to-parquet.d.ts.map +1 -1
- package/dist/lib/encoders/encode-arrow-to-parquet.js +3 -10
- package/dist/lib/encoders/encode-arrow-to-parquet.js.map +1 -1
- package/dist/lib/encoders/encode-table-to-parquet-js.d.ts +5 -0
- package/dist/lib/encoders/encode-table-to-parquet-js.d.ts.map +1 -0
- package/dist/lib/encoders/encode-table-to-parquet-js.js +199 -0
- package/dist/lib/encoders/encode-table-to-parquet-js.js.map +1 -0
- package/dist/lib/geo/geospatial-metadata.d.ts +67 -0
- package/dist/lib/geo/geospatial-metadata.d.ts.map +1 -0
- package/dist/lib/geo/geospatial-metadata.js +338 -0
- package/dist/lib/geo/geospatial-metadata.js.map +1 -0
- package/dist/lib/parquet-page-index.d.ts +62 -0
- package/dist/lib/parquet-page-index.d.ts.map +1 -0
- package/dist/lib/parquet-page-index.js +377 -0
- package/dist/lib/parquet-page-index.js.map +1 -0
- package/dist/lib/parquet-predicate.d.ts +17 -0
- package/dist/lib/parquet-predicate.d.ts.map +1 -0
- package/dist/lib/parquet-predicate.js +300 -0
- package/dist/lib/parquet-predicate.js.map +1 -0
- package/dist/lib/parquet-source-worker-client.d.ts +6 -0
- package/dist/lib/parquet-source-worker-client.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-client.js +22 -0
- package/dist/lib/parquet-source-worker-client.js.map +1 -0
- package/dist/lib/parquet-source-worker-decoder.d.ts +4 -0
- package/dist/lib/parquet-source-worker-decoder.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-decoder.js +115 -0
- package/dist/lib/parquet-source-worker-decoder.js.map +1 -0
- package/dist/lib/parquet-source-worker-file.d.ts +24 -0
- package/dist/lib/parquet-source-worker-file.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-file.js +40 -0
- package/dist/lib/parquet-source-worker-file.js.map +1 -0
- package/dist/lib/parquet-source-worker-types.d.ts +97 -0
- package/dist/lib/parquet-source-worker-types.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-types.js +5 -0
- package/dist/lib/parquet-source-worker-types.js.map +1 -0
- package/dist/lib/parquet-worker-transport.d.ts +8 -0
- package/dist/lib/parquet-worker-transport.d.ts.map +1 -0
- package/dist/lib/parquet-worker-transport.js +40 -0
- package/dist/lib/parquet-worker-transport.js.map +1 -0
- package/dist/lib/parsers/convert-parquet-tables.d.ts +16 -0
- package/dist/lib/parsers/convert-parquet-tables.d.ts.map +1 -0
- package/dist/lib/parsers/convert-parquet-tables.js +30 -0
- package/dist/lib/parsers/convert-parquet-tables.js.map +1 -0
- package/dist/lib/parsers/get-parquet-schema.d.ts.map +1 -1
- package/dist/lib/parsers/get-parquet-schema.js +3 -1
- package/dist/lib/parsers/get-parquet-schema.js.map +1 -1
- package/dist/lib/parsers/parse-geoparquet-to-geojson.d.ts +4 -4
- package/dist/lib/parsers/parse-geoparquet-to-geojson.d.ts.map +1 -1
- package/dist/lib/parsers/parse-geoparquet-to-geojson.js +19 -6
- package/dist/lib/parsers/parse-geoparquet-to-geojson.js.map +1 -1
- package/dist/lib/parsers/parse-parquet-tables.d.ts +37 -0
- package/dist/lib/parsers/parse-parquet-tables.d.ts.map +1 -0
- package/dist/lib/parsers/parse-parquet-tables.js +50 -0
- package/dist/lib/parsers/parse-parquet-tables.js.map +1 -0
- package/dist/lib/parsers/parse-parquet-to-arrow-js.d.ts +19 -0
- package/dist/lib/parsers/parse-parquet-to-arrow-js.d.ts.map +1 -0
- package/dist/lib/parsers/parse-parquet-to-arrow-js.js +608 -0
- package/dist/lib/parsers/parse-parquet-to-arrow-js.js.map +1 -0
- package/dist/lib/parsers/parse-parquet-to-arrow.d.ts +7 -7
- package/dist/lib/parsers/parse-parquet-to-arrow.d.ts.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-arrow.js +45 -32
- package/dist/lib/parsers/parse-parquet-to-arrow.js.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-columns.d.ts +3 -3
- package/dist/lib/parsers/parse-parquet-to-columns.d.ts.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-columns.js +1 -4
- package/dist/lib/parsers/parse-parquet-to-columns.js.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-json.d.ts +3 -3
- package/dist/lib/parsers/parse-parquet-to-json.d.ts.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-json.js +77 -26
- package/dist/lib/parsers/parse-parquet-to-json.js.map +1 -1
- package/dist/lib/sources/parquet-range-file.d.ts +80 -0
- package/dist/lib/sources/parquet-range-file.d.ts.map +1 -0
- package/dist/lib/sources/parquet-range-file.js +261 -0
- package/dist/lib/sources/parquet-range-file.js.map +1 -0
- package/dist/lib/sources/single-batch-queue.d.ts +24 -0
- package/dist/lib/sources/single-batch-queue.d.ts.map +1 -0
- package/dist/lib/sources/single-batch-queue.js +91 -0
- package/dist/lib/sources/single-batch-queue.js.map +1 -0
- package/dist/lib/utils/load-wasm-node.d.ts +3 -0
- package/dist/lib/utils/load-wasm-node.d.ts.map +1 -0
- package/dist/lib/utils/load-wasm-node.js +23 -0
- package/dist/lib/utils/load-wasm-node.js.map +1 -0
- package/dist/lib/utils/load-wasm.d.ts +2 -2
- package/dist/lib/utils/load-wasm.d.ts.map +1 -1
- package/dist/lib/utils/load-wasm.js +28 -12
- package/dist/lib/utils/load-wasm.js.map +1 -1
- package/dist/lib/utils/make-stream-iterator.d.ts +2 -0
- package/dist/lib/utils/make-stream-iterator.d.ts.map +1 -1
- package/dist/lib/utils/make-stream-iterator.js +123 -14
- package/dist/lib/utils/make-stream-iterator.js.map +1 -1
- package/dist/lib/utils/normalize-parquet-options.d.ts +5 -0
- package/dist/lib/utils/normalize-parquet-options.d.ts.map +1 -0
- package/dist/lib/utils/normalize-parquet-options.js +11 -0
- package/dist/lib/utils/normalize-parquet-options.js.map +1 -0
- package/dist/parquet-dataset-source.cjs +26413 -0
- package/dist/parquet-dataset-source.cjs.map +6 -0
- package/dist/parquet-dataset-source.d.ts +54 -0
- package/dist/parquet-dataset-source.d.ts.map +1 -0
- package/dist/parquet-dataset-source.js +380 -0
- package/dist/parquet-dataset-source.js.map +1 -0
- package/dist/parquet-format.d.ts +2 -0
- package/dist/parquet-format.d.ts.map +1 -1
- package/dist/parquet-format.js +2 -0
- package/dist/parquet-format.js.map +1 -1
- package/dist/parquet-js-loader-types.d.ts +57 -0
- package/dist/parquet-js-loader-types.d.ts.map +1 -0
- package/dist/parquet-js-loader-types.js +33 -0
- package/dist/parquet-js-loader-types.js.map +1 -0
- package/dist/parquet-js-loader.d.ts +32 -0
- package/dist/parquet-js-loader.d.ts.map +1 -0
- package/dist/parquet-js-loader.js +58 -0
- package/dist/parquet-js-loader.js.map +1 -0
- package/dist/parquet-js-writer.d.ts +44 -0
- package/dist/parquet-js-writer.d.ts.map +1 -0
- package/dist/parquet-js-writer.js +28 -0
- package/dist/parquet-js-writer.js.map +1 -0
- package/dist/parquet-loader-base.d.ts +25 -0
- package/dist/parquet-loader-base.d.ts.map +1 -0
- package/dist/parquet-loader-base.js +23 -0
- package/dist/parquet-loader-base.js.map +1 -0
- package/dist/parquet-loader-options.d.ts +44 -0
- package/dist/parquet-loader-options.d.ts.map +1 -0
- package/dist/parquet-loader-options.js +10 -0
- package/dist/parquet-loader-options.js.map +1 -0
- package/dist/parquet-loader-types.d.ts +61 -0
- package/dist/parquet-loader-types.d.ts.map +1 -0
- package/dist/parquet-loader-types.js +17 -0
- package/dist/parquet-loader-types.js.map +1 -0
- package/dist/parquet-loader.d.ts +42 -0
- package/dist/parquet-loader.d.ts.map +1 -0
- package/dist/parquet-loader.js +68 -0
- package/dist/parquet-loader.js.map +1 -0
- package/dist/parquet-source-capabilities.d.ts +36 -0
- package/dist/parquet-source-capabilities.d.ts.map +1 -0
- package/dist/parquet-source-capabilities.js +22 -0
- package/dist/parquet-source-capabilities.js.map +1 -0
- package/dist/parquet-source-loader-types.d.ts +72 -0
- package/dist/parquet-source-loader-types.d.ts.map +1 -0
- package/dist/parquet-source-loader-types.js +74 -0
- package/dist/parquet-source-loader-types.js.map +1 -0
- package/dist/parquet-source-loader.cjs +25975 -0
- package/dist/parquet-source-loader.cjs.map +6 -0
- package/dist/parquet-source-loader.d.ts +120 -0
- package/dist/parquet-source-loader.d.ts.map +1 -0
- package/dist/parquet-source-loader.js +812 -0
- package/dist/parquet-source-loader.js.map +1 -0
- package/dist/parquet-source-types.d.ts +384 -0
- package/dist/parquet-source-types.d.ts.map +1 -0
- package/dist/parquet-source-types.js +5 -0
- package/dist/parquet-source-types.js.map +1 -0
- package/dist/parquet-source-worker-url.d.ts +3 -0
- package/dist/parquet-source-worker-url.d.ts.map +1 -0
- package/dist/parquet-source-worker-url.js +22 -0
- package/dist/parquet-source-worker-url.js.map +1 -0
- package/dist/parquet-source-worker.js +38491 -0
- package/dist/parquet-source-worker.js.map +7 -0
- package/dist/parquet-worker-node.cjs +54779 -0
- package/dist/parquet-worker-node.cjs.map +7 -0
- package/dist/parquet-worker-url.d.ts +3 -0
- package/dist/parquet-worker-url.d.ts.map +1 -0
- package/dist/parquet-worker-url.js +15 -0
- package/dist/parquet-worker-url.js.map +1 -0
- package/dist/parquet-worker.js +19920 -0
- package/dist/parquet-worker.js.map +7 -0
- package/dist/parquet-writer.d.ts +10 -0
- package/dist/parquet-writer.d.ts.map +1 -0
- package/dist/parquet-writer.js +27 -0
- package/dist/parquet-writer.js.map +1 -0
- package/dist/parquet_wasm_bg.wasm +0 -0
- package/dist/parquetjs/codecs/byte-stream-split.d.ts +9 -0
- package/dist/parquetjs/codecs/byte-stream-split.d.ts.map +1 -0
- package/dist/parquetjs/codecs/byte-stream-split.js +159 -0
- package/dist/parquetjs/codecs/byte-stream-split.js.map +1 -0
- package/dist/parquetjs/codecs/declare.d.ts +20 -3
- package/dist/parquetjs/codecs/declare.d.ts.map +1 -1
- package/dist/parquetjs/codecs/declare.js +7 -1
- package/dist/parquetjs/codecs/declare.js.map +1 -1
- package/dist/parquetjs/codecs/delta.d.ts +17 -0
- package/dist/parquetjs/codecs/delta.d.ts.map +1 -0
- package/dist/parquetjs/codecs/delta.js +439 -0
- package/dist/parquetjs/codecs/delta.js.map +1 -0
- package/dist/parquetjs/codecs/dictionary.d.ts +5 -2
- package/dist/parquetjs/codecs/dictionary.d.ts.map +1 -1
- package/dist/parquetjs/codecs/dictionary.js +16 -4
- package/dist/parquetjs/codecs/dictionary.js.map +1 -1
- package/dist/parquetjs/codecs/index.d.ts.map +1 -1
- package/dist/parquetjs/codecs/index.js +18 -0
- package/dist/parquetjs/codecs/index.js.map +1 -1
- package/dist/parquetjs/codecs/plain.d.ts +3 -3
- package/dist/parquetjs/codecs/plain.d.ts.map +1 -1
- package/dist/parquetjs/codecs/plain.js +88 -76
- package/dist/parquetjs/codecs/plain.js.map +1 -1
- package/dist/parquetjs/codecs/rle.d.ts +3 -3
- package/dist/parquetjs/codecs/rle.d.ts.map +1 -1
- package/dist/parquetjs/codecs/rle.js +196 -68
- package/dist/parquetjs/codecs/rle.js.map +1 -1
- package/dist/parquetjs/compression.d.ts +7 -8
- package/dist/parquetjs/compression.d.ts.map +1 -1
- package/dist/parquetjs/compression.js +95 -141
- package/dist/parquetjs/compression.js.map +1 -1
- package/dist/parquetjs/encoder/dictionary-planner.d.ts +17 -0
- package/dist/parquetjs/encoder/dictionary-planner.d.ts.map +1 -0
- package/dist/parquetjs/encoder/dictionary-planner.js +64 -0
- package/dist/parquetjs/encoder/dictionary-planner.js.map +1 -0
- package/dist/parquetjs/encoder/page-planner.d.ts +11 -0
- package/dist/parquetjs/encoder/page-planner.d.ts.map +1 -0
- package/dist/parquetjs/encoder/page-planner.js +60 -0
- package/dist/parquetjs/encoder/page-planner.js.map +1 -0
- package/dist/parquetjs/encoder/parquet-encoder.d.ts +11 -4
- package/dist/parquetjs/encoder/parquet-encoder.d.ts.map +1 -1
- package/dist/parquetjs/encoder/parquet-encoder.js +259 -52
- package/dist/parquetjs/encoder/parquet-encoder.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/BsonType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/BsonType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/BsonType.js +1 -1
- package/dist/parquetjs/parquet-thrift/BsonType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnChunk.js +2 -2
- package/dist/parquetjs/parquet-thrift/ColumnChunk.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts +6 -6
- package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnIndex.js +3 -3
- package/dist/parquetjs/parquet-thrift/ColumnIndex.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.js +2 -2
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.js.map +1 -1
- 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 +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnOrder.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.js +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.js +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DateType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DateType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DateType.js +1 -1
- package/dist/parquetjs/parquet-thrift/DateType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.js +1 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.js.map +1 -1
- 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 +1 -1
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.d.ts +8 -0
- package/dist/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.js +14 -0
- package/dist/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/Encoding.d.ts +2 -1
- package/dist/parquetjs/parquet-thrift/Encoding.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/Encoding.js +1 -0
- package/dist/parquetjs/parquet-thrift/Encoding.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/EnumType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/EnumType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/EnumType.js +1 -1
- package/dist/parquetjs/parquet-thrift/EnumType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/FileMetaData.js +2 -2
- package/dist/parquetjs/parquet-thrift/FileMetaData.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/Float16Type.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/Float16Type.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/Float16Type.js +27 -0
- package/dist/parquetjs/parquet-thrift/Float16Type.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeographyType.d.ts +14 -0
- package/dist/parquetjs/parquet-thrift/GeographyType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeographyType.js +51 -0
- package/dist/parquetjs/parquet-thrift/GeographyType.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeometryType.d.ts +11 -0
- package/dist/parquetjs/parquet-thrift/GeometryType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeometryType.js +41 -0
- package/dist/parquetjs/parquet-thrift/GeometryType.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.js +1 -1
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/IntType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/IntType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/IntType.js +1 -1
- package/dist/parquetjs/parquet-thrift/IntType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/JsonType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/JsonType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/JsonType.js +1 -1
- package/dist/parquetjs/parquet-thrift/JsonType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.js +1 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ListType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/ListType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ListType.js +1 -1
- package/dist/parquetjs/parquet-thrift/ListType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.d.ts +17 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.js +97 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/MapType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/MapType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/MapType.js +1 -1
- package/dist/parquetjs/parquet-thrift/MapType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.js +1 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.js +1 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/NanoSeconds.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/NanoSeconds.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/NanoSeconds.js +27 -0
- package/dist/parquetjs/parquet-thrift/NanoSeconds.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/NullType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/NullType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/NullType.js +1 -1
- package/dist/parquetjs/parquet-thrift/NullType.js.map +1 -1
- 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 +1 -1
- package/dist/parquetjs/parquet-thrift/OffsetIndex.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.js +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.js +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageLocation.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/PageLocation.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageLocation.js +2 -2
- package/dist/parquetjs/parquet-thrift/PageLocation.js.map +1 -1
- 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 +2 -2
- package/dist/parquetjs/parquet-thrift/RowGroup.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.js +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.js +1 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/Statistics.d.ts +14 -10
- package/dist/parquetjs/parquet-thrift/Statistics.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/Statistics.js +38 -2
- package/dist/parquetjs/parquet-thrift/Statistics.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/StringType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/StringType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/StringType.js +1 -1
- package/dist/parquetjs/parquet-thrift/StringType.js.map +1 -1
- 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 +1 -1
- package/dist/parquetjs/parquet-thrift/TimeType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts +5 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.js +25 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.js.map +1 -1
- 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 +1 -1
- package/dist/parquetjs/parquet-thrift/TimestampType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.js +1 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.js +1 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/VariantType.d.ts +11 -0
- package/dist/parquetjs/parquet-thrift/VariantType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/VariantType.js +41 -0
- package/dist/parquetjs/parquet-thrift/VariantType.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/index.d.ts +6 -2
- package/dist/parquetjs/parquet-thrift/index.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/index.js +6 -2
- package/dist/parquetjs/parquet-thrift/index.js.map +1 -1
- package/dist/parquetjs/parser/decoders.d.ts +14 -3
- package/dist/parquetjs/parser/decoders.d.ts.map +1 -1
- package/dist/parquetjs/parser/decoders.js +381 -117
- package/dist/parquetjs/parser/decoders.js.map +1 -1
- package/dist/parquetjs/parser/parquet-reader.d.ts +35 -10
- package/dist/parquetjs/parser/parquet-reader.d.ts.map +1 -1
- package/dist/parquetjs/parser/parquet-reader.js +179 -59
- package/dist/parquetjs/parser/parquet-reader.js.map +1 -1
- package/dist/parquetjs/schema/declare.d.ts +62 -8
- package/dist/parquetjs/schema/declare.d.ts.map +1 -1
- package/dist/parquetjs/schema/declare.js.map +1 -1
- package/dist/parquetjs/schema/schema.d.ts +3 -0
- package/dist/parquetjs/schema/schema.d.ts.map +1 -1
- package/dist/parquetjs/schema/schema.js +21 -3
- package/dist/parquetjs/schema/schema.js.map +1 -1
- package/dist/parquetjs/schema/shred.d.ts +2 -0
- package/dist/parquetjs/schema/shred.d.ts.map +1 -1
- package/dist/parquetjs/schema/shred.js +71 -23
- package/dist/parquetjs/schema/shred.js.map +1 -1
- package/dist/parquetjs/schema/types.d.ts.map +1 -1
- package/dist/parquetjs/schema/types.js +272 -51
- package/dist/parquetjs/schema/types.js.map +1 -1
- package/dist/parquetjs/utils/binary-utils.d.ts +41 -0
- package/dist/parquetjs/utils/binary-utils.d.ts.map +1 -0
- package/dist/parquetjs/utils/binary-utils.js +106 -0
- package/dist/parquetjs/utils/binary-utils.js.map +1 -0
- package/dist/parquetjs/utils/file-utils.d.ts +1 -1
- package/dist/parquetjs/utils/file-utils.d.ts.map +1 -1
- package/dist/parquetjs/utils/file-utils.js +3 -3
- package/dist/parquetjs/utils/file-utils.js.map +1 -1
- package/dist/parquetjs/utils/read-utils.d.ts +14 -6
- package/dist/parquetjs/utils/read-utils.d.ts.map +1 -1
- package/dist/parquetjs/utils/read-utils.js +46 -39
- package/dist/parquetjs/utils/read-utils.js.map +1 -1
- package/dist/parquetjs/utils/thrift-runtime.d.ts +106 -0
- package/dist/parquetjs/utils/thrift-runtime.d.ts.map +1 -0
- package/dist/parquetjs/utils/thrift-runtime.js +50 -0
- package/dist/parquetjs/utils/thrift-runtime.js.map +1 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol-writer.d.ts +78 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol-writer.d.ts.map +1 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol-writer.js +213 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol-writer.js.map +1 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol.d.ts +80 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol.d.ts.map +1 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol.js +276 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol.js.map +1 -0
- package/dist/parquetjs/utils/uint8-array-transport.d.ts +25 -0
- package/dist/parquetjs/utils/uint8-array-transport.d.ts.map +1 -0
- package/dist/parquetjs/utils/uint8-array-transport.js +62 -0
- package/dist/parquetjs/utils/uint8-array-transport.js.map +1 -0
- package/dist/polyfills/process.d.ts +12 -0
- package/dist/polyfills/process.d.ts.map +1 -0
- package/dist/polyfills/process.js +17 -0
- package/dist/polyfills/process.js.map +1 -0
- package/dist/unbundled.d.ts +9 -0
- package/dist/unbundled.d.ts.map +1 -0
- package/dist/unbundled.js +10 -0
- package/dist/unbundled.js.map +1 -0
- package/dist/wasm.d.ts +3 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +6 -0
- package/dist/wasm.js.map +1 -0
- package/dist/workers/parquet-source-worker.d.ts +2 -0
- package/dist/workers/parquet-source-worker.d.ts.map +1 -0
- package/dist/workers/parquet-source-worker.js +17 -0
- package/dist/workers/parquet-source-worker.js.map +1 -0
- package/dist/workers/parquet-worker-node.d.ts +2 -0
- package/dist/workers/parquet-worker-node.d.ts.map +1 -0
- package/dist/workers/parquet-worker-node.js +5 -0
- package/dist/workers/parquet-worker-node.js.map +1 -0
- package/dist/workers/parquet-worker.d.ts +2 -0
- package/dist/workers/parquet-worker.d.ts.map +1 -0
- package/dist/workers/parquet-worker.js +27 -0
- package/dist/workers/parquet-worker.js.map +1 -0
- package/package.json +63 -33
- package/src/bundled.ts +33 -0
- package/src/geoparquet-loader-with-parser.ts +95 -0
- package/src/geoparquet-loader.ts +54 -0
- package/src/index.ts +49 -23
- package/src/lib/arrow/convert-columns-to-row-group.ts +3 -0
- package/src/lib/arrow/convert-schema-from-parquet.ts +97 -30
- package/src/lib/arrow/convert-schema-to-parquet.ts +16 -7
- package/src/lib/arrow/create-nested-arrow-vector.ts +589 -0
- package/src/lib/constants.ts +0 -2
- package/src/lib/encoders/encode-arrow-to-parquet.ts +10 -16
- package/src/lib/encoders/encode-table-to-parquet-js.ts +261 -0
- package/src/lib/geo/geospatial-metadata.ts +457 -0
- package/src/lib/parquet-page-index.ts +581 -0
- package/src/lib/parquet-predicate.ts +374 -0
- package/src/lib/parquet-source-worker-client.ts +39 -0
- package/src/lib/parquet-source-worker-decoder.ts +156 -0
- package/src/lib/parquet-source-worker-file.ts +56 -0
- package/src/lib/parquet-source-worker-types.ts +107 -0
- package/src/lib/parquet-worker-transport.ts +57 -0
- package/src/lib/parsers/convert-parquet-tables.ts +39 -0
- package/src/lib/parsers/get-parquet-schema.ts +3 -1
- package/src/lib/parsers/parse-geoparquet-to-geojson.ts +27 -14
- package/src/lib/parsers/parse-parquet-tables.ts +82 -0
- package/src/lib/parsers/parse-parquet-to-arrow-js.ts +829 -0
- package/src/lib/parsers/parse-parquet-to-arrow.ts +63 -36
- package/src/lib/parsers/parse-parquet-to-columns.ts +6 -7
- package/src/lib/parsers/parse-parquet-to-json.ts +101 -33
- package/src/lib/sources/parquet-range-file.ts +359 -0
- package/src/lib/sources/single-batch-queue.ts +95 -0
- package/src/lib/utils/load-wasm-node.ts +25 -0
- package/src/lib/utils/load-wasm.ts +36 -13
- package/src/lib/utils/make-stream-iterator.ts +126 -14
- package/src/lib/utils/normalize-parquet-options.ts +14 -0
- package/src/parquet-dataset-source.ts +488 -0
- package/src/parquet-format.ts +2 -0
- package/src/parquet-js-loader-types.ts +52 -0
- package/src/parquet-js-loader.ts +83 -0
- package/src/parquet-js-writer.ts +68 -0
- package/src/parquet-loader-base.ts +34 -0
- package/src/parquet-loader-options.ts +51 -0
- package/src/parquet-loader-types.ts +35 -0
- package/src/parquet-loader.ts +115 -0
- package/src/parquet-source-capabilities.ts +56 -0
- package/src/parquet-source-loader-types.ts +87 -0
- package/src/parquet-source-loader.ts +1265 -0
- package/src/parquet-source-types.ts +458 -0
- package/src/parquet-source-worker-url.ts +23 -0
- package/src/parquet-worker-url.ts +18 -0
- package/src/parquet-writer.ts +42 -0
- package/src/parquetjs/LICENSE +23 -1
- package/src/parquetjs/codecs/byte-stream-split.ts +221 -0
- package/src/parquetjs/codecs/declare.ts +35 -3
- package/src/parquetjs/codecs/delta.ts +587 -0
- package/src/parquetjs/codecs/dictionary.ts +22 -4
- package/src/parquetjs/codecs/index.ts +18 -0
- package/src/parquetjs/codecs/plain.ts +149 -87
- package/src/parquetjs/codecs/rle.ts +268 -82
- package/src/parquetjs/compression.ts +110 -155
- package/src/parquetjs/encoder/dictionary-planner.ts +99 -0
- package/src/parquetjs/encoder/page-planner.ts +83 -0
- package/src/parquetjs/encoder/parquet-encoder.ts +378 -77
- package/src/parquetjs/parquet-thrift/BsonType.ts +1 -1
- package/src/parquetjs/parquet-thrift/ColumnChunk.ts +2 -2
- package/src/parquetjs/parquet-thrift/ColumnIndex.ts +13 -13
- package/src/parquetjs/parquet-thrift/ColumnMetaData.ts +2 -2
- package/src/parquetjs/parquet-thrift/ColumnOrder.ts +1 -1
- package/src/parquetjs/parquet-thrift/DataPageHeader.ts +1 -1
- package/src/parquetjs/parquet-thrift/DataPageHeaderV2.ts +1 -1
- package/src/parquetjs/parquet-thrift/DateType.ts +1 -1
- package/src/parquetjs/parquet-thrift/DecimalType.ts +1 -1
- package/src/parquetjs/parquet-thrift/DictionaryPageHeader.ts +1 -1
- package/src/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.ts +13 -0
- package/src/parquetjs/parquet-thrift/Encoding.ts +2 -1
- package/src/parquetjs/parquet-thrift/EnumType.ts +1 -1
- package/src/parquetjs/parquet-thrift/FileMetaData.ts +2 -2
- package/src/parquetjs/parquet-thrift/Float16Type.ts +28 -0
- package/src/parquetjs/parquet-thrift/GeographyType.ts +54 -0
- package/src/parquetjs/parquet-thrift/GeometryType.ts +43 -0
- package/src/parquetjs/parquet-thrift/IndexPageHeader.ts +1 -1
- package/src/parquetjs/parquet-thrift/IntType.ts +1 -1
- package/src/parquetjs/parquet-thrift/JsonType.ts +1 -1
- package/src/parquetjs/parquet-thrift/KeyValue.ts +1 -1
- package/src/parquetjs/parquet-thrift/ListType.ts +1 -1
- package/src/parquetjs/parquet-thrift/LogicalType.ts +97 -1
- package/src/parquetjs/parquet-thrift/MapType.ts +1 -1
- package/src/parquetjs/parquet-thrift/MicroSeconds.ts +1 -1
- package/src/parquetjs/parquet-thrift/MilliSeconds.ts +1 -1
- package/src/parquetjs/parquet-thrift/NanoSeconds.ts +28 -0
- package/src/parquetjs/parquet-thrift/NullType.ts +1 -1
- package/src/parquetjs/parquet-thrift/OffsetIndex.ts +1 -1
- package/src/parquetjs/parquet-thrift/PageEncodingStats.ts +1 -1
- package/src/parquetjs/parquet-thrift/PageHeader.ts +1 -1
- package/src/parquetjs/parquet-thrift/PageLocation.ts +2 -2
- package/src/parquetjs/parquet-thrift/RowGroup.ts +2 -2
- package/src/parquetjs/parquet-thrift/SchemaElement.ts +1 -1
- package/src/parquetjs/parquet-thrift/SortingColumn.ts +1 -1
- package/src/parquetjs/parquet-thrift/Statistics.ts +50 -14
- package/src/parquetjs/parquet-thrift/StringType.ts +1 -1
- package/src/parquetjs/parquet-thrift/TimeType.ts +1 -1
- package/src/parquetjs/parquet-thrift/TimeUnit.ts +25 -1
- package/src/parquetjs/parquet-thrift/TimestampType.ts +1 -1
- package/src/parquetjs/parquet-thrift/TypeDefinedOrder.ts +1 -1
- package/src/parquetjs/parquet-thrift/UUIDType.ts +1 -1
- package/src/parquetjs/parquet-thrift/VariantType.ts +43 -0
- package/src/parquetjs/parquet-thrift/index.ts +6 -4
- package/src/parquetjs/parser/decoders.ts +487 -133
- package/src/parquetjs/parser/parquet-reader.ts +297 -71
- package/src/parquetjs/schema/declare.ts +99 -7
- package/src/parquetjs/schema/schema.ts +23 -3
- package/src/parquetjs/schema/shred.ts +112 -35
- package/src/parquetjs/schema/types.ts +294 -61
- package/src/parquetjs/utils/binary-utils.ts +132 -0
- package/src/parquetjs/utils/file-utils.ts +4 -4
- package/src/parquetjs/utils/read-utils.ts +56 -55
- package/src/parquetjs/utils/thrift-runtime.ts +109 -0
- package/src/parquetjs/utils/uint8-array-compact-protocol-writer.ts +254 -0
- package/src/parquetjs/utils/uint8-array-compact-protocol.ts +322 -0
- package/src/parquetjs/utils/uint8-array-transport.ts +79 -0
- package/src/polyfills/process.ts +17 -0
- package/src/unbundled.ts +33 -0
- package/src/wasm.ts +6 -0
- package/src/workers/parquet-source-worker.ts +21 -0
- package/src/workers/parquet-worker-node.ts +5 -0
- package/src/workers/parquet-worker.ts +31 -0
- package/dist/parquet-arrow-loader.d.ts +0 -43
- package/dist/parquet-arrow-loader.d.ts.map +0 -1
- package/dist/parquet-arrow-loader.js +0 -49
- package/dist/parquet-arrow-loader.js.map +0 -1
- package/dist/parquet-arrow-writer.d.ts +0 -9
- package/dist/parquet-arrow-writer.d.ts.map +0 -1
- package/dist/parquet-arrow-writer.js +0 -23
- package/dist/parquet-arrow-writer.js.map +0 -1
- package/dist/parquet-json-loader.d.ts +0 -148
- package/dist/parquet-json-loader.d.ts.map +0 -1
- package/dist/parquet-json-loader.js +0 -106
- package/dist/parquet-json-loader.js.map +0 -1
- package/dist/parquet-json-writer.d.ts +0 -19
- package/dist/parquet-json-writer.d.ts.map +0 -1
- package/dist/parquet-json-writer.js +0 -20
- package/dist/parquet-json-writer.js.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.browser.d.ts +0 -3
- package/dist/polyfills/buffer/buffer-polyfill.browser.d.ts.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.browser.js +0 -12
- package/dist/polyfills/buffer/buffer-polyfill.browser.js.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.node.d.ts +0 -3
- package/dist/polyfills/buffer/buffer-polyfill.node.d.ts.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.node.js +0 -17
- package/dist/polyfills/buffer/buffer-polyfill.node.js.map +0 -1
- package/dist/polyfills/buffer/buffer.d.ts +0 -222
- package/dist/polyfills/buffer/buffer.d.ts.map +0 -1
- package/dist/polyfills/buffer/buffer.js +0 -1868
- package/dist/polyfills/buffer/buffer.js.map +0 -1
- package/dist/polyfills/buffer/index.d.ts +0 -4
- package/dist/polyfills/buffer/index.d.ts.map +0 -1
- package/dist/polyfills/buffer/index.js +0 -9
- package/dist/polyfills/buffer/index.js.map +0 -1
- package/dist/polyfills/buffer/install-buffer-polyfill.d.ts +0 -2
- package/dist/polyfills/buffer/install-buffer-polyfill.d.ts.map +0 -1
- package/dist/polyfills/buffer/install-buffer-polyfill.js +0 -10
- package/dist/polyfills/buffer/install-buffer-polyfill.js.map +0 -1
- package/dist/workers/parquet-json-worker.d.ts +0 -2
- package/dist/workers/parquet-json-worker.d.ts.map +0 -1
- package/dist/workers/parquet-json-worker.js +0 -7
- package/dist/workers/parquet-json-worker.js.map +0 -1
- package/src/parquet-arrow-loader.ts +0 -74
- package/src/parquet-arrow-writer.ts +0 -33
- package/src/parquet-json-loader.ts +0 -160
- package/src/parquet-json-writer.ts +0 -27
- package/src/parquetjs/modules.d.ts +0 -25
- package/src/polyfills/buffer/buffer-polyfill.browser.ts +0 -14
- package/src/polyfills/buffer/buffer-polyfill.node.ts +0 -19
- package/src/polyfills/buffer/buffer.ts +0 -2205
- package/src/polyfills/buffer/index.ts +0 -11
- package/src/polyfills/buffer/install-buffer-polyfill.ts +0 -12
- package/src/workers/parquet-json-worker.ts +0 -8
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import * as arrow from 'apache-arrow';
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
ParquetColumnChunk,
|
|
9
|
+
ParquetField,
|
|
10
|
+
ParquetRowGroup
|
|
11
|
+
} from '../../parquetjs/schema/declare';
|
|
12
|
+
|
|
13
|
+
/** Largest byte value copied inline to avoid TypedArray#set call overhead. */
|
|
14
|
+
const MAXIMUM_INLINE_BYTE_COPY_LENGTH = 7;
|
|
15
|
+
|
|
16
|
+
/** Primitive Arrow arrays emitted directly from decoded physical Parquet values. */
|
|
17
|
+
type NestedPrimitiveArrowArray =
|
|
18
|
+
| Float32Array
|
|
19
|
+
| Float64Array
|
|
20
|
+
| Int8Array
|
|
21
|
+
| Int16Array
|
|
22
|
+
| Int32Array
|
|
23
|
+
| Uint8Array
|
|
24
|
+
| Uint16Array
|
|
25
|
+
| Uint32Array
|
|
26
|
+
| BigInt64Array
|
|
27
|
+
| BigUint64Array;
|
|
28
|
+
|
|
29
|
+
/** Selected decoded values and their Arrow validity information. */
|
|
30
|
+
type SelectedLeafValues = {
|
|
31
|
+
length: number;
|
|
32
|
+
firstValueIndex: number;
|
|
33
|
+
valueCount: number;
|
|
34
|
+
nullBitmap?: Uint8Array;
|
|
35
|
+
nullCount: number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Repeated-list offsets plus the selected primitive values contained by the lists. */
|
|
39
|
+
type SelectedRepeatedValues = SelectedLeafValues & {
|
|
40
|
+
valueOffsets: Int32Array;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates an Arrow List vector directly from a repeated Parquet primitive or repeated struct.
|
|
45
|
+
* Returns undefined for shapes whose repetition tree is not supported by the direct path.
|
|
46
|
+
*/
|
|
47
|
+
export function createNestedArrowVector(
|
|
48
|
+
arrowType: arrow.DataType,
|
|
49
|
+
parquetField: ParquetField,
|
|
50
|
+
rowGroup: ParquetRowGroup,
|
|
51
|
+
start: number,
|
|
52
|
+
end: number
|
|
53
|
+
): arrow.Vector | undefined {
|
|
54
|
+
if (!(arrowType instanceof arrow.List) || parquetField.repetitionType !== 'REPEATED') {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const data = parquetField.fields
|
|
59
|
+
? createRepeatedStructData(arrowType, parquetField, rowGroup, start, end)
|
|
60
|
+
: createRepeatedPrimitiveData(arrowType, parquetField, rowGroup, start, end);
|
|
61
|
+
return data ? new arrow.Vector([data]) : undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Creates a top-level repeated primitive as Arrow List data. */
|
|
65
|
+
function createRepeatedPrimitiveData(
|
|
66
|
+
listType: arrow.List,
|
|
67
|
+
parquetField: ParquetField,
|
|
68
|
+
rowGroup: ParquetRowGroup,
|
|
69
|
+
start: number,
|
|
70
|
+
end: number
|
|
71
|
+
): arrow.Data | undefined {
|
|
72
|
+
const columnData = rowGroup.columnData[parquetField.key];
|
|
73
|
+
if (!columnData) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const selected = selectRootRepeatedValues(columnData, parquetField, start, end);
|
|
78
|
+
const childData = createSelectedLeafData(
|
|
79
|
+
listType.children[0].type,
|
|
80
|
+
parquetField,
|
|
81
|
+
columnData,
|
|
82
|
+
selected
|
|
83
|
+
);
|
|
84
|
+
if (!childData) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return arrow.makeData({
|
|
89
|
+
type: listType,
|
|
90
|
+
valueOffsets: selected.valueOffsets,
|
|
91
|
+
child: childData
|
|
92
|
+
} as any);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Creates a top-level repeated group as Arrow List<Struct> data. */
|
|
96
|
+
function createRepeatedStructData(
|
|
97
|
+
listType: arrow.List,
|
|
98
|
+
parquetField: ParquetField,
|
|
99
|
+
rowGroup: ParquetRowGroup,
|
|
100
|
+
start: number,
|
|
101
|
+
end: number
|
|
102
|
+
): arrow.Data | undefined {
|
|
103
|
+
const structType = listType.children[0].type;
|
|
104
|
+
if (!(structType instanceof arrow.Struct)) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const primitiveLeaves = listPrimitiveLeaves(parquetField);
|
|
109
|
+
const driverField = primitiveLeaves.reduce<ParquetField | undefined>(
|
|
110
|
+
(driver, leaf) => (!driver || leaf.rLevelMax < driver.rLevelMax ? leaf : driver),
|
|
111
|
+
undefined
|
|
112
|
+
);
|
|
113
|
+
const driverColumn = driverField && rowGroup.columnData[driverField.key];
|
|
114
|
+
if (!driverField || !driverColumn) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const rootLayout = selectRepeatedStructLayout(driverColumn, parquetField, start, end);
|
|
119
|
+
const children: arrow.Data[] = [];
|
|
120
|
+
for (const arrowChild of structType.children) {
|
|
121
|
+
const parquetChild = parquetField.fields?.[arrowChild.name];
|
|
122
|
+
if (!parquetChild || parquetChild.fields) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const columnData = rowGroup.columnData[parquetChild.key];
|
|
126
|
+
if (!columnData) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
let childData: arrow.Data | undefined;
|
|
131
|
+
if (parquetChild.repetitionType === 'REPEATED' && arrowChild.type instanceof arrow.List) {
|
|
132
|
+
childData = createRepeatedStructChildData(
|
|
133
|
+
arrowChild.type,
|
|
134
|
+
parquetField,
|
|
135
|
+
parquetChild,
|
|
136
|
+
columnData,
|
|
137
|
+
start,
|
|
138
|
+
end,
|
|
139
|
+
rootLayout.elementCount
|
|
140
|
+
);
|
|
141
|
+
} else {
|
|
142
|
+
const selected = selectStructScalarValues(
|
|
143
|
+
columnData,
|
|
144
|
+
parquetField,
|
|
145
|
+
parquetChild,
|
|
146
|
+
start,
|
|
147
|
+
end,
|
|
148
|
+
rootLayout.elementCount
|
|
149
|
+
);
|
|
150
|
+
childData = createSelectedLeafData(arrowChild.type, parquetChild, columnData, selected);
|
|
151
|
+
}
|
|
152
|
+
if (!childData) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
children.push(childData);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const structData = arrow.makeData({
|
|
159
|
+
type: structType,
|
|
160
|
+
length: rootLayout.elementCount,
|
|
161
|
+
nullCount: 0,
|
|
162
|
+
children
|
|
163
|
+
});
|
|
164
|
+
return arrow.makeData({
|
|
165
|
+
type: listType,
|
|
166
|
+
valueOffsets: rootLayout.valueOffsets,
|
|
167
|
+
child: structData
|
|
168
|
+
} as any);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Creates one repeated primitive child within a repeated struct. */
|
|
172
|
+
function createRepeatedStructChildData(
|
|
173
|
+
listType: arrow.List,
|
|
174
|
+
parentField: ParquetField,
|
|
175
|
+
parquetField: ParquetField,
|
|
176
|
+
columnData: ParquetColumnChunk,
|
|
177
|
+
start: number,
|
|
178
|
+
end: number,
|
|
179
|
+
parentCount: number
|
|
180
|
+
): arrow.Data | undefined {
|
|
181
|
+
const selected = selectStructRepeatedValues(
|
|
182
|
+
columnData,
|
|
183
|
+
parentField,
|
|
184
|
+
parquetField,
|
|
185
|
+
start,
|
|
186
|
+
end,
|
|
187
|
+
parentCount
|
|
188
|
+
);
|
|
189
|
+
const childData = createSelectedLeafData(
|
|
190
|
+
listType.children[0].type,
|
|
191
|
+
parquetField,
|
|
192
|
+
columnData,
|
|
193
|
+
selected
|
|
194
|
+
);
|
|
195
|
+
if (!childData) {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
return arrow.makeData({
|
|
199
|
+
type: listType,
|
|
200
|
+
valueOffsets: selected.valueOffsets,
|
|
201
|
+
child: childData
|
|
202
|
+
} as any);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Selects primitive values and row offsets for a top-level repeated leaf. */
|
|
206
|
+
function selectRootRepeatedValues(
|
|
207
|
+
columnData: ParquetColumnChunk,
|
|
208
|
+
parquetField: ParquetField,
|
|
209
|
+
start: number,
|
|
210
|
+
end: number
|
|
211
|
+
): SelectedRepeatedValues {
|
|
212
|
+
const rowCount = end - start;
|
|
213
|
+
const valueCounts = new Int32Array(rowCount);
|
|
214
|
+
let rowIndex = -1;
|
|
215
|
+
let sourceValueIndex = 0;
|
|
216
|
+
let firstValueIndex = -1;
|
|
217
|
+
let valueCount = 0;
|
|
218
|
+
|
|
219
|
+
for (let levelIndex = 0; levelIndex < columnData.dlevels.length; levelIndex++) {
|
|
220
|
+
if (columnData.rlevels[levelIndex] === 0) {
|
|
221
|
+
rowIndex++;
|
|
222
|
+
}
|
|
223
|
+
const hasValue = columnData.dlevels[levelIndex] === parquetField.dLevelMax;
|
|
224
|
+
if (rowIndex >= start && rowIndex < end && hasValue) {
|
|
225
|
+
firstValueIndex = firstValueIndex < 0 ? sourceValueIndex : firstValueIndex;
|
|
226
|
+
valueCounts[rowIndex - start]++;
|
|
227
|
+
valueCount++;
|
|
228
|
+
}
|
|
229
|
+
if (hasValue) {
|
|
230
|
+
sourceValueIndex++;
|
|
231
|
+
}
|
|
232
|
+
if (rowIndex >= end) {
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
length: valueCount,
|
|
239
|
+
firstValueIndex: Math.max(0, firstValueIndex),
|
|
240
|
+
valueCount,
|
|
241
|
+
nullCount: 0,
|
|
242
|
+
valueOffsets: accumulateOffsets(valueCounts)
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Selects row offsets and element count for a top-level repeated group. */
|
|
247
|
+
function selectRepeatedStructLayout(
|
|
248
|
+
columnData: ParquetColumnChunk,
|
|
249
|
+
parentField: ParquetField,
|
|
250
|
+
start: number,
|
|
251
|
+
end: number
|
|
252
|
+
): {valueOffsets: Int32Array; elementCount: number} {
|
|
253
|
+
const valueCounts = new Int32Array(end - start);
|
|
254
|
+
let rowIndex = -1;
|
|
255
|
+
let elementCount = 0;
|
|
256
|
+
|
|
257
|
+
for (let levelIndex = 0; levelIndex < columnData.dlevels.length; levelIndex++) {
|
|
258
|
+
const repetitionLevel = columnData.rlevels[levelIndex];
|
|
259
|
+
if (repetitionLevel === 0) {
|
|
260
|
+
rowIndex++;
|
|
261
|
+
}
|
|
262
|
+
if (
|
|
263
|
+
rowIndex >= start &&
|
|
264
|
+
rowIndex < end &&
|
|
265
|
+
repetitionLevel <= parentField.rLevelMax &&
|
|
266
|
+
columnData.dlevels[levelIndex] >= parentField.dLevelMax
|
|
267
|
+
) {
|
|
268
|
+
valueCounts[rowIndex - start]++;
|
|
269
|
+
elementCount++;
|
|
270
|
+
}
|
|
271
|
+
if (rowIndex >= end) {
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return {valueOffsets: accumulateOffsets(valueCounts), elementCount};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Selects scalar child values aligned to the repeated parent struct elements. */
|
|
280
|
+
function selectStructScalarValues(
|
|
281
|
+
columnData: ParquetColumnChunk,
|
|
282
|
+
parentField: ParquetField,
|
|
283
|
+
parquetField: ParquetField,
|
|
284
|
+
start: number,
|
|
285
|
+
end: number,
|
|
286
|
+
parentCount: number
|
|
287
|
+
): SelectedLeafValues {
|
|
288
|
+
const nullBitmap = new Uint8Array(Math.ceil(parentCount / 8));
|
|
289
|
+
let rowIndex = -1;
|
|
290
|
+
let sourceValueIndex = 0;
|
|
291
|
+
let firstValueIndex = -1;
|
|
292
|
+
let outputIndex = 0;
|
|
293
|
+
let valueCount = 0;
|
|
294
|
+
|
|
295
|
+
for (let levelIndex = 0; levelIndex < columnData.dlevels.length; levelIndex++) {
|
|
296
|
+
const repetitionLevel = columnData.rlevels[levelIndex];
|
|
297
|
+
if (repetitionLevel === 0) {
|
|
298
|
+
rowIndex++;
|
|
299
|
+
}
|
|
300
|
+
const definitionLevel = columnData.dlevels[levelIndex];
|
|
301
|
+
const hasValue = definitionLevel === parquetField.dLevelMax;
|
|
302
|
+
if (
|
|
303
|
+
rowIndex >= start &&
|
|
304
|
+
rowIndex < end &&
|
|
305
|
+
repetitionLevel <= parentField.rLevelMax &&
|
|
306
|
+
definitionLevel >= parentField.dLevelMax
|
|
307
|
+
) {
|
|
308
|
+
if (hasValue) {
|
|
309
|
+
firstValueIndex = firstValueIndex < 0 ? sourceValueIndex : firstValueIndex;
|
|
310
|
+
nullBitmap[outputIndex >> 3] |= 1 << (outputIndex & 7);
|
|
311
|
+
valueCount++;
|
|
312
|
+
}
|
|
313
|
+
outputIndex++;
|
|
314
|
+
}
|
|
315
|
+
if (hasValue) {
|
|
316
|
+
sourceValueIndex++;
|
|
317
|
+
}
|
|
318
|
+
if (rowIndex >= end) {
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (outputIndex !== parentCount) {
|
|
324
|
+
throw new Error(
|
|
325
|
+
`Parquet nested column ${parquetField.key} has ${outputIndex} parent values; expected ${parentCount}`
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
const nullCount = parentCount - valueCount;
|
|
329
|
+
return {
|
|
330
|
+
length: parentCount,
|
|
331
|
+
firstValueIndex: Math.max(0, firstValueIndex),
|
|
332
|
+
valueCount,
|
|
333
|
+
nullBitmap: nullCount ? nullBitmap : undefined,
|
|
334
|
+
nullCount
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** Selects repeated child values and list offsets aligned to repeated parent struct elements. */
|
|
339
|
+
function selectStructRepeatedValues(
|
|
340
|
+
columnData: ParquetColumnChunk,
|
|
341
|
+
parentField: ParquetField,
|
|
342
|
+
parquetField: ParquetField,
|
|
343
|
+
start: number,
|
|
344
|
+
end: number,
|
|
345
|
+
parentCount: number
|
|
346
|
+
): SelectedRepeatedValues {
|
|
347
|
+
const valueCounts = new Int32Array(parentCount);
|
|
348
|
+
let rowIndex = -1;
|
|
349
|
+
let parentIndex = -1;
|
|
350
|
+
let sourceValueIndex = 0;
|
|
351
|
+
let firstValueIndex = -1;
|
|
352
|
+
let valueCount = 0;
|
|
353
|
+
|
|
354
|
+
for (let levelIndex = 0; levelIndex < columnData.dlevels.length; levelIndex++) {
|
|
355
|
+
const repetitionLevel = columnData.rlevels[levelIndex];
|
|
356
|
+
if (repetitionLevel === 0) {
|
|
357
|
+
rowIndex++;
|
|
358
|
+
}
|
|
359
|
+
const definitionLevel = columnData.dlevels[levelIndex];
|
|
360
|
+
const hasValue = definitionLevel === parquetField.dLevelMax;
|
|
361
|
+
if (rowIndex >= start && rowIndex < end) {
|
|
362
|
+
if (repetitionLevel <= parentField.rLevelMax && definitionLevel >= parentField.dLevelMax) {
|
|
363
|
+
parentIndex++;
|
|
364
|
+
}
|
|
365
|
+
if (hasValue) {
|
|
366
|
+
if (parentIndex < 0 || parentIndex >= parentCount) {
|
|
367
|
+
throw new Error(
|
|
368
|
+
`Parquet nested column ${parquetField.key} has invalid repetition levels`
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
firstValueIndex = firstValueIndex < 0 ? sourceValueIndex : firstValueIndex;
|
|
372
|
+
valueCounts[parentIndex]++;
|
|
373
|
+
valueCount++;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (hasValue) {
|
|
377
|
+
sourceValueIndex++;
|
|
378
|
+
}
|
|
379
|
+
if (rowIndex >= end) {
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (parentIndex + 1 !== parentCount) {
|
|
385
|
+
throw new Error(
|
|
386
|
+
`Parquet nested column ${parquetField.key} has ${parentIndex + 1} parent values; expected ${parentCount}`
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
length: valueCount,
|
|
391
|
+
firstValueIndex: Math.max(0, firstValueIndex),
|
|
392
|
+
valueCount,
|
|
393
|
+
nullCount: 0,
|
|
394
|
+
valueOffsets: accumulateOffsets(valueCounts)
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** Creates Arrow primitive or byte data for selected decoded leaf values. */
|
|
399
|
+
function createSelectedLeafData(
|
|
400
|
+
arrowType: arrow.DataType,
|
|
401
|
+
parquetField: ParquetField,
|
|
402
|
+
columnData: ParquetColumnChunk,
|
|
403
|
+
selected: SelectedLeafValues
|
|
404
|
+
): arrow.Data | undefined {
|
|
405
|
+
const primitiveData = createSelectedPrimitiveData(arrowType, parquetField, columnData, selected);
|
|
406
|
+
if (primitiveData) {
|
|
407
|
+
return primitiveData;
|
|
408
|
+
}
|
|
409
|
+
return createSelectedByteData(arrowType, parquetField, columnData, selected);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/** Creates fixed-width Arrow data for selected physical primitive values. */
|
|
413
|
+
function createSelectedPrimitiveData(
|
|
414
|
+
arrowType: arrow.DataType,
|
|
415
|
+
parquetField: ParquetField,
|
|
416
|
+
columnData: ParquetColumnChunk,
|
|
417
|
+
selected: SelectedLeafValues
|
|
418
|
+
): arrow.Data | undefined {
|
|
419
|
+
const data = createNestedPrimitiveArray(arrowType, parquetField, selected.length);
|
|
420
|
+
if (!data) {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const sourceValues = columnData.values;
|
|
425
|
+
let sourceValueIndex = selected.firstValueIndex;
|
|
426
|
+
for (let outputIndex = 0; outputIndex < selected.length; outputIndex++) {
|
|
427
|
+
if (!selected.nullBitmap || selected.nullBitmap[outputIndex >> 3] & (1 << (outputIndex & 7))) {
|
|
428
|
+
setNestedPrimitiveValue(data, outputIndex, sourceValues[sourceValueIndex++]);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return arrow.makeData({
|
|
433
|
+
type: arrowType,
|
|
434
|
+
data,
|
|
435
|
+
nullBitmap: selected.nullBitmap,
|
|
436
|
+
nullCount: selected.nullCount
|
|
437
|
+
} as any);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** Allocates the Arrow array matching an unconverted physical Parquet primitive. */
|
|
441
|
+
function createNestedPrimitiveArray(
|
|
442
|
+
arrowType: arrow.DataType,
|
|
443
|
+
parquetField: ParquetField,
|
|
444
|
+
length: number
|
|
445
|
+
): NestedPrimitiveArrowArray | undefined {
|
|
446
|
+
if (parquetField.primitiveType === 'FLOAT' && arrowType instanceof arrow.Float32) {
|
|
447
|
+
return new Float32Array(length);
|
|
448
|
+
}
|
|
449
|
+
if (parquetField.primitiveType === 'DOUBLE' && arrowType instanceof arrow.Float64) {
|
|
450
|
+
return new Float64Array(length);
|
|
451
|
+
}
|
|
452
|
+
if (parquetField.primitiveType === 'INT32' && arrowType instanceof arrow.Int8) {
|
|
453
|
+
return new Int8Array(length);
|
|
454
|
+
}
|
|
455
|
+
if (parquetField.primitiveType === 'INT32' && arrowType instanceof arrow.Int16) {
|
|
456
|
+
return new Int16Array(length);
|
|
457
|
+
}
|
|
458
|
+
if (
|
|
459
|
+
parquetField.primitiveType === 'INT32' &&
|
|
460
|
+
(arrowType instanceof arrow.Int32 ||
|
|
461
|
+
arrowType instanceof arrow.DateDay ||
|
|
462
|
+
arrowType instanceof arrow.TimeMillisecond)
|
|
463
|
+
) {
|
|
464
|
+
return new Int32Array(length);
|
|
465
|
+
}
|
|
466
|
+
if (parquetField.primitiveType === 'INT32' && arrowType instanceof arrow.Uint8) {
|
|
467
|
+
return new Uint8Array(length);
|
|
468
|
+
}
|
|
469
|
+
if (parquetField.primitiveType === 'INT32' && arrowType instanceof arrow.Uint16) {
|
|
470
|
+
return new Uint16Array(length);
|
|
471
|
+
}
|
|
472
|
+
if (parquetField.primitiveType === 'INT32' && arrowType instanceof arrow.Uint32) {
|
|
473
|
+
return new Uint32Array(length);
|
|
474
|
+
}
|
|
475
|
+
if (
|
|
476
|
+
parquetField.primitiveType === 'INT64' &&
|
|
477
|
+
(arrowType instanceof arrow.Int64 ||
|
|
478
|
+
arrowType instanceof arrow.TimeMicrosecond ||
|
|
479
|
+
arrowType instanceof arrow.TimeNanosecond ||
|
|
480
|
+
arrowType instanceof arrow.TimestampMillisecond ||
|
|
481
|
+
arrowType instanceof arrow.TimestampMicrosecond ||
|
|
482
|
+
arrowType instanceof arrow.TimestampNanosecond)
|
|
483
|
+
) {
|
|
484
|
+
return new BigInt64Array(length);
|
|
485
|
+
}
|
|
486
|
+
if (parquetField.primitiveType === 'INT64' && arrowType instanceof arrow.Uint64) {
|
|
487
|
+
return new BigUint64Array(length);
|
|
488
|
+
}
|
|
489
|
+
return undefined;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** Writes one decoded primitive into the exact array expected by Arrow. */
|
|
493
|
+
function setNestedPrimitiveValue(
|
|
494
|
+
data: NestedPrimitiveArrowArray,
|
|
495
|
+
index: number,
|
|
496
|
+
value: unknown
|
|
497
|
+
): void {
|
|
498
|
+
if (data instanceof BigInt64Array) {
|
|
499
|
+
data[index] = typeof value === 'bigint' ? value : BigInt(value as number | string);
|
|
500
|
+
} else if (data instanceof BigUint64Array) {
|
|
501
|
+
data[index] = BigInt.asUintN(
|
|
502
|
+
64,
|
|
503
|
+
typeof value === 'bigint' ? value : BigInt(value as number | string)
|
|
504
|
+
);
|
|
505
|
+
} else {
|
|
506
|
+
data[index] = Number(value);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Creates Arrow Utf8 or Binary data for selected decoded byte values. */
|
|
511
|
+
function createSelectedByteData(
|
|
512
|
+
arrowType: arrow.DataType,
|
|
513
|
+
parquetField: ParquetField,
|
|
514
|
+
columnData: ParquetColumnChunk,
|
|
515
|
+
selected: SelectedLeafValues
|
|
516
|
+
): arrow.Data | undefined {
|
|
517
|
+
if (!supportsNestedByteData(arrowType, parquetField)) {
|
|
518
|
+
return undefined;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
const byteValues = columnData.values as Uint8Array[];
|
|
522
|
+
const valueOffsets = new Int32Array(selected.length + 1);
|
|
523
|
+
let sourceValueIndex = selected.firstValueIndex;
|
|
524
|
+
let dataByteLength = 0;
|
|
525
|
+
for (let outputIndex = 0; outputIndex < selected.length; outputIndex++) {
|
|
526
|
+
if (!selected.nullBitmap || selected.nullBitmap[outputIndex >> 3] & (1 << (outputIndex & 7))) {
|
|
527
|
+
dataByteLength += byteValues[sourceValueIndex++].byteLength;
|
|
528
|
+
if (dataByteLength > 0x7fffffff) {
|
|
529
|
+
throw new Error('Arrow Utf8/Binary column exceeds the 32-bit offset range');
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
valueOffsets[outputIndex + 1] = dataByteLength;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const data = new Uint8Array(dataByteLength);
|
|
536
|
+
let dataOffset = 0;
|
|
537
|
+
const valueEnd = selected.firstValueIndex + selected.valueCount;
|
|
538
|
+
for (let valueIndex = selected.firstValueIndex; valueIndex < valueEnd; valueIndex++) {
|
|
539
|
+
const bytes = byteValues[valueIndex];
|
|
540
|
+
if (bytes.byteLength <= MAXIMUM_INLINE_BYTE_COPY_LENGTH) {
|
|
541
|
+
for (let byteIndex = 0; byteIndex < bytes.byteLength; byteIndex++) {
|
|
542
|
+
data[dataOffset++] = bytes[byteIndex];
|
|
543
|
+
}
|
|
544
|
+
} else {
|
|
545
|
+
data.set(bytes, dataOffset);
|
|
546
|
+
dataOffset += bytes.byteLength;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
return arrow.makeData({
|
|
551
|
+
type: arrowType,
|
|
552
|
+
valueOffsets,
|
|
553
|
+
data,
|
|
554
|
+
nullBitmap: selected.nullBitmap,
|
|
555
|
+
nullCount: selected.nullCount
|
|
556
|
+
} as any);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/** Returns whether one Parquet byte leaf maps directly to Arrow Utf8 or Binary. */
|
|
560
|
+
function supportsNestedByteData(arrowType: arrow.DataType, parquetField: ParquetField): boolean {
|
|
561
|
+
if (arrowType instanceof arrow.Utf8) {
|
|
562
|
+
return parquetField.originalType === 'UTF8' || parquetField.originalType === 'ENUM';
|
|
563
|
+
}
|
|
564
|
+
return (
|
|
565
|
+
arrowType instanceof arrow.Binary &&
|
|
566
|
+
(!parquetField.originalType ||
|
|
567
|
+
parquetField.originalType === 'GEOMETRY' ||
|
|
568
|
+
parquetField.originalType === 'GEOGRAPHY') &&
|
|
569
|
+
(parquetField.primitiveType === 'BYTE_ARRAY' ||
|
|
570
|
+
parquetField.primitiveType === 'FIXED_LEN_BYTE_ARRAY')
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/** Lists all primitive descendant fields in schema order. */
|
|
575
|
+
function listPrimitiveLeaves(parquetField: ParquetField): ParquetField[] {
|
|
576
|
+
if (!parquetField.fields) {
|
|
577
|
+
return [parquetField];
|
|
578
|
+
}
|
|
579
|
+
return Object.values(parquetField.fields).flatMap(listPrimitiveLeaves);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** Converts per-parent value counts into Arrow list offsets. */
|
|
583
|
+
function accumulateOffsets(valueCounts: Int32Array): Int32Array {
|
|
584
|
+
const valueOffsets = new Int32Array(valueCounts.length + 1);
|
|
585
|
+
for (let index = 0; index < valueCounts.length; index++) {
|
|
586
|
+
valueOffsets[index + 1] = valueOffsets[index] + valueCounts[index];
|
|
587
|
+
}
|
|
588
|
+
return valueOffsets;
|
|
589
|
+
}
|
package/src/lib/constants.ts
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
7
|
export const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
8
8
|
|
|
9
|
-
export const PARQUET_WASM_URL = 'https://unpkg.com/parquet-wasm@0.6.1/esm/parquet_wasm_bg.wasm';
|
|
10
|
-
|
|
11
9
|
/**
|
|
12
10
|
* Parquet File Magic String
|
|
13
11
|
*/
|
|
@@ -7,16 +7,16 @@ import type {ArrowTable} from '@loaders.gl/schema';
|
|
|
7
7
|
import * as arrow from 'apache-arrow';
|
|
8
8
|
import {loadWasm} from '../utils/load-wasm';
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type {ParquetWriterOptions} from '../../parquet-writer';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Encode Arrow arrow.Table to Parquet buffer
|
|
14
14
|
*/
|
|
15
15
|
export async function encodeArrowToParquet(
|
|
16
16
|
table: ArrowTable,
|
|
17
|
-
options:
|
|
17
|
+
options: ParquetWriterOptions
|
|
18
18
|
): Promise<ArrayBuffer> {
|
|
19
|
-
const wasmUrl = options.parquet?.wasmUrl
|
|
19
|
+
const wasmUrl = options.parquet?.wasmUrl;
|
|
20
20
|
const wasm = await loadWasm(wasmUrl);
|
|
21
21
|
|
|
22
22
|
// Serialize the table to the IPC format.
|
|
@@ -26,19 +26,13 @@ export async function encodeArrowToParquet(
|
|
|
26
26
|
// Pass the IPC stream to the Parquet writer.
|
|
27
27
|
const wasmTable = wasm.Table.fromIPCStream(ipcStream);
|
|
28
28
|
const wasmProperties = new wasm.WriterPropertiesBuilder().build();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
);
|
|
37
|
-
return bytes.slice().buffer;
|
|
38
|
-
} finally {
|
|
39
|
-
// wasmTable.free();
|
|
40
|
-
// wasmProperties.free();
|
|
41
|
-
}
|
|
29
|
+
const parquetBytes = wasm.writeParquet(wasmTable, wasmProperties);
|
|
30
|
+
const bytes = new Uint8Array(
|
|
31
|
+
parquetBytes.buffer,
|
|
32
|
+
parquetBytes.byteOffset,
|
|
33
|
+
parquetBytes.byteLength
|
|
34
|
+
);
|
|
35
|
+
return bytes.slice().buffer;
|
|
42
36
|
}
|
|
43
37
|
|
|
44
38
|
// type WriteOptions = {
|