@loaders.gl/parquet 4.4.5 → 5.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -3
- package/dist/bundled.d.ts +9 -0
- package/dist/bundled.d.ts.map +1 -0
- package/dist/bundled.js +10 -0
- package/dist/bundled.js.map +1 -0
- package/dist/geoparquet-loader-with-parser.d.ts +33 -0
- package/dist/geoparquet-loader-with-parser.d.ts.map +1 -0
- package/dist/geoparquet-loader-with-parser.js +52 -0
- package/dist/geoparquet-loader-with-parser.js.map +1 -0
- package/dist/geoparquet-loader.d.ts +59 -0
- package/dist/geoparquet-loader.d.ts.map +1 -0
- package/dist/geoparquet-loader.js +30 -0
- package/dist/geoparquet-loader.js.map +1 -0
- package/dist/index.cjs +25873 -4776
- package/dist/index.cjs.map +3 -4
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -11
- package/dist/index.js.map +1 -1
- package/dist/lib/arrow/convert-columns-to-row-group.js +3 -0
- package/dist/lib/arrow/convert-columns-to-row-group.js.map +1 -1
- package/dist/lib/arrow/convert-schema-from-parquet.d.ts.map +1 -1
- package/dist/lib/arrow/convert-schema-from-parquet.js +86 -26
- package/dist/lib/arrow/convert-schema-from-parquet.js.map +1 -1
- package/dist/lib/arrow/convert-schema-to-parquet.d.ts.map +1 -1
- package/dist/lib/arrow/convert-schema-to-parquet.js +16 -7
- package/dist/lib/arrow/convert-schema-to-parquet.js.map +1 -1
- package/dist/lib/arrow/create-nested-arrow-vector.d.ts +8 -0
- package/dist/lib/arrow/create-nested-arrow-vector.d.ts.map +1 -0
- package/dist/lib/arrow/create-nested-arrow-vector.js +396 -0
- package/dist/lib/arrow/create-nested-arrow-vector.js.map +1 -0
- package/dist/lib/constants.d.ts +0 -1
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +1 -2
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/encoders/encode-arrow-to-parquet.d.ts +2 -2
- package/dist/lib/encoders/encode-arrow-to-parquet.d.ts.map +1 -1
- package/dist/lib/encoders/encode-arrow-to-parquet.js +3 -10
- package/dist/lib/encoders/encode-arrow-to-parquet.js.map +1 -1
- package/dist/lib/encoders/encode-table-to-parquet-js.d.ts +5 -0
- package/dist/lib/encoders/encode-table-to-parquet-js.d.ts.map +1 -0
- package/dist/lib/encoders/encode-table-to-parquet-js.js +199 -0
- package/dist/lib/encoders/encode-table-to-parquet-js.js.map +1 -0
- package/dist/lib/geo/geospatial-metadata.d.ts +67 -0
- package/dist/lib/geo/geospatial-metadata.d.ts.map +1 -0
- package/dist/lib/geo/geospatial-metadata.js +338 -0
- package/dist/lib/geo/geospatial-metadata.js.map +1 -0
- package/dist/lib/parquet-page-index.d.ts +62 -0
- package/dist/lib/parquet-page-index.d.ts.map +1 -0
- package/dist/lib/parquet-page-index.js +377 -0
- package/dist/lib/parquet-page-index.js.map +1 -0
- package/dist/lib/parquet-predicate.d.ts +17 -0
- package/dist/lib/parquet-predicate.d.ts.map +1 -0
- package/dist/lib/parquet-predicate.js +300 -0
- package/dist/lib/parquet-predicate.js.map +1 -0
- package/dist/lib/parquet-source-worker-client.d.ts +6 -0
- package/dist/lib/parquet-source-worker-client.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-client.js +22 -0
- package/dist/lib/parquet-source-worker-client.js.map +1 -0
- package/dist/lib/parquet-source-worker-decoder.d.ts +4 -0
- package/dist/lib/parquet-source-worker-decoder.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-decoder.js +115 -0
- package/dist/lib/parquet-source-worker-decoder.js.map +1 -0
- package/dist/lib/parquet-source-worker-file.d.ts +24 -0
- package/dist/lib/parquet-source-worker-file.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-file.js +40 -0
- package/dist/lib/parquet-source-worker-file.js.map +1 -0
- package/dist/lib/parquet-source-worker-types.d.ts +97 -0
- package/dist/lib/parquet-source-worker-types.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-types.js +5 -0
- package/dist/lib/parquet-source-worker-types.js.map +1 -0
- package/dist/lib/parquet-worker-transport.d.ts +8 -0
- package/dist/lib/parquet-worker-transport.d.ts.map +1 -0
- package/dist/lib/parquet-worker-transport.js +40 -0
- package/dist/lib/parquet-worker-transport.js.map +1 -0
- package/dist/lib/parsers/convert-parquet-tables.d.ts +16 -0
- package/dist/lib/parsers/convert-parquet-tables.d.ts.map +1 -0
- package/dist/lib/parsers/convert-parquet-tables.js +30 -0
- package/dist/lib/parsers/convert-parquet-tables.js.map +1 -0
- package/dist/lib/parsers/get-parquet-schema.d.ts.map +1 -1
- package/dist/lib/parsers/get-parquet-schema.js +3 -1
- package/dist/lib/parsers/get-parquet-schema.js.map +1 -1
- package/dist/lib/parsers/parse-geoparquet-to-geojson.d.ts +4 -4
- package/dist/lib/parsers/parse-geoparquet-to-geojson.d.ts.map +1 -1
- package/dist/lib/parsers/parse-geoparquet-to-geojson.js +19 -6
- package/dist/lib/parsers/parse-geoparquet-to-geojson.js.map +1 -1
- package/dist/lib/parsers/parse-parquet-tables.d.ts +37 -0
- package/dist/lib/parsers/parse-parquet-tables.d.ts.map +1 -0
- package/dist/lib/parsers/parse-parquet-tables.js +50 -0
- package/dist/lib/parsers/parse-parquet-tables.js.map +1 -0
- package/dist/lib/parsers/parse-parquet-to-arrow-js.d.ts +19 -0
- package/dist/lib/parsers/parse-parquet-to-arrow-js.d.ts.map +1 -0
- package/dist/lib/parsers/parse-parquet-to-arrow-js.js +608 -0
- package/dist/lib/parsers/parse-parquet-to-arrow-js.js.map +1 -0
- package/dist/lib/parsers/parse-parquet-to-arrow.d.ts +7 -7
- package/dist/lib/parsers/parse-parquet-to-arrow.d.ts.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-arrow.js +45 -32
- package/dist/lib/parsers/parse-parquet-to-arrow.js.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-columns.d.ts +3 -3
- package/dist/lib/parsers/parse-parquet-to-columns.d.ts.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-columns.js +1 -4
- package/dist/lib/parsers/parse-parquet-to-columns.js.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-json.d.ts +3 -3
- package/dist/lib/parsers/parse-parquet-to-json.d.ts.map +1 -1
- package/dist/lib/parsers/parse-parquet-to-json.js +77 -26
- package/dist/lib/parsers/parse-parquet-to-json.js.map +1 -1
- package/dist/lib/sources/parquet-range-file.d.ts +80 -0
- package/dist/lib/sources/parquet-range-file.d.ts.map +1 -0
- package/dist/lib/sources/parquet-range-file.js +261 -0
- package/dist/lib/sources/parquet-range-file.js.map +1 -0
- package/dist/lib/sources/single-batch-queue.d.ts +24 -0
- package/dist/lib/sources/single-batch-queue.d.ts.map +1 -0
- package/dist/lib/sources/single-batch-queue.js +91 -0
- package/dist/lib/sources/single-batch-queue.js.map +1 -0
- package/dist/lib/utils/load-wasm-node.d.ts +3 -0
- package/dist/lib/utils/load-wasm-node.d.ts.map +1 -0
- package/dist/lib/utils/load-wasm-node.js +23 -0
- package/dist/lib/utils/load-wasm-node.js.map +1 -0
- package/dist/lib/utils/load-wasm.d.ts +2 -2
- package/dist/lib/utils/load-wasm.d.ts.map +1 -1
- package/dist/lib/utils/load-wasm.js +28 -12
- package/dist/lib/utils/load-wasm.js.map +1 -1
- package/dist/lib/utils/make-stream-iterator.d.ts +2 -0
- package/dist/lib/utils/make-stream-iterator.d.ts.map +1 -1
- package/dist/lib/utils/make-stream-iterator.js +123 -14
- package/dist/lib/utils/make-stream-iterator.js.map +1 -1
- package/dist/lib/utils/normalize-parquet-options.d.ts +5 -0
- package/dist/lib/utils/normalize-parquet-options.d.ts.map +1 -0
- package/dist/lib/utils/normalize-parquet-options.js +11 -0
- package/dist/lib/utils/normalize-parquet-options.js.map +1 -0
- package/dist/parquet-dataset-source.cjs +26413 -0
- package/dist/parquet-dataset-source.cjs.map +6 -0
- package/dist/parquet-dataset-source.d.ts +54 -0
- package/dist/parquet-dataset-source.d.ts.map +1 -0
- package/dist/parquet-dataset-source.js +380 -0
- package/dist/parquet-dataset-source.js.map +1 -0
- package/dist/parquet-format.d.ts +2 -0
- package/dist/parquet-format.d.ts.map +1 -1
- package/dist/parquet-format.js +2 -0
- package/dist/parquet-format.js.map +1 -1
- package/dist/parquet-js-loader-types.d.ts +57 -0
- package/dist/parquet-js-loader-types.d.ts.map +1 -0
- package/dist/parquet-js-loader-types.js +33 -0
- package/dist/parquet-js-loader-types.js.map +1 -0
- package/dist/parquet-js-loader.d.ts +32 -0
- package/dist/parquet-js-loader.d.ts.map +1 -0
- package/dist/parquet-js-loader.js +58 -0
- package/dist/parquet-js-loader.js.map +1 -0
- package/dist/parquet-js-writer.d.ts +44 -0
- package/dist/parquet-js-writer.d.ts.map +1 -0
- package/dist/parquet-js-writer.js +28 -0
- package/dist/parquet-js-writer.js.map +1 -0
- package/dist/parquet-loader-base.d.ts +25 -0
- package/dist/parquet-loader-base.d.ts.map +1 -0
- package/dist/parquet-loader-base.js +23 -0
- package/dist/parquet-loader-base.js.map +1 -0
- package/dist/parquet-loader-options.d.ts +44 -0
- package/dist/parquet-loader-options.d.ts.map +1 -0
- package/dist/parquet-loader-options.js +10 -0
- package/dist/parquet-loader-options.js.map +1 -0
- package/dist/parquet-loader-types.d.ts +61 -0
- package/dist/parquet-loader-types.d.ts.map +1 -0
- package/dist/parquet-loader-types.js +17 -0
- package/dist/parquet-loader-types.js.map +1 -0
- package/dist/parquet-loader.d.ts +42 -0
- package/dist/parquet-loader.d.ts.map +1 -0
- package/dist/parquet-loader.js +68 -0
- package/dist/parquet-loader.js.map +1 -0
- package/dist/parquet-source-capabilities.d.ts +36 -0
- package/dist/parquet-source-capabilities.d.ts.map +1 -0
- package/dist/parquet-source-capabilities.js +22 -0
- package/dist/parquet-source-capabilities.js.map +1 -0
- package/dist/parquet-source-loader-types.d.ts +72 -0
- package/dist/parquet-source-loader-types.d.ts.map +1 -0
- package/dist/parquet-source-loader-types.js +74 -0
- package/dist/parquet-source-loader-types.js.map +1 -0
- package/dist/parquet-source-loader.cjs +25975 -0
- package/dist/parquet-source-loader.cjs.map +6 -0
- package/dist/parquet-source-loader.d.ts +120 -0
- package/dist/parquet-source-loader.d.ts.map +1 -0
- package/dist/parquet-source-loader.js +812 -0
- package/dist/parquet-source-loader.js.map +1 -0
- package/dist/parquet-source-types.d.ts +384 -0
- package/dist/parquet-source-types.d.ts.map +1 -0
- package/dist/parquet-source-types.js +5 -0
- package/dist/parquet-source-types.js.map +1 -0
- package/dist/parquet-source-worker-url.d.ts +3 -0
- package/dist/parquet-source-worker-url.d.ts.map +1 -0
- package/dist/parquet-source-worker-url.js +22 -0
- package/dist/parquet-source-worker-url.js.map +1 -0
- package/dist/parquet-source-worker.js +38491 -0
- package/dist/parquet-source-worker.js.map +7 -0
- package/dist/parquet-worker-node.cjs +54779 -0
- package/dist/parquet-worker-node.cjs.map +7 -0
- package/dist/parquet-worker-url.d.ts +3 -0
- package/dist/parquet-worker-url.d.ts.map +1 -0
- package/dist/parquet-worker-url.js +15 -0
- package/dist/parquet-worker-url.js.map +1 -0
- package/dist/parquet-worker.js +19920 -0
- package/dist/parquet-worker.js.map +7 -0
- package/dist/parquet-writer.d.ts +10 -0
- package/dist/parquet-writer.d.ts.map +1 -0
- package/dist/parquet-writer.js +27 -0
- package/dist/parquet-writer.js.map +1 -0
- package/dist/parquet_wasm_bg.wasm +0 -0
- package/dist/parquetjs/codecs/byte-stream-split.d.ts +9 -0
- package/dist/parquetjs/codecs/byte-stream-split.d.ts.map +1 -0
- package/dist/parquetjs/codecs/byte-stream-split.js +159 -0
- package/dist/parquetjs/codecs/byte-stream-split.js.map +1 -0
- package/dist/parquetjs/codecs/declare.d.ts +20 -3
- package/dist/parquetjs/codecs/declare.d.ts.map +1 -1
- package/dist/parquetjs/codecs/declare.js +7 -1
- package/dist/parquetjs/codecs/declare.js.map +1 -1
- package/dist/parquetjs/codecs/delta.d.ts +17 -0
- package/dist/parquetjs/codecs/delta.d.ts.map +1 -0
- package/dist/parquetjs/codecs/delta.js +439 -0
- package/dist/parquetjs/codecs/delta.js.map +1 -0
- package/dist/parquetjs/codecs/dictionary.d.ts +5 -2
- package/dist/parquetjs/codecs/dictionary.d.ts.map +1 -1
- package/dist/parquetjs/codecs/dictionary.js +16 -4
- package/dist/parquetjs/codecs/dictionary.js.map +1 -1
- package/dist/parquetjs/codecs/index.d.ts.map +1 -1
- package/dist/parquetjs/codecs/index.js +18 -0
- package/dist/parquetjs/codecs/index.js.map +1 -1
- package/dist/parquetjs/codecs/plain.d.ts +3 -3
- package/dist/parquetjs/codecs/plain.d.ts.map +1 -1
- package/dist/parquetjs/codecs/plain.js +88 -76
- package/dist/parquetjs/codecs/plain.js.map +1 -1
- package/dist/parquetjs/codecs/rle.d.ts +3 -3
- package/dist/parquetjs/codecs/rle.d.ts.map +1 -1
- package/dist/parquetjs/codecs/rle.js +196 -68
- package/dist/parquetjs/codecs/rle.js.map +1 -1
- package/dist/parquetjs/compression.d.ts +7 -8
- package/dist/parquetjs/compression.d.ts.map +1 -1
- package/dist/parquetjs/compression.js +95 -141
- package/dist/parquetjs/compression.js.map +1 -1
- package/dist/parquetjs/encoder/dictionary-planner.d.ts +17 -0
- package/dist/parquetjs/encoder/dictionary-planner.d.ts.map +1 -0
- package/dist/parquetjs/encoder/dictionary-planner.js +64 -0
- package/dist/parquetjs/encoder/dictionary-planner.js.map +1 -0
- package/dist/parquetjs/encoder/page-planner.d.ts +11 -0
- package/dist/parquetjs/encoder/page-planner.d.ts.map +1 -0
- package/dist/parquetjs/encoder/page-planner.js +60 -0
- package/dist/parquetjs/encoder/page-planner.js.map +1 -0
- package/dist/parquetjs/encoder/parquet-encoder.d.ts +11 -4
- package/dist/parquetjs/encoder/parquet-encoder.d.ts.map +1 -1
- package/dist/parquetjs/encoder/parquet-encoder.js +259 -52
- package/dist/parquetjs/encoder/parquet-encoder.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/BsonType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/BsonType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/BsonType.js +1 -1
- package/dist/parquetjs/parquet-thrift/BsonType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnChunk.js +2 -2
- package/dist/parquetjs/parquet-thrift/ColumnChunk.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts +6 -6
- package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnIndex.js +3 -3
- package/dist/parquetjs/parquet-thrift/ColumnIndex.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.js +2 -2
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnOrder.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnOrder.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnOrder.js +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnOrder.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.js +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeader.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.js +1 -1
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DateType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DateType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DateType.js +1 -1
- package/dist/parquetjs/parquet-thrift/DateType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.js +1 -1
- package/dist/parquetjs/parquet-thrift/DecimalType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.js +1 -1
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.d.ts +8 -0
- package/dist/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.js +14 -0
- package/dist/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/Encoding.d.ts +2 -1
- package/dist/parquetjs/parquet-thrift/Encoding.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/Encoding.js +1 -0
- package/dist/parquetjs/parquet-thrift/Encoding.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/EnumType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/EnumType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/EnumType.js +1 -1
- package/dist/parquetjs/parquet-thrift/EnumType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/FileMetaData.js +2 -2
- package/dist/parquetjs/parquet-thrift/FileMetaData.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/Float16Type.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/Float16Type.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/Float16Type.js +27 -0
- package/dist/parquetjs/parquet-thrift/Float16Type.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeographyType.d.ts +14 -0
- package/dist/parquetjs/parquet-thrift/GeographyType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeographyType.js +51 -0
- package/dist/parquetjs/parquet-thrift/GeographyType.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeometryType.d.ts +11 -0
- package/dist/parquetjs/parquet-thrift/GeometryType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeometryType.js +41 -0
- package/dist/parquetjs/parquet-thrift/GeometryType.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.js +1 -1
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/IntType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/IntType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/IntType.js +1 -1
- package/dist/parquetjs/parquet-thrift/IntType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/JsonType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/JsonType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/JsonType.js +1 -1
- package/dist/parquetjs/parquet-thrift/JsonType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.js +1 -1
- package/dist/parquetjs/parquet-thrift/KeyValue.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ListType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/ListType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ListType.js +1 -1
- package/dist/parquetjs/parquet-thrift/ListType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.d.ts +17 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.js +97 -1
- package/dist/parquetjs/parquet-thrift/LogicalType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/MapType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/MapType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/MapType.js +1 -1
- package/dist/parquetjs/parquet-thrift/MapType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.js +1 -1
- package/dist/parquetjs/parquet-thrift/MicroSeconds.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.js +1 -1
- package/dist/parquetjs/parquet-thrift/MilliSeconds.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/NanoSeconds.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/NanoSeconds.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/NanoSeconds.js +27 -0
- package/dist/parquetjs/parquet-thrift/NanoSeconds.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/NullType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/NullType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/NullType.js +1 -1
- package/dist/parquetjs/parquet-thrift/NullType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/OffsetIndex.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/OffsetIndex.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/OffsetIndex.js +1 -1
- package/dist/parquetjs/parquet-thrift/OffsetIndex.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.js +1 -1
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.js +1 -1
- package/dist/parquetjs/parquet-thrift/PageHeader.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageLocation.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/PageLocation.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/PageLocation.js +2 -2
- package/dist/parquetjs/parquet-thrift/PageLocation.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/RowGroup.d.ts +2 -2
- package/dist/parquetjs/parquet-thrift/RowGroup.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/RowGroup.js +2 -2
- package/dist/parquetjs/parquet-thrift/RowGroup.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.js +1 -1
- package/dist/parquetjs/parquet-thrift/SchemaElement.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.js +1 -1
- package/dist/parquetjs/parquet-thrift/SortingColumn.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/Statistics.d.ts +14 -10
- package/dist/parquetjs/parquet-thrift/Statistics.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/Statistics.js +38 -2
- package/dist/parquetjs/parquet-thrift/Statistics.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/StringType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/StringType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/StringType.js +1 -1
- package/dist/parquetjs/parquet-thrift/StringType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimeType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/TimeType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimeType.js +1 -1
- package/dist/parquetjs/parquet-thrift/TimeType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts +5 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.js +25 -1
- package/dist/parquetjs/parquet-thrift/TimeUnit.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimestampType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/TimestampType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TimestampType.js +1 -1
- package/dist/parquetjs/parquet-thrift/TimestampType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.js +1 -1
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.d.ts +1 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.js +1 -1
- package/dist/parquetjs/parquet-thrift/UUIDType.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/VariantType.d.ts +11 -0
- package/dist/parquetjs/parquet-thrift/VariantType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/VariantType.js +41 -0
- package/dist/parquetjs/parquet-thrift/VariantType.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/index.d.ts +6 -2
- package/dist/parquetjs/parquet-thrift/index.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/index.js +6 -2
- package/dist/parquetjs/parquet-thrift/index.js.map +1 -1
- package/dist/parquetjs/parser/decoders.d.ts +14 -3
- package/dist/parquetjs/parser/decoders.d.ts.map +1 -1
- package/dist/parquetjs/parser/decoders.js +381 -117
- package/dist/parquetjs/parser/decoders.js.map +1 -1
- package/dist/parquetjs/parser/parquet-reader.d.ts +35 -10
- package/dist/parquetjs/parser/parquet-reader.d.ts.map +1 -1
- package/dist/parquetjs/parser/parquet-reader.js +179 -59
- package/dist/parquetjs/parser/parquet-reader.js.map +1 -1
- package/dist/parquetjs/schema/declare.d.ts +62 -8
- package/dist/parquetjs/schema/declare.d.ts.map +1 -1
- package/dist/parquetjs/schema/declare.js.map +1 -1
- package/dist/parquetjs/schema/schema.d.ts +3 -0
- package/dist/parquetjs/schema/schema.d.ts.map +1 -1
- package/dist/parquetjs/schema/schema.js +21 -3
- package/dist/parquetjs/schema/schema.js.map +1 -1
- package/dist/parquetjs/schema/shred.d.ts +2 -0
- package/dist/parquetjs/schema/shred.d.ts.map +1 -1
- package/dist/parquetjs/schema/shred.js +71 -23
- package/dist/parquetjs/schema/shred.js.map +1 -1
- package/dist/parquetjs/schema/types.d.ts.map +1 -1
- package/dist/parquetjs/schema/types.js +272 -51
- package/dist/parquetjs/schema/types.js.map +1 -1
- package/dist/parquetjs/utils/binary-utils.d.ts +41 -0
- package/dist/parquetjs/utils/binary-utils.d.ts.map +1 -0
- package/dist/parquetjs/utils/binary-utils.js +106 -0
- package/dist/parquetjs/utils/binary-utils.js.map +1 -0
- package/dist/parquetjs/utils/file-utils.d.ts +1 -1
- package/dist/parquetjs/utils/file-utils.d.ts.map +1 -1
- package/dist/parquetjs/utils/file-utils.js +3 -3
- package/dist/parquetjs/utils/file-utils.js.map +1 -1
- package/dist/parquetjs/utils/read-utils.d.ts +14 -6
- package/dist/parquetjs/utils/read-utils.d.ts.map +1 -1
- package/dist/parquetjs/utils/read-utils.js +46 -39
- package/dist/parquetjs/utils/read-utils.js.map +1 -1
- package/dist/parquetjs/utils/thrift-runtime.d.ts +106 -0
- package/dist/parquetjs/utils/thrift-runtime.d.ts.map +1 -0
- package/dist/parquetjs/utils/thrift-runtime.js +50 -0
- package/dist/parquetjs/utils/thrift-runtime.js.map +1 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol-writer.d.ts +78 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol-writer.d.ts.map +1 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol-writer.js +213 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol-writer.js.map +1 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol.d.ts +80 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol.d.ts.map +1 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol.js +276 -0
- package/dist/parquetjs/utils/uint8-array-compact-protocol.js.map +1 -0
- package/dist/parquetjs/utils/uint8-array-transport.d.ts +25 -0
- package/dist/parquetjs/utils/uint8-array-transport.d.ts.map +1 -0
- package/dist/parquetjs/utils/uint8-array-transport.js +62 -0
- package/dist/parquetjs/utils/uint8-array-transport.js.map +1 -0
- package/dist/polyfills/process.d.ts +12 -0
- package/dist/polyfills/process.d.ts.map +1 -0
- package/dist/polyfills/process.js +17 -0
- package/dist/polyfills/process.js.map +1 -0
- package/dist/unbundled.d.ts +9 -0
- package/dist/unbundled.d.ts.map +1 -0
- package/dist/unbundled.js +10 -0
- package/dist/unbundled.js.map +1 -0
- package/dist/wasm.d.ts +3 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +6 -0
- package/dist/wasm.js.map +1 -0
- package/dist/workers/parquet-source-worker.d.ts +2 -0
- package/dist/workers/parquet-source-worker.d.ts.map +1 -0
- package/dist/workers/parquet-source-worker.js +17 -0
- package/dist/workers/parquet-source-worker.js.map +1 -0
- package/dist/workers/parquet-worker-node.d.ts +2 -0
- package/dist/workers/parquet-worker-node.d.ts.map +1 -0
- package/dist/workers/parquet-worker-node.js +5 -0
- package/dist/workers/parquet-worker-node.js.map +1 -0
- package/dist/workers/parquet-worker.d.ts +2 -0
- package/dist/workers/parquet-worker.d.ts.map +1 -0
- package/dist/workers/parquet-worker.js +27 -0
- package/dist/workers/parquet-worker.js.map +1 -0
- package/package.json +63 -33
- package/src/bundled.ts +33 -0
- package/src/geoparquet-loader-with-parser.ts +95 -0
- package/src/geoparquet-loader.ts +54 -0
- package/src/index.ts +49 -23
- package/src/lib/arrow/convert-columns-to-row-group.ts +3 -0
- package/src/lib/arrow/convert-schema-from-parquet.ts +97 -30
- package/src/lib/arrow/convert-schema-to-parquet.ts +16 -7
- package/src/lib/arrow/create-nested-arrow-vector.ts +589 -0
- package/src/lib/constants.ts +0 -2
- package/src/lib/encoders/encode-arrow-to-parquet.ts +10 -16
- package/src/lib/encoders/encode-table-to-parquet-js.ts +261 -0
- package/src/lib/geo/geospatial-metadata.ts +457 -0
- package/src/lib/parquet-page-index.ts +581 -0
- package/src/lib/parquet-predicate.ts +374 -0
- package/src/lib/parquet-source-worker-client.ts +39 -0
- package/src/lib/parquet-source-worker-decoder.ts +156 -0
- package/src/lib/parquet-source-worker-file.ts +56 -0
- package/src/lib/parquet-source-worker-types.ts +107 -0
- package/src/lib/parquet-worker-transport.ts +57 -0
- package/src/lib/parsers/convert-parquet-tables.ts +39 -0
- package/src/lib/parsers/get-parquet-schema.ts +3 -1
- package/src/lib/parsers/parse-geoparquet-to-geojson.ts +27 -14
- package/src/lib/parsers/parse-parquet-tables.ts +82 -0
- package/src/lib/parsers/parse-parquet-to-arrow-js.ts +829 -0
- package/src/lib/parsers/parse-parquet-to-arrow.ts +63 -36
- package/src/lib/parsers/parse-parquet-to-columns.ts +6 -7
- package/src/lib/parsers/parse-parquet-to-json.ts +101 -33
- package/src/lib/sources/parquet-range-file.ts +359 -0
- package/src/lib/sources/single-batch-queue.ts +95 -0
- package/src/lib/utils/load-wasm-node.ts +25 -0
- package/src/lib/utils/load-wasm.ts +36 -13
- package/src/lib/utils/make-stream-iterator.ts +126 -14
- package/src/lib/utils/normalize-parquet-options.ts +14 -0
- package/src/parquet-dataset-source.ts +488 -0
- package/src/parquet-format.ts +2 -0
- package/src/parquet-js-loader-types.ts +52 -0
- package/src/parquet-js-loader.ts +83 -0
- package/src/parquet-js-writer.ts +68 -0
- package/src/parquet-loader-base.ts +34 -0
- package/src/parquet-loader-options.ts +51 -0
- package/src/parquet-loader-types.ts +35 -0
- package/src/parquet-loader.ts +115 -0
- package/src/parquet-source-capabilities.ts +56 -0
- package/src/parquet-source-loader-types.ts +87 -0
- package/src/parquet-source-loader.ts +1265 -0
- package/src/parquet-source-types.ts +458 -0
- package/src/parquet-source-worker-url.ts +23 -0
- package/src/parquet-worker-url.ts +18 -0
- package/src/parquet-writer.ts +42 -0
- package/src/parquetjs/LICENSE +23 -1
- package/src/parquetjs/codecs/byte-stream-split.ts +221 -0
- package/src/parquetjs/codecs/declare.ts +35 -3
- package/src/parquetjs/codecs/delta.ts +587 -0
- package/src/parquetjs/codecs/dictionary.ts +22 -4
- package/src/parquetjs/codecs/index.ts +18 -0
- package/src/parquetjs/codecs/plain.ts +149 -87
- package/src/parquetjs/codecs/rle.ts +268 -82
- package/src/parquetjs/compression.ts +110 -155
- package/src/parquetjs/encoder/dictionary-planner.ts +99 -0
- package/src/parquetjs/encoder/page-planner.ts +83 -0
- package/src/parquetjs/encoder/parquet-encoder.ts +378 -77
- package/src/parquetjs/parquet-thrift/BsonType.ts +1 -1
- package/src/parquetjs/parquet-thrift/ColumnChunk.ts +2 -2
- package/src/parquetjs/parquet-thrift/ColumnIndex.ts +13 -13
- package/src/parquetjs/parquet-thrift/ColumnMetaData.ts +2 -2
- package/src/parquetjs/parquet-thrift/ColumnOrder.ts +1 -1
- package/src/parquetjs/parquet-thrift/DataPageHeader.ts +1 -1
- package/src/parquetjs/parquet-thrift/DataPageHeaderV2.ts +1 -1
- package/src/parquetjs/parquet-thrift/DateType.ts +1 -1
- package/src/parquetjs/parquet-thrift/DecimalType.ts +1 -1
- package/src/parquetjs/parquet-thrift/DictionaryPageHeader.ts +1 -1
- package/src/parquetjs/parquet-thrift/EdgeInterpolationAlgorithm.ts +13 -0
- package/src/parquetjs/parquet-thrift/Encoding.ts +2 -1
- package/src/parquetjs/parquet-thrift/EnumType.ts +1 -1
- package/src/parquetjs/parquet-thrift/FileMetaData.ts +2 -2
- package/src/parquetjs/parquet-thrift/Float16Type.ts +28 -0
- package/src/parquetjs/parquet-thrift/GeographyType.ts +54 -0
- package/src/parquetjs/parquet-thrift/GeometryType.ts +43 -0
- package/src/parquetjs/parquet-thrift/IndexPageHeader.ts +1 -1
- package/src/parquetjs/parquet-thrift/IntType.ts +1 -1
- package/src/parquetjs/parquet-thrift/JsonType.ts +1 -1
- package/src/parquetjs/parquet-thrift/KeyValue.ts +1 -1
- package/src/parquetjs/parquet-thrift/ListType.ts +1 -1
- package/src/parquetjs/parquet-thrift/LogicalType.ts +97 -1
- package/src/parquetjs/parquet-thrift/MapType.ts +1 -1
- package/src/parquetjs/parquet-thrift/MicroSeconds.ts +1 -1
- package/src/parquetjs/parquet-thrift/MilliSeconds.ts +1 -1
- package/src/parquetjs/parquet-thrift/NanoSeconds.ts +28 -0
- package/src/parquetjs/parquet-thrift/NullType.ts +1 -1
- package/src/parquetjs/parquet-thrift/OffsetIndex.ts +1 -1
- package/src/parquetjs/parquet-thrift/PageEncodingStats.ts +1 -1
- package/src/parquetjs/parquet-thrift/PageHeader.ts +1 -1
- package/src/parquetjs/parquet-thrift/PageLocation.ts +2 -2
- package/src/parquetjs/parquet-thrift/RowGroup.ts +2 -2
- package/src/parquetjs/parquet-thrift/SchemaElement.ts +1 -1
- package/src/parquetjs/parquet-thrift/SortingColumn.ts +1 -1
- package/src/parquetjs/parquet-thrift/Statistics.ts +50 -14
- package/src/parquetjs/parquet-thrift/StringType.ts +1 -1
- package/src/parquetjs/parquet-thrift/TimeType.ts +1 -1
- package/src/parquetjs/parquet-thrift/TimeUnit.ts +25 -1
- package/src/parquetjs/parquet-thrift/TimestampType.ts +1 -1
- package/src/parquetjs/parquet-thrift/TypeDefinedOrder.ts +1 -1
- package/src/parquetjs/parquet-thrift/UUIDType.ts +1 -1
- package/src/parquetjs/parquet-thrift/VariantType.ts +43 -0
- package/src/parquetjs/parquet-thrift/index.ts +6 -4
- package/src/parquetjs/parser/decoders.ts +487 -133
- package/src/parquetjs/parser/parquet-reader.ts +297 -71
- package/src/parquetjs/schema/declare.ts +99 -7
- package/src/parquetjs/schema/schema.ts +23 -3
- package/src/parquetjs/schema/shred.ts +112 -35
- package/src/parquetjs/schema/types.ts +294 -61
- package/src/parquetjs/utils/binary-utils.ts +132 -0
- package/src/parquetjs/utils/file-utils.ts +4 -4
- package/src/parquetjs/utils/read-utils.ts +56 -55
- package/src/parquetjs/utils/thrift-runtime.ts +109 -0
- package/src/parquetjs/utils/uint8-array-compact-protocol-writer.ts +254 -0
- package/src/parquetjs/utils/uint8-array-compact-protocol.ts +322 -0
- package/src/parquetjs/utils/uint8-array-transport.ts +79 -0
- package/src/polyfills/process.ts +17 -0
- package/src/unbundled.ts +33 -0
- package/src/wasm.ts +6 -0
- package/src/workers/parquet-source-worker.ts +21 -0
- package/src/workers/parquet-worker-node.ts +5 -0
- package/src/workers/parquet-worker.ts +31 -0
- package/dist/parquet-arrow-loader.d.ts +0 -43
- package/dist/parquet-arrow-loader.d.ts.map +0 -1
- package/dist/parquet-arrow-loader.js +0 -49
- package/dist/parquet-arrow-loader.js.map +0 -1
- package/dist/parquet-arrow-writer.d.ts +0 -9
- package/dist/parquet-arrow-writer.d.ts.map +0 -1
- package/dist/parquet-arrow-writer.js +0 -23
- package/dist/parquet-arrow-writer.js.map +0 -1
- package/dist/parquet-json-loader.d.ts +0 -148
- package/dist/parquet-json-loader.d.ts.map +0 -1
- package/dist/parquet-json-loader.js +0 -106
- package/dist/parquet-json-loader.js.map +0 -1
- package/dist/parquet-json-writer.d.ts +0 -19
- package/dist/parquet-json-writer.d.ts.map +0 -1
- package/dist/parquet-json-writer.js +0 -20
- package/dist/parquet-json-writer.js.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.browser.d.ts +0 -3
- package/dist/polyfills/buffer/buffer-polyfill.browser.d.ts.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.browser.js +0 -12
- package/dist/polyfills/buffer/buffer-polyfill.browser.js.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.node.d.ts +0 -3
- package/dist/polyfills/buffer/buffer-polyfill.node.d.ts.map +0 -1
- package/dist/polyfills/buffer/buffer-polyfill.node.js +0 -17
- package/dist/polyfills/buffer/buffer-polyfill.node.js.map +0 -1
- package/dist/polyfills/buffer/buffer.d.ts +0 -222
- package/dist/polyfills/buffer/buffer.d.ts.map +0 -1
- package/dist/polyfills/buffer/buffer.js +0 -1868
- package/dist/polyfills/buffer/buffer.js.map +0 -1
- package/dist/polyfills/buffer/index.d.ts +0 -4
- package/dist/polyfills/buffer/index.d.ts.map +0 -1
- package/dist/polyfills/buffer/index.js +0 -9
- package/dist/polyfills/buffer/index.js.map +0 -1
- package/dist/polyfills/buffer/install-buffer-polyfill.d.ts +0 -2
- package/dist/polyfills/buffer/install-buffer-polyfill.d.ts.map +0 -1
- package/dist/polyfills/buffer/install-buffer-polyfill.js +0 -10
- package/dist/polyfills/buffer/install-buffer-polyfill.js.map +0 -1
- package/dist/workers/parquet-json-worker.d.ts +0 -2
- package/dist/workers/parquet-json-worker.d.ts.map +0 -1
- package/dist/workers/parquet-json-worker.js +0 -7
- package/dist/workers/parquet-json-worker.js.map +0 -1
- package/src/parquet-arrow-loader.ts +0 -74
- package/src/parquet-arrow-writer.ts +0 -33
- package/src/parquet-json-loader.ts +0 -160
- package/src/parquet-json-writer.ts +0 -27
- package/src/parquetjs/modules.d.ts +0 -25
- package/src/polyfills/buffer/buffer-polyfill.browser.ts +0 -14
- package/src/polyfills/buffer/buffer-polyfill.node.ts +0 -19
- package/src/polyfills/buffer/buffer.ts +0 -2205
- package/src/polyfills/buffer/index.ts +0 -11
- package/src/polyfills/buffer/install-buffer-polyfill.ts +0 -12
- package/src/workers/parquet-json-worker.ts +0 -8
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { hydrateArrowTable } from '@loaders.gl/arrow';
|
|
5
|
+
import { BlobFile, DataSource, isBrowser } from '@loaders.gl/loader-utils';
|
|
6
|
+
import { convertTable } from '@loaders.gl/schema-utils';
|
|
7
|
+
import { getSchemaFromParquetReader } from "./lib/parsers/get-parquet-schema.js";
|
|
8
|
+
import { canParquetRowGroupMatch, copyParquetPredicate, filterParquetRowIndices, gatherParquetColumns, getParquetPredicateColumns, validateParquetPredicate } from "./lib/parquet-predicate.js";
|
|
9
|
+
import { createParquetPagePruningPlan, getParquetPageReadRanges } from "./lib/parquet-page-index.js";
|
|
10
|
+
import { canDecodeParquetSourceOnWorker, decodeParquetSourceRowGroupOnWorker } from "./lib/parquet-source-worker-client.js";
|
|
11
|
+
import { ParquetRangeFile } from "./lib/sources/parquet-range-file.js";
|
|
12
|
+
import { PARQUET_SOURCE_CAPABILITIES } from "./parquet-source-capabilities.js";
|
|
13
|
+
import { ParquetSourceLoader as ParquetSourceLoaderMetadata } from "./parquet-source-loader-types.js";
|
|
14
|
+
export { PARQUET_SOURCE_CAPABILITIES } from "./parquet-source-capabilities.js";
|
|
15
|
+
import { preloadCompressions } from "./parquetjs/compression.js";
|
|
16
|
+
import { CompressionCodec, Encoding } from "./parquetjs/parquet-thrift/index.js";
|
|
17
|
+
import { ParquetReader } from "./parquetjs/parser/parquet-reader.js";
|
|
18
|
+
import * as Types from "./parquetjs/schema/types.js";
|
|
19
|
+
import { copyUint8Array, readDoubleLE, readFloatLE, readInt32LE, readInt64LE, readUInt32LE, readUInt64LE, toUint8Array } from "./parquetjs/utils/binary-utils.js";
|
|
20
|
+
import { fieldIndexOf } from "./parquetjs/utils/read-utils.js";
|
|
21
|
+
const { preload: _preloadParquetSourceLoader, createDataSource: _createMetadataDataSource, ...ParquetSourceLoaderBase } = ParquetSourceLoaderMetadata;
|
|
22
|
+
/** Runtime source factory for reusable, range-backed Parquet access. */
|
|
23
|
+
export const ParquetSourceLoaderWithParser = {
|
|
24
|
+
...ParquetSourceLoaderBase,
|
|
25
|
+
createDataSource: (data, options, coreApi) => new ParquetSource(data, options, coreApi)
|
|
26
|
+
};
|
|
27
|
+
/** Runtime Parquet source loader exposed by the explicit package subpath. */
|
|
28
|
+
export { ParquetSourceLoaderWithParser as ParquetSourceLoader };
|
|
29
|
+
/** Reusable Parquet source that caches footer/schema state and selectively reads byte ranges. */
|
|
30
|
+
export class ParquetSource extends DataSource {
|
|
31
|
+
/** Immutable feature support for the current range-backed source implementation. */
|
|
32
|
+
capabilities = PARQUET_SOURCE_CAPABILITIES;
|
|
33
|
+
/** Shared initialization for this source instance. */
|
|
34
|
+
initializationPromise = null;
|
|
35
|
+
/** File allocated during source initialization, including while it is opening. */
|
|
36
|
+
readableFile = null;
|
|
37
|
+
/** Whether this source has been permanently closed. */
|
|
38
|
+
closed = false;
|
|
39
|
+
/** Compression module preload shared by all selective reads. */
|
|
40
|
+
compressionPromise = null;
|
|
41
|
+
/** Read abort controllers used to cancel active iterators when the source closes. */
|
|
42
|
+
activeReadControllers = new Set();
|
|
43
|
+
/** Cumulative source telemetry counters. */
|
|
44
|
+
telemetry = createParquetTelemetry();
|
|
45
|
+
/** Creates a Parquet source backed by strict URL ranges or Blob slices. */
|
|
46
|
+
constructor(data, options, coreApi) {
|
|
47
|
+
const wasmUrl = options.parquet?.wasmUrl;
|
|
48
|
+
super(data, options, ParquetSourceLoaderWithParser.defaultOptions, coreApi);
|
|
49
|
+
if (wasmUrl !== undefined) {
|
|
50
|
+
this.options.parquet.wasmUrl = wasmUrl;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Returns the cached logical schema decoded from the Parquet footer. */
|
|
54
|
+
async getSchema(options = {}) {
|
|
55
|
+
const initialization = await this.getInitialization(options.signal);
|
|
56
|
+
return initialization.schema;
|
|
57
|
+
}
|
|
58
|
+
/** Returns normalized dataset, row-group, and column-chunk metadata. */
|
|
59
|
+
async getMetadata(options = {}) {
|
|
60
|
+
const initialization = await this.getInitialization(options.signal);
|
|
61
|
+
if (!options.formatSpecificMetadata) {
|
|
62
|
+
return initialization.metadata;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
...initialization.metadata,
|
|
66
|
+
formatSpecificMetadata: initialization.fileMetadata
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Returns a copy of cumulative transport, decode, conversion, and pruning telemetry. */
|
|
70
|
+
getTelemetry() {
|
|
71
|
+
return Object.freeze({ ...this.telemetry });
|
|
72
|
+
}
|
|
73
|
+
/** Selectively fetches row groups and columns as ordered Arrow batches with source provenance. */
|
|
74
|
+
async *read(options = {}) {
|
|
75
|
+
const readOptions = this.getReadOptions(options);
|
|
76
|
+
const readContext = createReadAbortContext(readOptions.signal);
|
|
77
|
+
const inFlightReads = new Set();
|
|
78
|
+
let completed = false;
|
|
79
|
+
let readError;
|
|
80
|
+
this.activeReadControllers.add(readContext.abortController);
|
|
81
|
+
try {
|
|
82
|
+
const initialization = await this.getInitialization(readContext.abortController.signal);
|
|
83
|
+
await this.getCompressionInitialization();
|
|
84
|
+
throwIfAborted(readContext.abortController.signal);
|
|
85
|
+
const candidateRowGroupIndices = normalizeRowGroupIndices(readOptions.rowGroups, initialization.fileMetadata.row_groups.length);
|
|
86
|
+
const callbackFilteredRowGroupIndices = readOptions.rowGroupFilter
|
|
87
|
+
? candidateRowGroupIndices.filter(rowGroupIndex => readOptions.rowGroupFilter(initialization.metadata.rowGroups[rowGroupIndex]))
|
|
88
|
+
: candidateRowGroupIndices;
|
|
89
|
+
const predicate = readOptions.predicate;
|
|
90
|
+
const availableColumns = new Set(initialization.schema.fields.map(field => field.name));
|
|
91
|
+
if (predicate) {
|
|
92
|
+
validateParquetPredicate(predicate, availableColumns);
|
|
93
|
+
}
|
|
94
|
+
const rowGroupIndices = predicate
|
|
95
|
+
? callbackFilteredRowGroupIndices.filter(rowGroupIndex => canParquetRowGroupMatch(predicate, initialization.metadata.rowGroups[rowGroupIndex]))
|
|
96
|
+
: callbackFilteredRowGroupIndices;
|
|
97
|
+
const rowGroupsPrunedByStatistics = callbackFilteredRowGroupIndices.length - rowGroupIndices.length;
|
|
98
|
+
this.recordTelemetry('row-group-prune', {
|
|
99
|
+
rowGroupsRequested: candidateRowGroupIndices.length,
|
|
100
|
+
rowGroupsPruned: candidateRowGroupIndices.length - rowGroupIndices.length,
|
|
101
|
+
rowGroupsPrunedByStatistics
|
|
102
|
+
}, {});
|
|
103
|
+
const columns = normalizeColumns(readOptions.columns, initialization.schema);
|
|
104
|
+
const predicateColumns = predicate ? getParquetPredicateColumns(predicate) : [];
|
|
105
|
+
const decodedColumns = columns.length === 0 ? [] : [...new Set([...columns, ...predicateColumns])];
|
|
106
|
+
const columnList = decodedColumns.map(column => [column]);
|
|
107
|
+
const batchSize = normalizeBatchSize(readOptions.batchSize);
|
|
108
|
+
const concurrency = normalizeConcurrency(readOptions.concurrency);
|
|
109
|
+
const projectedSchema = projectSchema(initialization.schema, columns);
|
|
110
|
+
const projectedColumnNames = columns.length ? new Set(columns) : undefined;
|
|
111
|
+
const workerOptions = this.getWorkerOptions(concurrency, readContext.abortController.signal);
|
|
112
|
+
const decodeOnWorker = canDecodeParquetSourceOnWorker(workerOptions);
|
|
113
|
+
const scheduledReads = new Map();
|
|
114
|
+
let nextPositionToSchedule = 0;
|
|
115
|
+
const scheduleReads = () => {
|
|
116
|
+
while (nextPositionToSchedule < rowGroupIndices.length &&
|
|
117
|
+
scheduledReads.size < concurrency) {
|
|
118
|
+
const position = nextPositionToSchedule++;
|
|
119
|
+
const rowGroupIndex = rowGroupIndices[position];
|
|
120
|
+
const read = this.readRowGroup(initialization, rowGroupIndex, columnList, projectedSchema, batchSize, predicate, projectedColumnNames, decodeOnWorker ? workerOptions : undefined, readContext.abortController.signal).then(result => ({ result }), error => ({ error }));
|
|
121
|
+
scheduledReads.set(position, read);
|
|
122
|
+
inFlightReads.add(read);
|
|
123
|
+
void read.then(() => inFlightReads.delete(read));
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
scheduleReads();
|
|
127
|
+
for (let position = 0; position < rowGroupIndices.length; position++) {
|
|
128
|
+
const settledRead = await scheduledReads.get(position);
|
|
129
|
+
scheduledReads.delete(position);
|
|
130
|
+
scheduleReads();
|
|
131
|
+
if ('error' in settledRead) {
|
|
132
|
+
throw settledRead.error;
|
|
133
|
+
}
|
|
134
|
+
const { rowGroupIndex, columns: materializedColumns, rowCount, rowIndices, workerResult } = settledRead.result;
|
|
135
|
+
if (workerResult) {
|
|
136
|
+
for (const workerBatch of workerResult.batches) {
|
|
137
|
+
throwIfAborted(readContext.abortController.signal);
|
|
138
|
+
const deserializationStartTime = getCurrentTime();
|
|
139
|
+
const arrowTable = hydrateArrowTable(workerBatch.arrowTable);
|
|
140
|
+
const deserializationDurationMs = getCurrentTime() - deserializationStartTime;
|
|
141
|
+
this.recordTelemetry('arrow-conversion', { arrowConversionDurationMs: deserializationDurationMs }, { rowGroupIndex, durationMs: deserializationDurationMs });
|
|
142
|
+
const batch = createParquetBatchFromArrow(initialization.metadata, projectedSchema, rowGroupIndex, workerBatch.rowGroupRowOffset, arrowTable, workerBatch.rowCount, workerBatch.rowGroupRowIndices);
|
|
143
|
+
this.recordTelemetry('batch', { batchesEmitted: 1, rowsEmitted: workerBatch.rowCount }, { rowGroupIndex, rowCount: workerBatch.rowCount });
|
|
144
|
+
yield batch;
|
|
145
|
+
}
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const outputRowCount = rowCount;
|
|
149
|
+
const outputBatchSize = batchSize || Math.max(outputRowCount, 1);
|
|
150
|
+
for (let outputRowOffset = 0; outputRowOffset < outputRowCount; outputRowOffset += outputBatchSize) {
|
|
151
|
+
throwIfAborted(readContext.abortController.signal);
|
|
152
|
+
const batchRowCount = Math.min(outputBatchSize, outputRowCount - outputRowOffset);
|
|
153
|
+
const batchRowIndices = rowIndices
|
|
154
|
+
? rowIndices.slice(outputRowOffset, outputRowOffset + batchRowCount)
|
|
155
|
+
: undefined;
|
|
156
|
+
const rowGroupRowOffset = batchRowIndices?.[0] ?? outputRowOffset;
|
|
157
|
+
const batchColumns = sliceColumns(materializedColumns, outputRowOffset, outputRowOffset + batchRowCount);
|
|
158
|
+
const conversionStartTime = getCurrentTime();
|
|
159
|
+
const batch = createParquetBatch(initialization.metadata, projectedSchema, rowGroupIndex, rowGroupRowOffset, batchColumns, batchRowCount, batchRowIndices);
|
|
160
|
+
const conversionDurationMs = getCurrentTime() - conversionStartTime;
|
|
161
|
+
this.recordTelemetry('arrow-conversion', { arrowConversionDurationMs: conversionDurationMs }, { rowGroupIndex, durationMs: conversionDurationMs });
|
|
162
|
+
this.recordTelemetry('batch', { batchesEmitted: 1, rowsEmitted: batchRowCount }, { rowGroupIndex, rowCount: batchRowCount });
|
|
163
|
+
yield batch;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
completed = true;
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
readError = error;
|
|
170
|
+
if (readContext.abortController.signal.aborted) {
|
|
171
|
+
this.recordTelemetry('cancel', { cancellationCount: 1 }, { error });
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
this.recordTelemetry('read-error', { failedReadCount: 1 }, { error });
|
|
175
|
+
}
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
if (!completed && readError === undefined) {
|
|
180
|
+
this.recordTelemetry('cancel', { cancellationCount: 1 }, {});
|
|
181
|
+
}
|
|
182
|
+
readContext.abortController.abort();
|
|
183
|
+
readContext.removeSignalListener();
|
|
184
|
+
this.activeReadControllers.delete(readContext.abortController);
|
|
185
|
+
await Promise.allSettled([...inFlightReads]);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/** Closes the underlying readable file and aborts active remote requests. */
|
|
189
|
+
async close() {
|
|
190
|
+
if (this.closed) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this.closed = true;
|
|
194
|
+
for (const abortController of this.activeReadControllers) {
|
|
195
|
+
abortController.abort();
|
|
196
|
+
}
|
|
197
|
+
await this.readableFile?.close();
|
|
198
|
+
const initialization = await this.initializationPromise?.catch(() => null);
|
|
199
|
+
if (initialization?.file !== this.readableFile) {
|
|
200
|
+
await initialization?.file.close();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/** Returns cached initialization, resetting the cache when initialization fails. */
|
|
204
|
+
getInitialization(signal) {
|
|
205
|
+
if (this.closed) {
|
|
206
|
+
return Promise.reject(new Error('ParquetSource is closed'));
|
|
207
|
+
}
|
|
208
|
+
if (!this.initializationPromise) {
|
|
209
|
+
this.initializationPromise = this.initialize(signal).catch(error => {
|
|
210
|
+
this.initializationPromise = null;
|
|
211
|
+
throw error;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return this.initializationPromise;
|
|
215
|
+
}
|
|
216
|
+
/** Preloads TypeScript decoder compression modules once and permits retry after failure. */
|
|
217
|
+
getCompressionInitialization() {
|
|
218
|
+
if (!this.compressionPromise) {
|
|
219
|
+
this.compressionPromise = preloadCompressions()
|
|
220
|
+
.then(() => undefined)
|
|
221
|
+
.catch(error => {
|
|
222
|
+
this.compressionPromise = null;
|
|
223
|
+
throw error;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return this.compressionPromise;
|
|
227
|
+
}
|
|
228
|
+
/** Snapshots source defaults and per-read overrides before asynchronous iteration begins. */
|
|
229
|
+
getReadOptions(options) {
|
|
230
|
+
const rowGroups = options.rowGroups ?? this.options.parquet?.rowGroups;
|
|
231
|
+
const columns = options.columns ?? this.options.parquet?.columns;
|
|
232
|
+
const predicate = options.predicate ?? this.options.parquet?.predicate;
|
|
233
|
+
return {
|
|
234
|
+
rowGroups: rowGroups && [...rowGroups],
|
|
235
|
+
columns: columns && [...columns],
|
|
236
|
+
rowGroupFilter: options.rowGroupFilter ?? this.options.parquet?.rowGroupFilter,
|
|
237
|
+
predicate: predicate ? copyParquetPredicate(predicate) : undefined,
|
|
238
|
+
batchSize: options.batchSize ?? this.options.parquet?.batchSize,
|
|
239
|
+
concurrency: options.concurrency ?? this.options.parquet?.concurrency,
|
|
240
|
+
signal: options.signal
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/** Creates loader-utils worker options for one selective source read. */
|
|
244
|
+
getWorkerOptions(concurrency, signal) {
|
|
245
|
+
return {
|
|
246
|
+
core: {
|
|
247
|
+
worker: this.options.core?.worker ?? true,
|
|
248
|
+
maxConcurrency: concurrency,
|
|
249
|
+
maxMobileConcurrency: this.options.core?.maxMobileConcurrency ?? concurrency,
|
|
250
|
+
reuseWorkers: this.options.core?.reuseWorkers ?? isBrowser,
|
|
251
|
+
_workerType: this.options.core?._workerType
|
|
252
|
+
},
|
|
253
|
+
'parquet-source': {
|
|
254
|
+
workerUrl: this.options.parquet?.workerUrl
|
|
255
|
+
},
|
|
256
|
+
parquet: {
|
|
257
|
+
signal
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/** Fetches and decodes one selected row group using the cached footer and schema. */
|
|
262
|
+
async readRowGroup(initialization, rowGroupIndex, columnList, projectedSchema, batchSize, predicate, projectedColumnNames, workerOptions, signal) {
|
|
263
|
+
const rowGroup = initialization.fileMetadata.row_groups[rowGroupIndex];
|
|
264
|
+
const pagePlan = predicate
|
|
265
|
+
? await createParquetPagePruningPlan(initialization.file, rowGroup, initialization.parquetSchema, columnList, predicate, signal)
|
|
266
|
+
: undefined;
|
|
267
|
+
if (pagePlan) {
|
|
268
|
+
this.recordPagePruningTelemetry(rowGroupIndex, pagePlan);
|
|
269
|
+
if (pagePlan.rowRanges.length === 0) {
|
|
270
|
+
return { rowGroupIndex, columns: {}, rowCount: 0, rowIndices: [] };
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (workerOptions) {
|
|
274
|
+
return await this.readRowGroupOnWorker(initialization, rowGroupIndex, columnList, projectedSchema, batchSize, predicate, pagePlan, workerOptions, signal);
|
|
275
|
+
}
|
|
276
|
+
const decodeStartTime = getCurrentTime();
|
|
277
|
+
const decodedRowGroups = pagePlan
|
|
278
|
+
? await Promise.all(pagePlan.rowRanges.map(rowRange => initialization.reader.readRowGroupRange(initialization.parquetSchema, rowGroup, columnList, rowRange, pagePlan.pageLocations, signal)))
|
|
279
|
+
: [
|
|
280
|
+
await initialization.reader.readRowGroup(initialization.parquetSchema, rowGroup, columnList, signal)
|
|
281
|
+
];
|
|
282
|
+
throwIfAborted(signal);
|
|
283
|
+
const columns = concatenateMaterializedColumns(decodedRowGroups.map(decodedRowGroup => initialization.parquetSchema.materializeColumns(decodedRowGroup)));
|
|
284
|
+
const sourceRowIndices = pagePlan
|
|
285
|
+
? pagePlan.rowRanges.flatMap(rowRange => Array.from({ length: rowRange.end - rowRange.start }, (_, index) => rowRange.start + index))
|
|
286
|
+
: undefined;
|
|
287
|
+
const localRowCount = sourceRowIndices?.length ?? Number(rowGroup.num_rows);
|
|
288
|
+
const localRowIndices = predicate
|
|
289
|
+
? filterParquetRowIndices(predicate, columns, localRowCount)
|
|
290
|
+
: undefined;
|
|
291
|
+
const rowIndices = localRowIndices?.map(rowIndex => sourceRowIndices?.[rowIndex] ?? rowIndex);
|
|
292
|
+
const outputColumns = localRowIndices
|
|
293
|
+
? gatherParquetColumns(columns, localRowIndices, projectedColumnNames)
|
|
294
|
+
: columns;
|
|
295
|
+
const decodeDurationMs = getCurrentTime() - decodeStartTime;
|
|
296
|
+
this.recordTelemetry('decode', { decodeDurationMs, rowGroupsDecoded: 1 }, { rowGroupIndex, durationMs: decodeDurationMs });
|
|
297
|
+
if (predicate) {
|
|
298
|
+
this.recordTelemetry('predicate-filter', {
|
|
299
|
+
predicateRowsTested: localRowCount,
|
|
300
|
+
predicateRowsMatched: rowIndices.length
|
|
301
|
+
}, { rowGroupIndex, rowCount: rowIndices.length });
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
rowGroupIndex,
|
|
305
|
+
columns: outputColumns,
|
|
306
|
+
rowCount: rowIndices?.length ?? localRowCount,
|
|
307
|
+
rowIndices
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/** Fetches selected chunks and transfers their decompression and Arrow conversion to a worker. */
|
|
311
|
+
async readRowGroupOnWorker(initialization, rowGroupIndex, columnList, projectedSchema, batchSize, predicate, pagePlan, workerOptions, signal) {
|
|
312
|
+
const rowGroup = initialization.fileMetadata.row_groups[rowGroupIndex];
|
|
313
|
+
const selectedColumnChunks = rowGroup.columns.filter(columnChunk => {
|
|
314
|
+
const path = columnChunk.meta_data?.path_in_schema;
|
|
315
|
+
return Boolean(path && (columnList.length === 0 || fieldIndexOf(columnList, path) >= 0));
|
|
316
|
+
});
|
|
317
|
+
const rangeDescriptors = pagePlan
|
|
318
|
+
? getParquetPageReadRanges(rowGroup, columnList, pagePlan)
|
|
319
|
+
: selectedColumnChunks.map(getColumnChunkRange);
|
|
320
|
+
const ranges = await Promise.all(rangeDescriptors.map(async ({ offset, length }) => {
|
|
321
|
+
return { offset, data: await initialization.file.read(offset, length, signal) };
|
|
322
|
+
}));
|
|
323
|
+
throwIfAborted(signal);
|
|
324
|
+
let workerResult;
|
|
325
|
+
try {
|
|
326
|
+
workerResult = await decodeParquetSourceRowGroupOnWorker({
|
|
327
|
+
fileByteLength: initialization.file.size,
|
|
328
|
+
rowCount: Number(rowGroup.num_rows),
|
|
329
|
+
uncompressedByteLength: Number(rowGroup.total_byte_size),
|
|
330
|
+
schemaDefinition: initialization.parquetSchema.schema,
|
|
331
|
+
projectedSchema,
|
|
332
|
+
columnChunks: selectedColumnChunks.map(createParquetSourceWorkerColumnChunk),
|
|
333
|
+
ranges,
|
|
334
|
+
batchSize: batchSize || Math.max(Number(rowGroup.num_rows), 1),
|
|
335
|
+
predicate: predicate ? copyParquetPredicate(predicate) : undefined,
|
|
336
|
+
pagePlan,
|
|
337
|
+
preserveBinary: Boolean(this.options.parquet?.preserveBinary)
|
|
338
|
+
}, workerOptions);
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
throwIfAborted(signal);
|
|
342
|
+
throw error;
|
|
343
|
+
}
|
|
344
|
+
throwIfAborted(signal);
|
|
345
|
+
this.recordTelemetry('decode', { decodeDurationMs: workerResult.decodeDurationMs, rowGroupsDecoded: 1 }, { rowGroupIndex, durationMs: workerResult.decodeDurationMs });
|
|
346
|
+
this.recordTelemetry('arrow-conversion', { arrowConversionDurationMs: workerResult.arrowConversionDurationMs }, { rowGroupIndex, durationMs: workerResult.arrowConversionDurationMs });
|
|
347
|
+
if (predicate) {
|
|
348
|
+
this.recordTelemetry('predicate-filter', {
|
|
349
|
+
predicateRowsTested: workerResult.sourceRowCount,
|
|
350
|
+
predicateRowsMatched: workerResult.rowCount
|
|
351
|
+
}, { rowGroupIndex, rowCount: workerResult.rowCount });
|
|
352
|
+
}
|
|
353
|
+
return { rowGroupIndex, rowCount: workerResult.rowCount, workerResult };
|
|
354
|
+
}
|
|
355
|
+
/** Records the rows and pages avoided by one conservative page-index plan. */
|
|
356
|
+
recordPagePruningTelemetry(rowGroupIndex, plan) {
|
|
357
|
+
this.recordTelemetry('page-index-prune', {
|
|
358
|
+
pageIndexesRead: plan.indexCount,
|
|
359
|
+
pagesRead: plan.selectedPageCount,
|
|
360
|
+
pagesPruned: plan.totalPageCount - plan.selectedPageCount,
|
|
361
|
+
rowsPrunedByPageIndex: plan.prunedRowCount,
|
|
362
|
+
rowGroupsPrunedByPageIndex: plan.rowRanges.length === 0 ? 1 : 0,
|
|
363
|
+
rowGroupsPruned: plan.rowRanges.length === 0 ? 1 : 0
|
|
364
|
+
}, { rowGroupIndex, rowCount: plan.prunedRowCount });
|
|
365
|
+
}
|
|
366
|
+
/** Opens the readable file and decodes its footer and schema once. */
|
|
367
|
+
async initialize(signal) {
|
|
368
|
+
const file = await this.openFile(signal);
|
|
369
|
+
try {
|
|
370
|
+
const reader = new ParquetReader(file, {
|
|
371
|
+
preserveBinary: this.options.parquet?.preserveBinary,
|
|
372
|
+
signal
|
|
373
|
+
});
|
|
374
|
+
const fileMetadata = await reader.getFileMetadata();
|
|
375
|
+
const parquetSchema = await reader.getSchema();
|
|
376
|
+
const schema = deepFreeze(await getSchemaFromParquetReader(reader));
|
|
377
|
+
const metadata = createParquetSourceMetadata(this.data, this.url, file, fileMetadata, schema, parquetSchema, file instanceof ParquetRangeFile ? file.objectVersion : undefined);
|
|
378
|
+
reader.props.signal = undefined;
|
|
379
|
+
return { file, reader, schema, parquetSchema, fileMetadata, metadata };
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
await file.close();
|
|
383
|
+
throw error;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/** Opens a Blob file or probes a remote object with one bounded range request. */
|
|
387
|
+
async openFile(signal) {
|
|
388
|
+
if (typeof this.data !== 'string') {
|
|
389
|
+
this.readableFile = new BlobFile(this.data);
|
|
390
|
+
return this.readableFile;
|
|
391
|
+
}
|
|
392
|
+
const file = new ParquetRangeFile(this.url, {
|
|
393
|
+
fetch: this.fetch,
|
|
394
|
+
headers: this.options.parquet?.headers,
|
|
395
|
+
rangeRequests: this.options.rangeRequests,
|
|
396
|
+
onTelemetry: event => this.recordTelemetry(event.type, {
|
|
397
|
+
rangeRequestCount: event.rangeRequestCount,
|
|
398
|
+
requestedBytes: event.requestedBytes,
|
|
399
|
+
downloadedBytes: event.downloadedBytes,
|
|
400
|
+
cacheHits: event.cacheHits,
|
|
401
|
+
networkDurationMs: event.networkDurationMs,
|
|
402
|
+
failedRangeRequestCount: event.failedRangeRequestCount,
|
|
403
|
+
abortedRangeRequestCount: event.abortedRangeRequestCount
|
|
404
|
+
}, { durationMs: event.networkDurationMs, error: event.error })
|
|
405
|
+
});
|
|
406
|
+
this.readableFile = file;
|
|
407
|
+
return await file.open(signal);
|
|
408
|
+
}
|
|
409
|
+
/** Applies telemetry deltas and emits a callback with the resulting cumulative snapshot. */
|
|
410
|
+
recordTelemetry(type, delta, details) {
|
|
411
|
+
for (const [key, value] of Object.entries(delta)) {
|
|
412
|
+
if (value !== undefined) {
|
|
413
|
+
this.telemetry[key] += value;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
try {
|
|
417
|
+
this.options.parquet?.onTelemetry?.({ type, telemetry: this.getTelemetry(), ...details });
|
|
418
|
+
}
|
|
419
|
+
catch {
|
|
420
|
+
// Telemetry must never change source read behavior.
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
/** Normalizes a decoded Parquet footer into source metadata. */
|
|
425
|
+
function createParquetSourceMetadata(data, url, file, fileMetadata, schema, parquetSchema, objectVersion) {
|
|
426
|
+
let rowOffset = 0;
|
|
427
|
+
const rowGroups = fileMetadata.row_groups.map((rowGroup, index) => {
|
|
428
|
+
const columns = rowGroup.columns
|
|
429
|
+
.filter(columnChunk => Boolean(columnChunk.meta_data))
|
|
430
|
+
.map(columnChunk => createColumnChunkMetadata(columnChunk, parquetSchema));
|
|
431
|
+
const normalizedRowGroup = createRowGroupMetadata(index, rowOffset, Number(rowGroup.num_rows), Number(rowGroup.total_byte_size), columns);
|
|
432
|
+
rowOffset += normalizedRowGroup.rowCount;
|
|
433
|
+
return normalizedRowGroup;
|
|
434
|
+
});
|
|
435
|
+
return Object.freeze({
|
|
436
|
+
schema,
|
|
437
|
+
name: getSourceName(data, url),
|
|
438
|
+
url: url || undefined,
|
|
439
|
+
fileByteLength: file.size,
|
|
440
|
+
version: fileMetadata.version,
|
|
441
|
+
formatVersion: fileMetadata.version,
|
|
442
|
+
createdBy: fileMetadata.created_by,
|
|
443
|
+
rowCount: Number(fileMetadata.num_rows),
|
|
444
|
+
rowGroupCount: rowGroups.length,
|
|
445
|
+
keyValueMetadata: Object.freeze(getKeyValueMetadata(fileMetadata)),
|
|
446
|
+
rowGroups: Object.freeze(rowGroups),
|
|
447
|
+
objectVersion: hasObjectVersion(objectVersion) ? Object.freeze({ ...objectVersion }) : undefined
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
/** Normalizes a decoded Parquet column chunk. */
|
|
451
|
+
function createColumnChunkMetadata(columnChunk, parquetSchema) {
|
|
452
|
+
const columnMetadata = columnChunk.meta_data;
|
|
453
|
+
const dataPageOffset = Number(columnMetadata.data_page_offset);
|
|
454
|
+
const dictionaryPageOffset = columnMetadata.dictionary_page_offset === undefined
|
|
455
|
+
? undefined
|
|
456
|
+
: Number(columnMetadata.dictionary_page_offset);
|
|
457
|
+
const statistics = createColumnChunkStatistics(columnMetadata.statistics, parquetSchema.findField(columnMetadata.path_in_schema));
|
|
458
|
+
const compressedByteLength = Number(columnMetadata.total_compressed_size);
|
|
459
|
+
const uncompressedByteLength = Number(columnMetadata.total_uncompressed_size);
|
|
460
|
+
return Object.freeze({
|
|
461
|
+
path: Object.freeze([...columnMetadata.path_in_schema]),
|
|
462
|
+
filePath: columnChunk.file_path || undefined,
|
|
463
|
+
compression: CompressionCodec[columnMetadata.codec] || String(columnMetadata.codec),
|
|
464
|
+
encodings: Object.freeze(columnMetadata.encodings.map(encoding => Encoding[encoding] || String(encoding))),
|
|
465
|
+
valueCount: Number(columnMetadata.num_values),
|
|
466
|
+
fileOffset: Math.min(dataPageOffset, dictionaryPageOffset && dictionaryPageOffset > 0 ? dictionaryPageOffset : dataPageOffset),
|
|
467
|
+
compressedByteLength,
|
|
468
|
+
compressedSize: compressedByteLength,
|
|
469
|
+
uncompressedByteLength,
|
|
470
|
+
uncompressedSize: uncompressedByteLength,
|
|
471
|
+
dataPageOffset,
|
|
472
|
+
dictionaryPageOffset,
|
|
473
|
+
columnIndexOffset: columnChunk.column_index_offset === undefined
|
|
474
|
+
? undefined
|
|
475
|
+
: Number(columnChunk.column_index_offset),
|
|
476
|
+
columnIndexByteLength: columnChunk.column_index_length,
|
|
477
|
+
offsetIndexOffset: columnChunk.offset_index_offset === undefined
|
|
478
|
+
? undefined
|
|
479
|
+
: Number(columnChunk.offset_index_offset),
|
|
480
|
+
offsetIndexByteLength: columnChunk.offset_index_length,
|
|
481
|
+
statistics
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
/** Decodes optional footer statistics into the column's logical value representation. */
|
|
485
|
+
function createColumnChunkStatistics(statistics, field) {
|
|
486
|
+
if (!statistics) {
|
|
487
|
+
return undefined;
|
|
488
|
+
}
|
|
489
|
+
const minBytes = statistics.min_value ?? statistics.min;
|
|
490
|
+
const maxBytes = statistics.max_value ?? statistics.max;
|
|
491
|
+
const result = {
|
|
492
|
+
nullCount: statistics.null_count === undefined ? undefined : Number(statistics.null_count),
|
|
493
|
+
distinctCount: statistics.distinct_count === undefined ? undefined : Number(statistics.distinct_count),
|
|
494
|
+
minIsExact: statistics.is_min_value_exact,
|
|
495
|
+
maxIsExact: statistics.is_max_value_exact
|
|
496
|
+
};
|
|
497
|
+
if (minBytes) {
|
|
498
|
+
result.min = decodeStatisticsValueSafely(toUint8Array(minBytes), field);
|
|
499
|
+
}
|
|
500
|
+
if (maxBytes) {
|
|
501
|
+
result.max = decodeStatisticsValueSafely(toUint8Array(maxBytes), field);
|
|
502
|
+
}
|
|
503
|
+
if (result.min === undefined &&
|
|
504
|
+
result.max === undefined &&
|
|
505
|
+
result.nullCount === undefined &&
|
|
506
|
+
result.distinctCount === undefined &&
|
|
507
|
+
result.minIsExact === undefined &&
|
|
508
|
+
result.maxIsExact === undefined) {
|
|
509
|
+
return undefined;
|
|
510
|
+
}
|
|
511
|
+
return Object.freeze(result);
|
|
512
|
+
}
|
|
513
|
+
/** Decodes one footer statistic and returns undefined for malformed or unsupported values. */
|
|
514
|
+
function decodeStatisticsValueSafely(bytes, field) {
|
|
515
|
+
try {
|
|
516
|
+
let primitiveValue;
|
|
517
|
+
switch (field.primitiveType) {
|
|
518
|
+
case 'BOOLEAN':
|
|
519
|
+
primitiveValue = Boolean(bytes[0]);
|
|
520
|
+
break;
|
|
521
|
+
case 'INT32':
|
|
522
|
+
primitiveValue =
|
|
523
|
+
field.originalType === 'UINT_32' ? readUInt32LE(bytes, 0) : readInt32LE(bytes, 0);
|
|
524
|
+
break;
|
|
525
|
+
case 'INT64':
|
|
526
|
+
primitiveValue =
|
|
527
|
+
field.originalType === 'UINT_64' ? readUInt64LE(bytes, 0) : readInt64LE(bytes, 0);
|
|
528
|
+
break;
|
|
529
|
+
case 'FLOAT':
|
|
530
|
+
primitiveValue = readFloatLE(bytes, 0);
|
|
531
|
+
break;
|
|
532
|
+
case 'DOUBLE':
|
|
533
|
+
primitiveValue = readDoubleLE(bytes, 0);
|
|
534
|
+
break;
|
|
535
|
+
case 'INT96':
|
|
536
|
+
case 'BYTE_ARRAY':
|
|
537
|
+
case 'FIXED_LEN_BYTE_ARRAY':
|
|
538
|
+
primitiveValue = copyUint8Array(bytes);
|
|
539
|
+
break;
|
|
540
|
+
default:
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
return Types.fromPrimitive(field.originalType || field.primitiveType, primitiveValue, field);
|
|
544
|
+
}
|
|
545
|
+
catch {
|
|
546
|
+
return undefined;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
/** Normalizes one decoded row group and derives its compressed byte length. */
|
|
550
|
+
function createRowGroupMetadata(index, rowOffset, rowCount, uncompressedByteLength, columns) {
|
|
551
|
+
const compressedByteLength = columns.reduce((sum, column) => sum + column.compressedByteLength, 0);
|
|
552
|
+
return Object.freeze({
|
|
553
|
+
index,
|
|
554
|
+
rowOffset,
|
|
555
|
+
rowCount,
|
|
556
|
+
uncompressedByteLength,
|
|
557
|
+
uncompressedSize: uncompressedByteLength,
|
|
558
|
+
compressedByteLength,
|
|
559
|
+
compressedSize: compressedByteLength,
|
|
560
|
+
columns: Object.freeze(columns)
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
/** Returns the complete contiguous byte range occupied by one Parquet column chunk. */
|
|
564
|
+
function getColumnChunkRange(columnChunk) {
|
|
565
|
+
if (columnChunk.file_path) {
|
|
566
|
+
throw new Error('Parquet worker decoding does not support external column chunk files');
|
|
567
|
+
}
|
|
568
|
+
const columnMetadata = columnChunk.meta_data;
|
|
569
|
+
if (!columnMetadata) {
|
|
570
|
+
throw new Error('Parquet column chunk is missing metadata');
|
|
571
|
+
}
|
|
572
|
+
const dataPageOffset = Number(columnMetadata.data_page_offset);
|
|
573
|
+
const dictionaryPageOffset = columnMetadata.dictionary_page_offset === undefined
|
|
574
|
+
? undefined
|
|
575
|
+
: Number(columnMetadata.dictionary_page_offset);
|
|
576
|
+
const offset = Math.min(dataPageOffset, dictionaryPageOffset && dictionaryPageOffset > 0 ? dictionaryPageOffset : dataPageOffset);
|
|
577
|
+
const length = Number(columnMetadata.total_compressed_size);
|
|
578
|
+
if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) || offset < 0 || length < 0) {
|
|
579
|
+
throw new Error('Parquet column chunk range must use non-negative safe integers');
|
|
580
|
+
}
|
|
581
|
+
return { offset, length };
|
|
582
|
+
}
|
|
583
|
+
/** Copies one selected Thrift column chunk into a structured-cloneable worker descriptor. */
|
|
584
|
+
function createParquetSourceWorkerColumnChunk(columnChunk) {
|
|
585
|
+
const columnMetadata = columnChunk.meta_data;
|
|
586
|
+
if (!columnMetadata) {
|
|
587
|
+
throw new Error('Parquet column chunk is missing metadata');
|
|
588
|
+
}
|
|
589
|
+
return {
|
|
590
|
+
filePath: columnChunk.file_path || undefined,
|
|
591
|
+
physicalType: columnMetadata.type,
|
|
592
|
+
compressionCodec: columnMetadata.codec,
|
|
593
|
+
path: [...columnMetadata.path_in_schema],
|
|
594
|
+
valueCount: Number(columnMetadata.num_values),
|
|
595
|
+
compressedByteLength: Number(columnMetadata.total_compressed_size),
|
|
596
|
+
uncompressedByteLength: Number(columnMetadata.total_uncompressed_size),
|
|
597
|
+
dataPageOffset: Number(columnMetadata.data_page_offset),
|
|
598
|
+
dictionaryPageOffset: columnMetadata.dictionary_page_offset === undefined
|
|
599
|
+
? undefined
|
|
600
|
+
: Number(columnMetadata.dictionary_page_offset)
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
/** Converts decoded columns into one Arrow batch and attaches stable source provenance. */
|
|
604
|
+
function createParquetBatch(metadata, schema, rowGroupIndex, rowGroupRowOffset, columns, rowCount, rowGroupRowIndices) {
|
|
605
|
+
const arrowTable = convertTable({ shape: 'columnar-table', schema, data: columns }, 'arrow-table');
|
|
606
|
+
return createParquetBatchFromArrow(metadata, schema, rowGroupIndex, rowGroupRowOffset, arrowTable.data, rowCount, rowGroupRowIndices);
|
|
607
|
+
}
|
|
608
|
+
/** Wraps a worker-transferred or locally converted Arrow table with source provenance. */
|
|
609
|
+
function createParquetBatchFromArrow(metadata, schema, rowGroupIndex, rowGroupRowOffset, data, rowCount, rowGroupRowIndices) {
|
|
610
|
+
const rowGroup = metadata.rowGroups[rowGroupIndex];
|
|
611
|
+
const sourceId = metadata.url || metadata.name;
|
|
612
|
+
const provenance = Object.freeze({
|
|
613
|
+
sourceId,
|
|
614
|
+
sourceUrl: metadata.url,
|
|
615
|
+
source: sourceId,
|
|
616
|
+
rowGroupIndex,
|
|
617
|
+
rowOffset: rowGroup.rowOffset + rowGroupRowOffset,
|
|
618
|
+
rowGroupRowOffset,
|
|
619
|
+
rowCount,
|
|
620
|
+
rowGroupRowIndices: rowGroupRowIndices ? Object.freeze([...rowGroupRowIndices]) : undefined,
|
|
621
|
+
rowIndices: rowGroupRowIndices
|
|
622
|
+
? Object.freeze(rowGroupRowIndices.map(rowIndex => rowGroup.rowOffset + rowIndex))
|
|
623
|
+
: undefined
|
|
624
|
+
});
|
|
625
|
+
return {
|
|
626
|
+
batchType: 'data',
|
|
627
|
+
shape: 'arrow-table',
|
|
628
|
+
schemaType: 'explicit',
|
|
629
|
+
schema,
|
|
630
|
+
data,
|
|
631
|
+
length: rowCount,
|
|
632
|
+
metadata: provenance,
|
|
633
|
+
...provenance
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
/** Returns a contiguous row slice of every decoded column without constructing row objects. */
|
|
637
|
+
function sliceColumns(columns, start, end) {
|
|
638
|
+
const slicedColumns = {};
|
|
639
|
+
for (const [name, column] of Object.entries(columns)) {
|
|
640
|
+
const slice = column.slice;
|
|
641
|
+
slicedColumns[name] = slice
|
|
642
|
+
? slice.call(column, start, end)
|
|
643
|
+
: Array.prototype.slice.call(column, start, end);
|
|
644
|
+
}
|
|
645
|
+
return slicedColumns;
|
|
646
|
+
}
|
|
647
|
+
/** Concatenates materialized page-range fragments without constructing row objects. */
|
|
648
|
+
function concatenateMaterializedColumns(fragments) {
|
|
649
|
+
const columns = {};
|
|
650
|
+
for (const fragment of fragments) {
|
|
651
|
+
for (const [name, values] of Object.entries(fragment)) {
|
|
652
|
+
columns[name] ||= [];
|
|
653
|
+
const destination = columns[name];
|
|
654
|
+
for (let index = 0; index < values.length; index++) {
|
|
655
|
+
destination.push(values[index]);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return columns;
|
|
660
|
+
}
|
|
661
|
+
/** Validates and normalizes requested row-group indexes. */
|
|
662
|
+
function normalizeRowGroupIndices(rowGroups, rowGroupCount) {
|
|
663
|
+
const rowGroupIndices = rowGroups || Array.from({ length: rowGroupCount }, (_, index) => index);
|
|
664
|
+
const seenIndices = new Set();
|
|
665
|
+
for (const rowGroupIndex of rowGroupIndices) {
|
|
666
|
+
if (!Number.isInteger(rowGroupIndex) || rowGroupIndex < 0 || rowGroupIndex >= rowGroupCount) {
|
|
667
|
+
throw new Error(`Invalid Parquet row-group index ${rowGroupIndex}`);
|
|
668
|
+
}
|
|
669
|
+
if (seenIndices.has(rowGroupIndex)) {
|
|
670
|
+
throw new Error(`Duplicate Parquet row-group index ${rowGroupIndex}`);
|
|
671
|
+
}
|
|
672
|
+
seenIndices.add(rowGroupIndex);
|
|
673
|
+
}
|
|
674
|
+
return [...rowGroupIndices];
|
|
675
|
+
}
|
|
676
|
+
/** Validates selected top-level columns against the source schema. */
|
|
677
|
+
function normalizeColumns(columns, schema) {
|
|
678
|
+
if (!columns?.length) {
|
|
679
|
+
return [];
|
|
680
|
+
}
|
|
681
|
+
const availableColumns = new Set(schema.fields.map(field => field.name));
|
|
682
|
+
const normalizedColumns = [];
|
|
683
|
+
for (const column of columns) {
|
|
684
|
+
if (!availableColumns.has(column)) {
|
|
685
|
+
throw new Error(`Parquet column not found: ${column}`);
|
|
686
|
+
}
|
|
687
|
+
if (!normalizedColumns.includes(column)) {
|
|
688
|
+
normalizedColumns.push(column);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return normalizedColumns;
|
|
692
|
+
}
|
|
693
|
+
/** Returns a schema containing only explicitly selected top-level fields. */
|
|
694
|
+
function projectSchema(schema, columns) {
|
|
695
|
+
if (columns.length === 0) {
|
|
696
|
+
return schema;
|
|
697
|
+
}
|
|
698
|
+
const selectedColumns = new Set(columns);
|
|
699
|
+
return { ...schema, fields: schema.fields.filter(field => selectedColumns.has(field.name)) };
|
|
700
|
+
}
|
|
701
|
+
/** Validates an optional output batch size. */
|
|
702
|
+
function normalizeBatchSize(batchSize) {
|
|
703
|
+
if (batchSize === undefined) {
|
|
704
|
+
return undefined;
|
|
705
|
+
}
|
|
706
|
+
if (!Number.isInteger(batchSize) || batchSize <= 0) {
|
|
707
|
+
throw new Error(`Invalid Parquet batch size ${batchSize}`);
|
|
708
|
+
}
|
|
709
|
+
return batchSize;
|
|
710
|
+
}
|
|
711
|
+
/** Validates the row-group decode concurrency limit. */
|
|
712
|
+
function normalizeConcurrency(concurrency = 1) {
|
|
713
|
+
if (!Number.isInteger(concurrency) || concurrency <= 0) {
|
|
714
|
+
throw new Error(`Invalid Parquet concurrency ${concurrency}`);
|
|
715
|
+
}
|
|
716
|
+
return concurrency;
|
|
717
|
+
}
|
|
718
|
+
/** Creates a zero-filled telemetry snapshot for one Parquet source. */
|
|
719
|
+
function createParquetTelemetry() {
|
|
720
|
+
return {
|
|
721
|
+
rangeRequestCount: 0,
|
|
722
|
+
requestedBytes: 0,
|
|
723
|
+
downloadedBytes: 0,
|
|
724
|
+
cacheHits: 0,
|
|
725
|
+
networkDurationMs: 0,
|
|
726
|
+
failedRangeRequestCount: 0,
|
|
727
|
+
abortedRangeRequestCount: 0,
|
|
728
|
+
retryCount: 0,
|
|
729
|
+
decodeDurationMs: 0,
|
|
730
|
+
arrowConversionDurationMs: 0,
|
|
731
|
+
rowGroupsRequested: 0,
|
|
732
|
+
rowGroupsPruned: 0,
|
|
733
|
+
rowGroupsPrunedByStatistics: 0,
|
|
734
|
+
rowGroupsPrunedByPageIndex: 0,
|
|
735
|
+
pageIndexesRead: 0,
|
|
736
|
+
pagesRead: 0,
|
|
737
|
+
pagesPruned: 0,
|
|
738
|
+
rowsPrunedByPageIndex: 0,
|
|
739
|
+
rowGroupsDecoded: 0,
|
|
740
|
+
batchesEmitted: 0,
|
|
741
|
+
rowsEmitted: 0,
|
|
742
|
+
predicateRowsTested: 0,
|
|
743
|
+
predicateRowsMatched: 0,
|
|
744
|
+
cancellationCount: 0,
|
|
745
|
+
failedReadCount: 0
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
/** Returns a monotonic timestamp when available and falls back to wall-clock time. */
|
|
749
|
+
function getCurrentTime() {
|
|
750
|
+
return globalThis.performance?.now() ?? Date.now();
|
|
751
|
+
}
|
|
752
|
+
/** Creates a read-scoped abort controller linked to the caller signal. */
|
|
753
|
+
function createReadAbortContext(signal) {
|
|
754
|
+
const abortController = new AbortController();
|
|
755
|
+
const abortRead = () => abortController.abort(signal?.reason);
|
|
756
|
+
if (signal?.aborted) {
|
|
757
|
+
abortRead();
|
|
758
|
+
}
|
|
759
|
+
else {
|
|
760
|
+
signal?.addEventListener('abort', abortRead, { once: true });
|
|
761
|
+
}
|
|
762
|
+
return {
|
|
763
|
+
abortController,
|
|
764
|
+
removeSignalListener: () => signal?.removeEventListener('abort', abortRead)
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
/** Throws a cross-runtime AbortError when a signal has been aborted. */
|
|
768
|
+
function throwIfAborted(signal) {
|
|
769
|
+
if (!signal.aborted) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
if (signal.reason !== undefined) {
|
|
773
|
+
throw signal.reason;
|
|
774
|
+
}
|
|
775
|
+
const error = new Error('Parquet read aborted');
|
|
776
|
+
error.name = 'AbortError';
|
|
777
|
+
throw error;
|
|
778
|
+
}
|
|
779
|
+
/** Recursively freezes the plain schema tree cached by a source. */
|
|
780
|
+
function deepFreeze(value) {
|
|
781
|
+
if (!value || typeof value !== 'object' || Object.isFrozen(value)) {
|
|
782
|
+
return value;
|
|
783
|
+
}
|
|
784
|
+
for (const nestedValue of Object.values(value)) {
|
|
785
|
+
deepFreeze(nestedValue);
|
|
786
|
+
}
|
|
787
|
+
return Object.freeze(value);
|
|
788
|
+
}
|
|
789
|
+
/** Converts footer key/value pairs into an object. */
|
|
790
|
+
function getKeyValueMetadata(fileMetadata) {
|
|
791
|
+
const result = {};
|
|
792
|
+
for (const entry of fileMetadata.key_value_metadata || []) {
|
|
793
|
+
if (entry.value !== undefined) {
|
|
794
|
+
result[entry.key] = entry.value;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
return result;
|
|
798
|
+
}
|
|
799
|
+
/** Infers a stable display name from URL or File input. */
|
|
800
|
+
function getSourceName(data, url) {
|
|
801
|
+
const sourceName = typeof data !== 'string' && 'name' in data && typeof data.name === 'string'
|
|
802
|
+
? data.name
|
|
803
|
+
: typeof data === 'string'
|
|
804
|
+
? url.split(/[?#]/)[0].split('/').pop() || 'parquet'
|
|
805
|
+
: 'parquet';
|
|
806
|
+
return sourceName.replace(/\.parquet$/i, '') || 'parquet';
|
|
807
|
+
}
|
|
808
|
+
/** Returns true when at least one HTTP object validator was captured. */
|
|
809
|
+
function hasObjectVersion(version) {
|
|
810
|
+
return Boolean(version?.etag || version?.lastModified);
|
|
811
|
+
}
|
|
812
|
+
//# sourceMappingURL=parquet-source-loader.js.map
|