@gscdump/engine 3.5.0 → 3.6.0

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.
Files changed (274) hide show
  1. package/README.md +28 -18
  2. package/dist/THIRD-PARTY-LICENSES.md +2 -2
  3. package/dist/adapters/duckdb-node.d.mts +4 -4
  4. package/dist/adapters/duckdb-node.mjs +103 -77
  5. package/dist/adapters/filesystem.d.mts +6 -7
  6. package/dist/adapters/filesystem.mjs +11 -6
  7. package/dist/adapters/hyparquet.d.mts +9 -10
  8. package/dist/adapters/hyparquet.mjs +84 -44
  9. package/dist/adapters/node-harness.d.mts +3 -4
  10. package/dist/adapters/parquet-attach.d.mts +4 -5
  11. package/dist/adapters/parquet-attach.mjs +7 -2
  12. package/dist/adapters/r2-manifest.d.mts +4 -5
  13. package/dist/adapters/r2.d.mts +2 -3
  14. package/dist/adapters/snapshot-attach.d.mts +7 -8
  15. package/dist/adapters/snapshot-attach.mjs +7 -2
  16. package/dist/analysis-range.d.mts +2 -3
  17. package/dist/analysis-types.d.mts +4 -5
  18. package/dist/analyzer/define.d.mts +6 -7
  19. package/dist/analyzer/dispatch.d.mts +2 -3
  20. package/dist/analyzer/registry.d.mts +4 -5
  21. package/dist/analyzer/types.d.mts +11 -12
  22. package/dist/arrow-utils.d.mts +4 -5
  23. package/dist/arrow-utils.mjs +10 -0
  24. package/dist/coerce.d.mts +1 -2
  25. package/dist/compaction.d.mts +2 -3
  26. package/dist/drizzle-schema.d.mts +14 -15
  27. package/dist/duckdb.d.mts +5 -6
  28. package/dist/duckdb.mjs +9 -5
  29. package/dist/engine.d.mts +1 -2
  30. package/dist/entities/empty-types.d.mts +4 -5
  31. package/dist/entities/indexing-metadata.d.mts +5 -6
  32. package/dist/entities/inspection.d.mts +9 -10
  33. package/dist/entities/query-dim.d.mts +7 -7
  34. package/dist/entities/sitemap-shared.d.mts +26 -27
  35. package/dist/entities/sitemap-write.d.mts +1 -2
  36. package/dist/entities/sitemap.d.mts +1 -2
  37. package/dist/entity-keys.d.mts +28 -29
  38. package/dist/errors.d.mts +5 -6
  39. package/dist/iceberg/append-sink.d.mts +2 -3
  40. package/dist/iceberg/catalog.d.mts +10 -10
  41. package/dist/iceberg/catalog.mjs +2 -2
  42. package/dist/iceberg/overwrite-writer.d.mts +17 -18
  43. package/dist/iceberg/schema.d.mts +16 -16
  44. package/dist/ingest-accumulator.d.mts +8 -9
  45. package/dist/ingest.d.mts +15 -12
  46. package/dist/ingest.mjs +22 -6
  47. package/dist/layout.d.mts +4 -5
  48. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.9_patch_hash_d26d002aede61ad95dd633d6557b56897cdcbc45dfc3a5d93fa0e9075ad5425f/node_modules/hyparquet-writer/src/datapage.mjs +1 -1
  49. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.9_patch_hash_d26d002aede61ad95dd633d6557b56897cdcbc45dfc3a5d93fa0e9075ad5425f/node_modules/hyparquet-writer/src/indexes.mjs +1 -1
  50. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.9_patch_hash_d26d002aede61ad95dd633d6557b56897cdcbc45dfc3a5d93fa0e9075ad5425f/node_modules/hyparquet-writer/src/metadata.mjs +1 -1
  51. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.9_patch_hash_d26d002aede61ad95dd633d6557b56897cdcbc45dfc3a5d93fa0e9075ad5425f/node_modules/hyparquet-writer/src/types.d.mts +2 -3
  52. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.9_patch_hash_d26d002aede61ad95dd633d6557b56897cdcbc45dfc3a5d93fa0e9075ad5425f/node_modules/hyparquet-writer/types/index.d.mts +2 -3
  53. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/assemble.mjs +3 -144
  54. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/bloom.mjs +3 -58
  55. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/column.mjs +8 -129
  56. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/convert.mjs +3 -118
  57. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/datapage.mjs +6 -144
  58. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/delta.mjs +2 -65
  59. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/encoding.mjs +2 -76
  60. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/filter.mjs +4 -212
  61. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/geoparquet.mjs +1 -24
  62. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/index.mjs +3 -3
  63. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/indexes.mjs +5 -32
  64. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/metadata.mjs +7 -241
  65. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/node.mjs +1 -5
  66. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/plain.mjs +1 -79
  67. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/plan.mjs +6 -375
  68. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/read.mjs +6 -77
  69. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/rowgroup.mjs +7 -175
  70. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/scan.mjs +5 -73
  71. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/schema.mjs +1 -22
  72. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/snappy.mjs +1 -68
  73. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/thrift.mjs +1 -86
  74. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/types.d.mts +2 -28
  75. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/utils.mjs +1 -31
  76. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/variant.mjs +3 -228
  77. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/src/wkb.mjs +1 -94
  78. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/types/index.d.mts +2 -52
  79. package/dist/node_modules/.pnpm/hyparquet@1.29.2/node_modules/hyparquet/types/node.d.mts +2 -2
  80. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/assemble.mjs +144 -0
  81. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/bloom.mjs +124 -0
  82. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/column.mjs +129 -0
  83. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/constants.mjs +80 -0
  84. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/convert.mjs +118 -0
  85. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/datapage.mjs +144 -0
  86. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/delta.mjs +65 -0
  87. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/encoding.mjs +76 -0
  88. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/filter.mjs +212 -0
  89. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/geoparquet.mjs +24 -0
  90. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/index.mjs +8 -0
  91. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/indexes.mjs +32 -0
  92. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/metadata.mjs +241 -0
  93. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/node.mjs +7 -0
  94. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/plain.mjs +79 -0
  95. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/plan.mjs +375 -0
  96. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/query.mjs +3 -0
  97. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/read.mjs +81 -0
  98. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/rowgroup.mjs +175 -0
  99. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/scan.mjs +74 -0
  100. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/schema.mjs +75 -0
  101. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/snappy.mjs +68 -0
  102. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/thrift.mjs +86 -0
  103. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/types.d.mts +25 -0
  104. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/utils.mjs +32 -0
  105. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/variant.mjs +228 -0
  106. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/wkb.mjs +94 -0
  107. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/src/xxhash.mjs +68 -0
  108. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/types/index.d.mts +58 -0
  109. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/types/node.d.mts +3 -0
  110. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/types/scan.d.mts +1 -0
  111. package/dist/node_modules/.pnpm/hyparquet@1.30.0/node_modules/hyparquet/types/utils.d.mts +1 -0
  112. package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/index.mjs +1 -1
  113. package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/read.mjs +1 -1
  114. package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/sql/icebergDataSource.mjs +1 -1
  115. package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/sql/icebergQuery.mjs +1 -1
  116. package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/types.d.mts +17 -18
  117. package/dist/node_modules/.pnpm/icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/create.d.mts +1 -0
  118. package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/types/index.d.mts +1 -1
  119. package/dist/node_modules/.pnpm/icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/manifest.d.mts +1 -0
  120. package/dist/node_modules/.pnpm/icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/metadata.d.mts +1 -0
  121. package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/types/read.d.mts +1 -1
  122. package/dist/node_modules/.pnpm/icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/s3.d.mts +1 -0
  123. package/dist/node_modules/.pnpm/icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/sql/icebergDataSource.d.mts +2 -0
  124. package/dist/node_modules/.pnpm/icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/sql/icebergQuery.d.mts +2 -0
  125. package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/types/write/write.d.mts +2 -3
  126. package/dist/node_modules/.pnpm/squirreling@0.16.4/node_modules/squirreling/src/ast.d.mts +1 -0
  127. package/dist/parquet-plan.d.mts +5 -6
  128. package/dist/period/index.d.mts +8 -8
  129. package/dist/profile.d.mts +3 -3
  130. package/dist/report/define.d.mts +1 -2
  131. package/dist/report/hash.d.mts +3 -4
  132. package/dist/report/registry.d.mts +3 -4
  133. package/dist/report/types.d.mts +22 -23
  134. package/dist/resolver/adapter.d.mts +2 -3
  135. package/dist/resolver/canonical-source.d.mts +1 -2
  136. package/dist/resolver/compile.d.mts +12 -8
  137. package/dist/resolver/compile.mjs +7 -3
  138. package/dist/resolver/datasets.d.mts +9 -9
  139. package/dist/resolver/extras-overlay.d.mts +2 -3
  140. package/dist/resolver/filter-utils.d.mts +7 -7
  141. package/dist/resolver/fragments.d.mts +3 -4
  142. package/dist/resolver/pg-adapter.d.mts +7 -8
  143. package/dist/resolver/run-query.d.mts +16 -17
  144. package/dist/resolver/run-query.mjs +16 -15
  145. package/dist/resolver/schema-drift.d.mts +2 -3
  146. package/dist/resolver/types.d.mts +8 -9
  147. package/dist/rollups/canonical.d.mts +4 -5
  148. package/dist/rollups/core.d.mts +12 -13
  149. package/dist/rollups/defaults.d.mts +2 -3
  150. package/dist/rollups/hourly.d.mts +3 -4
  151. package/dist/rollups/indexing.d.mts +5 -6
  152. package/dist/rollups/traffic.d.mts +5 -6
  153. package/dist/rollups/windows.d.mts +7 -8
  154. package/dist/schedule.d.mts +6 -7
  155. package/dist/schema.d.mts +9 -9
  156. package/dist/scope.d.mts +6 -7
  157. package/dist/sink.d.mts +9 -10
  158. package/dist/sinks/in-memory-sink.d.mts +3 -4
  159. package/dist/snapshot.d.mts +2 -3
  160. package/dist/source/attached-table.d.mts +4 -5
  161. package/dist/source/create-sql-query-source.d.mts +2 -3
  162. package/dist/source/index.d.mts +6 -6
  163. package/dist/source/source-types.d.mts +7 -8
  164. package/dist/sql-bind.d.mts +3 -4
  165. package/dist/sql-fragments.d.mts +5 -6
  166. package/dist/storage.d.mts +37 -37
  167. package/dist/sync-config.d.mts +20 -21
  168. package/dist/vendor/hysnappy-purejs.d.mts +2 -3
  169. package/dist/vendor/hysnappy-purejs.mjs +1 -1
  170. package/package.json +12 -10
  171. package/dist/node_modules/.pnpm/icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/sql/icebergDataSource.d.mts +0 -2
  172. package/dist/node_modules/.pnpm/icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/sql/icebergQuery.d.mts +0 -2
  173. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/create.d.mts → hyparquet@1.30.0/node_modules/hyparquet/types/indexes.d.mts} +0 -0
  174. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird → hyparquet@1.30.0/node_modules/hyparquet}/types/metadata.d.mts +0 -0
  175. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/manifest.d.mts → hyparquet@1.30.0/node_modules/hyparquet/types/query.d.mts} +0 -0
  176. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7/node_modules/icebird/types/s3.d.mts → hyparquet@1.30.0/node_modules/hyparquet/types/read.d.mts} +0 -0
  177. /package/dist/node_modules/.pnpm/{squirreling@0.16.3/node_modules/squirreling/src/ast.d.mts → hyparquet@1.30.0/node_modules/hyparquet/types/snappy.d.mts} +0 -0
  178. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/avro/avro.metadata.mjs +0 -0
  179. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/avro/avro.read.mjs +0 -0
  180. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/avro/avro.write.mjs +0 -0
  181. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/catalog/file.mjs +0 -0
  182. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/catalog/loadTable.mjs +0 -0
  183. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/catalog/rest.mjs +0 -0
  184. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/create.mjs +0 -0
  185. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/delete.mjs +0 -0
  186. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/fetch.mjs +0 -0
  187. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/json.mjs +0 -0
  188. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/manifest.mjs +0 -0
  189. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/metadata.mjs +0 -0
  190. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/prune.mjs +0 -0
  191. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/puffin/deletion-vector.mjs +0 -0
  192. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/puffin/puffin.mjs +0 -0
  193. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/puffin/roaring.mjs +0 -0
  194. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/s3.mjs +0 -0
  195. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/schema.mjs +0 -0
  196. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/sigv4.mjs +0 -0
  197. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/sql/whereFilter.mjs +0 -0
  198. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/utils.mjs +0 -0
  199. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/commit.mjs +0 -0
  200. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/conversions.mjs +0 -0
  201. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/delete-file.mjs +0 -0
  202. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/geospatial.mjs +0 -0
  203. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/manifest-list.mjs +0 -0
  204. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/manifest.mjs +0 -0
  205. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/parquet.mjs +0 -0
  206. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/partition.mjs +0 -0
  207. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/rewrite.mjs +0 -0
  208. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/serde.mjs +0 -0
  209. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/snapshot.mjs +0 -0
  210. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/sort.mjs +0 -0
  211. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/stage-deletion-vector.mjs +0 -0
  212. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/stage-position-delete.mjs +0 -0
  213. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/stage.mjs +0 -0
  214. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/stats.mjs +0 -0
  215. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/transform.mjs +0 -0
  216. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/src/write/write.mjs +0 -0
  217. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/types/catalog/file.d.mts +0 -0
  218. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/types/catalog/rest.d.mts +0 -0
  219. /package/dist/node_modules/.pnpm/{icebird@0.8.27_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7 → icebird@0.8.28_patch_hash_651b5cc1b513184638c98e21a0852c4559044ae60f8449fbe9d81a894ea5b4d7}/node_modules/icebird/types/fetch.d.mts +0 -0
  220. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/backend/batch.mjs +0 -0
  221. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/backend/batchAdapters.mjs +0 -0
  222. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/backend/dataSource.mjs +0 -0
  223. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/accumulator.mjs +0 -0
  224. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/aggregates.mjs +0 -0
  225. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/batchResults.mjs +0 -0
  226. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/batches.mjs +0 -0
  227. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/execute.mjs +0 -0
  228. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/fold.mjs +0 -0
  229. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/join.mjs +0 -0
  230. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/rowScope.mjs +0 -0
  231. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/scanColumn.mjs +0 -0
  232. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/sort.mjs +0 -0
  233. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/streamingAggregate.mjs +0 -0
  234. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/utils.mjs +0 -0
  235. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/window.mjs +0 -0
  236. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/execute/yield.mjs +0 -0
  237. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/alias.mjs +0 -0
  238. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/batch.mjs +0 -0
  239. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/binary.mjs +0 -0
  240. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/date.mjs +0 -0
  241. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/evaluate.mjs +0 -0
  242. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/math.mjs +0 -0
  243. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/regexp.mjs +0 -0
  244. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/scalar.mjs +0 -0
  245. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/expression/strings.mjs +0 -0
  246. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/index.d.mts +0 -0
  247. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/index.mjs +0 -0
  248. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/expression.mjs +0 -0
  249. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/extractTables.mjs +0 -0
  250. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/functions.mjs +0 -0
  251. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/joins.mjs +0 -0
  252. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/parse.mjs +0 -0
  253. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/primary.mjs +0 -0
  254. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/state.mjs +0 -0
  255. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/tokenize.mjs +0 -0
  256. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/parse/types.d.mts +0 -0
  257. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/plan/columns.mjs +0 -0
  258. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/plan/plan.mjs +0 -0
  259. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/plan/types.d.mts +0 -0
  260. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/spatial/bbox.mjs +0 -0
  261. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/spatial/equality.mjs +0 -0
  262. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/spatial/operations.mjs +0 -0
  263. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/spatial/pointRelations.mjs +0 -0
  264. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/spatial/primitives.mjs +0 -0
  265. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/spatial/segments.mjs +0 -0
  266. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/spatial/spatial.mjs +0 -0
  267. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/spatial/wkt.mjs +0 -0
  268. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/types.d.mts +0 -0
  269. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/validation/aggregates.mjs +0 -0
  270. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/validation/executionErrors.mjs +0 -0
  271. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/validation/functions.mjs +0 -0
  272. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/validation/keywords.mjs +0 -0
  273. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/validation/parseErrors.mjs +0 -0
  274. /package/dist/node_modules/.pnpm/{squirreling@0.16.3 → squirreling@0.16.4}/node_modules/squirreling/src/validation/tables.mjs +0 -0
