@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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Copyright (c) 2017 ironSource Ltd.
|
|
5
5
|
// Forked from https://github.com/kbajalc/parquets under MIT license
|
|
6
6
|
import { PARQUET_CODECS } from "../codecs/index.js";
|
|
7
|
-
import { ConvertedType, Encoding, FieldRepetitionType, PageType, Type } from "../parquet-thrift/index.js";
|
|
7
|
+
import { ConvertedType, EdgeInterpolationAlgorithm, Encoding, FieldRepetitionType, PageType, Type } from "../parquet-thrift/index.js";
|
|
8
8
|
import { decompress } from "../compression.js";
|
|
9
9
|
import { PARQUET_RDLVL_TYPE, PARQUET_RDLVL_ENCODING } from "../../lib/constants.js";
|
|
10
10
|
import { decodePageHeader, getThriftEnum, getBitWidth } from "../utils/read-utils.js";
|
|
@@ -21,43 +21,61 @@ export async function decodeDataPages(buffer, context) {
|
|
|
21
21
|
offset: 0,
|
|
22
22
|
size: buffer.length
|
|
23
23
|
};
|
|
24
|
+
const expectedLevelCount = context.numValues === undefined ? undefined : Number(context.numValues);
|
|
25
|
+
if (expectedLevelCount !== undefined &&
|
|
26
|
+
(!Number.isSafeInteger(expectedLevelCount) || expectedLevelCount < 0)) {
|
|
27
|
+
throw new Error(`Invalid Parquet column value count ${expectedLevelCount}`);
|
|
28
|
+
}
|
|
29
|
+
const outputCapacity = expectedLevelCount ?? 0;
|
|
24
30
|
const data = {
|
|
25
|
-
rlevels:
|
|
26
|
-
dlevels:
|
|
27
|
-
values:
|
|
31
|
+
rlevels: createParquetLevelBuffer(context, outputCapacity, context.rLevelMax),
|
|
32
|
+
dlevels: createParquetLevelBuffer(context, outputCapacity, context.dLevelMax),
|
|
33
|
+
values: createParquetColumnValueBuffer(context, outputCapacity),
|
|
28
34
|
pageHeaders: [],
|
|
29
35
|
count: 0
|
|
30
36
|
};
|
|
31
37
|
let dictionary = context.dictionary || [];
|
|
38
|
+
let levelOffset = 0;
|
|
39
|
+
let valueOffset = 0;
|
|
32
40
|
while (
|
|
33
41
|
// @ts-ignore size can be undefined
|
|
34
42
|
cursor.offset < cursor.size &&
|
|
35
|
-
(
|
|
43
|
+
(expectedLevelCount === undefined || levelOffset < expectedLevelCount)) {
|
|
36
44
|
// Looks like we have to decode these in sequence due to cursor updates?
|
|
37
|
-
const page = await decodePage(cursor, context
|
|
45
|
+
const page = await decodePage(cursor, context, {
|
|
46
|
+
values: data.values,
|
|
47
|
+
valueOffset,
|
|
48
|
+
dictionary,
|
|
49
|
+
rlevels: data.rlevels,
|
|
50
|
+
dlevels: data.dlevels,
|
|
51
|
+
levelOffset
|
|
52
|
+
});
|
|
38
53
|
if (page.dictionary) {
|
|
39
54
|
dictionary = page.dictionary;
|
|
40
55
|
// eslint-disable-next-line no-continue
|
|
41
56
|
continue;
|
|
42
57
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (dictionary.length && valueEncoding !== 'PLAIN') {
|
|
47
|
-
// eslint-disable-next-line no-loop-func
|
|
48
|
-
page.values = page.values.map((value) => dictionary[value]);
|
|
58
|
+
levelOffset += page.count;
|
|
59
|
+
if (page.directValuesWritten !== undefined) {
|
|
60
|
+
valueOffset += page.directValuesWritten;
|
|
49
61
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
else {
|
|
63
|
+
const valueEncoding = getThriftEnum(Encoding, page.pageHeader.data_page_header?.encoding ?? page.pageHeader.data_page_header_v2?.encoding);
|
|
64
|
+
const usesDictionary = dictionary.length &&
|
|
65
|
+
(valueEncoding === 'PLAIN_DICTIONARY' || valueEncoding === 'RLE_DICTIONARY');
|
|
66
|
+
for (let index = 0; index < page.values.length; index++) {
|
|
67
|
+
const value = usesDictionary ? dictionary[Number(page.values[index])] : page.values[index];
|
|
68
|
+
if (value !== undefined) {
|
|
69
|
+
data.values[valueOffset++] = value;
|
|
70
|
+
}
|
|
56
71
|
}
|
|
57
72
|
}
|
|
58
73
|
data.count += page.count;
|
|
59
74
|
data.pageHeaders.push(page.pageHeader);
|
|
60
75
|
}
|
|
76
|
+
data.rlevels = trimParquetLevelBuffer(data.rlevels, levelOffset);
|
|
77
|
+
data.dlevels = trimParquetLevelBuffer(data.dlevels, levelOffset);
|
|
78
|
+
data.values = trimParquetValueBuffer(data.values, valueOffset);
|
|
61
79
|
return data;
|
|
62
80
|
}
|
|
63
81
|
/**
|
|
@@ -65,17 +83,17 @@ export async function decodeDataPages(buffer, context) {
|
|
|
65
83
|
* @param cursor
|
|
66
84
|
* @param context
|
|
67
85
|
*/
|
|
68
|
-
export async function decodePage(cursor, context) {
|
|
86
|
+
export async function decodePage(cursor, context, target) {
|
|
69
87
|
let page;
|
|
70
88
|
const { pageHeader, length } = decodePageHeader(cursor.buffer, cursor.offset);
|
|
71
89
|
cursor.offset += length;
|
|
72
90
|
const pageType = getThriftEnum(PageType, pageHeader.type);
|
|
73
91
|
switch (pageType) {
|
|
74
92
|
case 'DATA_PAGE':
|
|
75
|
-
page = await decodeDataPage(cursor, pageHeader, context);
|
|
93
|
+
page = await decodeDataPage(cursor, pageHeader, context, target);
|
|
76
94
|
break;
|
|
77
95
|
case 'DATA_PAGE_V2':
|
|
78
|
-
page = await decodeDataPageV2(cursor, pageHeader, context);
|
|
96
|
+
page = await decodeDataPageV2(cursor, pageHeader, context, target);
|
|
79
97
|
break;
|
|
80
98
|
case 'DICTIONARY_PAGE':
|
|
81
99
|
page = {
|
|
@@ -122,29 +140,28 @@ export function decodeSchema(schemaElements, offset, len) {
|
|
|
122
140
|
const res = decodeSchema(schemaElements, next + 1, schemaElement.num_children);
|
|
123
141
|
next = res.next;
|
|
124
142
|
schema[schemaElement.name] = {
|
|
125
|
-
// type: undefined,
|
|
126
143
|
optional,
|
|
127
144
|
repeated,
|
|
145
|
+
logicalType: decodeSchemaLogicalType(schemaElement),
|
|
146
|
+
fieldId: schemaElement.field_id,
|
|
128
147
|
fields: res.schema
|
|
129
148
|
};
|
|
130
149
|
}
|
|
131
150
|
else {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
switch (logicalType) {
|
|
138
|
-
case 'DECIMAL':
|
|
139
|
-
logicalType = `${logicalType}_${type}`;
|
|
140
|
-
break;
|
|
141
|
-
default:
|
|
142
|
-
}
|
|
151
|
+
const physicalType = getThriftEnum(Type, schemaElement.type);
|
|
152
|
+
const logicalType = decodeSchemaLogicalType(schemaElement);
|
|
153
|
+
const parquetType = getSchemaParquetType(schemaElement, physicalType, logicalType);
|
|
154
|
+
const precision = logicalType?.precision ?? schemaElement.precision;
|
|
155
|
+
const scale = logicalType?.scale ?? schemaElement.scale;
|
|
143
156
|
schema[schemaElement.name] = {
|
|
144
|
-
type:
|
|
157
|
+
type: parquetType,
|
|
158
|
+
physicalType,
|
|
145
159
|
typeLength: schemaElement.type_length,
|
|
146
|
-
presision:
|
|
147
|
-
|
|
160
|
+
presision: precision,
|
|
161
|
+
precision,
|
|
162
|
+
scale,
|
|
163
|
+
logicalType,
|
|
164
|
+
fieldId: schemaElement.field_id,
|
|
148
165
|
optional,
|
|
149
166
|
repeated
|
|
150
167
|
};
|
|
@@ -153,6 +170,171 @@ export function decodeSchema(schemaElements, offset, len) {
|
|
|
153
170
|
}
|
|
154
171
|
return { schema, offset, next };
|
|
155
172
|
}
|
|
173
|
+
/** Decodes the parameterized Parquet LogicalType union, falling back to ConvertedType metadata. */
|
|
174
|
+
function decodeSchemaLogicalType(schemaElement) {
|
|
175
|
+
const logicalType = schemaElement.logicalType;
|
|
176
|
+
if (logicalType?.STRING)
|
|
177
|
+
return { type: 'STRING' };
|
|
178
|
+
if (logicalType?.MAP)
|
|
179
|
+
return { type: 'MAP' };
|
|
180
|
+
if (logicalType?.LIST)
|
|
181
|
+
return { type: 'LIST' };
|
|
182
|
+
if (logicalType?.ENUM)
|
|
183
|
+
return { type: 'ENUM' };
|
|
184
|
+
if (logicalType?.DECIMAL) {
|
|
185
|
+
return {
|
|
186
|
+
type: 'DECIMAL',
|
|
187
|
+
precision: logicalType.DECIMAL.precision,
|
|
188
|
+
scale: logicalType.DECIMAL.scale
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
if (logicalType?.DATE)
|
|
192
|
+
return { type: 'DATE' };
|
|
193
|
+
if (logicalType?.TIME) {
|
|
194
|
+
return {
|
|
195
|
+
type: 'TIME',
|
|
196
|
+
unit: decodeTimeUnit(logicalType.TIME.unit),
|
|
197
|
+
isAdjustedToUTC: logicalType.TIME.isAdjustedToUTC
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (logicalType?.TIMESTAMP) {
|
|
201
|
+
return {
|
|
202
|
+
type: 'TIMESTAMP',
|
|
203
|
+
unit: decodeTimeUnit(logicalType.TIMESTAMP.unit),
|
|
204
|
+
isAdjustedToUTC: logicalType.TIMESTAMP.isAdjustedToUTC
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (logicalType?.INTEGER) {
|
|
208
|
+
const bitWidth = logicalType.INTEGER.bitWidth;
|
|
209
|
+
if (bitWidth !== 8 && bitWidth !== 16 && bitWidth !== 32 && bitWidth !== 64) {
|
|
210
|
+
throw new Error(`parquet: invalid INTEGER bit width ${bitWidth}`);
|
|
211
|
+
}
|
|
212
|
+
return { type: 'INTEGER', bitWidth, isSigned: logicalType.INTEGER.isSigned };
|
|
213
|
+
}
|
|
214
|
+
if (logicalType?.UNKNOWN)
|
|
215
|
+
return { type: 'UNKNOWN' };
|
|
216
|
+
if (logicalType?.JSON)
|
|
217
|
+
return { type: 'JSON' };
|
|
218
|
+
if (logicalType?.BSON)
|
|
219
|
+
return { type: 'BSON' };
|
|
220
|
+
if (logicalType?.UUID)
|
|
221
|
+
return { type: 'UUID' };
|
|
222
|
+
if (logicalType?.FLOAT16)
|
|
223
|
+
return { type: 'FLOAT16' };
|
|
224
|
+
if (logicalType?.VARIANT) {
|
|
225
|
+
return { type: 'VARIANT', specificationVersion: logicalType.VARIANT.specification_version };
|
|
226
|
+
}
|
|
227
|
+
if (logicalType?.GEOMETRY)
|
|
228
|
+
return { type: 'GEOMETRY', crs: logicalType.GEOMETRY.crs };
|
|
229
|
+
if (logicalType?.GEOGRAPHY) {
|
|
230
|
+
return {
|
|
231
|
+
type: 'GEOGRAPHY',
|
|
232
|
+
crs: logicalType.GEOGRAPHY.crs,
|
|
233
|
+
algorithm: logicalType.GEOGRAPHY.algorithm === undefined
|
|
234
|
+
? undefined
|
|
235
|
+
: getThriftEnum(EdgeInterpolationAlgorithm, logicalType.GEOGRAPHY.algorithm)
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
if (schemaElement.converted_type === undefined || schemaElement.converted_type === null) {
|
|
239
|
+
return undefined;
|
|
240
|
+
}
|
|
241
|
+
const convertedType = getThriftEnum(ConvertedType, schemaElement.converted_type);
|
|
242
|
+
switch (convertedType) {
|
|
243
|
+
case 'UTF8':
|
|
244
|
+
return { type: 'STRING' };
|
|
245
|
+
case 'MAP':
|
|
246
|
+
case 'MAP_KEY_VALUE':
|
|
247
|
+
return { type: 'MAP' };
|
|
248
|
+
case 'LIST':
|
|
249
|
+
return { type: 'LIST' };
|
|
250
|
+
case 'ENUM':
|
|
251
|
+
return { type: 'ENUM' };
|
|
252
|
+
case 'DECIMAL':
|
|
253
|
+
return { type: 'DECIMAL', precision: schemaElement.precision, scale: schemaElement.scale };
|
|
254
|
+
case 'DATE':
|
|
255
|
+
return { type: 'DATE' };
|
|
256
|
+
case 'TIME_MILLIS':
|
|
257
|
+
return { type: 'TIME', unit: 'MILLIS', isAdjustedToUTC: true };
|
|
258
|
+
case 'TIME_MICROS':
|
|
259
|
+
return { type: 'TIME', unit: 'MICROS', isAdjustedToUTC: true };
|
|
260
|
+
case 'TIMESTAMP_MILLIS':
|
|
261
|
+
return { type: 'TIMESTAMP', unit: 'MILLIS', isAdjustedToUTC: true };
|
|
262
|
+
case 'TIMESTAMP_MICROS':
|
|
263
|
+
return { type: 'TIMESTAMP', unit: 'MICROS', isAdjustedToUTC: true };
|
|
264
|
+
case 'UINT_8':
|
|
265
|
+
case 'UINT_16':
|
|
266
|
+
case 'UINT_32':
|
|
267
|
+
case 'UINT_64':
|
|
268
|
+
return {
|
|
269
|
+
type: 'INTEGER',
|
|
270
|
+
bitWidth: Number(convertedType.slice(5)),
|
|
271
|
+
isSigned: false
|
|
272
|
+
};
|
|
273
|
+
case 'INT_8':
|
|
274
|
+
case 'INT_16':
|
|
275
|
+
case 'INT_32':
|
|
276
|
+
case 'INT_64':
|
|
277
|
+
return {
|
|
278
|
+
type: 'INTEGER',
|
|
279
|
+
bitWidth: Number(convertedType.slice(4)),
|
|
280
|
+
isSigned: true
|
|
281
|
+
};
|
|
282
|
+
case 'JSON':
|
|
283
|
+
return { type: 'JSON' };
|
|
284
|
+
case 'BSON':
|
|
285
|
+
return { type: 'BSON' };
|
|
286
|
+
default:
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/** Resolves one physical/logical pair to the internal Parquet value converter. */
|
|
291
|
+
function getSchemaParquetType(schemaElement, physicalType, logicalType) {
|
|
292
|
+
if (!logicalType) {
|
|
293
|
+
return schemaElement.converted_type === undefined || schemaElement.converted_type === null
|
|
294
|
+
? physicalType
|
|
295
|
+
: getThriftEnum(ConvertedType, schemaElement.converted_type);
|
|
296
|
+
}
|
|
297
|
+
switch (logicalType.type) {
|
|
298
|
+
case 'STRING':
|
|
299
|
+
return 'UTF8';
|
|
300
|
+
case 'ENUM':
|
|
301
|
+
return 'ENUM';
|
|
302
|
+
case 'DECIMAL':
|
|
303
|
+
return `DECIMAL_${physicalType}`;
|
|
304
|
+
case 'DATE':
|
|
305
|
+
return 'DATE';
|
|
306
|
+
case 'TIME':
|
|
307
|
+
return `TIME_${logicalType.unit}`;
|
|
308
|
+
case 'TIMESTAMP':
|
|
309
|
+
return `TIMESTAMP_${logicalType.unit}`;
|
|
310
|
+
case 'INTEGER':
|
|
311
|
+
return `${logicalType.isSigned ? 'INT' : 'UINT'}_${logicalType.bitWidth}`;
|
|
312
|
+
case 'UNKNOWN':
|
|
313
|
+
case 'JSON':
|
|
314
|
+
case 'BSON':
|
|
315
|
+
case 'UUID':
|
|
316
|
+
case 'FLOAT16':
|
|
317
|
+
case 'VARIANT':
|
|
318
|
+
case 'GEOMETRY':
|
|
319
|
+
case 'GEOGRAPHY':
|
|
320
|
+
return logicalType.type;
|
|
321
|
+
default:
|
|
322
|
+
if (schemaElement.converted_type !== undefined && schemaElement.converted_type !== null) {
|
|
323
|
+
return getThriftEnum(ConvertedType, schemaElement.converted_type);
|
|
324
|
+
}
|
|
325
|
+
return physicalType;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
/** Returns the selected member of the Parquet TimeUnit union. */
|
|
329
|
+
function decodeTimeUnit(timeUnit) {
|
|
330
|
+
if (timeUnit?.MILLIS)
|
|
331
|
+
return 'MILLIS';
|
|
332
|
+
if (timeUnit?.MICROS)
|
|
333
|
+
return 'MICROS';
|
|
334
|
+
if (timeUnit?.NANOS)
|
|
335
|
+
return 'NANOS';
|
|
336
|
+
throw new Error('parquet: TIME or TIMESTAMP logical type is missing its unit');
|
|
337
|
+
}
|
|
156
338
|
/**
|
|
157
339
|
* Decode a consecutive array of data using one of the parquet encodings
|
|
158
340
|
*/
|
|
@@ -168,7 +350,7 @@ function decodeValues(type, encoding, cursor, count, opts) {
|
|
|
168
350
|
* @param header
|
|
169
351
|
* @param options
|
|
170
352
|
*/
|
|
171
|
-
async function decodeDataPage(cursor, header, context) {
|
|
353
|
+
async function decodeDataPage(cursor, header, context, target) {
|
|
172
354
|
const cursorEnd = cursor.offset + header.compressed_page_size;
|
|
173
355
|
const valueCount = header.data_page_header?.num_values;
|
|
174
356
|
/* uncompress page */
|
|
@@ -184,49 +366,38 @@ async function decodeDataPage(cursor, header, context) {
|
|
|
184
366
|
}
|
|
185
367
|
/* read repetition levels */
|
|
186
368
|
const rLevelEncoding = getThriftEnum(Encoding, header.data_page_header?.repetition_level_encoding);
|
|
187
|
-
|
|
188
|
-
let rLevels = new Array(valueCount);
|
|
189
|
-
if (context.column.rLevelMax > 0) {
|
|
190
|
-
rLevels = decodeValues(PARQUET_RDLVL_TYPE, rLevelEncoding, dataCursor, valueCount, {
|
|
191
|
-
bitWidth: getBitWidth(context.column.rLevelMax),
|
|
192
|
-
disableEnvelope: false
|
|
193
|
-
// column: opts.column
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
rLevels.fill(0);
|
|
198
|
-
}
|
|
369
|
+
const rLevels = decodeLevels(dataCursor, valueCount, context.column.rLevelMax, rLevelEncoding, false, target?.rlevels, target?.levelOffset);
|
|
199
370
|
/* read definition levels */
|
|
200
371
|
const dLevelEncoding = getThriftEnum(Encoding, header.data_page_header?.definition_level_encoding);
|
|
201
|
-
|
|
202
|
-
let
|
|
372
|
+
const dLevels = decodeLevels(dataCursor, valueCount, context.column.dLevelMax, dLevelEncoding, false, target?.dlevels, target?.levelOffset);
|
|
373
|
+
let valueCountNonNull = valueCount;
|
|
203
374
|
if (context.column.dLevelMax > 0) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
dLevels.fill(0);
|
|
212
|
-
}
|
|
213
|
-
let valueCountNonNull = 0;
|
|
214
|
-
for (const dlvl of dLevels) {
|
|
215
|
-
if (dlvl === context.column.dLevelMax) {
|
|
216
|
-
valueCountNonNull++;
|
|
375
|
+
valueCountNonNull = 0;
|
|
376
|
+
const decodedDefinitionLevels = target?.dlevels || dLevels;
|
|
377
|
+
const definitionLevelOffset = target?.levelOffset || 0;
|
|
378
|
+
for (let index = 0; index < valueCount; index++) {
|
|
379
|
+
if (decodedDefinitionLevels[definitionLevelOffset + index] === context.column.dLevelMax) {
|
|
380
|
+
valueCountNonNull++;
|
|
381
|
+
}
|
|
217
382
|
}
|
|
218
383
|
}
|
|
219
384
|
/* read values */
|
|
220
385
|
const valueEncoding = getThriftEnum(Encoding, header.data_page_header?.encoding);
|
|
221
386
|
const decodeOptions = {
|
|
222
387
|
typeLength: context.column.typeLength,
|
|
223
|
-
bitWidth: context
|
|
388
|
+
bitWidth: getValueBitWidth(context, valueEncoding),
|
|
389
|
+
retainByteArrayViews: context.retainByteArrayViews,
|
|
390
|
+
output: target?.values,
|
|
391
|
+
outputOffset: target?.valueOffset,
|
|
392
|
+
dictionary: isDictionaryEncoding(valueEncoding) ? target?.dictionary : undefined,
|
|
393
|
+
int64AsBigInt: shouldDecodeInt64AsBigInt(context)
|
|
224
394
|
};
|
|
225
395
|
const values = decodeValues(context.column.primitiveType, valueEncoding, dataCursor, valueCountNonNull, decodeOptions);
|
|
226
396
|
return {
|
|
227
397
|
dlevels: dLevels,
|
|
228
398
|
rlevels: rLevels,
|
|
229
399
|
values,
|
|
400
|
+
directValuesWritten: target ? valueCountNonNull : undefined,
|
|
230
401
|
count: valueCount,
|
|
231
402
|
pageHeader: header
|
|
232
403
|
};
|
|
@@ -238,60 +409,163 @@ async function decodeDataPage(cursor, header, context) {
|
|
|
238
409
|
* @param opts
|
|
239
410
|
* @returns
|
|
240
411
|
*/
|
|
241
|
-
async function decodeDataPageV2(cursor, header, context) {
|
|
412
|
+
async function decodeDataPageV2(cursor, header, context, target) {
|
|
413
|
+
const dataPageHeader = header.data_page_header_v2;
|
|
414
|
+
if (!dataPageHeader) {
|
|
415
|
+
throw new Error('Missing Parquet data page v2 header');
|
|
416
|
+
}
|
|
242
417
|
const cursorEnd = cursor.offset + header.compressed_page_size;
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
const valueCountNonNull = valueCount -
|
|
246
|
-
const valueEncoding = getThriftEnum(Encoding,
|
|
418
|
+
const levelsOffset = cursor.offset;
|
|
419
|
+
const valueCount = dataPageHeader.num_values;
|
|
420
|
+
const valueCountNonNull = valueCount - dataPageHeader.num_nulls;
|
|
421
|
+
const valueEncoding = getThriftEnum(Encoding, dataPageHeader.encoding);
|
|
422
|
+
if (header.compressed_page_size < 0 ||
|
|
423
|
+
cursorEnd > (cursor.size ?? cursor.buffer.length) ||
|
|
424
|
+
valueCountNonNull < 0) {
|
|
425
|
+
throw new Error('Invalid Parquet data page v2 header');
|
|
426
|
+
}
|
|
247
427
|
/* read repetition levels */
|
|
248
|
-
|
|
249
|
-
let rLevels = new Array(valueCount);
|
|
428
|
+
let rLevels = [];
|
|
250
429
|
if (context.column.rLevelMax > 0) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
disableEnvelope: true
|
|
254
|
-
});
|
|
430
|
+
const repetitionLevelCursor = createPageSliceCursor(cursor, levelsOffset, dataPageHeader.repetition_levels_byte_length);
|
|
431
|
+
rLevels = decodeLevels(repetitionLevelCursor, valueCount, context.column.rLevelMax, PARQUET_RDLVL_ENCODING, true, target?.rlevels, target?.levelOffset);
|
|
255
432
|
}
|
|
256
|
-
else {
|
|
433
|
+
else if (!target) {
|
|
434
|
+
rLevels = new Array(valueCount);
|
|
257
435
|
rLevels.fill(0);
|
|
258
436
|
}
|
|
437
|
+
const definitionLevelsOffset = levelsOffset + dataPageHeader.repetition_levels_byte_length;
|
|
259
438
|
/* read definition levels */
|
|
260
|
-
|
|
261
|
-
let dLevels = new Array(valueCount);
|
|
439
|
+
let dLevels = [];
|
|
262
440
|
if (context.column.dLevelMax > 0) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
disableEnvelope: true
|
|
266
|
-
});
|
|
441
|
+
const definitionLevelCursor = createPageSliceCursor(cursor, definitionLevelsOffset, dataPageHeader.definition_levels_byte_length);
|
|
442
|
+
dLevels = decodeLevels(definitionLevelCursor, valueCount, context.column.dLevelMax, PARQUET_RDLVL_ENCODING, true, target?.dlevels, target?.levelOffset);
|
|
267
443
|
}
|
|
268
|
-
else {
|
|
444
|
+
else if (!target) {
|
|
445
|
+
dLevels = new Array(valueCount);
|
|
269
446
|
dLevels.fill(0);
|
|
270
447
|
}
|
|
271
448
|
/* read values */
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
449
|
+
const valuesOffset = definitionLevelsOffset + dataPageHeader.definition_levels_byte_length;
|
|
450
|
+
const valuesCompressedByteLength = cursorEnd - valuesOffset;
|
|
451
|
+
const valuesUncompressedByteLength = header.uncompressed_page_size -
|
|
452
|
+
dataPageHeader.repetition_levels_byte_length -
|
|
453
|
+
dataPageHeader.definition_levels_byte_length;
|
|
454
|
+
if (valuesCompressedByteLength < 0 || valuesUncompressedByteLength < 0) {
|
|
455
|
+
throw new Error('Invalid Parquet data page v2 level lengths');
|
|
456
|
+
}
|
|
457
|
+
let valuesBuffer = cursor.buffer.subarray(valuesOffset, cursorEnd);
|
|
458
|
+
if (dataPageHeader.is_compressed !== false && context.compression !== 'UNCOMPRESSED') {
|
|
459
|
+
valuesBuffer = await decompress(context.compression, valuesBuffer, valuesUncompressedByteLength);
|
|
281
460
|
}
|
|
461
|
+
const valuesBufCursor = { buffer: valuesBuffer, offset: 0, size: valuesBuffer.length };
|
|
462
|
+
cursor.offset = cursorEnd;
|
|
282
463
|
const decodeOptions = {
|
|
283
464
|
typeLength: context.column.typeLength,
|
|
284
|
-
bitWidth: context
|
|
465
|
+
bitWidth: getValueBitWidth(context, valueEncoding),
|
|
466
|
+
retainByteArrayViews: context.retainByteArrayViews,
|
|
467
|
+
output: target?.values,
|
|
468
|
+
outputOffset: target?.valueOffset,
|
|
469
|
+
dictionary: isDictionaryEncoding(valueEncoding) ? target?.dictionary : undefined,
|
|
470
|
+
int64AsBigInt: shouldDecodeInt64AsBigInt(context)
|
|
285
471
|
};
|
|
286
472
|
const values = decodeValues(context.column.primitiveType, valueEncoding, valuesBufCursor, valueCountNonNull, decodeOptions);
|
|
287
473
|
return {
|
|
288
474
|
dlevels: dLevels,
|
|
289
475
|
rlevels: rLevels,
|
|
290
476
|
values,
|
|
477
|
+
directValuesWritten: target ? valueCountNonNull : undefined,
|
|
291
478
|
count: valueCount,
|
|
292
479
|
pageHeader: header
|
|
293
480
|
};
|
|
294
481
|
}
|
|
482
|
+
/** Decodes repetition or definition levels into an optional column-level destination. */
|
|
483
|
+
function decodeLevels(cursor, count, levelMax, encoding, disableEnvelope, output, outputOffset = 0) {
|
|
484
|
+
if (levelMax === 0) {
|
|
485
|
+
return output ? [] : new Array(count).fill(0);
|
|
486
|
+
}
|
|
487
|
+
const levels = decodeValues(PARQUET_RDLVL_TYPE, encoding, cursor, count, {
|
|
488
|
+
bitWidth: getBitWidth(levelMax),
|
|
489
|
+
disableEnvelope,
|
|
490
|
+
output,
|
|
491
|
+
outputOffset
|
|
492
|
+
});
|
|
493
|
+
return output ? [] : levels;
|
|
494
|
+
}
|
|
495
|
+
/** Allocates compact unsigned storage for repetition and definition levels. */
|
|
496
|
+
function createParquetLevelBuffer(context, capacity, levelMax) {
|
|
497
|
+
if (!context.useTypedLevelBuffers || capacity === 0) {
|
|
498
|
+
return levelMax > 0 ? new Array(capacity) : new Array(capacity).fill(0);
|
|
499
|
+
}
|
|
500
|
+
if (levelMax <= 0xff) {
|
|
501
|
+
return new Uint8Array(capacity);
|
|
502
|
+
}
|
|
503
|
+
if (levelMax <= 0xffff) {
|
|
504
|
+
return new Uint16Array(capacity);
|
|
505
|
+
}
|
|
506
|
+
return new Uint32Array(capacity);
|
|
507
|
+
}
|
|
508
|
+
/** Restricts an overallocated level buffer to the number of decoded levels. */
|
|
509
|
+
function trimParquetLevelBuffer(levels, length) {
|
|
510
|
+
if (Array.isArray(levels)) {
|
|
511
|
+
levels.length = length;
|
|
512
|
+
return levels;
|
|
513
|
+
}
|
|
514
|
+
return levels.subarray(0, length);
|
|
515
|
+
}
|
|
516
|
+
/** Returns whether an encoding stores RLE dictionary indices instead of physical values. */
|
|
517
|
+
function isDictionaryEncoding(encoding) {
|
|
518
|
+
return encoding === 'PLAIN_DICTIONARY' || encoding === 'RLE_DICTIONARY';
|
|
519
|
+
}
|
|
520
|
+
/** Preserves exact physical signed INT64 values in every output shape. */
|
|
521
|
+
function shouldDecodeInt64AsBigInt(context) {
|
|
522
|
+
return context.column.primitiveType === 'INT64';
|
|
523
|
+
}
|
|
524
|
+
/** Allocates the narrowest lossless column buffer supported by the current JavaScript decoder. */
|
|
525
|
+
function createParquetColumnValueBuffer(context, capacity) {
|
|
526
|
+
if (!context.useTypedValueBuffers || capacity === 0) {
|
|
527
|
+
return new Array(capacity);
|
|
528
|
+
}
|
|
529
|
+
switch (context.column.primitiveType) {
|
|
530
|
+
case 'BOOLEAN':
|
|
531
|
+
return new Uint8Array(capacity);
|
|
532
|
+
case 'INT32':
|
|
533
|
+
return new Int32Array(capacity);
|
|
534
|
+
case 'INT64':
|
|
535
|
+
return new BigInt64Array(capacity);
|
|
536
|
+
case 'INT96':
|
|
537
|
+
case 'DOUBLE':
|
|
538
|
+
return new Float64Array(capacity);
|
|
539
|
+
case 'FLOAT':
|
|
540
|
+
return new Float32Array(capacity);
|
|
541
|
+
default:
|
|
542
|
+
return new Array(capacity);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
/** Restricts an overallocated typed column buffer to its decoded non-null values. */
|
|
546
|
+
function trimParquetValueBuffer(values, length) {
|
|
547
|
+
if (Array.isArray(values)) {
|
|
548
|
+
values.length = length;
|
|
549
|
+
return values;
|
|
550
|
+
}
|
|
551
|
+
return values.subarray(0, length);
|
|
552
|
+
}
|
|
553
|
+
/** Returns the physical value bit width required by encodings such as RLE BOOLEAN. */
|
|
554
|
+
function getValueBitWidth(context, encoding) {
|
|
555
|
+
if (encoding === 'RLE' && context.column.primitiveType === 'BOOLEAN') {
|
|
556
|
+
return 1;
|
|
557
|
+
}
|
|
558
|
+
return context.column.typeLength;
|
|
559
|
+
}
|
|
560
|
+
/** Creates a bounded cursor over one uncompressed data page v2 level section. */
|
|
561
|
+
function createPageSliceCursor(cursor, offset, byteLength) {
|
|
562
|
+
const end = offset + byteLength;
|
|
563
|
+
if (byteLength < 0 || end > (cursor.size ?? cursor.buffer.length)) {
|
|
564
|
+
throw new Error('Invalid Parquet data page v2 level lengths');
|
|
565
|
+
}
|
|
566
|
+
const buffer = cursor.buffer.subarray(offset, end);
|
|
567
|
+
return { buffer, offset: 0, size: buffer.length };
|
|
568
|
+
}
|
|
295
569
|
/**
|
|
296
570
|
* Do decoding of dictionary page which helps to iterate over all indexes and get dataPage values.
|
|
297
571
|
* @param cursor
|
|
@@ -307,7 +581,7 @@ async function decodeDictionaryPage(cursor, pageHeader, context) {
|
|
|
307
581
|
};
|
|
308
582
|
cursor.offset = cursorEnd;
|
|
309
583
|
if (context.compression !== 'UNCOMPRESSED') {
|
|
310
|
-
const valuesBuf = await decompress(context.compression, dictCursor.buffer.
|
|
584
|
+
const valuesBuf = await decompress(context.compression, dictCursor.buffer.subarray(dictCursor.offset), pageHeader.uncompressed_page_size);
|
|
311
585
|
dictCursor = {
|
|
312
586
|
buffer: valuesBuf,
|
|
313
587
|
offset: 0,
|
|
@@ -316,27 +590,17 @@ async function decodeDictionaryPage(cursor, pageHeader, context) {
|
|
|
316
590
|
cursor.offset = cursorEnd;
|
|
317
591
|
}
|
|
318
592
|
const numValues = pageHeader?.dictionary_page_header?.num_values || 0;
|
|
319
|
-
const
|
|
320
|
-
//
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
return
|
|
331
|
-
}
|
|
332
|
-
function preserveBinary(d) {
|
|
333
|
-
if (ArrayBuffer.isView(d)) {
|
|
334
|
-
return d;
|
|
335
|
-
}
|
|
336
|
-
// Convert to ArrayBuffer
|
|
337
|
-
if (Buffer.isBuffer(d)) {
|
|
338
|
-
return new Uint8Array(d.buffer, d.byteOffset, d.byteLength).slice().buffer;
|
|
339
|
-
}
|
|
340
|
-
return d.toString();
|
|
593
|
+
const declaredEncoding = getThriftEnum(Encoding, pageHeader.dictionary_page_header?.encoding);
|
|
594
|
+
// Some established writers put the data-page dictionary encoding in this field even though
|
|
595
|
+
// dictionary values themselves use PLAIN. Preserve compatibility with those files.
|
|
596
|
+
const dictionaryValueEncoding = declaredEncoding === 'PLAIN_DICTIONARY' || declaredEncoding === 'RLE_DICTIONARY'
|
|
597
|
+
? 'PLAIN'
|
|
598
|
+
: declaredEncoding;
|
|
599
|
+
const decodedDictionaryValues = decodeValues(context.column.primitiveType, dictionaryValueEncoding, dictCursor, numValues, {
|
|
600
|
+
...context,
|
|
601
|
+
typeLength: context.column.typeLength,
|
|
602
|
+
int64AsBigInt: shouldDecodeInt64AsBigInt(context)
|
|
603
|
+
});
|
|
604
|
+
return decodedDictionaryValues;
|
|
341
605
|
}
|
|
342
606
|
//# sourceMappingURL=decoders.js.map
|