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