@loaders.gl/parquet 4.5.3 → 5.0.0-alpha.10
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/delta-format.d.ts +9 -0
- package/dist/delta-format.d.ts.map +1 -0
- package/dist/delta-format.js +12 -0
- package/dist/delta-format.js.map +1 -0
- package/dist/delta-source-loader-types.d.ts +27 -0
- package/dist/delta-source-loader-types.d.ts.map +1 -0
- package/dist/delta-source-loader-types.js +28 -0
- package/dist/delta-source-loader-types.js.map +1 -0
- package/dist/delta-source.d.ts +48 -0
- package/dist/delta-source.d.ts.map +1 -0
- package/dist/delta-source.js +222 -0
- package/dist/delta-source.js.map +1 -0
- package/dist/delta-types.d.ts +38 -0
- package/dist/delta-types.d.ts.map +1 -0
- package/dist/delta-types.js +5 -0
- package/dist/delta-types.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/iceberg-rest-catalog.d.ts +49 -0
- package/dist/iceberg-rest-catalog.d.ts.map +1 -0
- package/dist/iceberg-rest-catalog.js +78 -0
- package/dist/iceberg-rest-catalog.js.map +1 -0
- package/dist/iceberg-table-source.d.ts +63 -0
- package/dist/iceberg-table-source.d.ts.map +1 -0
- package/dist/iceberg-table-source.js +797 -0
- package/dist/iceberg-table-source.js.map +1 -0
- package/dist/iceberg-types.d.ts +150 -0
- package/dist/iceberg-types.d.ts.map +1 -0
- package/dist/iceberg-types.js +5 -0
- package/dist/iceberg-types.js.map +1 -0
- package/dist/index.cjs +41568 -6781
- package/dist/index.cjs.map +3 -4
- package/dist/index.d.ts +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -12
- 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 +3 -1
- package/dist/lib/arrow/convert-schema-from-parquet.d.ts.map +1 -1
- package/dist/lib/arrow/convert-schema-from-parquet.js +164 -29
- 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 +485 -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 +394 -0
- package/dist/lib/encoders/encode-table-to-parquet-js.js.map +1 -0
- package/dist/lib/geo/geoparquet-covering.d.ts +19 -0
- package/dist/lib/geo/geoparquet-covering.d.ts.map +1 -0
- package/dist/lib/geo/geoparquet-covering.js +137 -0
- package/dist/lib/geo/geoparquet-covering.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 +412 -0
- package/dist/lib/geo/geospatial-metadata.js.map +1 -0
- package/dist/lib/parquet-bloom-filter-planner.d.ts +16 -0
- package/dist/lib/parquet-bloom-filter-planner.d.ts.map +1 -0
- package/dist/lib/parquet-bloom-filter-planner.js +57 -0
- package/dist/lib/parquet-bloom-filter-planner.js.map +1 -0
- package/dist/lib/parquet-bloom-filter.d.ts +30 -0
- package/dist/lib/parquet-bloom-filter.d.ts.map +1 -0
- package/dist/lib/parquet-bloom-filter.js +289 -0
- package/dist/lib/parquet-bloom-filter.js.map +1 -0
- package/dist/lib/parquet-encryption.d.ts +80 -0
- package/dist/lib/parquet-encryption.d.ts.map +1 -0
- package/dist/lib/parquet-encryption.js +190 -0
- package/dist/lib/parquet-encryption.js.map +1 -0
- package/dist/lib/parquet-page-index.d.ts +91 -0
- package/dist/lib/parquet-page-index.d.ts.map +1 -0
- package/dist/lib/parquet-page-index.js +463 -0
- package/dist/lib/parquet-page-index.js.map +1 -0
- package/dist/lib/parquet-predicate.d.ts +21 -0
- package/dist/lib/parquet-predicate.d.ts.map +1 -0
- package/dist/lib/parquet-predicate.js +328 -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 +24 -0
- package/dist/lib/parquet-source-worker-client.js.map +1 -0
- package/dist/lib/parquet-source-worker-decoder.d.ts +7 -0
- package/dist/lib/parquet-source-worker-decoder.d.ts.map +1 -0
- package/dist/lib/parquet-source-worker-decoder.js +181 -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 +121 -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 +6 -2
- 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 +921 -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 +4 -5
- 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 +95 -28
- package/dist/lib/parsers/parse-parquet-to-json.js.map +1 -1
- package/dist/lib/slice-parquet-batch.d.ts +9 -0
- package/dist/lib/slice-parquet-batch.d.ts.map +1 -0
- package/dist/lib/slice-parquet-batch.js +28 -0
- package/dist/lib/slice-parquet-batch.js.map +1 -0
- 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 +267 -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 +25 -0
- package/dist/lib/utils/normalize-parquet-options.js.map +1 -0
- package/dist/parquet-dataset-source.cjs +38974 -0
- package/dist/parquet-dataset-source.cjs.map +6 -0
- package/dist/parquet-dataset-source.d.ts +81 -0
- package/dist/parquet-dataset-source.d.ts.map +1 -0
- package/dist/parquet-dataset-source.js +602 -0
- package/dist/parquet-dataset-source.js.map +1 -0
- package/dist/parquet-encoded-page-types.d.ts +108 -0
- package/dist/parquet-encoded-page-types.d.ts.map +1 -0
- package/dist/parquet-encoded-page-types.js +5 -0
- package/dist/parquet-encoded-page-types.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 +59 -0
- package/dist/parquet-js-loader-types.d.ts.map +1 -0
- package/dist/parquet-js-loader-types.js +34 -0
- package/dist/parquet-js-loader-types.js.map +1 -0
- package/dist/parquet-js-loader.d.ts +18 -22
- package/dist/parquet-js-loader.d.ts.map +1 -1
- package/dist/parquet-js-loader.js +53 -14
- package/dist/parquet-js-loader.js.map +1 -1
- package/dist/parquet-js-writer.d.ts +65 -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 +55 -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 +43 -0
- package/dist/parquet-source-capabilities.d.ts.map +1 -0
- package/dist/parquet-source-capabilities.js +32 -0
- package/dist/parquet-source-capabilities.js.map +1 -0
- package/dist/parquet-source-loader-types.d.ts +82 -0
- package/dist/parquet-source-loader-types.d.ts.map +1 -0
- package/dist/parquet-source-loader-types.js +84 -0
- package/dist/parquet-source-loader-types.js.map +1 -0
- package/dist/parquet-source-loader.cjs +38261 -0
- package/dist/parquet-source-loader.cjs.map +6 -0
- package/dist/parquet-source-loader.d.ts +167 -0
- package/dist/parquet-source-loader.d.ts.map +1 -0
- package/dist/parquet-source-loader.js +1438 -0
- package/dist/parquet-source-loader.js.map +1 -0
- package/dist/parquet-source-types.d.ts +534 -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-factory.d.ts +4 -0
- package/dist/parquet-source-worker-factory.d.ts.map +1 -0
- package/dist/parquet-source-worker-factory.js +6 -0
- package/dist/parquet-source-worker-factory.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 +38871 -0
- package/dist/parquet-source-worker.js.map +7 -0
- package/dist/parquet-worker-node.cjs +78507 -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 +19 -0
- package/dist/parquet-worker-url.js.map +1 -0
- package/dist/parquet-worker.js +20094 -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 +35 -3
- package/dist/parquetjs/codecs/declare.d.ts.map +1 -1
- package/dist/parquetjs/codecs/declare.js +17 -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 +788 -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 +22 -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 +231 -78
- package/dist/parquetjs/codecs/plain.js.map +1 -1
- package/dist/parquetjs/codecs/rle.d.ts +7 -3
- package/dist/parquetjs/codecs/rle.d.ts.map +1 -1
- package/dist/parquetjs/codecs/rle.js +613 -69
- package/dist/parquetjs/codecs/rle.js.map +1 -1
- package/dist/parquetjs/compression.d.ts +16 -8
- package/dist/parquetjs/compression.d.ts.map +1 -1
- package/dist/parquetjs/compression.js +114 -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 +67 -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 +54 -5
- package/dist/parquetjs/encoder/parquet-encoder.d.ts.map +1 -1
- package/dist/parquetjs/encoder/parquet-encoder.js +930 -66
- package/dist/parquetjs/encoder/parquet-encoder.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/BoundingBox.d.ts +29 -0
- package/dist/parquetjs/parquet-thrift/BoundingBox.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/BoundingBox.js +85 -0
- package/dist/parquetjs/parquet-thrift/BoundingBox.js.map +1 -0
- 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 +7 -2
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnChunk.js +37 -2
- package/dist/parquetjs/parquet-thrift/ColumnChunk.js.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnCryptoMetaData.d.ts +35 -0
- package/dist/parquetjs/parquet-thrift/ColumnCryptoMetaData.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/ColumnCryptoMetaData.js +135 -0
- package/dist/parquetjs/parquet-thrift/ColumnCryptoMetaData.js.map +1 -0
- 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 +12 -2
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.js +75 -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/EncryptionAlgorithm.d.ts +22 -0
- package/dist/parquetjs/parquet-thrift/EncryptionAlgorithm.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/EncryptionAlgorithm.js +111 -0
- package/dist/parquetjs/parquet-thrift/EncryptionAlgorithm.js.map +1 -0
- 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/FileCryptoMetaData.d.ts +16 -0
- package/dist/parquetjs/parquet-thrift/FileCryptoMetaData.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/FileCryptoMetaData.js +57 -0
- package/dist/parquetjs/parquet-thrift/FileCryptoMetaData.js.map +1 -0
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts +7 -2
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/FileMetaData.js +37 -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/GeospatialStatistics.d.ts +18 -0
- package/dist/parquetjs/parquet-thrift/GeospatialStatistics.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/GeospatialStatistics.js +62 -0
- package/dist/parquetjs/parquet-thrift/GeospatialStatistics.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/SizeStatistics.d.ts +26 -0
- package/dist/parquetjs/parquet-thrift/SizeStatistics.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/SizeStatistics.js +85 -0
- package/dist/parquetjs/parquet-thrift/SizeStatistics.js.map +1 -0
- 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 +12 -2
- package/dist/parquetjs/parquet-thrift/index.d.ts.map +1 -1
- package/dist/parquetjs/parquet-thrift/index.js +12 -2
- package/dist/parquetjs/parquet-thrift/index.js.map +1 -1
- package/dist/parquetjs/parser/decoders.d.ts +23 -3
- package/dist/parquetjs/parser/decoders.d.ts.map +1 -1
- package/dist/parquetjs/parser/decoders.js +687 -119
- package/dist/parquetjs/parser/decoders.js.map +1 -1
- package/dist/parquetjs/parser/encoded-pages.d.ts +24 -0
- package/dist/parquetjs/parser/encoded-pages.d.ts.map +1 -0
- package/dist/parquetjs/parser/encoded-pages.js +206 -0
- package/dist/parquetjs/parser/encoded-pages.js.map +1 -0
- package/dist/parquetjs/parser/parquet-reader.d.ts +111 -10
- package/dist/parquetjs/parser/parquet-reader.d.ts.map +1 -1
- package/dist/parquetjs/parser/parquet-reader.js +836 -69
- package/dist/parquetjs/parser/parquet-reader.js.map +1 -1
- package/dist/parquetjs/schema/declare.d.ts +83 -10
- 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 +31 -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 +285 -29
- 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 +290 -71
- package/dist/parquetjs/schema/types.js.map +1 -1
- package/dist/parquetjs/schema/variant.d.ts +3 -0
- package/dist/parquetjs/schema/variant.d.ts.map +1 -0
- package/dist/parquetjs/schema/variant.js +248 -0
- package/dist/parquetjs/schema/variant.js.map +1 -0
- 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/crc32.d.ts +3 -0
- package/dist/parquetjs/utils/crc32.d.ts.map +1 -0
- package/dist/parquetjs/utils/crc32.js +15 -0
- package/dist/parquetjs/utils/crc32.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 +25 -7
- package/dist/parquetjs/utils/read-utils.d.ts.map +1 -1
- package/dist/parquetjs/utils/read-utils.js +66 -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 +10 -0
- package/dist/unbundled.d.ts.map +1 -0
- package/dist/unbundled.js +11 -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 +84 -40
- package/src/bundled.ts +43 -0
- package/src/delta-format.ts +12 -0
- package/src/delta-source-loader-types.ts +40 -0
- package/src/delta-source.ts +305 -0
- package/src/delta-types.ts +40 -0
- package/src/geoparquet-loader-with-parser.ts +95 -0
- package/src/geoparquet-loader.ts +54 -0
- package/src/iceberg-rest-catalog.ts +122 -0
- package/src/iceberg-table-source.ts +1037 -0
- package/src/iceberg-types.ts +165 -0
- package/src/index.ts +105 -26
- package/src/lib/arrow/convert-columns-to-row-group.ts +3 -0
- package/src/lib/arrow/convert-schema-from-parquet.ts +193 -32
- package/src/lib/arrow/convert-schema-to-parquet.ts +16 -7
- package/src/lib/arrow/create-nested-arrow-vector.ts +705 -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 +526 -0
- package/src/lib/geo/geoparquet-covering.ts +201 -0
- package/src/lib/geo/geospatial-metadata.ts +547 -0
- package/src/lib/parquet-bloom-filter-planner.ts +86 -0
- package/src/lib/parquet-bloom-filter.ts +345 -0
- package/src/lib/parquet-encryption.ts +344 -0
- package/src/lib/parquet-page-index.ts +727 -0
- package/src/lib/parquet-predicate.ts +410 -0
- package/src/lib/parquet-source-worker-client.ts +41 -0
- package/src/lib/parquet-source-worker-decoder.ts +252 -0
- package/src/lib/parquet-source-worker-file.ts +56 -0
- package/src/lib/parquet-source-worker-types.ts +132 -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 +6 -2
- 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 +1213 -0
- package/src/lib/parsers/parse-parquet-to-arrow.ts +62 -36
- package/src/lib/parsers/parse-parquet-to-columns.ts +9 -8
- package/src/lib/parsers/parse-parquet-to-json.ts +119 -35
- package/src/lib/slice-parquet-batch.ts +32 -0
- package/src/lib/sources/parquet-range-file.ts +365 -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 +30 -0
- package/src/parquet-dataset-source.ts +800 -0
- package/src/parquet-encoded-page-types.ts +122 -0
- package/src/parquet-format.ts +2 -0
- package/src/parquet-js-loader-types.ts +53 -0
- package/src/parquet-js-loader.ts +76 -19
- package/src/parquet-js-writer.ts +98 -0
- package/src/parquet-loader-base.ts +34 -0
- package/src/parquet-loader-options.ts +62 -0
- package/src/parquet-loader-types.ts +35 -0
- package/src/parquet-loader.ts +115 -0
- package/src/parquet-source-capabilities.ts +73 -0
- package/src/parquet-source-loader-types.ts +97 -0
- package/src/parquet-source-loader.ts +2254 -0
- package/src/parquet-source-types.ts +627 -0
- package/src/parquet-source-worker-factory.ts +8 -0
- package/src/parquet-source-worker-url.ts +23 -0
- package/src/parquet-worker-url.ts +23 -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 +62 -3
- package/src/parquetjs/codecs/delta.ts +1047 -0
- package/src/parquetjs/codecs/dictionary.ts +22 -4
- package/src/parquetjs/codecs/index.ts +22 -0
- package/src/parquetjs/codecs/plain.ts +317 -89
- package/src/parquetjs/codecs/rle.ts +852 -82
- package/src/parquetjs/compression.ts +137 -156
- package/src/parquetjs/encoder/dictionary-planner.ts +104 -0
- package/src/parquetjs/encoder/page-planner.ts +83 -0
- package/src/parquetjs/encoder/parquet-encoder.ts +1374 -95
- package/src/parquetjs/parquet-thrift/BoundingBox.ts +108 -0
- package/src/parquetjs/parquet-thrift/BsonType.ts +1 -1
- package/src/parquetjs/parquet-thrift/ColumnChunk.ts +37 -2
- package/src/parquetjs/parquet-thrift/ColumnCryptoMetaData.ts +139 -0
- package/src/parquetjs/parquet-thrift/ColumnIndex.ts +13 -13
- package/src/parquetjs/parquet-thrift/ColumnMetaData.ts +75 -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/EncryptionAlgorithm.ts +127 -0
- package/src/parquetjs/parquet-thrift/EnumType.ts +1 -1
- package/src/parquetjs/parquet-thrift/FileCryptoMetaData.ts +60 -0
- package/src/parquetjs/parquet-thrift/FileMetaData.ts +37 -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/GeospatialStatistics.ts +68 -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/SizeStatistics.ts +98 -0
- 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 +12 -4
- package/src/parquetjs/parser/decoders.ts +922 -143
- package/src/parquetjs/parser/encoded-pages.ts +278 -0
- package/src/parquetjs/parser/parquet-reader.ts +1334 -83
- package/src/parquetjs/schema/declare.ts +121 -9
- package/src/parquetjs/schema/schema.ts +33 -3
- package/src/parquetjs/schema/shred.ts +345 -41
- package/src/parquetjs/schema/types.ts +308 -84
- package/src/parquetjs/schema/variant.ts +313 -0
- package/src/parquetjs/utils/binary-utils.ts +132 -0
- package/src/parquetjs/utils/crc32.ts +15 -0
- package/src/parquetjs/utils/file-utils.ts +4 -4
- package/src/parquetjs/utils/read-utils.ts +77 -51
- 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 +47 -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
|
@@ -5,8 +5,16 @@
|
|
|
5
5
|
// Forked from https://github.com/kbajalc/parquets under MIT license
|
|
6
6
|
|
|
7
7
|
/* eslint-disable camelcase */
|
|
8
|
-
import {
|
|
8
|
+
import {BSONWriter, parseBSONSync} from '@loaders.gl/bson';
|
|
9
9
|
import {OriginalType, ParquetField, ParquetType, PrimitiveType} from './declare';
|
|
10
|
+
import {
|
|
11
|
+
decodeUtf8,
|
|
12
|
+
encodeUtf8,
|
|
13
|
+
readUInt32LE,
|
|
14
|
+
toArrayBuffer,
|
|
15
|
+
toUint8Array,
|
|
16
|
+
writeUInt32LE
|
|
17
|
+
} from '../utils/binary-utils';
|
|
10
18
|
|
|
11
19
|
export interface ParquetTypeKit {
|
|
12
20
|
primitiveType: PrimitiveType;
|
|
@@ -56,6 +64,12 @@ export const PARQUET_LOGICAL_TYPES: Record<ParquetType, ParquetTypeKit> = {
|
|
|
56
64
|
toPrimitive: toPrimitive_UTF8,
|
|
57
65
|
fromPrimitive: fromPrimitive_UTF8
|
|
58
66
|
},
|
|
67
|
+
ENUM: {
|
|
68
|
+
primitiveType: 'BYTE_ARRAY',
|
|
69
|
+
originalType: 'ENUM',
|
|
70
|
+
toPrimitive: toPrimitive_UTF8,
|
|
71
|
+
fromPrimitive: fromPrimitive_UTF8
|
|
72
|
+
},
|
|
59
73
|
TIME_MILLIS: {
|
|
60
74
|
primitiveType: 'INT32',
|
|
61
75
|
originalType: 'TIME_MILLIS',
|
|
@@ -66,6 +80,11 @@ export const PARQUET_LOGICAL_TYPES: Record<ParquetType, ParquetTypeKit> = {
|
|
|
66
80
|
originalType: 'TIME_MICROS',
|
|
67
81
|
toPrimitive: toPrimitive_TIME_MICROS
|
|
68
82
|
},
|
|
83
|
+
TIME_NANOS: {
|
|
84
|
+
primitiveType: 'INT64',
|
|
85
|
+
originalType: 'TIME_NANOS',
|
|
86
|
+
toPrimitive: toPrimitive_TIME_NANOS
|
|
87
|
+
},
|
|
69
88
|
DATE: {
|
|
70
89
|
primitiveType: 'INT32',
|
|
71
90
|
originalType: 'DATE',
|
|
@@ -84,6 +103,11 @@ export const PARQUET_LOGICAL_TYPES: Record<ParquetType, ParquetTypeKit> = {
|
|
|
84
103
|
toPrimitive: toPrimitive_TIMESTAMP_MICROS,
|
|
85
104
|
fromPrimitive: fromPrimitive_TIMESTAMP_MICROS
|
|
86
105
|
},
|
|
106
|
+
TIMESTAMP_NANOS: {
|
|
107
|
+
primitiveType: 'INT64',
|
|
108
|
+
originalType: 'TIMESTAMP_NANOS',
|
|
109
|
+
toPrimitive: toPrimitive_TIMESTAMP_NANOS
|
|
110
|
+
},
|
|
87
111
|
UINT_8: {
|
|
88
112
|
primitiveType: 'INT32',
|
|
89
113
|
originalType: 'UINT_8',
|
|
@@ -136,6 +160,39 @@ export const PARQUET_LOGICAL_TYPES: Record<ParquetType, ParquetTypeKit> = {
|
|
|
136
160
|
toPrimitive: toPrimitive_BSON,
|
|
137
161
|
fromPrimitive: fromPrimitive_BSON
|
|
138
162
|
},
|
|
163
|
+
UUID: {
|
|
164
|
+
primitiveType: 'FIXED_LEN_BYTE_ARRAY',
|
|
165
|
+
originalType: 'UUID',
|
|
166
|
+
typeLength: 16,
|
|
167
|
+
toPrimitive: toPrimitive_BYTE_ARRAY
|
|
168
|
+
},
|
|
169
|
+
FLOAT16: {
|
|
170
|
+
primitiveType: 'FIXED_LEN_BYTE_ARRAY',
|
|
171
|
+
originalType: 'FLOAT16',
|
|
172
|
+
typeLength: 2,
|
|
173
|
+
toPrimitive: toPrimitive_FLOAT16,
|
|
174
|
+
fromPrimitive: fromPrimitive_FLOAT16
|
|
175
|
+
},
|
|
176
|
+
UNKNOWN: {
|
|
177
|
+
primitiveType: 'BYTE_ARRAY',
|
|
178
|
+
originalType: 'UNKNOWN',
|
|
179
|
+
toPrimitive: toPrimitive_BYTE_ARRAY
|
|
180
|
+
},
|
|
181
|
+
VARIANT: {
|
|
182
|
+
primitiveType: 'BYTE_ARRAY',
|
|
183
|
+
originalType: 'VARIANT',
|
|
184
|
+
toPrimitive: toPrimitive_BYTE_ARRAY
|
|
185
|
+
},
|
|
186
|
+
GEOMETRY: {
|
|
187
|
+
primitiveType: 'BYTE_ARRAY',
|
|
188
|
+
originalType: 'GEOMETRY',
|
|
189
|
+
toPrimitive: toPrimitive_BYTE_ARRAY
|
|
190
|
+
},
|
|
191
|
+
GEOGRAPHY: {
|
|
192
|
+
primitiveType: 'BYTE_ARRAY',
|
|
193
|
+
originalType: 'GEOGRAPHY',
|
|
194
|
+
toPrimitive: toPrimitive_BYTE_ARRAY
|
|
195
|
+
},
|
|
139
196
|
INTERVAL: {
|
|
140
197
|
primitiveType: 'FIXED_LEN_BYTE_ARRAY',
|
|
141
198
|
originalType: 'INTERVAL',
|
|
@@ -207,15 +264,82 @@ function fromPrimitive_BOOLEAN(value: any): boolean {
|
|
|
207
264
|
|
|
208
265
|
function toPrimitive_FLOAT(value: any): number {
|
|
209
266
|
const v = parseFloat(value);
|
|
210
|
-
if (isNaN(v)) {
|
|
267
|
+
if (Number.isNaN(v)) {
|
|
211
268
|
throw new Error(`invalid value for FLOAT: ${value}`);
|
|
212
269
|
}
|
|
213
270
|
return v;
|
|
214
271
|
}
|
|
215
272
|
|
|
273
|
+
/** Converts a JavaScript number to the two-byte IEEE 754 binary16 representation. */
|
|
274
|
+
function toPrimitive_FLOAT16(value: unknown): Uint8Array {
|
|
275
|
+
const numberValue = Number(value);
|
|
276
|
+
if (Number.isNaN(numberValue) && !Number.isNaN(value)) {
|
|
277
|
+
throw new Error(`invalid value for FLOAT16: ${value}`);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const float32 = new Float32Array([numberValue]);
|
|
281
|
+
const bits = new Uint32Array(float32.buffer)[0];
|
|
282
|
+
const sign = (bits >>> 16) & 0x8000;
|
|
283
|
+
const exponent = (bits >>> 23) & 0xff;
|
|
284
|
+
const mantissa = bits & 0x7fffff;
|
|
285
|
+
let half: number;
|
|
286
|
+
if (exponent === 0xff) {
|
|
287
|
+
half = sign | 0x7c00 | (mantissa ? 0x0200 : 0);
|
|
288
|
+
} else {
|
|
289
|
+
const halfExponent = exponent - 127 + 15;
|
|
290
|
+
if (halfExponent >= 0x1f) {
|
|
291
|
+
half = sign | 0x7c00;
|
|
292
|
+
} else if (halfExponent <= 0) {
|
|
293
|
+
if (halfExponent < -10) {
|
|
294
|
+
half = sign;
|
|
295
|
+
} else {
|
|
296
|
+
const normalizedMantissa = mantissa | 0x800000;
|
|
297
|
+
half = sign | roundRightShiftToNearestEven(normalizedMantissa, 14 - halfExponent);
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
const halfMantissa = roundRightShiftToNearestEven(mantissa, 13);
|
|
301
|
+
if (halfMantissa === 0x400) {
|
|
302
|
+
const roundedExponent = halfExponent + 1;
|
|
303
|
+
half = roundedExponent >= 0x1f ? sign | 0x7c00 : sign | (roundedExponent << 10);
|
|
304
|
+
} else {
|
|
305
|
+
half = sign | (halfExponent << 10) | halfMantissa;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return new Uint8Array([half & 0xff, half >>> 8]);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** Rounds a non-negative integer right shift using IEEE round-to-nearest, ties-to-even. */
|
|
313
|
+
function roundRightShiftToNearestEven(value: number, shift: number): number {
|
|
314
|
+
const divisor = 2 ** shift;
|
|
315
|
+
const quotient = Math.floor(value / divisor);
|
|
316
|
+
const remainder = value - quotient * divisor;
|
|
317
|
+
const halfway = divisor / 2;
|
|
318
|
+
return quotient + (remainder > halfway || (remainder === halfway && quotient % 2 === 1) ? 1 : 0);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** Converts little-endian IEEE 754 binary16 bytes to a JavaScript number. */
|
|
322
|
+
function fromPrimitive_FLOAT16(value: unknown): number {
|
|
323
|
+
const bytes = toUint8Array(value as ArrayBuffer | ArrayBufferView);
|
|
324
|
+
if (bytes.byteLength !== 2) {
|
|
325
|
+
throw new Error(`invalid FLOAT16 byte length: ${bytes.byteLength}`);
|
|
326
|
+
}
|
|
327
|
+
const half = bytes[0] | (bytes[1] << 8);
|
|
328
|
+
const sign = half & 0x8000 ? -1 : 1;
|
|
329
|
+
const exponent = (half >>> 10) & 0x1f;
|
|
330
|
+
const mantissa = half & 0x03ff;
|
|
331
|
+
if (exponent === 0x1f) {
|
|
332
|
+
return mantissa ? Number.NaN : sign * Number.POSITIVE_INFINITY;
|
|
333
|
+
}
|
|
334
|
+
if (exponent === 0) {
|
|
335
|
+
return sign * 2 ** -14 * (mantissa / 1024);
|
|
336
|
+
}
|
|
337
|
+
return sign * 2 ** (exponent - 15) * (1 + mantissa / 1024);
|
|
338
|
+
}
|
|
339
|
+
|
|
216
340
|
function toPrimitive_DOUBLE(value: any): number {
|
|
217
341
|
const v = parseFloat(value);
|
|
218
|
-
if (isNaN(v)) {
|
|
342
|
+
if (Number.isNaN(v)) {
|
|
219
343
|
throw new Error(`invalid value for DOUBLE: ${value}`);
|
|
220
344
|
}
|
|
221
345
|
return v;
|
|
@@ -223,7 +347,7 @@ function toPrimitive_DOUBLE(value: any): number {
|
|
|
223
347
|
|
|
224
348
|
function toPrimitive_INT8(value: any) {
|
|
225
349
|
const v = parseInt(value, 10);
|
|
226
|
-
if (v < -0x80 || v > 0x7f || isNaN(v)) {
|
|
350
|
+
if (v < -0x80 || v > 0x7f || Number.isNaN(v)) {
|
|
227
351
|
throw new Error(`invalid value for INT8: ${value}`);
|
|
228
352
|
}
|
|
229
353
|
|
|
@@ -232,7 +356,7 @@ function toPrimitive_INT8(value: any) {
|
|
|
232
356
|
|
|
233
357
|
function toPrimitive_UINT8(value: any) {
|
|
234
358
|
const v = parseInt(value, 10);
|
|
235
|
-
if (v < 0 || v > 0xff || isNaN(v)) {
|
|
359
|
+
if (v < 0 || v > 0xff || Number.isNaN(v)) {
|
|
236
360
|
throw new Error(`invalid value for UINT8: ${value}`);
|
|
237
361
|
}
|
|
238
362
|
|
|
@@ -241,7 +365,7 @@ function toPrimitive_UINT8(value: any) {
|
|
|
241
365
|
|
|
242
366
|
function toPrimitive_INT16(value: any) {
|
|
243
367
|
const v = parseInt(value, 10);
|
|
244
|
-
if (v < -0x8000 || v > 0x7fff || isNaN(v)) {
|
|
368
|
+
if (v < -0x8000 || v > 0x7fff || Number.isNaN(v)) {
|
|
245
369
|
throw new Error(`invalid value for INT16: ${value}`);
|
|
246
370
|
}
|
|
247
371
|
|
|
@@ -250,7 +374,7 @@ function toPrimitive_INT16(value: any) {
|
|
|
250
374
|
|
|
251
375
|
function toPrimitive_UINT16(value: any) {
|
|
252
376
|
const v = parseInt(value, 10);
|
|
253
|
-
if (v < 0 || v > 0xffff || isNaN(v)) {
|
|
377
|
+
if (v < 0 || v > 0xffff || Number.isNaN(v)) {
|
|
254
378
|
throw new Error(`invalid value for UINT16: ${value}`);
|
|
255
379
|
}
|
|
256
380
|
|
|
@@ -259,7 +383,7 @@ function toPrimitive_UINT16(value: any) {
|
|
|
259
383
|
|
|
260
384
|
function toPrimitive_INT32(value: any) {
|
|
261
385
|
const v = parseInt(value, 10);
|
|
262
|
-
if (v < -0x80000000 || v > 0x7fffffff || isNaN(v)) {
|
|
386
|
+
if (v < -0x80000000 || v > 0x7fffffff || Number.isNaN(v)) {
|
|
263
387
|
throw new Error(`invalid value for INT32: ${value}`);
|
|
264
388
|
}
|
|
265
389
|
|
|
@@ -269,7 +393,7 @@ function toPrimitive_INT32(value: any) {
|
|
|
269
393
|
function decimalToPrimitive_INT32(value: number, field: ParquetField): number {
|
|
270
394
|
const primitiveValue = value * 10 ** (field.scale || 0);
|
|
271
395
|
const v = Math.round(((primitiveValue * 10 ** -field.presision!) % 1) * 10 ** field.presision!);
|
|
272
|
-
if (v < -0x80000000 || v > 0x7fffffff || isNaN(v)) {
|
|
396
|
+
if (v < -0x80000000 || v > 0x7fffffff || Number.isNaN(v)) {
|
|
273
397
|
throw new Error(`invalid value for INT32: ${value}`);
|
|
274
398
|
}
|
|
275
399
|
return v;
|
|
@@ -277,99 +401,204 @@ function decimalToPrimitive_INT32(value: number, field: ParquetField): number {
|
|
|
277
401
|
|
|
278
402
|
function toPrimitive_UINT32(value: any): number {
|
|
279
403
|
const v = parseInt(value, 10);
|
|
280
|
-
if (v < 0 || v >
|
|
404
|
+
if (v < 0 || v > 0xffffffff || Number.isNaN(v)) {
|
|
281
405
|
throw new Error(`invalid value for UINT32: ${value}`);
|
|
282
406
|
}
|
|
283
407
|
return v;
|
|
284
408
|
}
|
|
285
409
|
|
|
286
|
-
function toPrimitive_INT64(value:
|
|
287
|
-
|
|
288
|
-
|
|
410
|
+
function toPrimitive_INT64(value: unknown): number | bigint {
|
|
411
|
+
if (typeof value === 'number') {
|
|
412
|
+
if (!Number.isSafeInteger(value)) {
|
|
413
|
+
throw new Error(`invalid value for INT64: ${value}`);
|
|
414
|
+
}
|
|
415
|
+
return value;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
let primitiveValue: bigint;
|
|
419
|
+
try {
|
|
420
|
+
primitiveValue = BigInt(value as bigint | boolean | string);
|
|
421
|
+
} catch {
|
|
289
422
|
throw new Error(`invalid value for INT64: ${value}`);
|
|
290
423
|
}
|
|
291
|
-
|
|
424
|
+
if (primitiveValue < -(2n ** 63n) || primitiveValue > 2n ** 63n - 1n) {
|
|
425
|
+
throw new Error(`invalid value for INT64: ${value}`);
|
|
426
|
+
}
|
|
427
|
+
return primitiveValue;
|
|
292
428
|
}
|
|
293
429
|
|
|
294
430
|
function decimalToPrimitive_INT64(value: number, field: ParquetField) {
|
|
295
431
|
const primitiveValue = value * 10 ** (field.scale || 0);
|
|
296
432
|
const v = Math.round(((primitiveValue * 10 ** -field.presision!) % 1) * 10 ** field.presision!);
|
|
297
|
-
if (isNaN(v)) {
|
|
433
|
+
if (Number.isNaN(v)) {
|
|
298
434
|
throw new Error(`invalid value for INT64: ${value}`);
|
|
299
435
|
}
|
|
300
436
|
|
|
301
437
|
return v;
|
|
302
438
|
}
|
|
303
439
|
|
|
304
|
-
function toPrimitive_UINT64(value:
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
440
|
+
function toPrimitive_UINT64(value: unknown): bigint {
|
|
441
|
+
const primitiveValue = BigInt(value as bigint | boolean | number | string);
|
|
442
|
+
if (primitiveValue < 0n || primitiveValue > 2n ** 64n - 1n) {
|
|
307
443
|
throw new Error(`invalid value for UINT64: ${value}`);
|
|
308
444
|
}
|
|
309
|
-
|
|
310
|
-
return v;
|
|
445
|
+
return BigInt.asIntN(64, primitiveValue);
|
|
311
446
|
}
|
|
312
447
|
|
|
313
|
-
function toPrimitive_INT96(value:
|
|
314
|
-
|
|
315
|
-
if (
|
|
448
|
+
function toPrimitive_INT96(value: unknown): number | bigint {
|
|
449
|
+
if (typeof value === 'bigint') return value;
|
|
450
|
+
if (typeof value === 'number') {
|
|
451
|
+
if (Number.isSafeInteger(value)) return value;
|
|
316
452
|
throw new Error(`invalid value for INT96: ${value}`);
|
|
317
453
|
}
|
|
454
|
+
if (typeof value !== 'string' || !/^[+-]?\d+$/.test(value)) {
|
|
455
|
+
throw new Error(`invalid value for INT96: ${value}`);
|
|
456
|
+
}
|
|
457
|
+
const bigintValue = BigInt(value);
|
|
458
|
+
return bigintValue >= Number.MIN_SAFE_INTEGER && bigintValue <= Number.MAX_SAFE_INTEGER
|
|
459
|
+
? Number(bigintValue)
|
|
460
|
+
: bigintValue;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function toPrimitive_BYTE_ARRAY(value: any): Uint8Array {
|
|
464
|
+
return typeof value === 'string' ? encodeUtf8(value) : toUint8Array(value);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function decimalToPrimitive_BYTE_ARRAY(value: unknown, field: ParquetField): Uint8Array {
|
|
468
|
+
if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {
|
|
469
|
+
const bytes = toUint8Array(value);
|
|
470
|
+
if (field.typeLength !== undefined && bytes.byteLength !== field.typeLength) {
|
|
471
|
+
throw new Error(
|
|
472
|
+
`invalid DECIMAL byte width: expected ${field.typeLength}, received ${bytes.byteLength}`
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
return bytes;
|
|
476
|
+
}
|
|
318
477
|
|
|
319
|
-
|
|
478
|
+
const unscaledValue = getUnscaledDecimalInteger(value, field.scale || 0);
|
|
479
|
+
const precision = field.precision ?? field.presision;
|
|
480
|
+
if (precision !== undefined && getDecimalDigitCount(unscaledValue) > precision) {
|
|
481
|
+
throw new Error(`DECIMAL value ${value} exceeds precision ${precision}`);
|
|
482
|
+
}
|
|
483
|
+
const byteWidth = field.typeLength ?? getSignedBigIntByteWidth(unscaledValue);
|
|
484
|
+
const bitWidth = BigInt(byteWidth * 8);
|
|
485
|
+
const minimum = -(1n << (bitWidth - 1n));
|
|
486
|
+
const maximum = (1n << (bitWidth - 1n)) - 1n;
|
|
487
|
+
if (unscaledValue < minimum || unscaledValue > maximum) {
|
|
488
|
+
throw new Error(`DECIMAL value ${value} does not fit in ${byteWidth} bytes`);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
const bytes = new Uint8Array(byteWidth);
|
|
492
|
+
let unsignedValue = BigInt.asUintN(byteWidth * 8, unscaledValue);
|
|
493
|
+
for (let byteIndex = byteWidth - 1; byteIndex >= 0; byteIndex--) {
|
|
494
|
+
bytes[byteIndex] = Number(unsignedValue & 0xffn);
|
|
495
|
+
unsignedValue >>= 8n;
|
|
496
|
+
}
|
|
497
|
+
return bytes;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/** Converts a logical decimal value to its exact scaled integer. */
|
|
501
|
+
function getUnscaledDecimalInteger(value: unknown, scale: number): bigint {
|
|
502
|
+
if (!Number.isInteger(scale) || scale < 0) {
|
|
503
|
+
throw new Error(`invalid DECIMAL scale: ${scale}`);
|
|
504
|
+
}
|
|
505
|
+
if (typeof value === 'bigint') {
|
|
506
|
+
return value * 10n ** BigInt(scale);
|
|
507
|
+
}
|
|
508
|
+
if (typeof value === 'number') {
|
|
509
|
+
const scaledValue = Math.round(value * 10 ** scale);
|
|
510
|
+
if (!Number.isFinite(value) || !Number.isSafeInteger(scaledValue)) {
|
|
511
|
+
throw new Error(`DECIMAL number ${value} cannot be represented exactly; use a string`);
|
|
512
|
+
}
|
|
513
|
+
return BigInt(scaledValue);
|
|
514
|
+
}
|
|
515
|
+
if (typeof value !== 'string') {
|
|
516
|
+
throw new Error(`invalid value for DECIMAL: ${value}`);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const match = /^([+-]?)(\d+)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/.exec(value.trim());
|
|
520
|
+
if (!match) {
|
|
521
|
+
throw new Error(`invalid value for DECIMAL: ${value}`);
|
|
522
|
+
}
|
|
523
|
+
const sign = match[1] === '-' ? -1n : 1n;
|
|
524
|
+
const fraction = match[3] || '';
|
|
525
|
+
let unscaledValue = BigInt(`${match[2]}${fraction}` || '0');
|
|
526
|
+
const decimalShift = scale + Number(match[4] || 0) - fraction.length;
|
|
527
|
+
if (decimalShift >= 0) {
|
|
528
|
+
unscaledValue *= 10n ** BigInt(decimalShift);
|
|
529
|
+
} else {
|
|
530
|
+
const divisor = 10n ** BigInt(-decimalShift);
|
|
531
|
+
if (unscaledValue % divisor !== 0n) {
|
|
532
|
+
throw new Error(`DECIMAL value ${value} has more fractional digits than scale ${scale}`);
|
|
533
|
+
}
|
|
534
|
+
unscaledValue /= divisor;
|
|
535
|
+
}
|
|
536
|
+
return sign * unscaledValue;
|
|
320
537
|
}
|
|
321
538
|
|
|
322
|
-
|
|
323
|
-
|
|
539
|
+
/** Returns the number of base-10 digits in a signed integer, treating zero as one digit. */
|
|
540
|
+
function getDecimalDigitCount(value: bigint): number {
|
|
541
|
+
return (value < 0n ? -value : value).toString().length;
|
|
324
542
|
}
|
|
325
543
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
544
|
+
/** Returns the smallest two's-complement byte width that can contain a signed integer. */
|
|
545
|
+
function getSignedBigIntByteWidth(value: bigint): number {
|
|
546
|
+
let byteWidth = 1;
|
|
547
|
+
while (value < -(1n << BigInt(byteWidth * 8 - 1)) || value >= 1n << BigInt(byteWidth * 8 - 1)) {
|
|
548
|
+
byteWidth++;
|
|
549
|
+
}
|
|
550
|
+
return byteWidth;
|
|
329
551
|
}
|
|
330
552
|
|
|
331
|
-
function toPrimitive_UTF8(value: any):
|
|
332
|
-
return
|
|
553
|
+
function toPrimitive_UTF8(value: any): Uint8Array {
|
|
554
|
+
return encodeUtf8(String(value));
|
|
333
555
|
}
|
|
334
556
|
|
|
335
557
|
function fromPrimitive_UTF8(value: any): string {
|
|
336
|
-
return value
|
|
558
|
+
return decodeUtf8(toUint8Array(value));
|
|
337
559
|
}
|
|
338
560
|
|
|
339
|
-
function toPrimitive_JSON(value: any):
|
|
340
|
-
return
|
|
561
|
+
function toPrimitive_JSON(value: any): Uint8Array {
|
|
562
|
+
return encodeUtf8(JSON.stringify(value));
|
|
341
563
|
}
|
|
342
564
|
|
|
343
565
|
function fromPrimitive_JSON(value: any): unknown {
|
|
344
|
-
return JSON.parse(value);
|
|
566
|
+
return JSON.parse(decodeUtf8(toUint8Array(value)));
|
|
345
567
|
}
|
|
346
568
|
|
|
347
|
-
function toPrimitive_BSON(value: any):
|
|
569
|
+
function toPrimitive_BSON(value: any): Uint8Array {
|
|
348
570
|
// @ts-ignore
|
|
349
571
|
const arrayBuffer: ArrayBuffer = BSONWriter.encodeSync?.(value);
|
|
350
|
-
return
|
|
572
|
+
return toUint8Array(arrayBuffer);
|
|
351
573
|
}
|
|
352
574
|
|
|
353
575
|
function fromPrimitive_BSON(value: any) {
|
|
354
|
-
return
|
|
576
|
+
return parseBSONSync(toArrayBuffer(value));
|
|
355
577
|
}
|
|
356
578
|
|
|
357
579
|
function toPrimitive_TIME_MILLIS(value: any) {
|
|
358
580
|
const v = parseInt(value, 10);
|
|
359
|
-
|
|
360
|
-
if (v < 0 || v > 0xffffffffffffffff || isNaN(v)) {
|
|
581
|
+
if (v < 0 || v >= kMillisPerDay || Number.isNaN(v)) {
|
|
361
582
|
throw new Error(`invalid value for TIME_MILLIS: ${value}`);
|
|
362
583
|
}
|
|
363
584
|
|
|
364
585
|
return v;
|
|
365
586
|
}
|
|
366
587
|
|
|
367
|
-
function toPrimitive_TIME_MICROS(value:
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
588
|
+
function toPrimitive_TIME_MICROS(value: unknown): bigint {
|
|
589
|
+
const primitiveValue = BigInt(value as bigint | boolean | number | string);
|
|
590
|
+
if (primitiveValue < 0n || primitiveValue >= 86_400_000_000n) {
|
|
370
591
|
throw new Error(`invalid value for TIME_MICROS: ${value}`);
|
|
371
592
|
}
|
|
372
|
-
return
|
|
593
|
+
return primitiveValue;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function toPrimitive_TIME_NANOS(value: unknown): bigint {
|
|
597
|
+
const primitiveValue = BigInt(value as bigint | boolean | number | string);
|
|
598
|
+
if (primitiveValue < 0n || primitiveValue >= 86_400_000_000_000n) {
|
|
599
|
+
throw new Error(`invalid value for TIME_NANOS: ${value}`);
|
|
600
|
+
}
|
|
601
|
+
return primitiveValue;
|
|
373
602
|
}
|
|
374
603
|
|
|
375
604
|
const kMillisPerDay = 86400000;
|
|
@@ -383,7 +612,7 @@ function toPrimitive_DATE(value: any): number {
|
|
|
383
612
|
/* convert from integer */
|
|
384
613
|
{
|
|
385
614
|
const v = parseInt(value, 10);
|
|
386
|
-
if (v <
|
|
615
|
+
if (v < -0x80000000 || v > 0x7fffffff || Number.isNaN(v)) {
|
|
387
616
|
throw new Error(`invalid value for DATE: ${value}`);
|
|
388
617
|
}
|
|
389
618
|
|
|
@@ -404,7 +633,7 @@ function toPrimitive_TIMESTAMP_MILLIS(value: any): number {
|
|
|
404
633
|
/* convert from integer */
|
|
405
634
|
{
|
|
406
635
|
const v = parseInt(value, 10);
|
|
407
|
-
if (
|
|
636
|
+
if (!Number.isSafeInteger(v)) {
|
|
408
637
|
throw new Error(`invalid value for TIMESTAMP_MILLIS: ${value}`);
|
|
409
638
|
}
|
|
410
639
|
|
|
@@ -413,28 +642,36 @@ function toPrimitive_TIMESTAMP_MILLIS(value: any): number {
|
|
|
413
642
|
}
|
|
414
643
|
|
|
415
644
|
function fromPrimitive_TIMESTAMP_MILLIS(value: any): Date {
|
|
416
|
-
return new Date(value);
|
|
645
|
+
return new Date(Number(value));
|
|
417
646
|
}
|
|
418
647
|
|
|
419
|
-
function toPrimitive_TIMESTAMP_MICROS(value:
|
|
648
|
+
function toPrimitive_TIMESTAMP_MICROS(value: unknown): bigint {
|
|
420
649
|
/* convert from date */
|
|
421
650
|
if (value instanceof Date) {
|
|
422
|
-
return value.getTime() *
|
|
651
|
+
return BigInt(value.getTime()) * 1000n;
|
|
423
652
|
}
|
|
424
653
|
|
|
425
654
|
/* convert from integer */
|
|
426
655
|
{
|
|
427
|
-
|
|
428
|
-
|
|
656
|
+
let primitiveValue: bigint;
|
|
657
|
+
try {
|
|
658
|
+
primitiveValue = BigInt(value as bigint | boolean | number | string);
|
|
659
|
+
} catch {
|
|
429
660
|
throw new Error(`invalid value for TIMESTAMP_MICROS: ${value}`);
|
|
430
661
|
}
|
|
431
|
-
|
|
432
|
-
return v;
|
|
662
|
+
return primitiveValue;
|
|
433
663
|
}
|
|
434
664
|
}
|
|
435
665
|
|
|
436
666
|
function fromPrimitive_TIMESTAMP_MICROS(value: any) {
|
|
437
|
-
return new Date(value / 1000);
|
|
667
|
+
return new Date(Number(value) / 1000);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function toPrimitive_TIMESTAMP_NANOS(value: unknown): bigint {
|
|
671
|
+
if (value instanceof Date) {
|
|
672
|
+
return BigInt(value.getTime()) * 1_000_000n;
|
|
673
|
+
}
|
|
674
|
+
return BigInt(value as bigint | boolean | number | string);
|
|
438
675
|
}
|
|
439
676
|
|
|
440
677
|
function toPrimitive_INTERVAL(value: any) {
|
|
@@ -444,47 +681,34 @@ function toPrimitive_INTERVAL(value: any) {
|
|
|
444
681
|
);
|
|
445
682
|
}
|
|
446
683
|
|
|
447
|
-
const buf =
|
|
684
|
+
const buf = new Uint8Array(12);
|
|
448
685
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
686
|
+
writeUInt32LE(buf, value.months, 0);
|
|
687
|
+
writeUInt32LE(buf, value.days, 4);
|
|
688
|
+
writeUInt32LE(buf, value.milliseconds, 8);
|
|
452
689
|
return buf;
|
|
453
690
|
}
|
|
454
691
|
|
|
455
692
|
function fromPrimitive_INTERVAL(value: any) {
|
|
456
|
-
const
|
|
457
|
-
const months =
|
|
458
|
-
const days =
|
|
459
|
-
const millis =
|
|
693
|
+
const bytes = toUint8Array(value);
|
|
694
|
+
const months = readUInt32LE(bytes, 0);
|
|
695
|
+
const days = readUInt32LE(bytes, 4);
|
|
696
|
+
const millis = readUInt32LE(bytes, 8);
|
|
460
697
|
|
|
461
698
|
return {months, days, milliseconds: millis};
|
|
462
699
|
}
|
|
463
700
|
|
|
464
701
|
function decimalFromPrimitive_INT(value: any, field: ParquetField) {
|
|
465
|
-
const
|
|
466
|
-
|
|
702
|
+
const numberValue = Number(value);
|
|
703
|
+
const precision = field.precision ?? field.presision!;
|
|
704
|
+
const precisionInt = Math.round(((numberValue * 10 ** -precision) % 1) * 10 ** precision);
|
|
705
|
+
return precisionInt * 10 ** -(field.scale || 0);
|
|
467
706
|
}
|
|
468
707
|
|
|
469
708
|
function decimalFromPrimitive_BYTE_ARRAY(value: any, field: ParquetField) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
const component = value[i] << (8 * (value.length - i - 1));
|
|
476
|
-
number += component;
|
|
477
|
-
}
|
|
478
|
-
} else {
|
|
479
|
-
for (let i = 0; i < value.length; i++) {
|
|
480
|
-
// `value.length - i - 1` bytes have reverse order (big-endian)
|
|
481
|
-
const component = value[i] * 2 ** (8 * (value.length - 1 - i));
|
|
482
|
-
number += component;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
const presisionInt = Math.round(
|
|
487
|
-
((number * 10 ** -field.presision!) % 1) * 10 ** field.presision!
|
|
488
|
-
);
|
|
489
|
-
return presisionInt * 10 ** -(field.scale || 0);
|
|
709
|
+
const bytes = toUint8Array(value);
|
|
710
|
+
let unscaledValue = 0n;
|
|
711
|
+
for (const byte of bytes) unscaledValue = (unscaledValue << 8n) | BigInt(byte);
|
|
712
|
+
if (bytes.length > 0 && (bytes[0] & 0x80) !== 0) unscaledValue -= 1n << BigInt(bytes.length * 8);
|
|
713
|
+
return Number(unscaledValue) / 10 ** (field.scale || 0);
|
|
490
714
|
}
|