@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
|
@@ -13,36 +13,66 @@ import {
|
|
|
13
13
|
ParquetCodec,
|
|
14
14
|
ParquetColumnChunk,
|
|
15
15
|
ParquetField,
|
|
16
|
+
ParquetLogicalType,
|
|
16
17
|
PrimitiveType,
|
|
17
18
|
ParquetRow
|
|
18
19
|
} from '../schema/declare';
|
|
19
20
|
import {ParquetSchema} from '../schema/schema';
|
|
20
21
|
import * as Shred from '../schema/shred';
|
|
21
22
|
import {
|
|
23
|
+
BsonType,
|
|
22
24
|
ColumnChunk,
|
|
23
25
|
ColumnMetaData,
|
|
24
26
|
CompressionCodec,
|
|
25
27
|
ConvertedType,
|
|
26
28
|
DataPageHeader,
|
|
27
29
|
DataPageHeaderV2,
|
|
30
|
+
DateType,
|
|
31
|
+
DecimalType,
|
|
32
|
+
DictionaryPageHeader,
|
|
33
|
+
EdgeInterpolationAlgorithm,
|
|
28
34
|
Encoding,
|
|
35
|
+
EnumType,
|
|
29
36
|
FieldRepetitionType,
|
|
30
37
|
FileMetaData,
|
|
38
|
+
Float16Type,
|
|
39
|
+
GeographyType,
|
|
40
|
+
GeometryType,
|
|
41
|
+
IntType,
|
|
42
|
+
JsonType,
|
|
31
43
|
KeyValue,
|
|
44
|
+
ListType,
|
|
45
|
+
LogicalType,
|
|
46
|
+
MapType,
|
|
47
|
+
MicroSeconds,
|
|
48
|
+
MilliSeconds,
|
|
49
|
+
NanoSeconds,
|
|
50
|
+
NullType,
|
|
32
51
|
PageHeader,
|
|
52
|
+
PageEncodingStats,
|
|
33
53
|
PageType,
|
|
34
54
|
RowGroup,
|
|
35
55
|
SchemaElement,
|
|
36
|
-
|
|
56
|
+
StringType,
|
|
57
|
+
TimeType,
|
|
58
|
+
TimeUnit,
|
|
59
|
+
TimestampType,
|
|
60
|
+
Type,
|
|
61
|
+
UUIDType,
|
|
62
|
+
VariantType
|
|
37
63
|
} from '../parquet-thrift/index';
|
|
38
64
|
import {osopen, oswrite, osclose} from '../utils/file-utils';
|
|
39
65
|
import {getBitWidth, serializeThrift} from '../utils/read-utils';
|
|
40
|
-
import
|
|
66
|
+
import {concatUint8Arrays, encodeUtf8, writeUInt32LE} from '../utils/binary-utils';
|
|
67
|
+
import {CompactInt64} from '../utils/uint8-array-compact-protocol';
|
|
68
|
+
import {planColumnPages} from './page-planner';
|
|
69
|
+
import {planDictionary, type ParquetDictionaryPolicy} from './dictionary-planner';
|
|
41
70
|
|
|
42
71
|
/**
|
|
43
72
|
* Parquet File Magic String
|
|
44
73
|
*/
|
|
45
74
|
const PARQUET_MAGIC = 'PAR1';
|
|
75
|
+
const PARQUET_MAGIC_BYTES = encodeUtf8(PARQUET_MAGIC);
|
|
46
76
|
|
|
47
77
|
/**
|
|
48
78
|
* Parquet File Format Version
|
|
@@ -66,6 +96,9 @@ export interface ParquetEncoderOptions {
|
|
|
66
96
|
rowGroupSize?: number;
|
|
67
97
|
pageSize?: number;
|
|
68
98
|
useDataPageV2?: boolean;
|
|
99
|
+
dictionary?: ParquetDictionaryPolicy;
|
|
100
|
+
columnDictionaries?: Record<string, ParquetDictionaryPolicy>;
|
|
101
|
+
dictionaryPageSizeLimit?: number;
|
|
69
102
|
|
|
70
103
|
// Write Stream Options
|
|
71
104
|
flags?: string;
|
|
@@ -82,7 +115,7 @@ export interface ParquetEncoderOptions {
|
|
|
82
115
|
* are written.
|
|
83
116
|
*/
|
|
84
117
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
|
-
export class ParquetEncoder<
|
|
118
|
+
export class ParquetEncoder<_T> {
|
|
86
119
|
/**
|
|
87
120
|
* Convenience method to create a new buffered parquet writer that writes to
|
|
88
121
|
* the specified file
|
|
@@ -126,8 +159,7 @@ export class ParquetEncoder<T> {
|
|
|
126
159
|
) {
|
|
127
160
|
this.schema = schema;
|
|
128
161
|
this.envelopeWriter = envelopeWriter;
|
|
129
|
-
|
|
130
|
-
this.rowBuffer = {};
|
|
162
|
+
this.rowBuffer = schema.rowGroup();
|
|
131
163
|
this.rowGroupSize = opts.rowGroupSize || PARQUET_DEFAULT_ROW_GROUP_SIZE;
|
|
132
164
|
this.closed = false;
|
|
133
165
|
this.userMetadata = {};
|
|
@@ -156,8 +188,8 @@ export class ParquetEncoder<T> {
|
|
|
156
188
|
}
|
|
157
189
|
Shred.shredRecord(this.schema, row, this.rowBuffer);
|
|
158
190
|
if (this.rowBuffer.rowCount >= this.rowGroupSize) {
|
|
159
|
-
|
|
160
|
-
this.rowBuffer =
|
|
191
|
+
await this.envelopeWriter.writeRowGroup(this.rowBuffer);
|
|
192
|
+
this.rowBuffer = this.schema.rowGroup();
|
|
161
193
|
}
|
|
162
194
|
}
|
|
163
195
|
|
|
@@ -175,8 +207,8 @@ export class ParquetEncoder<T> {
|
|
|
175
207
|
this.closed = true;
|
|
176
208
|
|
|
177
209
|
if (this.rowBuffer.rowCount > 0 || this.rowBuffer.rowCount >= this.rowGroupSize) {
|
|
178
|
-
|
|
179
|
-
this.rowBuffer =
|
|
210
|
+
await this.envelopeWriter.writeRowGroup(this.rowBuffer);
|
|
211
|
+
this.rowBuffer = this.schema.rowGroup();
|
|
180
212
|
}
|
|
181
213
|
|
|
182
214
|
await this.envelopeWriter.writeFooter(this.userMetadata);
|
|
@@ -236,17 +268,20 @@ export class ParquetEnvelopeWriter {
|
|
|
236
268
|
}
|
|
237
269
|
|
|
238
270
|
public schema: ParquetSchema;
|
|
239
|
-
public write: (buf:
|
|
271
|
+
public write: (buf: Uint8Array) => Promise<void>;
|
|
240
272
|
public close: () => Promise<void>;
|
|
241
273
|
public offset: number;
|
|
242
274
|
public rowCount: number;
|
|
243
275
|
public rowGroups: RowGroup[];
|
|
244
276
|
public pageSize: number;
|
|
245
277
|
public useDataPageV2: boolean;
|
|
278
|
+
public dictionary: ParquetDictionaryPolicy;
|
|
279
|
+
public columnDictionaries: Record<string, ParquetDictionaryPolicy>;
|
|
280
|
+
public dictionaryPageSizeLimit: number;
|
|
246
281
|
|
|
247
282
|
constructor(
|
|
248
283
|
schema: ParquetSchema,
|
|
249
|
-
writeFn: (buf:
|
|
284
|
+
writeFn: (buf: Uint8Array) => Promise<void>,
|
|
250
285
|
closeFn: () => Promise<void>,
|
|
251
286
|
fileOffset: number,
|
|
252
287
|
opts: ParquetEncoderOptions
|
|
@@ -259,9 +294,12 @@ export class ParquetEnvelopeWriter {
|
|
|
259
294
|
this.rowGroups = [];
|
|
260
295
|
this.pageSize = opts.pageSize || PARQUET_DEFAULT_PAGE_SIZE;
|
|
261
296
|
this.useDataPageV2 = 'useDataPageV2' in opts ? Boolean(opts.useDataPageV2) : false;
|
|
297
|
+
this.dictionary = opts.dictionary ?? 'auto';
|
|
298
|
+
this.columnDictionaries = opts.columnDictionaries || {};
|
|
299
|
+
this.dictionaryPageSizeLimit = opts.dictionaryPageSizeLimit ?? 1024 * 1024;
|
|
262
300
|
}
|
|
263
301
|
|
|
264
|
-
writeSection(buf:
|
|
302
|
+
writeSection(buf: Uint8Array): Promise<void> {
|
|
265
303
|
this.offset += buf.length;
|
|
266
304
|
return this.write(buf);
|
|
267
305
|
}
|
|
@@ -270,7 +308,7 @@ export class ParquetEnvelopeWriter {
|
|
|
270
308
|
* Encode the parquet file header
|
|
271
309
|
*/
|
|
272
310
|
writeHeader(): Promise<void> {
|
|
273
|
-
return this.writeSection(
|
|
311
|
+
return this.writeSection(PARQUET_MAGIC_BYTES);
|
|
274
312
|
}
|
|
275
313
|
|
|
276
314
|
/**
|
|
@@ -281,7 +319,10 @@ export class ParquetEnvelopeWriter {
|
|
|
281
319
|
const rgroup = await encodeRowGroup(this.schema, records, {
|
|
282
320
|
baseOffset: this.offset,
|
|
283
321
|
pageSize: this.pageSize,
|
|
284
|
-
useDataPageV2: this.useDataPageV2
|
|
322
|
+
useDataPageV2: this.useDataPageV2,
|
|
323
|
+
dictionary: this.dictionary,
|
|
324
|
+
columnDictionaries: this.columnDictionaries,
|
|
325
|
+
dictionaryPageSizeLimit: this.dictionaryPageSizeLimit
|
|
285
326
|
});
|
|
286
327
|
|
|
287
328
|
this.rowCount += records.rowCount;
|
|
@@ -369,36 +410,48 @@ function encodeValues(
|
|
|
369
410
|
*/
|
|
370
411
|
async function encodeDataPage(
|
|
371
412
|
column: ParquetField,
|
|
372
|
-
data: ParquetColumnChunk
|
|
413
|
+
data: ParquetColumnChunk,
|
|
414
|
+
valueEncoding: ParquetCodec = column.encoding!,
|
|
415
|
+
valueBitWidth?: number
|
|
373
416
|
): Promise<{
|
|
374
417
|
header: PageHeader;
|
|
375
418
|
headerSize: number;
|
|
376
|
-
page:
|
|
419
|
+
page: Uint8Array;
|
|
377
420
|
}> {
|
|
378
421
|
/* encode repetition and definition levels */
|
|
379
|
-
let rLevelsBuf:
|
|
422
|
+
let rLevelsBuf: Uint8Array = new Uint8Array(0);
|
|
380
423
|
if (column.rLevelMax > 0) {
|
|
381
|
-
rLevelsBuf = encodeValues(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
424
|
+
rLevelsBuf = encodeValues(
|
|
425
|
+
PARQUET_RDLVL_TYPE,
|
|
426
|
+
PARQUET_RDLVL_ENCODING,
|
|
427
|
+
data.rlevels as number[],
|
|
428
|
+
{
|
|
429
|
+
bitWidth: getBitWidth(column.rLevelMax)
|
|
430
|
+
// disableEnvelope: false
|
|
431
|
+
}
|
|
432
|
+
);
|
|
385
433
|
}
|
|
386
434
|
|
|
387
|
-
let dLevelsBuf:
|
|
435
|
+
let dLevelsBuf: Uint8Array = new Uint8Array(0);
|
|
388
436
|
if (column.dLevelMax > 0) {
|
|
389
|
-
dLevelsBuf = encodeValues(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
437
|
+
dLevelsBuf = encodeValues(
|
|
438
|
+
PARQUET_RDLVL_TYPE,
|
|
439
|
+
PARQUET_RDLVL_ENCODING,
|
|
440
|
+
data.dlevels as number[],
|
|
441
|
+
{
|
|
442
|
+
bitWidth: getBitWidth(column.dLevelMax)
|
|
443
|
+
// disableEnvelope: false
|
|
444
|
+
}
|
|
445
|
+
);
|
|
393
446
|
}
|
|
394
447
|
|
|
395
448
|
/* encode values */
|
|
396
|
-
const valuesBuf = encodeValues(column.primitiveType!,
|
|
449
|
+
const valuesBuf = encodeValues(column.primitiveType!, valueEncoding, data.values as any[], {
|
|
397
450
|
typeLength: column.typeLength,
|
|
398
|
-
bitWidth: column.typeLength
|
|
451
|
+
bitWidth: valueBitWidth ?? column.typeLength
|
|
399
452
|
});
|
|
400
453
|
|
|
401
|
-
const dataBuf =
|
|
454
|
+
const dataBuf = concatUint8Arrays([rLevelsBuf, dLevelsBuf, valuesBuf]);
|
|
402
455
|
|
|
403
456
|
// compression = column.compression === 'UNCOMPRESSED' ? (compression || 'UNCOMPRESSED') : column.compression;
|
|
404
457
|
const compressedBuf = await Compression.deflate(column.compression!, dataBuf);
|
|
@@ -408,7 +461,7 @@ async function encodeDataPage(
|
|
|
408
461
|
type: PageType.DATA_PAGE,
|
|
409
462
|
data_page_header: new DataPageHeader({
|
|
410
463
|
num_values: data.count,
|
|
411
|
-
encoding: Encoding[
|
|
464
|
+
encoding: Encoding[valueEncoding] as any,
|
|
412
465
|
definition_level_encoding: Encoding[PARQUET_RDLVL_ENCODING], // [PARQUET_RDLVL_ENCODING],
|
|
413
466
|
repetition_level_encoding: Encoding[PARQUET_RDLVL_ENCODING] // [PARQUET_RDLVL_ENCODING]
|
|
414
467
|
}),
|
|
@@ -418,7 +471,7 @@ async function encodeDataPage(
|
|
|
418
471
|
|
|
419
472
|
/* concat page header, repetition and definition levels and values */
|
|
420
473
|
const headerBuf = serializeThrift(header);
|
|
421
|
-
const page =
|
|
474
|
+
const page = concatUint8Arrays([headerBuf, compressedBuf]);
|
|
422
475
|
|
|
423
476
|
return {header, headerSize: headerBuf.length, page};
|
|
424
477
|
}
|
|
@@ -429,36 +482,48 @@ async function encodeDataPage(
|
|
|
429
482
|
async function encodeDataPageV2(
|
|
430
483
|
column: ParquetField,
|
|
431
484
|
data: ParquetColumnChunk,
|
|
432
|
-
rowCount: number
|
|
485
|
+
rowCount: number,
|
|
486
|
+
valueEncoding: ParquetCodec = column.encoding!,
|
|
487
|
+
valueBitWidth?: number
|
|
433
488
|
): Promise<{
|
|
434
489
|
header: PageHeader;
|
|
435
490
|
headerSize: number;
|
|
436
|
-
page:
|
|
491
|
+
page: Uint8Array;
|
|
437
492
|
}> {
|
|
438
493
|
/* encode values */
|
|
439
|
-
const valuesBuf = encodeValues(column.primitiveType!,
|
|
494
|
+
const valuesBuf = encodeValues(column.primitiveType!, valueEncoding, data.values as any[], {
|
|
440
495
|
typeLength: column.typeLength,
|
|
441
|
-
bitWidth: column.typeLength
|
|
496
|
+
bitWidth: valueBitWidth ?? column.typeLength
|
|
442
497
|
});
|
|
443
498
|
|
|
444
499
|
// compression = column.compression === 'UNCOMPRESSED' ? (compression || 'UNCOMPRESSED') : column.compression;
|
|
445
500
|
const compressedBuf = await Compression.deflate(column.compression!, valuesBuf);
|
|
446
501
|
|
|
447
502
|
/* encode repetition and definition levels */
|
|
448
|
-
let rLevelsBuf:
|
|
503
|
+
let rLevelsBuf: Uint8Array = new Uint8Array(0);
|
|
449
504
|
if (column.rLevelMax > 0) {
|
|
450
|
-
rLevelsBuf = encodeValues(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
505
|
+
rLevelsBuf = encodeValues(
|
|
506
|
+
PARQUET_RDLVL_TYPE,
|
|
507
|
+
PARQUET_RDLVL_ENCODING,
|
|
508
|
+
data.rlevels as number[],
|
|
509
|
+
{
|
|
510
|
+
bitWidth: getBitWidth(column.rLevelMax),
|
|
511
|
+
disableEnvelope: true
|
|
512
|
+
}
|
|
513
|
+
);
|
|
454
514
|
}
|
|
455
515
|
|
|
456
|
-
let dLevelsBuf:
|
|
516
|
+
let dLevelsBuf: Uint8Array = new Uint8Array(0);
|
|
457
517
|
if (column.dLevelMax > 0) {
|
|
458
|
-
dLevelsBuf = encodeValues(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
518
|
+
dLevelsBuf = encodeValues(
|
|
519
|
+
PARQUET_RDLVL_TYPE,
|
|
520
|
+
PARQUET_RDLVL_ENCODING,
|
|
521
|
+
data.dlevels as number[],
|
|
522
|
+
{
|
|
523
|
+
bitWidth: getBitWidth(column.dLevelMax),
|
|
524
|
+
disableEnvelope: true
|
|
525
|
+
}
|
|
526
|
+
);
|
|
462
527
|
}
|
|
463
528
|
|
|
464
529
|
/* build page header */
|
|
@@ -468,7 +533,7 @@ async function encodeDataPageV2(
|
|
|
468
533
|
num_values: data.count,
|
|
469
534
|
num_nulls: data.count - data.values.length,
|
|
470
535
|
num_rows: rowCount,
|
|
471
|
-
encoding: Encoding[
|
|
536
|
+
encoding: Encoding[valueEncoding] as any,
|
|
472
537
|
definition_levels_byte_length: dLevelsBuf.length,
|
|
473
538
|
repetition_levels_byte_length: rLevelsBuf.length,
|
|
474
539
|
is_compressed: column.compression !== 'UNCOMPRESSED'
|
|
@@ -479,10 +544,36 @@ async function encodeDataPageV2(
|
|
|
479
544
|
|
|
480
545
|
/* concat page header, repetition and definition levels and values */
|
|
481
546
|
const headerBuf = serializeThrift(header);
|
|
482
|
-
const page =
|
|
547
|
+
const page = concatUint8Arrays([headerBuf, rLevelsBuf, dLevelsBuf, compressedBuf]);
|
|
483
548
|
return {header, headerSize: headerBuf.length, page};
|
|
484
549
|
}
|
|
485
550
|
|
|
551
|
+
/** Encodes one chunk-wide PLAIN dictionary page. */
|
|
552
|
+
async function encodeDictionaryPage(
|
|
553
|
+
column: ParquetField,
|
|
554
|
+
dictionaryValues: unknown[]
|
|
555
|
+
): Promise<{header: PageHeader; headerSize: number; page: Uint8Array}> {
|
|
556
|
+
const valuesBuffer = encodeValues(column.primitiveType!, 'PLAIN', dictionaryValues as any[], {
|
|
557
|
+
typeLength: column.typeLength
|
|
558
|
+
});
|
|
559
|
+
const compressedBuffer = await Compression.deflate(column.compression!, valuesBuffer);
|
|
560
|
+
const header = new PageHeader({
|
|
561
|
+
type: PageType.DICTIONARY_PAGE,
|
|
562
|
+
dictionary_page_header: new DictionaryPageHeader({
|
|
563
|
+
num_values: dictionaryValues.length,
|
|
564
|
+
encoding: Encoding.PLAIN
|
|
565
|
+
}),
|
|
566
|
+
uncompressed_page_size: valuesBuffer.length,
|
|
567
|
+
compressed_page_size: compressedBuffer.length
|
|
568
|
+
});
|
|
569
|
+
const headerBuffer = serializeThrift(header);
|
|
570
|
+
return {
|
|
571
|
+
header,
|
|
572
|
+
headerSize: headerBuffer.length,
|
|
573
|
+
page: concatUint8Arrays([headerBuffer, compressedBuffer])
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
|
|
486
577
|
/**
|
|
487
578
|
* Encode an array of values into a parquet column chunk
|
|
488
579
|
*/
|
|
@@ -492,51 +583,106 @@ async function encodeColumnChunk(
|
|
|
492
583
|
offset: number,
|
|
493
584
|
opts: ParquetEncoderOptions
|
|
494
585
|
): Promise<{
|
|
495
|
-
body:
|
|
586
|
+
body: Uint8Array;
|
|
496
587
|
metadata: ColumnMetaData;
|
|
497
588
|
metadataOffset: number;
|
|
498
589
|
}> {
|
|
499
590
|
const data = buffer.columnData[column.path.join()];
|
|
500
591
|
const baseOffset = (opts.baseOffset || 0) + offset;
|
|
501
592
|
/* encode data page(s) */
|
|
502
|
-
|
|
503
|
-
let pageBuf: Buffer;
|
|
593
|
+
const pages: Uint8Array[] = [];
|
|
504
594
|
// tslint:disable-next-line:variable-name
|
|
505
595
|
let total_uncompressed_size = 0;
|
|
506
596
|
// tslint:disable-next-line:variable-name
|
|
507
597
|
let total_compressed_size = 0;
|
|
508
|
-
|
|
598
|
+
const plannedPages = planColumnPages(
|
|
599
|
+
column,
|
|
600
|
+
data,
|
|
601
|
+
buffer.rowCount,
|
|
602
|
+
opts.pageSize || PARQUET_DEFAULT_PAGE_SIZE
|
|
603
|
+
);
|
|
604
|
+
const dictionaryPolicy =
|
|
605
|
+
opts.columnDictionaries?.[column.path[0]] ?? opts.dictionary ?? ('auto' as const);
|
|
606
|
+
const dictionaryPlan = planDictionary(
|
|
607
|
+
column,
|
|
608
|
+
Array.from(data.values),
|
|
609
|
+
dictionaryPolicy,
|
|
610
|
+
opts.dictionaryPageSizeLimit ?? 1024 * 1024
|
|
611
|
+
);
|
|
612
|
+
if (dictionaryPlan) {
|
|
613
|
+
const result = await encodeDictionaryPage(column, dictionaryPlan.values);
|
|
614
|
+
pages.push(result.page);
|
|
615
|
+
total_uncompressed_size += result.header.uncompressed_page_size + result.headerSize;
|
|
616
|
+
total_compressed_size += result.header.compressed_page_size + result.headerSize;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
const valueEncoding: ParquetCodec = dictionaryPlan ? 'RLE_DICTIONARY' : column.encoding!;
|
|
620
|
+
let dictionaryIndexOffset = 0;
|
|
621
|
+
for (const plannedPage of plannedPages) {
|
|
622
|
+
const pageData = dictionaryPlan
|
|
623
|
+
? {
|
|
624
|
+
...plannedPage.data,
|
|
625
|
+
values: dictionaryPlan.indices.slice(
|
|
626
|
+
dictionaryIndexOffset,
|
|
627
|
+
dictionaryIndexOffset + plannedPage.data.values.length
|
|
628
|
+
)
|
|
629
|
+
}
|
|
630
|
+
: plannedPage.data;
|
|
631
|
+
dictionaryIndexOffset += plannedPage.data.values.length;
|
|
509
632
|
const result = opts.useDataPageV2
|
|
510
|
-
? await encodeDataPageV2(
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
633
|
+
? await encodeDataPageV2(
|
|
634
|
+
column,
|
|
635
|
+
pageData,
|
|
636
|
+
plannedPage.rowCount,
|
|
637
|
+
valueEncoding,
|
|
638
|
+
dictionaryPlan?.bitWidth
|
|
639
|
+
)
|
|
640
|
+
: await encodeDataPage(column, pageData, valueEncoding, dictionaryPlan?.bitWidth);
|
|
641
|
+
pages.push(result.page);
|
|
514
642
|
total_uncompressed_size += result.header.uncompressed_page_size + result.headerSize;
|
|
515
643
|
total_compressed_size += result.header.compressed_page_size + result.headerSize;
|
|
516
644
|
}
|
|
517
645
|
|
|
518
|
-
|
|
646
|
+
const pagesBuf = concatUint8Arrays(pages);
|
|
519
647
|
// const compression = column.compression === 'UNCOMPRESSED' ? (opts.compression || 'UNCOMPRESSED') : column.compression;
|
|
520
648
|
|
|
521
649
|
/* prepare metadata header */
|
|
522
650
|
const metadata = new ColumnMetaData({
|
|
523
651
|
path_in_schema: column.path,
|
|
524
|
-
num_values: data.count,
|
|
525
|
-
data_page_offset: baseOffset,
|
|
652
|
+
num_values: int64(data.count),
|
|
653
|
+
data_page_offset: int64(baseOffset + (dictionaryPlan ? pages[0].length : 0)),
|
|
654
|
+
dictionary_page_offset: dictionaryPlan ? int64(baseOffset) : undefined,
|
|
526
655
|
encodings: [],
|
|
527
|
-
|
|
528
|
-
|
|
656
|
+
encoding_stats: [
|
|
657
|
+
...(dictionaryPlan
|
|
658
|
+
? [
|
|
659
|
+
new PageEncodingStats({
|
|
660
|
+
page_type: PageType.DICTIONARY_PAGE,
|
|
661
|
+
encoding: Encoding.PLAIN,
|
|
662
|
+
count: 1
|
|
663
|
+
})
|
|
664
|
+
]
|
|
665
|
+
: []),
|
|
666
|
+
new PageEncodingStats({
|
|
667
|
+
page_type: opts.useDataPageV2 ? PageType.DATA_PAGE_V2 : PageType.DATA_PAGE,
|
|
668
|
+
encoding: Encoding[valueEncoding],
|
|
669
|
+
count: plannedPages.length
|
|
670
|
+
})
|
|
671
|
+
],
|
|
672
|
+
total_uncompressed_size: int64(total_uncompressed_size), // : pagesBuf.length,
|
|
673
|
+
total_compressed_size: int64(total_compressed_size),
|
|
529
674
|
type: Type[column.primitiveType!],
|
|
530
675
|
codec: CompressionCodec[column.compression!]
|
|
531
676
|
});
|
|
532
677
|
|
|
533
678
|
/* list encodings */
|
|
534
679
|
metadata.encodings.push(Encoding[PARQUET_RDLVL_ENCODING]);
|
|
535
|
-
metadata.encodings.push(Encoding
|
|
680
|
+
if (dictionaryPlan) metadata.encodings.push(Encoding.PLAIN);
|
|
681
|
+
metadata.encodings.push(Encoding[valueEncoding]);
|
|
536
682
|
|
|
537
683
|
/* concat metadata header and data pages */
|
|
538
|
-
const metadataOffset = baseOffset +
|
|
539
|
-
const body =
|
|
684
|
+
const metadataOffset = baseOffset + pagesBuf.length;
|
|
685
|
+
const body = concatUint8Arrays([pagesBuf, serializeThrift(metadata)]);
|
|
540
686
|
return {body, metadata, metadataOffset};
|
|
541
687
|
}
|
|
542
688
|
|
|
@@ -548,16 +694,16 @@ async function encodeRowGroup(
|
|
|
548
694
|
data: ParquetRowGroup,
|
|
549
695
|
opts: ParquetEncoderOptions
|
|
550
696
|
): Promise<{
|
|
551
|
-
body:
|
|
697
|
+
body: Uint8Array;
|
|
552
698
|
metadata: RowGroup;
|
|
553
699
|
}> {
|
|
554
700
|
const metadata = new RowGroup({
|
|
555
|
-
num_rows: data.rowCount,
|
|
701
|
+
num_rows: int64(data.rowCount),
|
|
556
702
|
columns: [],
|
|
557
|
-
total_byte_size: 0
|
|
703
|
+
total_byte_size: int64(0)
|
|
558
704
|
});
|
|
559
705
|
|
|
560
|
-
let body =
|
|
706
|
+
let body: Uint8Array = new Uint8Array(0);
|
|
561
707
|
for (const field of schema.fieldList) {
|
|
562
708
|
if (field.isNested) {
|
|
563
709
|
continue; // eslint-disable-line no-continue
|
|
@@ -566,14 +712,14 @@ async function encodeRowGroup(
|
|
|
566
712
|
const cchunkData = await encodeColumnChunk(field, data, body.length, opts);
|
|
567
713
|
|
|
568
714
|
const cchunk = new ColumnChunk({
|
|
569
|
-
file_offset: cchunkData.metadataOffset,
|
|
715
|
+
file_offset: int64(cchunkData.metadataOffset),
|
|
570
716
|
meta_data: cchunkData.metadata
|
|
571
717
|
});
|
|
572
718
|
|
|
573
719
|
metadata.columns.push(cchunk);
|
|
574
|
-
metadata.total_byte_size =
|
|
720
|
+
metadata.total_byte_size = int64(Number(metadata.total_byte_size) + cchunkData.body.length);
|
|
575
721
|
|
|
576
|
-
body =
|
|
722
|
+
body = concatUint8Arrays([body, cchunkData.body]);
|
|
577
723
|
}
|
|
578
724
|
|
|
579
725
|
return {body, metadata};
|
|
@@ -587,11 +733,11 @@ function encodeFooter(
|
|
|
587
733
|
rowCount: number,
|
|
588
734
|
rowGroups: RowGroup[],
|
|
589
735
|
userMetadata: Record<string, string>
|
|
590
|
-
):
|
|
736
|
+
): Uint8Array {
|
|
591
737
|
const metadata = new FileMetaData({
|
|
592
738
|
version: PARQUET_VERSION,
|
|
593
739
|
created_by: 'parquets',
|
|
594
|
-
num_rows: rowCount,
|
|
740
|
+
num_rows: int64(rowCount),
|
|
595
741
|
row_groups: rowGroups,
|
|
596
742
|
schema: [],
|
|
597
743
|
key_value_metadata: []
|
|
@@ -627,19 +773,174 @@ function encodeFooter(
|
|
|
627
773
|
}
|
|
628
774
|
|
|
629
775
|
if (field.originalType) {
|
|
630
|
-
|
|
776
|
+
const convertedType = ConvertedType[field.originalType as keyof typeof ConvertedType];
|
|
777
|
+
if (typeof convertedType === 'number') {
|
|
778
|
+
schemaElem.converted_type = convertedType;
|
|
779
|
+
}
|
|
631
780
|
}
|
|
632
781
|
|
|
633
782
|
schemaElem.type_length = field.typeLength;
|
|
783
|
+
schemaElem.precision = field.precision ?? field.presision;
|
|
784
|
+
schemaElem.scale = field.scale;
|
|
785
|
+
schemaElem.field_id = field.fieldId;
|
|
786
|
+
const logicalType = getFieldLogicalType(field);
|
|
787
|
+
if (logicalType) {
|
|
788
|
+
schemaElem.logicalType = encodeParquetLogicalType(logicalType);
|
|
789
|
+
}
|
|
634
790
|
|
|
635
791
|
metadata.schema.push(schemaElem);
|
|
636
792
|
}
|
|
637
793
|
|
|
638
794
|
const metadataEncoded = serializeThrift(metadata);
|
|
639
|
-
const footerEncoded =
|
|
795
|
+
const footerEncoded = new Uint8Array(metadataEncoded.length + 8);
|
|
640
796
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
footerEncoded.
|
|
797
|
+
footerEncoded.set(metadataEncoded);
|
|
798
|
+
writeUInt32LE(footerEncoded, metadataEncoded.length, metadataEncoded.length);
|
|
799
|
+
footerEncoded.set(PARQUET_MAGIC_BYTES, metadataEncoded.length + 4);
|
|
644
800
|
return footerEncoded;
|
|
645
801
|
}
|
|
802
|
+
|
|
803
|
+
/** Returns an explicit or inferred modern logical annotation for a writer field. */
|
|
804
|
+
function getFieldLogicalType(field: ParquetField): ParquetLogicalType | undefined {
|
|
805
|
+
if (field.logicalType) return field.logicalType;
|
|
806
|
+
const originalType = field.originalType;
|
|
807
|
+
if (!originalType) return undefined;
|
|
808
|
+
if (originalType === 'UTF8') return {type: 'STRING'};
|
|
809
|
+
if (originalType === 'ENUM') return {type: 'ENUM'};
|
|
810
|
+
if (originalType.startsWith('DECIMAL_')) {
|
|
811
|
+
return {
|
|
812
|
+
type: 'DECIMAL',
|
|
813
|
+
precision: field.precision ?? field.presision,
|
|
814
|
+
scale: field.scale
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
if (originalType === 'DATE') return {type: 'DATE'};
|
|
818
|
+
if (originalType.startsWith('TIME_')) {
|
|
819
|
+
return {
|
|
820
|
+
type: 'TIME',
|
|
821
|
+
unit: originalType.slice(5) as ParquetLogicalType['unit'],
|
|
822
|
+
isAdjustedToUTC: true
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
if (originalType.startsWith('TIMESTAMP_')) {
|
|
826
|
+
return {
|
|
827
|
+
type: 'TIMESTAMP',
|
|
828
|
+
unit: originalType.slice(10) as ParquetLogicalType['unit'],
|
|
829
|
+
isAdjustedToUTC: true
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
if (originalType.startsWith('UINT_') || originalType.startsWith('INT_')) {
|
|
833
|
+
return {
|
|
834
|
+
type: 'INTEGER',
|
|
835
|
+
bitWidth: Number(originalType.slice(originalType.indexOf('_') + 1)) as 8 | 16 | 32 | 64,
|
|
836
|
+
isSigned: originalType.startsWith('INT_')
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
if (originalType === 'JSON' || originalType === 'BSON') return {type: originalType};
|
|
840
|
+
if (
|
|
841
|
+
originalType === 'UUID' ||
|
|
842
|
+
originalType === 'FLOAT16' ||
|
|
843
|
+
originalType === 'UNKNOWN' ||
|
|
844
|
+
originalType === 'VARIANT' ||
|
|
845
|
+
originalType === 'GEOMETRY' ||
|
|
846
|
+
originalType === 'GEOGRAPHY'
|
|
847
|
+
) {
|
|
848
|
+
return {type: originalType};
|
|
849
|
+
}
|
|
850
|
+
return undefined;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/** Converts the internal logical annotation into the Parquet 2.13 Thrift union. */
|
|
854
|
+
function encodeParquetLogicalType(logicalType: ParquetLogicalType): LogicalType {
|
|
855
|
+
switch (logicalType.type) {
|
|
856
|
+
case 'STRING':
|
|
857
|
+
return LogicalType.fromSTRING(new StringType());
|
|
858
|
+
case 'MAP':
|
|
859
|
+
return LogicalType.fromMAP(new MapType());
|
|
860
|
+
case 'LIST':
|
|
861
|
+
return LogicalType.fromLIST(new ListType());
|
|
862
|
+
case 'ENUM':
|
|
863
|
+
return LogicalType.fromENUM(new EnumType());
|
|
864
|
+
case 'DECIMAL':
|
|
865
|
+
if (logicalType.precision === undefined || logicalType.scale === undefined) {
|
|
866
|
+
throw new Error('Parquet DECIMAL requires precision and scale');
|
|
867
|
+
}
|
|
868
|
+
return LogicalType.fromDECIMAL(
|
|
869
|
+
new DecimalType({precision: logicalType.precision, scale: logicalType.scale})
|
|
870
|
+
);
|
|
871
|
+
case 'DATE':
|
|
872
|
+
return LogicalType.fromDATE(new DateType());
|
|
873
|
+
case 'TIME':
|
|
874
|
+
return LogicalType.fromTIME(
|
|
875
|
+
new TimeType({
|
|
876
|
+
isAdjustedToUTC: logicalType.isAdjustedToUTC ?? false,
|
|
877
|
+
unit: encodeParquetTimeUnit(logicalType.unit)
|
|
878
|
+
})
|
|
879
|
+
);
|
|
880
|
+
case 'TIMESTAMP':
|
|
881
|
+
return LogicalType.fromTIMESTAMP(
|
|
882
|
+
new TimestampType({
|
|
883
|
+
isAdjustedToUTC: logicalType.isAdjustedToUTC ?? false,
|
|
884
|
+
unit: encodeParquetTimeUnit(logicalType.unit)
|
|
885
|
+
})
|
|
886
|
+
);
|
|
887
|
+
case 'INTEGER':
|
|
888
|
+
if (logicalType.bitWidth === undefined || logicalType.isSigned === undefined) {
|
|
889
|
+
throw new Error('Parquet INTEGER requires bitWidth and isSigned');
|
|
890
|
+
}
|
|
891
|
+
return LogicalType.fromINTEGER(
|
|
892
|
+
new IntType({bitWidth: logicalType.bitWidth, isSigned: logicalType.isSigned})
|
|
893
|
+
);
|
|
894
|
+
case 'UNKNOWN':
|
|
895
|
+
return LogicalType.fromUNKNOWN(new NullType());
|
|
896
|
+
case 'JSON':
|
|
897
|
+
return LogicalType.fromJSON(new JsonType());
|
|
898
|
+
case 'BSON':
|
|
899
|
+
return LogicalType.fromBSON(new BsonType());
|
|
900
|
+
case 'UUID':
|
|
901
|
+
return LogicalType.fromUUID(new UUIDType());
|
|
902
|
+
case 'FLOAT16':
|
|
903
|
+
return LogicalType.fromFLOAT16(new Float16Type());
|
|
904
|
+
case 'VARIANT':
|
|
905
|
+
return LogicalType.fromVARIANT(
|
|
906
|
+
new VariantType({specification_version: logicalType.specificationVersion})
|
|
907
|
+
);
|
|
908
|
+
case 'GEOMETRY':
|
|
909
|
+
return LogicalType.fromGEOMETRY(new GeometryType({crs: logicalType.crs}));
|
|
910
|
+
case 'GEOGRAPHY':
|
|
911
|
+
return LogicalType.fromGEOGRAPHY(
|
|
912
|
+
new GeographyType({
|
|
913
|
+
crs: logicalType.crs,
|
|
914
|
+
algorithm:
|
|
915
|
+
logicalType.algorithm === undefined
|
|
916
|
+
? undefined
|
|
917
|
+
: EdgeInterpolationAlgorithm[
|
|
918
|
+
logicalType.algorithm as keyof typeof EdgeInterpolationAlgorithm
|
|
919
|
+
]
|
|
920
|
+
})
|
|
921
|
+
);
|
|
922
|
+
default:
|
|
923
|
+
throw new Error(
|
|
924
|
+
`Unsupported Parquet logical type ${(logicalType as ParquetLogicalType).type}`
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/** Encodes one Parquet logical time unit. */
|
|
930
|
+
function encodeParquetTimeUnit(unit: ParquetLogicalType['unit']): TimeUnit {
|
|
931
|
+
switch (unit) {
|
|
932
|
+
case 'MILLIS':
|
|
933
|
+
return TimeUnit.fromMILLIS(new MilliSeconds());
|
|
934
|
+
case 'MICROS':
|
|
935
|
+
return TimeUnit.fromMICROS(new MicroSeconds());
|
|
936
|
+
case 'NANOS':
|
|
937
|
+
return TimeUnit.fromNANOS(new NanoSeconds());
|
|
938
|
+
default:
|
|
939
|
+
throw new Error('Parquet TIME and TIMESTAMP require a unit');
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/** Wrap a writer metadata number in the thrift int64 compatibility object. */
|
|
944
|
+
function int64(value: number): any {
|
|
945
|
+
return new CompactInt64(BigInt(value));
|
|
946
|
+
}
|