@@ -0,0 +1,375 @@
1
+ import { getPhysicalColumns } from "./schema.mjs";
2
+ import { parquetSchema } from "./metadata.mjs";
3
+ import { readColumnIndex, readOffsetIndex } from "./indexes.mjs";
4
+ import { bloomEligibleColumns, readBloomFilter } from "./bloom.mjs";
5
+ import { canSkipRowGroup, filterPageRanges, pathsNeededForFilter } from "./filter.mjs";
6
+ const runLimit = 1 << 21;
7
+ function parquetPlan(options) {
8
+ const { metadata, rowStart = 0, columns, useOffsetIndex = false } = options;
9
+ if (!metadata) throw new Error("parquetPlan requires metadata");
10
+ const groups = [];
11
+ const fetches = [];
12
+ const indexes = [];
13
+ const scanPlan = parquetPlanGroups(options);
14
+ for (const group of scanPlan.groups) {
15
+ const groupPlan = parquetPlanGroup({
16
+ ...group,
17
+ columns,
18
+ useOffsetIndex
19
+ });
20
+ groups.push(...groupPlan.groups);
21
+ fetches.push(...groupPlan.fetches);
22
+ indexes.push(...groupPlan.indexes);
23
+ }
24
+ fetches.push(...indexes);
25
+ return {
26
+ metadata,
27
+ rowStart,
28
+ rowEnd: scanPlan.rowEnd,
29
+ columns,
30
+ fetches,
31
+ groups
32
+ };
33
+ }
34
+ function parquetPlanGroups({ metadata, rowStart = 0, rowEnd = Infinity, columns, filter, filterStrict = true, bloomFiltersByGroup, schemaElements, pageRangesByGroup, pageLocationsByGroup }) {
35
+ if (!metadata) throw new Error("parquetPlan requires metadata");
36
+ const schemaTree = parquetSchema(metadata);
37
+ const physicalColumns = getPhysicalColumns(schemaTree);
38
+ const elementsByPath = filter ? {
39
+ ...physicalSchemaElements(schemaTree),
40
+ ...schemaElements
41
+ } : schemaElements;
42
+ const groups = [];
43
+ let groupStart = 0;
44
+ for (let groupIndex = 0; groupIndex < metadata.row_groups.length; groupIndex++) {
45
+ const rowGroup = metadata.row_groups[groupIndex];
46
+ const groupRows = Number(rowGroup.num_rows);
47
+ const groupEnd = groupStart + groupRows;
48
+ if (groupRows > 0 && groupEnd > rowStart && groupStart < rowEnd && !canSkipRowGroup({
49
+ rowGroup,
50
+ physicalColumns,
51
+ filter,
52
+ strict: filterStrict,
53
+ bloomFilters: bloomFiltersByGroup?.[groupIndex],
54
+ schemaElements: elementsByPath
55
+ })) {
56
+ const selectStart = Math.max(rowStart - groupStart, 0);
57
+ const selectEnd = Math.min(rowEnd - groupStart, groupRows);
58
+ const pageRanges = pageRangesByGroup?.[groupIndex];
59
+ const pageLocations = pageLocationsByGroup?.[groupIndex];
60
+ let ranges = pageRanges ? pageRanges.map(([start, end]) => {
61
+ return [Math.max(start, selectStart), Math.min(end, selectEnd)];
62
+ }).filter(([start, end]) => start < end) : [[selectStart, selectEnd]];
63
+ if (ranges.length > 1) ranges = rowGroup.columns.every((chunk) => {
64
+ const columnName = chunk.meta_data?.path_in_schema[0];
65
+ const columnPath = chunk.meta_data?.path_in_schema.join(".");
66
+ if (columns && columnName && !columns.includes(columnName)) return true;
67
+ return !!(chunk.offset_index_offset && chunk.offset_index_length) || !!(columnPath && pageLocations?.[columnPath]);
68
+ }) ? coalesceOverlappingPageRanges(ranges, rowGroup, columns, pageLocations) : [[ranges[0][0], ranges[ranges.length - 1][1]]];
69
+ if (ranges.length) groups.push({
70
+ rowGroup,
71
+ groupIndex,
72
+ groupStart,
73
+ groupRows,
74
+ ranges,
75
+ pageRanges,
76
+ pageLocations
77
+ });
78
+ }
79
+ groupStart = groupEnd;
80
+ }
81
+ return {
82
+ groups,
83
+ rowEnd: isFinite(rowEnd) ? rowEnd : groupStart
84
+ };
85
+ }
86
+ function parquetPlanGroup({ rowGroup, groupStart, groupRows, ranges, columns, useOffsetIndex = false, pageRanges, pageLocations }) {
87
+ const chunks = [];
88
+ const fetches = [];
89
+ const indexes = [];
90
+ const narrowed = ranges.length > 1 || ranges[0][0] > 0 || ranges[0][1] < groupRows;
91
+ for (const chunk of rowGroup.columns) {
92
+ const meta = chunk.meta_data;
93
+ if (chunk.file_path) throw new Error("parquet file_path not supported");
94
+ if (!meta) throw new Error("parquet column metadata is undefined");
95
+ if (columns && !columns.includes(meta.path_in_schema[0])) continue;
96
+ const columnOffset = meta.dictionary_page_offset || meta.data_page_offset;
97
+ const startByte = Number(columnOffset);
98
+ const endByte = Number(columnOffset + meta.total_compressed_size);
99
+ const chunkPageLocations = pageLocations?.[meta.path_in_schema.join(".")];
100
+ if (chunkPageLocations && narrowed) chunks.push({
101
+ columnMetadata: meta,
102
+ pageLocations: chunkPageLocations,
103
+ range: {
104
+ startByte,
105
+ endByte
106
+ }
107
+ });
108
+ else if ((useOffsetIndex || pageRanges) && chunk.offset_index_offset && chunk.offset_index_length && narrowed) {
109
+ const startByte = Number(chunk.offset_index_offset);
110
+ chunks.push({
111
+ columnMetadata: meta,
112
+ offsetIndex: {
113
+ startByte,
114
+ endByte: startByte + chunk.offset_index_length
115
+ },
116
+ range: {
117
+ startByte: Number(columnOffset),
118
+ endByte
119
+ }
120
+ });
121
+ } else chunks.push({
122
+ columnMetadata: meta,
123
+ range: {
124
+ startByte,
125
+ endByte
126
+ }
127
+ });
128
+ }
129
+ let run;
130
+ for (const chunk of chunks) {
131
+ if ("pageLocations" in chunk) continue;
132
+ if ("offsetIndex" in chunk) indexes.push(chunk.offsetIndex);
133
+ else if (columns) fetches.push(chunk.range);
134
+ else if (run && chunk.range.endByte - run.startByte <= runLimit) run.endByte = chunk.range.endByte;
135
+ else {
136
+ if (run) fetches.push(run);
137
+ run = { ...chunk.range };
138
+ }
139
+ }
140
+ if (run) fetches.push(run);
141
+ return {
142
+ groups: ranges.map(([selectStart, selectEnd]) => ({
143
+ chunks,
144
+ rowGroup,
145
+ groupStart,
146
+ groupRows,
147
+ selectStart,
148
+ selectEnd
149
+ })),
150
+ fetches,
151
+ indexes
152
+ };
153
+ }
154
+ function coalesceOverlappingPageRanges(ranges, rowGroup, columns, pageLocations) {
155
+ const selectedPageLayouts = rowGroup.columns.filter((chunk) => !columns || columns.includes(chunk.meta_data?.path_in_schema[0] || "")).map((chunk) => pageLocations?.[chunk.meta_data?.path_in_schema.join(".") || ""]);
156
+ const merged = [];
157
+ for (const range of ranges) {
158
+ const last = merged[merged.length - 1];
159
+ const overlapsPage = last && selectedPageLayouts.some((pages) => {
160
+ if (!pages) return true;
161
+ const lastPages = pagesForRange(last, pages, Number(rowGroup.num_rows));
162
+ const rangePages = pagesForRange(range, pages, Number(rowGroup.num_rows));
163
+ return lastPages[0] <= rangePages[1] && rangePages[0] <= lastPages[1];
164
+ });
165
+ if (last && overlapsPage) last[1] = range[1];
166
+ else merged.push([...range]);
167
+ }
168
+ return merged;
169
+ }
170
+ function pagesForRange([rangeStart, rangeEnd], pages, groupRows) {
171
+ let first = Infinity;
172
+ let last = -Infinity;
173
+ for (let i = 0; i < pages.length; i++) {
174
+ const pageStart = Number(pages[i].first_row_index);
175
+ if ((i + 1 < pages.length ? Number(pages[i + 1].first_row_index) : groupRows) > rangeStart && pageStart < rangeEnd) {
176
+ first = Math.min(first, i);
177
+ last = i;
178
+ }
179
+ }
180
+ return [first, last];
181
+ }
182
+ async function prefetchBloomFilters({ file, metadata, filter, filterStrict = true }) {
183
+ const result = metadata.row_groups.map(() => ({}));
184
+ const eligibleCols = bloomEligibleColumns(filter);
185
+ if (eligibleCols.size === 0) return result;
186
+ const physicalColumns = getPhysicalColumns(parquetSchema(metadata));
187
+ const tasks = [];
188
+ metadata.row_groups.forEach((rowGroup, rgIdx) => {
189
+ if (canSkipRowGroup({
190
+ rowGroup,
191
+ physicalColumns,
192
+ filter,
193
+ strict: filterStrict
194
+ })) return;
195
+ for (const colName of eligibleCols) {
196
+ const columnIdx = physicalColumns.indexOf(colName);
197
+ if (columnIdx === -1) continue;
198
+ const meta = rowGroup.columns[columnIdx]?.meta_data;
199
+ if (!meta?.bloom_filter_offset || !meta.bloom_filter_length) continue;
200
+ const start = Number(meta.bloom_filter_offset);
201
+ const end = start + meta.bloom_filter_length;
202
+ tasks.push((async () => {
203
+ const buffer = await file.slice(start, end);
204
+ const bloom = readBloomFilter({
205
+ view: new DataView(buffer),
206
+ offset: 0
207
+ });
208
+ if (bloom) result[rgIdx][colName] = bloom;
209
+ })());
210
+ }
211
+ });
212
+ if (tasks.length) await Promise.all(tasks);
213
+ return result;
214
+ }
215
+ async function prefetchPageIndexes({ file, metadata, filter, filterStrict = true, rowStart = 0, rowEnd = Infinity, columns, bloomFiltersByGroup, schemaElements, parsers }) {
216
+ const pageRangesByGroup = metadata.row_groups.map(() => void 0);
217
+ const pageLocationsByGroup = metadata.row_groups.map(() => ({}));
218
+ if (filter && "$nor" in filter && Array.isArray(filter.$nor)) return {
219
+ pageRangesByGroup,
220
+ pageLocationsByGroup
221
+ };
222
+ const filterColumns = pathsNeededForFilter(filter);
223
+ if (!filterColumns.length) return {
224
+ pageRangesByGroup,
225
+ pageLocationsByGroup
226
+ };
227
+ const schemaTree = parquetSchema(metadata);
228
+ const physicalColumns = getPhysicalColumns(schemaTree);
229
+ const elementsByPath = {
230
+ ...physicalSchemaElements(schemaTree),
231
+ ...schemaElements
232
+ };
233
+ const indexRanges = [];
234
+ const indexTasks = [];
235
+ const candidateGroups = [];
236
+ let groupStart = 0;
237
+ metadata.row_groups.forEach((rowGroup, rgIdx) => {
238
+ const groupRows = Number(rowGroup.num_rows);
239
+ const groupEnd = groupStart + groupRows;
240
+ const overlaps = groupRows > 0 && groupEnd > rowStart && groupStart < rowEnd;
241
+ groupStart = groupEnd;
242
+ if (!overlaps) return;
243
+ if (canSkipRowGroup({
244
+ rowGroup,
245
+ physicalColumns,
246
+ filter,
247
+ strict: filterStrict,
248
+ bloomFilters: bloomFiltersByGroup?.[rgIdx],
249
+ schemaElements: elementsByPath
250
+ })) return;
251
+ const columnPages = {};
252
+ let columnTaskCount = 0;
253
+ const scheduledOffsetPaths = /* @__PURE__ */ new Set();
254
+ let hasFilterIndex = false;
255
+ for (const columnName of filterColumns) {
256
+ const columnIdx = physicalColumns.indexOf(columnName);
257
+ if (columnIdx === -1) continue;
258
+ const chunk = rowGroup.columns[columnIdx];
259
+ if (!chunk?.meta_data) continue;
260
+ if (!chunk.column_index_offset || !chunk.column_index_length) continue;
261
+ if (!chunk.offset_index_offset || !chunk.offset_index_length) continue;
262
+ const element = elementsByPath[columnName];
263
+ if (!element) continue;
264
+ hasFilterIndex = true;
265
+ scheduledOffsetPaths.add(columnName);
266
+ const columnIndexStart = Number(chunk.column_index_offset);
267
+ const offsetIndexStart = Number(chunk.offset_index_offset);
268
+ const columnIndexEnd = columnIndexStart + chunk.column_index_length;
269
+ const offsetIndexEnd = offsetIndexStart + chunk.offset_index_length;
270
+ indexRanges.push({
271
+ startByte: columnIndexStart,
272
+ endByte: columnIndexEnd
273
+ }, {
274
+ startByte: offsetIndexStart,
275
+ endByte: offsetIndexEnd
276
+ });
277
+ columnTaskCount++;
278
+ indexTasks.push(async (prefetchedFile) => {
279
+ const [columnIndexBuffer, offsetIndexBuffer] = await Promise.all([prefetchedFile.slice(columnIndexStart, columnIndexEnd), prefetchedFile.slice(offsetIndexStart, offsetIndexEnd)]);
280
+ const columnIndex = readColumnIndex({
281
+ view: new DataView(columnIndexBuffer),
282
+ offset: 0
283
+ }, element, parsers);
284
+ const offsetIndex = readOffsetIndex({
285
+ view: new DataView(offsetIndexBuffer),
286
+ offset: 0
287
+ });
288
+ pageLocationsByGroup[rgIdx][columnName] = offsetIndex.page_locations;
289
+ columnPages[columnName] = {
290
+ minValues: columnIndex.min_values,
291
+ maxValues: columnIndex.max_values,
292
+ nullPages: columnIndex.null_pages,
293
+ nullCounts: columnIndex.null_counts,
294
+ pageStarts: offsetIndex.page_locations.map((page) => Number(page.first_row_index)),
295
+ element
296
+ };
297
+ });
298
+ }
299
+ if (hasFilterIndex) for (const chunk of rowGroup.columns) {
300
+ const meta = chunk.meta_data;
301
+ if (!meta) continue;
302
+ const columnName = meta.path_in_schema[0];
303
+ const columnPath = meta.path_in_schema.join(".");
304
+ if (columns && !columns.includes(columnName)) continue;
305
+ if (scheduledOffsetPaths.has(columnPath)) continue;
306
+ if (!chunk.offset_index_offset || !chunk.offset_index_length) continue;
307
+ scheduledOffsetPaths.add(columnPath);
308
+ const offsetIndexStart = Number(chunk.offset_index_offset);
309
+ const offsetIndexEnd = offsetIndexStart + chunk.offset_index_length;
310
+ indexRanges.push({
311
+ startByte: offsetIndexStart,
312
+ endByte: offsetIndexEnd
313
+ });
314
+ columnTaskCount++;
315
+ indexTasks.push(async (prefetchedFile) => {
316
+ const offsetIndexBuffer = await prefetchedFile.slice(offsetIndexStart, offsetIndexEnd);
317
+ const offsetIndex = readOffsetIndex({
318
+ view: new DataView(offsetIndexBuffer),
319
+ offset: 0
320
+ });
321
+ pageLocationsByGroup[rgIdx][columnPath] = offsetIndex.page_locations;
322
+ });
323
+ }
324
+ if (columnTaskCount) candidateGroups.push({
325
+ rgIdx,
326
+ groupRows,
327
+ columnPages
328
+ });
329
+ });
330
+ if (indexTasks.length) {
331
+ const prefetchedFile = prefetchAsyncBuffer(file, { fetches: coalesceByteRanges(indexRanges) });
332
+ await Promise.all(indexTasks.map((task) => task(prefetchedFile)));
333
+ for (const { rgIdx, groupRows, columnPages } of candidateGroups) pageRangesByGroup[rgIdx] = filterPageRanges(filter, columnPages, groupRows, filterStrict);
334
+ }
335
+ return {
336
+ pageRangesByGroup,
337
+ pageLocationsByGroup
338
+ };
339
+ }
340
+ function coalesceByteRanges(ranges) {
341
+ const sorted = ranges.map((range) => ({ ...range })).sort((a, b) => a.startByte - b.startByte || a.endByte - b.endByte);
342
+ const merged = [];
343
+ for (const range of sorted) {
344
+ const last = merged[merged.length - 1];
345
+ if (last && range.startByte <= last.endByte) last.endByte = Math.max(last.endByte, range.endByte);
346
+ else merged.push(range);
347
+ }
348
+ return merged;
349
+ }
350
+ function physicalSchemaElements(schemaTree) {
351
+ const elements = {};
352
+ function traverse(node) {
353
+ if (node.children.length) for (const child of node.children) traverse(child);
354
+ else elements[node.path.join(".")] = node.element;
355
+ }
356
+ traverse(schemaTree);
357
+ return elements;
358
+ }
359
+ function prefetchAsyncBuffer(file, { fetches }) {
360
+ const promises = fetches.map(({ startByte, endByte }) => file.slice(startByte, endByte));
361
+ return {
362
+ byteLength: file.byteLength,
363
+ slice(start, end = file.byteLength) {
364
+ const index = fetches.findIndex(({ startByte, endByte }) => startByte <= start && end <= endByte);
365
+ if (index < 0) return file.slice(start, end);
366
+ if (fetches[index].startByte !== start || fetches[index].endByte !== end) {
367
+ const startOffset = start - fetches[index].startByte;
368
+ const endOffset = end - fetches[index].startByte;
369
+ if (promises[index] instanceof Promise) return promises[index].then((buffer) => buffer.slice(startOffset, endOffset));
370
+ else return promises[index].slice(startOffset, endOffset);
371
+ } else return promises[index];
372
+ }
373
+ };
374
+ }
375
+ export { parquetPlan, parquetPlanGroup, parquetPlanGroups, prefetchAsyncBuffer, prefetchBloomFilters, prefetchPageIndexes };
@@ -0,0 +1,3 @@
1
+ import "./metadata.mjs";
2
+ import "./read.mjs";
3
+ export {};
@@ -0,0 +1,81 @@
1
+ import { parquetMetadataAsync, parquetSchema } from "./metadata.mjs";
2
+ import { concat } from "./utils.mjs";
3
+ import { columnsNeededForFilter, matchFilter } from "./filter.mjs";
4
+ import "./plan.mjs";
5
+ import { assembleAsync, asyncGroupToRows } from "./rowgroup.mjs";
6
+ import { prepareParquetRead, readParquetPlan } from "./scan.mjs";
7
+ const rowIndex = Symbol("rowIndex");
8
+ async function parquetRead(options) {
9
+ options.metadata ??= await parquetMetadataAsync(options.file, options);
10
+ const { rowStart = 0, rowEnd, columns, onChunk, onComplete, rowFormat, filter, filterStrict = true } = options;
11
+ if (filter && rowFormat !== "object") throw new Error("parquet filter requires rowFormat: \"object\"");
12
+ if (options.includeRowIndex && rowFormat !== "object") throw new Error("parquet includeRowIndex requires rowFormat: \"object\"");
13
+ const filterColumns = columnsNeededForFilter(filter);
14
+ let readColumns = columns;
15
+ if (columns && filterColumns.length) {
16
+ const selectedColumns = new Set(columns);
17
+ const extraColumns = filterColumns.filter((column) => !selectedColumns.has(column));
18
+ if (extraColumns.length) readColumns = [...columns, ...extraColumns];
19
+ }
20
+ const readOptions = readColumns === columns ? options : {
21
+ ...options,
22
+ columns: readColumns
23
+ };
24
+ const prepared = await prepareParquetRead(readOptions);
25
+ const preparedOptions = prepared.options;
26
+ const requiresProjection = readColumns !== columns;
27
+ const asyncGroups = readParquetPlan(preparedOptions, prepared.plan);
28
+ if (!onComplete && !onChunk) {
29
+ await awaitAllColumns(asyncGroups);
30
+ return;
31
+ }
32
+ if (!preparedOptions.metadata) throw new Error("parquet requires metadata");
33
+ const schemaTree = parquetSchema(preparedOptions.metadata);
34
+ const assembled = asyncGroups.map((arg) => assembleAsync(arg, schemaTree, options.parsers));
35
+ if (onChunk) for (const asyncGroup of assembled) for (const asyncColumn of asyncGroup.asyncColumns) asyncColumn.data.then(({ data, skipped }) => {
36
+ let rowStart = asyncGroup.groupStart + skipped;
37
+ for (const columnData of data) {
38
+ onChunk({
39
+ columnName: asyncColumn.pathInSchema[0],
40
+ columnData,
41
+ rowStart,
42
+ rowEnd: rowStart + columnData.length
43
+ });
44
+ rowStart += columnData.length;
45
+ }
46
+ }, () => {});
47
+ if (onComplete) {
48
+ await awaitAllColumns(assembled);
49
+ const rows = [];
50
+ for (const asyncGroup of assembled) {
51
+ const selectStart = asyncGroup.selectStart ?? Math.max(rowStart - asyncGroup.groupStart, 0);
52
+ const selectEnd = asyncGroup.selectEnd ?? Math.min((rowEnd ?? Infinity) - asyncGroup.groupStart, asyncGroup.groupRows);
53
+ const groupData = rowFormat === "object" ? await asyncGroupToRows(asyncGroup, selectStart, selectEnd, readColumns, "object") : await asyncGroupToRows(asyncGroup, selectStart, selectEnd, columns, "array");
54
+ if (options.includeRowIndex) for (let i = 0; i < groupData.length; i++) Object.defineProperty(groupData[i], rowIndex, { value: asyncGroup.groupStart + selectStart + i });
55
+ if (filter) {
56
+ for (const row of groupData) if (matchFilter(row, filter, filterStrict)) {
57
+ if (requiresProjection && columns) {
58
+ for (const col of filterColumns) if (!columns.includes(col)) delete row[col];
59
+ }
60
+ rows.push(row);
61
+ }
62
+ } else concat(rows, groupData);
63
+ }
64
+ onComplete(rows);
65
+ } else await awaitAllColumns(assembled);
66
+ }
67
+ async function awaitAllColumns(asyncGroups) {
68
+ const all = asyncGroups.flatMap((g) => g.asyncColumns.map((c) => c.data));
69
+ const failed = (await Promise.allSettled(all)).find((r) => r.status === "rejected");
70
+ if (failed) throw failed.reason;
71
+ }
72
+ function parquetReadObjects(options) {
73
+ return new Promise((onComplete, reject) => {
74
+ parquetRead({
75
+ ...options,
76
+ rowFormat: "object",
77
+ onComplete
78
+ }).catch(reject);
79
+ });
80
+ }
81
+ export { parquetRead, parquetReadObjects, rowIndex };
@@ -0,0 +1,175 @@
1
+ import { DEFAULT_PARSERS } from "./convert.mjs";
2
+ import { getSchemaPath } from "./schema.mjs";
3
+ import { readOffsetIndex } from "./indexes.mjs";
4
+ import { flatten } from "./utils.mjs";
5
+ import { assembleNested } from "./assemble.mjs";
6
+ import { readColumn } from "./column.mjs";
7
+ function readRowGroup(options, { metadata }, groupPlan) {
8
+ const asyncColumns = [];
9
+ for (const chunk of groupPlan.chunks) {
10
+ const { path_in_schema: pathInSchema } = chunk.columnMetadata;
11
+ const schemaPath = getSchemaPath(metadata.schema, pathInSchema);
12
+ const columnDecoder = {
13
+ pathInSchema,
14
+ element: schemaPath[schemaPath.length - 1].element,
15
+ schemaPath,
16
+ parsers: {
17
+ ...DEFAULT_PARSERS,
18
+ ...options.parsers
19
+ },
20
+ ...options,
21
+ ...chunk.columnMetadata
22
+ };
23
+ const { startByte, endByte } = chunk.range;
24
+ if ("pageLocations" in chunk) asyncColumns.push({
25
+ pathInSchema,
26
+ data: readSelectedPages(options, groupPlan, chunk, chunk.pageLocations, columnDecoder)
27
+ });
28
+ else if ("offsetIndex" in chunk) asyncColumns.push({
29
+ pathInSchema,
30
+ data: Promise.resolve(options.file.slice(chunk.offsetIndex.startByte, chunk.offsetIndex.endByte)).then((arrayBuffer) => {
31
+ const pages = readOffsetIndex({
32
+ view: new DataView(arrayBuffer),
33
+ offset: 0
34
+ }).page_locations;
35
+ return readSelectedPages(options, groupPlan, chunk, pages, columnDecoder);
36
+ })
37
+ });
38
+ else asyncColumns.push({
39
+ pathInSchema,
40
+ data: Promise.resolve(options.file.slice(startByte, endByte)).then((buffer) => {
41
+ const reader = {
42
+ view: new DataView(buffer),
43
+ offset: 0
44
+ };
45
+ return readColumn(reader, groupPlan, columnDecoder, options.onPage);
46
+ })
47
+ });
48
+ }
49
+ return {
50
+ groupStart: groupPlan.groupStart,
51
+ groupRows: groupPlan.groupRows,
52
+ selectStart: groupPlan.selectStart,
53
+ selectEnd: groupPlan.selectEnd,
54
+ asyncColumns
55
+ };
56
+ }
57
+ async function readSelectedPages(options, groupPlan, chunk, pages, columnDecoder) {
58
+ const { data_page_offset, dictionary_page_offset } = chunk.columnMetadata;
59
+ const { selectStart, selectEnd } = groupPlan;
60
+ let { startByte, endByte } = chunk.range;
61
+ let skipped = -1;
62
+ const hasDict = dictionary_page_offset || data_page_offset < pages[0].offset;
63
+ for (let i = 0; i < pages.length; i++) {
64
+ const page = pages[i];
65
+ const pageStart = Number(page.first_row_index);
66
+ const pageEnd = i + 1 < pages.length ? Number(pages[i + 1].first_row_index) : groupPlan.groupRows;
67
+ if (skipped < 0 && pageEnd > selectStart) {
68
+ startByte = Number(page.offset);
69
+ skipped = pageStart;
70
+ }
71
+ if (pageStart < selectEnd) endByte = Number(page.offset) + page.compressed_page_size;
72
+ }
73
+ if (skipped < 0) skipped = 0;
74
+ let view;
75
+ if (hasDict && skipped) {
76
+ const dictLength = Number(pages[0].offset) - chunk.range.startByte;
77
+ const [dictBuffer, dataBuffer] = await Promise.all([options.file.slice(chunk.range.startByte, Number(pages[0].offset)), options.file.slice(startByte, endByte)]);
78
+ const combined = new Uint8Array(dictLength + dataBuffer.byteLength);
79
+ combined.set(new Uint8Array(dictBuffer, 0, dictLength));
80
+ combined.set(new Uint8Array(dataBuffer), dictLength);
81
+ view = new DataView(combined.buffer);
82
+ } else if (hasDict) view = new DataView(await options.file.slice(chunk.range.startByte, endByte));
83
+ else view = new DataView(await options.file.slice(startByte, endByte));
84
+ const reader = {
85
+ view,
86
+ offset: 0
87
+ };
88
+ const adjustedGroupPlan = skipped ? {
89
+ ...groupPlan,
90
+ groupStart: groupPlan.groupStart + skipped,
91
+ selectStart: groupPlan.selectStart - skipped,
92
+ selectEnd: groupPlan.selectEnd - skipped
93
+ } : groupPlan;
94
+ const { data, skipped: columnSkipped } = readColumn(reader, adjustedGroupPlan, columnDecoder, options.onPage);
95
+ return {
96
+ data,
97
+ skipped: skipped + columnSkipped
98
+ };
99
+ }
100
+ async function asyncGroupToRows({ asyncColumns }, selectStart, selectEnd, columns, rowFormat) {
101
+ const asyncPages = await Promise.all(asyncColumns.map((column) => column.data.then(({ skipped, data }) => ({
102
+ skipped,
103
+ data: flatten(data)
104
+ }))));
105
+ const selectCount = selectEnd - selectStart;
106
+ if (rowFormat === "object") {
107
+ const groupData = Array(selectCount);
108
+ for (let selectRow = 0; selectRow < selectCount; selectRow++) {
109
+ const rowData = {};
110
+ for (let i = 0; i < asyncColumns.length; i++) {
111
+ const { data, skipped } = asyncPages[i];
112
+ rowData[asyncColumns[i].pathInSchema[0]] = data[selectStart + selectRow - skipped];
113
+ }
114
+ groupData[selectRow] = rowData;
115
+ }
116
+ return groupData;
117
+ }
118
+ const includedColumnNames = asyncColumns.map((child) => child.pathInSchema[0]).filter((name) => !columns || columns.includes(name));
119
+ const columnOrder = columns ?? includedColumnNames;
120
+ const columnIndexes = columnOrder.map((name) => asyncColumns.findIndex((column) => column.pathInSchema[0] === name));
121
+ const groupData = Array(selectCount);
122
+ for (let selectRow = 0; selectRow < selectCount; selectRow++) {
123
+ const rowData = Array(asyncColumns.length);
124
+ for (let i = 0; i < columnOrder.length; i++) {
125
+ const colIdx = columnIndexes[i];
126
+ if (colIdx < 0) throw new Error(`parquet column not found: ${columnOrder[i]}`);
127
+ const { data, skipped } = asyncPages[colIdx];
128
+ rowData[i] = data[selectStart + selectRow - skipped];
129
+ }
130
+ groupData[selectRow] = rowData;
131
+ }
132
+ return groupData;
133
+ }
134
+ function assembleAsync(asyncRowGroup, schemaTree, parsers) {
135
+ const { asyncColumns } = asyncRowGroup;
136
+ parsers = {
137
+ ...DEFAULT_PARSERS,
138
+ ...parsers
139
+ };
140
+ const assembled = [];
141
+ for (const child of schemaTree.children) if (child.children.length) {
142
+ const childColumns = asyncColumns.filter((column) => column.pathInSchema[0] === child.element.name);
143
+ if (!childColumns.length) continue;
144
+ assembled.push({
145
+ pathInSchema: child.path,
146
+ data: (async () => {
147
+ const resolved = await Promise.all(childColumns.map((c) => c.data));
148
+ const subcolumnData = /* @__PURE__ */ new Map();
149
+ const flattened = resolved.map(({ data }) => flatten(data));
150
+ const skipped = Math.max(...resolved.map((result) => result.skipped));
151
+ const end = Math.min(...resolved.map((result, i) => result.skipped + flattened[i].length));
152
+ for (let i = 0; i < childColumns.length; i++) {
153
+ const start = skipped - resolved[i].skipped;
154
+ const length = Math.max(0, end - skipped);
155
+ subcolumnData.set(childColumns[i].pathInSchema.join("."), flattened[i].slice(start, start + length));
156
+ }
157
+ assembleNested(subcolumnData, child, parsers);
158
+ const assembled = subcolumnData.get(child.element.name);
159
+ if (!assembled) throw new Error("parquet column data not assembled");
160
+ return {
161
+ data: [assembled],
162
+ skipped
163
+ };
164
+ })()
165
+ });
166
+ } else {
167
+ const asyncColumn = asyncColumns.find((column) => column.pathInSchema[0] === child.element.name);
168
+ if (asyncColumn) assembled.push(asyncColumn);
169
+ }
170
+ return {
171
+ ...asyncRowGroup,
172
+ asyncColumns: assembled
173
+ };
174
+ }
175
+ export { assembleAsync, asyncGroupToRows, readRowGroup };