@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
|
@@ -17,19 +17,44 @@ import {
|
|
|
17
17
|
ParquetCompression,
|
|
18
18
|
ParquetColumnChunk,
|
|
19
19
|
PrimitiveType,
|
|
20
|
-
ParquetReaderContext
|
|
20
|
+
ParquetReaderContext,
|
|
21
|
+
type ParquetLevelBuffer
|
|
21
22
|
} from '../schema/declare';
|
|
22
23
|
import {decodeFileMetadata, getThriftEnum, fieldIndexOf} from '../utils/read-utils';
|
|
24
|
+
import {decodeString, readUInt32LE, toUint8Array} from '../utils/binary-utils';
|
|
25
|
+
import {CompactInt64} from '../utils/uint8-array-compact-protocol';
|
|
26
|
+
import type {
|
|
27
|
+
ParquetDataPageLocation,
|
|
28
|
+
ParquetPageLocations,
|
|
29
|
+
ParquetRowRange
|
|
30
|
+
} from '../../lib/parquet-page-index';
|
|
31
|
+
|
|
32
|
+
/** Bounds concurrent range requests when a row group contains unusually many selected columns. */
|
|
33
|
+
const MAXIMUM_CONCURRENT_COLUMN_READS = 16;
|
|
23
34
|
|
|
24
35
|
export type ParquetReaderProps = {
|
|
36
|
+
/** Maximum dictionary-page read size. */
|
|
25
37
|
defaultDictionarySize?: number;
|
|
38
|
+
/** Preserve BYTE_ARRAY values instead of decoding them as strings. */
|
|
26
39
|
preserveBinary?: boolean;
|
|
40
|
+
/** Retain byte arrays as views into decoded page buffers for direct materialization. */
|
|
41
|
+
retainByteArrayViews?: boolean;
|
|
42
|
+
/** Decode supported primitive columns into typed buffers instead of boxed JavaScript arrays. */
|
|
43
|
+
useTypedValueBuffers?: boolean;
|
|
44
|
+
/** Decode repetition and definition levels into compact unsigned typed arrays. */
|
|
45
|
+
useTypedLevelBuffers?: boolean;
|
|
46
|
+
/** Abort signal forwarded to every underlying random-access read. */
|
|
47
|
+
signal?: AbortSignal;
|
|
27
48
|
};
|
|
28
49
|
|
|
29
50
|
/** Properties for initializing a ParquetRowGroupReader */
|
|
30
51
|
export type ParquetIterationProps = {
|
|
31
52
|
/** Filter allowing some columns to be dropped */
|
|
32
53
|
columnList?: string[] | string[][];
|
|
54
|
+
/** Zero-based row-group indexes to read, in output order. */
|
|
55
|
+
rowGroups?: number[];
|
|
56
|
+
/** Abort signal forwarded to row-group and column-chunk reads. */
|
|
57
|
+
signal?: AbortSignal;
|
|
33
58
|
};
|
|
34
59
|
|
|
35
60
|
/**
|
|
@@ -39,15 +64,21 @@ export type ParquetIterationProps = {
|
|
|
39
64
|
* rows from a parquet file use the ParquetReader instead
|
|
40
65
|
*/
|
|
41
66
|
export class ParquetReader {
|
|
42
|
-
static defaultProps: Required<ParquetReaderProps
|
|
67
|
+
static defaultProps: Required<Omit<ParquetReaderProps, 'signal'>> & {signal?: AbortSignal} = {
|
|
43
68
|
// max ArrayBuffer size in js is 2Gb
|
|
44
69
|
defaultDictionarySize: 2147483648,
|
|
45
|
-
preserveBinary: false
|
|
70
|
+
preserveBinary: false,
|
|
71
|
+
retainByteArrayViews: false,
|
|
72
|
+
useTypedValueBuffers: false,
|
|
73
|
+
useTypedLevelBuffers: false,
|
|
74
|
+
signal: undefined
|
|
46
75
|
};
|
|
47
76
|
|
|
48
|
-
props: Required<ParquetReaderProps
|
|
77
|
+
props: Required<Omit<ParquetReaderProps, 'signal'>> & {signal?: AbortSignal};
|
|
49
78
|
file: ReadableFile;
|
|
50
79
|
metadata: Promise<FileMetaData> | null = null;
|
|
80
|
+
/** Parsed Parquet schema shared by metadata, iteration, and materialization paths. */
|
|
81
|
+
private schema: Promise<ParquetSchema> | null = null;
|
|
51
82
|
|
|
52
83
|
constructor(file: ReadableFile, props?: ParquetReaderProps) {
|
|
53
84
|
this.file = file;
|
|
@@ -82,36 +113,41 @@ export class ParquetReader {
|
|
|
82
113
|
/** Iterate over the raw row groups */
|
|
83
114
|
async *rowGroupIterator(props?: ParquetIterationProps) {
|
|
84
115
|
// Ensure strings are nested in arrays
|
|
85
|
-
const columnList: string[][] = (props?.columnList || []).map((x)
|
|
86
|
-
Array.isArray(x) ? x : [x]
|
|
87
|
-
);
|
|
116
|
+
const columnList: string[][] = (props?.columnList || []).map(x => (Array.isArray(x) ? x : [x]));
|
|
88
117
|
|
|
89
|
-
const metadata = await this.getFileMetadata();
|
|
90
|
-
const schema = await this.getSchema();
|
|
118
|
+
const metadata = await this.getFileMetadata(props?.signal);
|
|
119
|
+
const schema = await this.getSchema(props?.signal);
|
|
91
120
|
|
|
92
121
|
const rowGroupCount = metadata?.row_groups.length || 0;
|
|
122
|
+
const rowGroupIndices =
|
|
123
|
+
props?.rowGroups || Array.from({length: rowGroupCount}, (_, index) => index);
|
|
93
124
|
|
|
94
|
-
for (
|
|
125
|
+
for (const rowGroupIndex of rowGroupIndices) {
|
|
126
|
+
if (!Number.isInteger(rowGroupIndex) || rowGroupIndex < 0 || rowGroupIndex >= rowGroupCount) {
|
|
127
|
+
throw new Error(`Invalid Parquet row-group index ${rowGroupIndex}`);
|
|
128
|
+
}
|
|
95
129
|
const rowGroup = await this.readRowGroup(
|
|
96
130
|
schema,
|
|
97
131
|
metadata.row_groups[rowGroupIndex],
|
|
98
|
-
columnList
|
|
132
|
+
columnList,
|
|
133
|
+
props?.signal
|
|
99
134
|
);
|
|
100
135
|
yield rowGroup;
|
|
101
136
|
}
|
|
102
137
|
}
|
|
103
138
|
|
|
104
|
-
async getRowCount(): Promise<number> {
|
|
105
|
-
const metadata = await this.getFileMetadata();
|
|
139
|
+
async getRowCount(signal?: AbortSignal): Promise<number> {
|
|
140
|
+
const metadata = await this.getFileMetadata(signal);
|
|
106
141
|
return Number(metadata.num_rows);
|
|
107
142
|
}
|
|
108
143
|
|
|
109
|
-
async getSchema(): Promise<ParquetSchema> {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
async getSchema(signal?: AbortSignal): Promise<ParquetSchema> {
|
|
145
|
+
this.schema ||= this.getFileMetadata(signal).then(metadata => {
|
|
146
|
+
const root = metadata.schema[0];
|
|
147
|
+
const {schema: schemaDefinition} = decodeSchema(metadata.schema, 1, root.num_children!);
|
|
148
|
+
return new ParquetSchema(schemaDefinition);
|
|
149
|
+
});
|
|
150
|
+
return await this.schema;
|
|
115
151
|
}
|
|
116
152
|
|
|
117
153
|
/**
|
|
@@ -127,10 +163,10 @@ export class ParquetReader {
|
|
|
127
163
|
return md;
|
|
128
164
|
}
|
|
129
165
|
|
|
130
|
-
async getFileMetadata(): Promise<FileMetaData> {
|
|
166
|
+
async getFileMetadata(signal?: AbortSignal): Promise<FileMetaData> {
|
|
131
167
|
if (!this.metadata) {
|
|
132
|
-
await this.readHeader();
|
|
133
|
-
this.metadata = this.readFooter();
|
|
168
|
+
await this.readHeader(signal);
|
|
169
|
+
this.metadata = this.readFooter(signal);
|
|
134
170
|
}
|
|
135
171
|
return this.metadata;
|
|
136
172
|
}
|
|
@@ -138,10 +174,9 @@ export class ParquetReader {
|
|
|
138
174
|
// LOW LEVEL METHODS
|
|
139
175
|
|
|
140
176
|
/** Metadata is stored in the footer */
|
|
141
|
-
async readHeader(): Promise<void> {
|
|
142
|
-
const arrayBuffer = await this.file.read(0, PARQUET_MAGIC.length);
|
|
143
|
-
const
|
|
144
|
-
const magic = buffer.toString();
|
|
177
|
+
async readHeader(signal?: AbortSignal): Promise<void> {
|
|
178
|
+
const arrayBuffer = await this.file.read(0, PARQUET_MAGIC.length, signal ?? this.props.signal);
|
|
179
|
+
const magic = decodeString(toUint8Array(arrayBuffer));
|
|
145
180
|
switch (magic) {
|
|
146
181
|
case PARQUET_MAGIC:
|
|
147
182
|
break;
|
|
@@ -153,24 +188,32 @@ export class ParquetReader {
|
|
|
153
188
|
}
|
|
154
189
|
|
|
155
190
|
/** Metadata is stored in the footer */
|
|
156
|
-
async readFooter(): Promise<FileMetaData> {
|
|
191
|
+
async readFooter(signal?: AbortSignal): Promise<FileMetaData> {
|
|
157
192
|
const trailerLen = PARQUET_MAGIC.length + 4;
|
|
158
|
-
const arrayBuffer = await this.file.read(
|
|
159
|
-
|
|
193
|
+
const arrayBuffer = await this.file.read(
|
|
194
|
+
this.file.size - trailerLen,
|
|
195
|
+
trailerLen,
|
|
196
|
+
signal ?? this.props.signal
|
|
197
|
+
);
|
|
198
|
+
const trailer = toUint8Array(arrayBuffer);
|
|
160
199
|
|
|
161
|
-
const magic =
|
|
200
|
+
const magic = decodeString(trailer, 4);
|
|
162
201
|
if (magic !== PARQUET_MAGIC) {
|
|
163
202
|
throw new Error(`Not a valid parquet file (magic="${magic})`);
|
|
164
203
|
}
|
|
165
204
|
|
|
166
|
-
const metadataSize =
|
|
205
|
+
const metadataSize = readUInt32LE(trailer, 0);
|
|
167
206
|
const metadataOffset = this.file.size - metadataSize - trailerLen;
|
|
168
207
|
if (metadataOffset < PARQUET_MAGIC.length) {
|
|
169
208
|
throw new Error(`Invalid metadata size ${metadataOffset}`);
|
|
170
209
|
}
|
|
171
210
|
|
|
172
|
-
const arrayBuffer2 = await this.file.read(
|
|
173
|
-
|
|
211
|
+
const arrayBuffer2 = await this.file.read(
|
|
212
|
+
metadataOffset,
|
|
213
|
+
metadataSize,
|
|
214
|
+
signal ?? this.props.signal
|
|
215
|
+
);
|
|
216
|
+
const metadataBuf = toUint8Array(arrayBuffer2);
|
|
174
217
|
// let metadata = new parquet_thrift.FileMetaData();
|
|
175
218
|
// parquet_util.decodeThrift(metadata, metadataBuf);
|
|
176
219
|
|
|
@@ -182,27 +225,83 @@ export class ParquetReader {
|
|
|
182
225
|
async readRowGroup(
|
|
183
226
|
schema: ParquetSchema,
|
|
184
227
|
rowGroup: RowGroup,
|
|
185
|
-
columnList: string[][]
|
|
228
|
+
columnList: string[][],
|
|
229
|
+
signal?: AbortSignal
|
|
186
230
|
): Promise<ParquetRowGroup> {
|
|
187
|
-
const
|
|
231
|
+
const selectedColumnChunks = rowGroup.columns.filter(columnChunk => {
|
|
232
|
+
const columnKey = columnChunk.meta_data?.path_in_schema;
|
|
233
|
+
return columnList.length === 0 || fieldIndexOf(columnList, columnKey!) >= 0;
|
|
234
|
+
});
|
|
235
|
+
const columnEntries: Array<readonly [string, ParquetColumnChunk]> = [];
|
|
236
|
+
for (
|
|
237
|
+
let batchStart = 0;
|
|
238
|
+
batchStart < selectedColumnChunks.length;
|
|
239
|
+
batchStart += MAXIMUM_CONCURRENT_COLUMN_READS
|
|
240
|
+
) {
|
|
241
|
+
const columnBatch = selectedColumnChunks.slice(
|
|
242
|
+
batchStart,
|
|
243
|
+
batchStart + MAXIMUM_CONCURRENT_COLUMN_READS
|
|
244
|
+
);
|
|
245
|
+
columnEntries.push(
|
|
246
|
+
...(await Promise.all(
|
|
247
|
+
columnBatch.map(async columnChunk => {
|
|
248
|
+
const columnKey = columnChunk.meta_data!.path_in_schema.join();
|
|
249
|
+
const columnData = await this.readColumnChunk(schema, columnChunk, signal);
|
|
250
|
+
return [columnKey, columnData] as const;
|
|
251
|
+
})
|
|
252
|
+
))
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
188
256
|
rowCount: Number(rowGroup.num_rows),
|
|
189
|
-
columnData:
|
|
257
|
+
columnData: Object.fromEntries(columnEntries)
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Reads independently materializable flat columns for one logical row range using page indexes. */
|
|
262
|
+
async readRowGroupRange(
|
|
263
|
+
schema: ParquetSchema,
|
|
264
|
+
rowGroup: RowGroup,
|
|
265
|
+
columnList: string[][],
|
|
266
|
+
rowRange: ParquetRowRange,
|
|
267
|
+
pageLocations: ParquetPageLocations,
|
|
268
|
+
signal?: AbortSignal
|
|
269
|
+
): Promise<ParquetRowGroup> {
|
|
270
|
+
const selectedColumnChunks = rowGroup.columns.filter(columnChunk => {
|
|
271
|
+
const columnKey = columnChunk.meta_data?.path_in_schema;
|
|
272
|
+
return columnList.length === 0 || fieldIndexOf(columnList, columnKey!) >= 0;
|
|
273
|
+
});
|
|
274
|
+
const columnEntries = await Promise.all(
|
|
275
|
+
selectedColumnChunks.map(async columnChunk => {
|
|
276
|
+
const columnKey = columnChunk.meta_data!.path_in_schema.join();
|
|
277
|
+
const pages = pageLocations[columnChunk.meta_data!.path_in_schema.join('.')];
|
|
278
|
+
if (!pages) {
|
|
279
|
+
throw new Error(`Parquet offset index missing for ${columnKey}`);
|
|
280
|
+
}
|
|
281
|
+
const columnData = await this.readColumnChunkRange(
|
|
282
|
+
schema,
|
|
283
|
+
columnChunk,
|
|
284
|
+
rowRange,
|
|
285
|
+
pages,
|
|
286
|
+
signal
|
|
287
|
+
);
|
|
288
|
+
return [columnKey, columnData] as const;
|
|
289
|
+
})
|
|
290
|
+
);
|
|
291
|
+
return {
|
|
292
|
+
rowCount: rowRange.end - rowRange.start,
|
|
293
|
+
columnData: Object.fromEntries(columnEntries)
|
|
190
294
|
};
|
|
191
|
-
for (const colChunk of rowGroup.columns) {
|
|
192
|
-
const colMetadata = colChunk.meta_data;
|
|
193
|
-
const colKey = colMetadata?.path_in_schema;
|
|
194
|
-
if (columnList.length > 0 && fieldIndexOf(columnList, colKey!) < 0) {
|
|
195
|
-
continue; // eslint-disable-line no-continue
|
|
196
|
-
}
|
|
197
|
-
buffer.columnData[colKey!.join()] = await this.readColumnChunk(schema, colChunk);
|
|
198
|
-
}
|
|
199
|
-
return buffer;
|
|
200
295
|
}
|
|
201
296
|
|
|
202
297
|
/**
|
|
203
298
|
* Each row group contains column chunks for all the columns.
|
|
204
299
|
*/
|
|
205
|
-
async readColumnChunk(
|
|
300
|
+
async readColumnChunk(
|
|
301
|
+
schema: ParquetSchema,
|
|
302
|
+
colChunk: ColumnChunk,
|
|
303
|
+
signal?: AbortSignal
|
|
304
|
+
): Promise<ParquetColumnChunk> {
|
|
206
305
|
if (colChunk.file_path !== undefined && colChunk.file_path !== null) {
|
|
207
306
|
throw new Error('external references are not supported');
|
|
208
307
|
}
|
|
@@ -220,14 +319,21 @@ export class ParquetReader {
|
|
|
220
319
|
) as any;
|
|
221
320
|
|
|
222
321
|
const pagesOffset = Number(colChunk.meta_data?.data_page_offset!);
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
322
|
+
const dictionaryPageOffset = colChunk.meta_data?.dictionary_page_offset;
|
|
323
|
+
const validDictionaryPageOffset =
|
|
324
|
+
dictionaryPageOffset !== undefined && Number(dictionaryPageOffset) > 0
|
|
325
|
+
? Number(dictionaryPageOffset)
|
|
326
|
+
: undefined;
|
|
327
|
+
const chunkOffset = Math.min(pagesOffset, validDictionaryPageOffset ?? pagesOffset);
|
|
328
|
+
const chunkEnd = chunkOffset + Number(colChunk.meta_data?.total_compressed_size!);
|
|
329
|
+
const chunkSize = Math.min(this.file.size - chunkOffset, Math.max(0, chunkEnd - chunkOffset));
|
|
330
|
+
const arrayBuffer = await this.file.read(chunkOffset, chunkSize, signal ?? this.props.signal);
|
|
331
|
+
const chunkBuffer = toUint8Array(arrayBuffer);
|
|
332
|
+
const pagesRelativeOffset = pagesOffset - chunkOffset;
|
|
333
|
+
const pagesSize = Math.min(
|
|
334
|
+
chunkBuffer.length - pagesRelativeOffset,
|
|
335
|
+
Math.max(0, chunkEnd - pagesOffset)
|
|
336
|
+
);
|
|
231
337
|
|
|
232
338
|
const context: ParquetReaderContext = {
|
|
233
339
|
type,
|
|
@@ -238,25 +344,98 @@ export class ParquetReader {
|
|
|
238
344
|
numValues: colChunk.meta_data?.num_values,
|
|
239
345
|
dictionary: [],
|
|
240
346
|
// Options - TBD is this the right place for these?
|
|
241
|
-
preserveBinary: this.props.preserveBinary
|
|
347
|
+
preserveBinary: this.props.preserveBinary,
|
|
348
|
+
retainByteArrayViews: this.props.retainByteArrayViews,
|
|
349
|
+
useTypedValueBuffers: this.props.useTypedValueBuffers,
|
|
350
|
+
useTypedLevelBuffers: this.props.useTypedLevelBuffers
|
|
242
351
|
};
|
|
243
352
|
|
|
244
|
-
let dictionary;
|
|
353
|
+
let dictionary: any[] | undefined;
|
|
245
354
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
355
|
+
if (validDictionaryPageOffset !== undefined) {
|
|
356
|
+
const dictionaryRelativeOffset = validDictionaryPageOffset - chunkOffset;
|
|
357
|
+
const dictionarySize = Math.min(
|
|
358
|
+
Math.max(0, pagesOffset - validDictionaryPageOffset),
|
|
359
|
+
chunkBuffer.length - dictionaryRelativeOffset,
|
|
360
|
+
this.props.defaultDictionarySize
|
|
361
|
+
);
|
|
362
|
+
const dictionaryBuffer = chunkBuffer.subarray(
|
|
363
|
+
dictionaryRelativeOffset,
|
|
364
|
+
dictionaryRelativeOffset + dictionarySize
|
|
365
|
+
);
|
|
366
|
+
dictionary = await decodeDictionaryBuffer(dictionaryBuffer, context);
|
|
252
367
|
}
|
|
253
368
|
|
|
254
369
|
dictionary = context.dictionary?.length ? context.dictionary : dictionary;
|
|
255
|
-
const
|
|
256
|
-
const pagesBuf = Buffer.from(arrayBuffer);
|
|
370
|
+
const pagesBuf = chunkBuffer.subarray(pagesRelativeOffset, pagesRelativeOffset + pagesSize);
|
|
257
371
|
return await decodeDataPages(pagesBuf, {...context, dictionary});
|
|
258
372
|
}
|
|
259
373
|
|
|
374
|
+
/** Reads and decodes only the contiguous data pages overlapping one flat-column row range. */
|
|
375
|
+
async readColumnChunkRange(
|
|
376
|
+
schema: ParquetSchema,
|
|
377
|
+
columnChunk: ColumnChunk,
|
|
378
|
+
rowRange: ParquetRowRange,
|
|
379
|
+
pages: readonly ParquetDataPageLocation[],
|
|
380
|
+
signal?: AbortSignal
|
|
381
|
+
): Promise<ParquetColumnChunk> {
|
|
382
|
+
if (columnChunk.file_path !== undefined && columnChunk.file_path !== null) {
|
|
383
|
+
throw new Error('external references are not supported');
|
|
384
|
+
}
|
|
385
|
+
const columnMetadata = columnChunk.meta_data!;
|
|
386
|
+
const field = schema.findField(columnMetadata.path_in_schema);
|
|
387
|
+
if (field.path.length !== 1 || field.repetitionType === 'REPEATED' || field.rLevelMax !== 0) {
|
|
388
|
+
throw new Error('Selective Parquet page reads currently require flat primitive columns');
|
|
389
|
+
}
|
|
390
|
+
const type: PrimitiveType = getThriftEnum(Type, columnMetadata.type) as any;
|
|
391
|
+
if (type !== field.primitiveType) {
|
|
392
|
+
throw new Error(`chunk type not matching schema: ${type}`);
|
|
393
|
+
}
|
|
394
|
+
const compression: ParquetCompression = getThriftEnum(
|
|
395
|
+
CompressionCodec,
|
|
396
|
+
columnMetadata.codec
|
|
397
|
+
) as any;
|
|
398
|
+
const overlappingPages = pages.filter(
|
|
399
|
+
page => page.endRowIndex > rowRange.start && page.firstRowIndex < rowRange.end
|
|
400
|
+
);
|
|
401
|
+
if (!overlappingPages.length) {
|
|
402
|
+
throw new Error('Parquet page plan does not overlap the requested row range');
|
|
403
|
+
}
|
|
404
|
+
const firstPage = overlappingPages[0];
|
|
405
|
+
const lastPage = overlappingPages[overlappingPages.length - 1];
|
|
406
|
+
const context: ParquetReaderContext = {
|
|
407
|
+
type,
|
|
408
|
+
rLevelMax: field.rLevelMax,
|
|
409
|
+
dLevelMax: field.dLevelMax,
|
|
410
|
+
compression,
|
|
411
|
+
column: field,
|
|
412
|
+
numValues: new CompactInt64(lastPage.endRowIndex - firstPage.firstRowIndex),
|
|
413
|
+
dictionary: [],
|
|
414
|
+
preserveBinary: this.props.preserveBinary,
|
|
415
|
+
retainByteArrayViews: this.props.retainByteArrayViews,
|
|
416
|
+
useTypedValueBuffers: this.props.useTypedValueBuffers
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
let dictionary: any[] | undefined;
|
|
420
|
+
const dictionaryPageOffset = Number(columnMetadata.dictionary_page_offset);
|
|
421
|
+
if (Number.isSafeInteger(dictionaryPageOffset) && dictionaryPageOffset > 0) {
|
|
422
|
+
const dictionaryLength = Math.max(0, pages[0].offset - dictionaryPageOffset);
|
|
423
|
+
const dictionaryBuffer = toUint8Array(
|
|
424
|
+
await this.file.read(dictionaryPageOffset, dictionaryLength, signal ?? this.props.signal)
|
|
425
|
+
);
|
|
426
|
+
dictionary = await decodeDictionaryBuffer(dictionaryBuffer, context);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const dataLength = lastPage.offset + lastPage.compressedByteLength - firstPage.offset;
|
|
430
|
+
const dataBuffer = toUint8Array(
|
|
431
|
+
await this.file.read(firstPage.offset, dataLength, signal ?? this.props.signal)
|
|
432
|
+
);
|
|
433
|
+
const decoded = await decodeDataPages(dataBuffer, {...context, dictionary});
|
|
434
|
+
const relativeStart = rowRange.start - firstPage.firstRowIndex;
|
|
435
|
+
const relativeEnd = relativeStart + rowRange.end - rowRange.start;
|
|
436
|
+
return sliceFlatColumnChunk(decoded, field.dLevelMax, relativeStart, relativeEnd);
|
|
437
|
+
}
|
|
438
|
+
|
|
260
439
|
/**
|
|
261
440
|
* Getting dictionary for allows to flatten values by indices.
|
|
262
441
|
* @param dictionaryPageOffset
|
|
@@ -267,8 +446,9 @@ export class ParquetReader {
|
|
|
267
446
|
async getDictionary(
|
|
268
447
|
dictionaryPageOffset: number,
|
|
269
448
|
context: ParquetReaderContext,
|
|
270
|
-
pagesOffset: number
|
|
271
|
-
|
|
449
|
+
pagesOffset: number,
|
|
450
|
+
signal?: AbortSignal
|
|
451
|
+
): Promise<any[]> {
|
|
272
452
|
if (dictionaryPageOffset === 0) {
|
|
273
453
|
// dictionarySize = Math.min(this.fileSize - pagesOffset, this.defaultDictionarySize);
|
|
274
454
|
// pagesBuf = await this.read(pagesOffset, dictionarySize);
|
|
@@ -281,15 +461,61 @@ export class ParquetReader {
|
|
|
281
461
|
}
|
|
282
462
|
|
|
283
463
|
const dictionarySize = Math.min(
|
|
464
|
+
Math.max(0, pagesOffset - dictionaryPageOffset),
|
|
284
465
|
this.file.size - dictionaryPageOffset,
|
|
285
466
|
this.props.defaultDictionarySize
|
|
286
467
|
);
|
|
287
|
-
const arrayBuffer = await this.file.read(
|
|
288
|
-
|
|
468
|
+
const arrayBuffer = await this.file.read(
|
|
469
|
+
dictionaryPageOffset,
|
|
470
|
+
dictionarySize,
|
|
471
|
+
signal ?? this.props.signal
|
|
472
|
+
);
|
|
473
|
+
const pagesBuf = toUint8Array(arrayBuffer);
|
|
474
|
+
return await decodeDictionaryBuffer(pagesBuf, context);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** Decodes one dictionary page from an already-read column-chunk range. */
|
|
479
|
+
async function decodeDictionaryBuffer(
|
|
480
|
+
dictionaryBuffer: Uint8Array,
|
|
481
|
+
context: ParquetReaderContext
|
|
482
|
+
): Promise<any[]> {
|
|
483
|
+
const cursor = {buffer: dictionaryBuffer, offset: 0, size: dictionaryBuffer.length};
|
|
484
|
+
const decodedPage = await decodePage(cursor, context);
|
|
485
|
+
return decodedPage.dictionary!;
|
|
486
|
+
}
|
|
289
487
|
|
|
290
|
-
|
|
291
|
-
|
|
488
|
+
/** Slices one decoded flat column chunk while preserving optional-value alignment. */
|
|
489
|
+
function sliceFlatColumnChunk(
|
|
490
|
+
columnChunk: ParquetColumnChunk,
|
|
491
|
+
definitionLevelMaximum: number,
|
|
492
|
+
start: number,
|
|
493
|
+
end: number
|
|
494
|
+
): ParquetColumnChunk {
|
|
495
|
+
const valueStart = countDefinedValues(columnChunk.dlevels, definitionLevelMaximum, 0, start);
|
|
496
|
+
const valueEnd =
|
|
497
|
+
valueStart + countDefinedValues(columnChunk.dlevels, definitionLevelMaximum, start, end);
|
|
498
|
+
return {
|
|
499
|
+
rlevels: columnChunk.rlevels.slice(start, end),
|
|
500
|
+
dlevels: columnChunk.dlevels.slice(start, end),
|
|
501
|
+
values: columnChunk.values.slice(valueStart, valueEnd) as typeof columnChunk.values,
|
|
502
|
+
count: end - start,
|
|
503
|
+
pageHeaders: columnChunk.pageHeaders
|
|
504
|
+
};
|
|
505
|
+
}
|
|
292
506
|
|
|
293
|
-
|
|
507
|
+
/** Counts defined primitive values represented by one flat level interval. */
|
|
508
|
+
function countDefinedValues(
|
|
509
|
+
definitionLevels: ParquetLevelBuffer,
|
|
510
|
+
definitionLevelMaximum: number,
|
|
511
|
+
start: number,
|
|
512
|
+
end: number
|
|
513
|
+
): number {
|
|
514
|
+
let count = 0;
|
|
515
|
+
for (let index = start; index < Math.min(end, definitionLevels.length); index++) {
|
|
516
|
+
if (definitionLevels[index] === definitionLevelMaximum) {
|
|
517
|
+
count++;
|
|
518
|
+
}
|
|
294
519
|
}
|
|
520
|
+
return count;
|
|
295
521
|
}
|
|
@@ -4,10 +4,19 @@
|
|
|
4
4
|
// Copyright (c) 2017 ironSource Ltd.
|
|
5
5
|
// Forked from https://github.com/kbajalc/parquets under MIT license
|
|
6
6
|
|
|
7
|
-
import Int64 from '
|
|
7
|
+
import {CompactInt64 as Int64} from '../utils/uint8-array-compact-protocol';
|
|
8
8
|
import type {PageHeader} from '../parquet-thrift';
|
|
9
|
+
import type {ParquetValueBuffer} from '../codecs/declare';
|
|
9
10
|
|
|
10
|
-
export type ParquetCodec =
|
|
11
|
+
export type ParquetCodec =
|
|
12
|
+
| 'PLAIN'
|
|
13
|
+
| 'RLE'
|
|
14
|
+
| 'PLAIN_DICTIONARY'
|
|
15
|
+
| 'RLE_DICTIONARY'
|
|
16
|
+
| 'DELTA_BINARY_PACKED'
|
|
17
|
+
| 'DELTA_LENGTH_BYTE_ARRAY'
|
|
18
|
+
| 'DELTA_BYTE_ARRAY'
|
|
19
|
+
| 'BYTE_STREAM_SPLIT';
|
|
11
20
|
export type ParquetCompression =
|
|
12
21
|
| 'UNCOMPRESSED'
|
|
13
22
|
| 'GZIP'
|
|
@@ -52,8 +61,10 @@ export type OriginalType =
|
|
|
52
61
|
| 'DATE' // 6
|
|
53
62
|
| 'TIME_MILLIS' // 7
|
|
54
63
|
| 'TIME_MICROS' // 8
|
|
64
|
+
| 'TIME_NANOS'
|
|
55
65
|
| 'TIMESTAMP_MILLIS' // 9
|
|
56
66
|
| 'TIMESTAMP_MICROS' // 10
|
|
67
|
+
| 'TIMESTAMP_NANOS'
|
|
57
68
|
| 'UINT_8' // 11
|
|
58
69
|
| 'UINT_16' // 12
|
|
59
70
|
| 'UINT_32' // 13
|
|
@@ -62,11 +73,65 @@ export type OriginalType =
|
|
|
62
73
|
| 'INT_16' // 16
|
|
63
74
|
| 'INT_32' // 17
|
|
64
75
|
| 'INT_64' // 18
|
|
76
|
+
| 'ENUM'
|
|
77
|
+
| 'UUID'
|
|
78
|
+
| 'FLOAT16'
|
|
79
|
+
| 'UNKNOWN'
|
|
80
|
+
| 'VARIANT'
|
|
81
|
+
| 'GEOMETRY'
|
|
82
|
+
| 'GEOGRAPHY'
|
|
65
83
|
| 'JSON' // 19
|
|
66
84
|
| 'BSON' // 20
|
|
67
85
|
| 'INTERVAL'; // 21
|
|
68
86
|
|
|
69
|
-
|
|
87
|
+
/** Units carried by Parquet TIME and TIMESTAMP logical type annotations. */
|
|
88
|
+
export type ParquetTimeUnit = 'MILLIS' | 'MICROS' | 'NANOS';
|
|
89
|
+
|
|
90
|
+
/** Logical type names defined by the Parquet 2.13 format. */
|
|
91
|
+
export type ParquetLogicalTypeName =
|
|
92
|
+
| 'STRING'
|
|
93
|
+
| 'MAP'
|
|
94
|
+
| 'LIST'
|
|
95
|
+
| 'ENUM'
|
|
96
|
+
| 'DECIMAL'
|
|
97
|
+
| 'DATE'
|
|
98
|
+
| 'TIME'
|
|
99
|
+
| 'TIMESTAMP'
|
|
100
|
+
| 'INTEGER'
|
|
101
|
+
| 'UNKNOWN'
|
|
102
|
+
| 'JSON'
|
|
103
|
+
| 'BSON'
|
|
104
|
+
| 'UUID'
|
|
105
|
+
| 'FLOAT16'
|
|
106
|
+
| 'VARIANT'
|
|
107
|
+
| 'GEOMETRY'
|
|
108
|
+
| 'GEOGRAPHY';
|
|
109
|
+
|
|
110
|
+
/** Serializable representation of one Parquet logical type annotation. */
|
|
111
|
+
export interface ParquetLogicalType {
|
|
112
|
+
/** Logical type discriminator. */
|
|
113
|
+
type: ParquetLogicalTypeName;
|
|
114
|
+
/** Integer width for INTEGER annotations. */
|
|
115
|
+
bitWidth?: 8 | 16 | 32 | 64;
|
|
116
|
+
/** Whether an INTEGER annotation is signed. */
|
|
117
|
+
isSigned?: boolean;
|
|
118
|
+
/** Time unit for TIME and TIMESTAMP annotations. */
|
|
119
|
+
unit?: ParquetTimeUnit;
|
|
120
|
+
/** Whether a TIME or TIMESTAMP value represents a UTC-normalized instant. */
|
|
121
|
+
isAdjustedToUTC?: boolean;
|
|
122
|
+
/** Decimal precision. */
|
|
123
|
+
precision?: number;
|
|
124
|
+
/** Decimal scale. */
|
|
125
|
+
scale?: number;
|
|
126
|
+
/** Variant specification version. */
|
|
127
|
+
specificationVersion?: number;
|
|
128
|
+
/** Coordinate reference system for geospatial logical types. */
|
|
129
|
+
crs?: string;
|
|
130
|
+
/** Edge interpolation algorithm for GEOGRAPHY values. */
|
|
131
|
+
algorithm?: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type ParquetDictionary = any[];
|
|
70
135
|
|
|
71
136
|
export interface SchemaDefinition {
|
|
72
137
|
[string: string]: FieldDefinition;
|
|
@@ -74,9 +139,18 @@ export interface SchemaDefinition {
|
|
|
74
139
|
|
|
75
140
|
export interface FieldDefinition {
|
|
76
141
|
type?: ParquetType;
|
|
142
|
+
/** Physical type declared by the file, retained independently from its logical type. */
|
|
143
|
+
physicalType?: PrimitiveType;
|
|
77
144
|
typeLength?: number;
|
|
145
|
+
/** @deprecated Use `precision`. */
|
|
78
146
|
presision?: number;
|
|
147
|
+
/** Decimal precision. */
|
|
148
|
+
precision?: number;
|
|
79
149
|
scale?: number;
|
|
150
|
+
/** Modern Parquet logical type annotation. */
|
|
151
|
+
logicalType?: ParquetLogicalType;
|
|
152
|
+
/** Stable field identifier declared by the Parquet schema. */
|
|
153
|
+
fieldId?: number;
|
|
80
154
|
encoding?: ParquetCodec;
|
|
81
155
|
compression?: ParquetCompression;
|
|
82
156
|
optional?: boolean;
|
|
@@ -90,9 +164,16 @@ export interface ParquetField {
|
|
|
90
164
|
key: string;
|
|
91
165
|
primitiveType?: PrimitiveType;
|
|
92
166
|
originalType?: OriginalType;
|
|
167
|
+
/** Modern Parquet logical type annotation. */
|
|
168
|
+
logicalType?: ParquetLogicalType;
|
|
169
|
+
/** Stable field identifier declared by the Parquet schema. */
|
|
170
|
+
fieldId?: number;
|
|
93
171
|
repetitionType: RepetitionType;
|
|
94
172
|
typeLength?: number;
|
|
173
|
+
/** @deprecated Use `precision`. */
|
|
95
174
|
presision?: number;
|
|
175
|
+
/** Decimal precision. */
|
|
176
|
+
precision?: number;
|
|
96
177
|
scale?: number;
|
|
97
178
|
encoding?: ParquetCodec;
|
|
98
179
|
compression?: ParquetCompression;
|
|
@@ -114,13 +195,24 @@ export interface ParquetReaderContext {
|
|
|
114
195
|
dictionary?: ParquetDictionary;
|
|
115
196
|
/** If true, binary values are not converted to strings */
|
|
116
197
|
preserveBinary?: boolean;
|
|
198
|
+
/** Retain byte arrays as views into decoded page buffers for direct materialization. */
|
|
199
|
+
retainByteArrayViews?: boolean;
|
|
200
|
+
/** Decode primitive values into typed column buffers when their physical type permits it. */
|
|
201
|
+
useTypedValueBuffers?: boolean;
|
|
202
|
+
/** Decode repetition and definition levels into compact unsigned typed arrays. */
|
|
203
|
+
useTypedLevelBuffers?: boolean;
|
|
117
204
|
}
|
|
118
205
|
|
|
206
|
+
/** Mutable storage for decoded Parquet repetition and definition levels. */
|
|
207
|
+
export type ParquetLevelBuffer = number[] | Uint8Array | Uint16Array | Uint32Array;
|
|
208
|
+
|
|
119
209
|
export interface ParquetPageData {
|
|
120
210
|
dlevels: number[];
|
|
121
211
|
rlevels: number[];
|
|
122
212
|
/** Actual column chunks */
|
|
123
|
-
values:
|
|
213
|
+
values: ParquetValueBuffer;
|
|
214
|
+
/** Number of values written directly into the column destination, if one was supplied. */
|
|
215
|
+
directValuesWritten?: number;
|
|
124
216
|
count: number;
|
|
125
217
|
dictionary?: ParquetDictionary;
|
|
126
218
|
/** The "raw" page header from the file */
|
|
@@ -147,9 +239,9 @@ export class ParquetRowGroup {
|
|
|
147
239
|
|
|
148
240
|
/** Holds the data for one column chunk */
|
|
149
241
|
export interface ParquetColumnChunk {
|
|
150
|
-
dlevels:
|
|
151
|
-
rlevels:
|
|
152
|
-
values:
|
|
242
|
+
dlevels: ParquetLevelBuffer;
|
|
243
|
+
rlevels: ParquetLevelBuffer;
|
|
244
|
+
values: ParquetValueBuffer;
|
|
153
245
|
count: number;
|
|
154
246
|
pageHeaders: PageHeader[];
|
|
155
247
|
}
|