@loaders.gl/parquet 4.2.0-alpha.4 → 4.2.0-alpha.6

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 (269) hide show
  1. package/dist/index.cjs +385 -598
  2. package/dist/index.cjs.map +7 -0
  3. package/dist/index.d.ts +12 -12
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +6 -1
  6. package/dist/lib/arrow/convert-columns-to-row-group.js +1 -2
  7. package/dist/lib/arrow/convert-row-group-to-columns.js +8 -6
  8. package/dist/lib/arrow/convert-schema-from-parquet.d.ts +3 -3
  9. package/dist/lib/arrow/convert-schema-from-parquet.d.ts.map +1 -1
  10. package/dist/lib/arrow/convert-schema-from-parquet.js +71 -82
  11. package/dist/lib/arrow/convert-schema-to-parquet.d.ts +1 -1
  12. package/dist/lib/arrow/convert-schema-to-parquet.d.ts.map +1 -1
  13. package/dist/lib/arrow/convert-schema-to-parquet.js +65 -35
  14. package/dist/lib/constants.js +15 -2
  15. package/dist/lib/parsers/get-parquet-schema.d.ts +1 -1
  16. package/dist/lib/parsers/get-parquet-schema.d.ts.map +1 -1
  17. package/dist/lib/parsers/get-parquet-schema.js +9 -7
  18. package/dist/lib/parsers/parse-geoparquet.d.ts +1 -1
  19. package/dist/lib/parsers/parse-geoparquet.d.ts.map +1 -1
  20. package/dist/lib/parsers/parse-geoparquet.js +47 -45
  21. package/dist/lib/parsers/parse-parquet-to-columns.d.ts +1 -1
  22. package/dist/lib/parsers/parse-parquet-to-columns.d.ts.map +1 -1
  23. package/dist/lib/parsers/parse-parquet-to-columns.js +36 -25
  24. package/dist/lib/parsers/parse-parquet.d.ts +1 -1
  25. package/dist/lib/parsers/parse-parquet.d.ts.map +1 -1
  26. package/dist/lib/parsers/parse-parquet.js +62 -50
  27. package/dist/lib/wasm/encode-parquet-wasm.d.ts +1 -1
  28. package/dist/lib/wasm/encode-parquet-wasm.d.ts.map +1 -1
  29. package/dist/lib/wasm/encode-parquet-wasm.js +49 -12
  30. package/dist/lib/wasm/load-wasm.js +13 -10
  31. package/dist/lib/wasm/parse-parquet-wasm.d.ts +1 -1
  32. package/dist/lib/wasm/parse-parquet-wasm.d.ts.map +1 -1
  33. package/dist/lib/wasm/parse-parquet-wasm.js +19 -15
  34. package/dist/parquet-loader.d.ts +1 -1
  35. package/dist/parquet-loader.d.ts.map +1 -1
  36. package/dist/parquet-loader.js +78 -65
  37. package/dist/parquet-wasm-loader.js +25 -28
  38. package/dist/parquet-wasm-writer.js +19 -23
  39. package/dist/parquet-writer.js +17 -13
  40. package/dist/parquetjs/codecs/declare.d.ts +1 -1
  41. package/dist/parquetjs/codecs/declare.d.ts.map +1 -1
  42. package/dist/parquetjs/codecs/declare.js +0 -1
  43. package/dist/parquetjs/codecs/dictionary.js +4 -8
  44. package/dist/parquetjs/codecs/index.d.ts +3 -3
  45. package/dist/parquetjs/codecs/index.d.ts.map +1 -1
  46. package/dist/parquetjs/codecs/index.js +20 -17
  47. package/dist/parquetjs/codecs/plain.d.ts +2 -2
  48. package/dist/parquetjs/codecs/plain.d.ts.map +1 -1
  49. package/dist/parquetjs/codecs/plain.js +166 -162
  50. package/dist/parquetjs/codecs/rle.d.ts +2 -2
  51. package/dist/parquetjs/codecs/rle.d.ts.map +1 -1
  52. package/dist/parquetjs/codecs/rle.js +124 -105
  53. package/dist/parquetjs/compression.d.ts +1 -1
  54. package/dist/parquetjs/compression.d.ts.map +1 -1
  55. package/dist/parquetjs/compression.js +157 -43
  56. package/dist/parquetjs/encoder/parquet-encoder.d.ts +3 -3
  57. package/dist/parquetjs/encoder/parquet-encoder.d.ts.map +1 -1
  58. package/dist/parquetjs/encoder/parquet-encoder.js +420 -275
  59. package/dist/parquetjs/parquet-thrift/BoundaryOrder.js +12 -7
  60. package/dist/parquetjs/parquet-thrift/BsonType.js +31 -27
  61. package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts +1 -1
  62. package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts.map +1 -1
  63. package/dist/parquetjs/parquet-thrift/ColumnChunk.js +182 -166
  64. package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts +1 -1
  65. package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts.map +1 -1
  66. package/dist/parquetjs/parquet-thrift/ColumnIndex.js +183 -166
  67. package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts +6 -6
  68. package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts.map +1 -1
  69. package/dist/parquetjs/parquet-thrift/ColumnMetaData.js +372 -333
  70. package/dist/parquetjs/parquet-thrift/ColumnOrder.d.ts +1 -1
  71. package/dist/parquetjs/parquet-thrift/ColumnOrder.d.ts.map +1 -1
  72. package/dist/parquetjs/parquet-thrift/ColumnOrder.js +74 -68
  73. package/dist/parquetjs/parquet-thrift/CompressionCodec.js +17 -12
  74. package/dist/parquetjs/parquet-thrift/ConvertedType.js +31 -26
  75. package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts +2 -2
  76. package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts.map +1 -1
  77. package/dist/parquetjs/parquet-thrift/DataPageHeader.js +141 -124
  78. package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts +2 -2
  79. package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts.map +1 -1
  80. package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.js +205 -181
  81. package/dist/parquetjs/parquet-thrift/DateType.js +31 -27
  82. package/dist/parquetjs/parquet-thrift/DecimalType.js +78 -69
  83. package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.d.ts +1 -1
  84. package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.d.ts.map +1 -1
  85. package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.js +96 -86
  86. package/dist/parquetjs/parquet-thrift/Encoding.js +17 -12
  87. package/dist/parquetjs/parquet-thrift/EnumType.js +31 -27
  88. package/dist/parquetjs/parquet-thrift/FieldRepetitionType.js +12 -7
  89. package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts +4 -4
  90. package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts.map +1 -1
  91. package/dist/parquetjs/parquet-thrift/FileMetaData.js +224 -205
  92. package/dist/parquetjs/parquet-thrift/IndexPageHeader.js +31 -27
  93. package/dist/parquetjs/parquet-thrift/IntType.js +78 -69
  94. package/dist/parquetjs/parquet-thrift/JsonType.js +31 -27
  95. package/dist/parquetjs/parquet-thrift/KeyValue.js +75 -67
  96. package/dist/parquetjs/parquet-thrift/ListType.js +31 -27
  97. package/dist/parquetjs/parquet-thrift/LogicalType.d.ts +13 -13
  98. package/dist/parquetjs/parquet-thrift/LogicalType.d.ts.map +1 -1
  99. package/dist/parquetjs/parquet-thrift/LogicalType.js +338 -344
  100. package/dist/parquetjs/parquet-thrift/MapType.js +31 -27
  101. package/dist/parquetjs/parquet-thrift/MicroSeconds.js +31 -27
  102. package/dist/parquetjs/parquet-thrift/MilliSeconds.js +31 -27
  103. package/dist/parquetjs/parquet-thrift/NullType.js +31 -27
  104. package/dist/parquetjs/parquet-thrift/OffsetIndex.d.ts +1 -1
  105. package/dist/parquetjs/parquet-thrift/OffsetIndex.d.ts.map +1 -1
  106. package/dist/parquetjs/parquet-thrift/OffsetIndex.js +67 -60
  107. package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts +2 -2
  108. package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts.map +1 -1
  109. package/dist/parquetjs/parquet-thrift/PageEncodingStats.js +101 -88
  110. package/dist/parquetjs/parquet-thrift/PageHeader.d.ts +5 -5
  111. package/dist/parquetjs/parquet-thrift/PageHeader.d.ts.map +1 -1
  112. package/dist/parquetjs/parquet-thrift/PageHeader.js +193 -175
  113. package/dist/parquetjs/parquet-thrift/PageLocation.js +111 -96
  114. package/dist/parquetjs/parquet-thrift/PageType.js +13 -8
  115. package/dist/parquetjs/parquet-thrift/RowGroup.d.ts +2 -2
  116. package/dist/parquetjs/parquet-thrift/RowGroup.d.ts.map +1 -1
  117. package/dist/parquetjs/parquet-thrift/RowGroup.js +149 -133
  118. package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts +4 -4
  119. package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts.map +1 -1
  120. package/dist/parquetjs/parquet-thrift/SchemaElement.js +221 -205
  121. package/dist/parquetjs/parquet-thrift/SortingColumn.js +101 -88
  122. package/dist/parquetjs/parquet-thrift/Statistics.js +149 -137
  123. package/dist/parquetjs/parquet-thrift/StringType.js +31 -27
  124. package/dist/parquetjs/parquet-thrift/TimeType.d.ts +1 -1
  125. package/dist/parquetjs/parquet-thrift/TimeType.d.ts.map +1 -1
  126. package/dist/parquetjs/parquet-thrift/TimeType.js +78 -69
  127. package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts +2 -2
  128. package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts.map +1 -1
  129. package/dist/parquetjs/parquet-thrift/TimeUnit.js +96 -91
  130. package/dist/parquetjs/parquet-thrift/TimestampType.d.ts +1 -1
  131. package/dist/parquetjs/parquet-thrift/TimestampType.d.ts.map +1 -1
  132. package/dist/parquetjs/parquet-thrift/TimestampType.js +78 -69
  133. package/dist/parquetjs/parquet-thrift/Type.js +17 -12
  134. package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.js +31 -27
  135. package/dist/parquetjs/parquet-thrift/UUIDType.js +31 -27
  136. package/dist/parquetjs/parquet-thrift/index.d.ts +44 -44
  137. package/dist/parquetjs/parquet-thrift/index.d.ts.map +1 -1
  138. package/dist/parquetjs/parquet-thrift/index.js +6 -1
  139. package/dist/parquetjs/parser/decoders.d.ts +3 -3
  140. package/dist/parquetjs/parser/decoders.d.ts.map +1 -1
  141. package/dist/parquetjs/parser/decoders.js +306 -242
  142. package/dist/parquetjs/parser/parquet-reader.d.ts +3 -3
  143. package/dist/parquetjs/parser/parquet-reader.d.ts.map +1 -1
  144. package/dist/parquetjs/parser/parquet-reader.js +183 -158
  145. package/dist/parquetjs/schema/declare.d.ts +1 -1
  146. package/dist/parquetjs/schema/declare.d.ts.map +1 -1
  147. package/dist/parquetjs/schema/declare.js +10 -9
  148. package/dist/parquetjs/schema/schema.d.ts +1 -1
  149. package/dist/parquetjs/schema/schema.d.ts.map +1 -1
  150. package/dist/parquetjs/schema/schema.js +142 -120
  151. package/dist/parquetjs/schema/shred.d.ts +2 -2
  152. package/dist/parquetjs/schema/shred.d.ts.map +1 -1
  153. package/dist/parquetjs/schema/shred.js +301 -204
  154. package/dist/parquetjs/schema/types.d.ts +1 -1
  155. package/dist/parquetjs/schema/types.d.ts.map +1 -1
  156. package/dist/parquetjs/schema/types.js +329 -314
  157. package/dist/parquetjs/utils/file-utils.js +24 -23
  158. package/dist/parquetjs/utils/read-utils.d.ts +1 -1
  159. package/dist/parquetjs/utils/read-utils.d.ts.map +1 -1
  160. package/dist/parquetjs/utils/read-utils.js +76 -69
  161. package/dist/polyfills/buffer/buffer-polyfill.browser.js +8 -3
  162. package/dist/polyfills/buffer/buffer-polyfill.node.js +13 -8
  163. package/dist/polyfills/buffer/buffer.js +1747 -1367
  164. package/dist/polyfills/buffer/index.d.ts +3 -3
  165. package/dist/polyfills/buffer/index.d.ts.map +1 -1
  166. package/dist/polyfills/buffer/index.js +5 -1
  167. package/dist/polyfills/buffer/install-buffer-polyfill.d.ts +28 -1
  168. package/dist/polyfills/buffer/install-buffer-polyfill.d.ts.map +1 -1
  169. package/dist/polyfills/buffer/install-buffer-polyfill.js +2 -1
  170. package/dist/polyfills/util.js +4 -1
  171. package/dist/workers/parquet-worker.js +3 -1
  172. package/package.json +21 -19
  173. package/src/index.ts +1 -1
  174. package/src/lib/parsers/parse-parquet-to-columns.ts +1 -1
  175. package/src/lib/parsers/parse-parquet.ts +1 -1
  176. package/src/parquetjs/encoder/parquet-encoder.ts +2 -2
  177. package/src/parquetjs/parser/decoders.ts +2 -2
  178. package/src/parquetjs/parser/parquet-reader.ts +3 -2
  179. package/src/parquetjs/schema/schema.ts +1 -1
  180. package/src/parquetjs/schema/types.ts +1 -0
  181. package/src/parquetjs/utils/read-utils.ts +2 -2
  182. package/src/polyfills/buffer/buffer.ts +0 -3
  183. package/dist/index.js.map +0 -1
  184. package/dist/lib/arrow/convert-columns-to-row-group.js.map +0 -1
  185. package/dist/lib/arrow/convert-row-group-to-columns.js.map +0 -1
  186. package/dist/lib/arrow/convert-schema-from-parquet.js.map +0 -1
  187. package/dist/lib/arrow/convert-schema-to-parquet.js.map +0 -1
  188. package/dist/lib/constants.js.map +0 -1
  189. package/dist/lib/parsers/get-parquet-schema.js.map +0 -1
  190. package/dist/lib/parsers/parse-geoparquet.js.map +0 -1
  191. package/dist/lib/parsers/parse-parquet-to-columns.js.map +0 -1
  192. package/dist/lib/parsers/parse-parquet.js.map +0 -1
  193. package/dist/lib/wasm/encode-parquet-wasm.js.map +0 -1
  194. package/dist/lib/wasm/load-wasm.js.map +0 -1
  195. package/dist/lib/wasm/parse-parquet-wasm.js.map +0 -1
  196. package/dist/lib/wip/convert-schema-deep.java.disabled +0 -910
  197. package/dist/lib/wip/convert-schema-deep.rs.disabled +0 -976
  198. package/dist/parquet-loader.js.map +0 -1
  199. package/dist/parquet-wasm-loader.js.map +0 -1
  200. package/dist/parquet-wasm-writer.js.map +0 -1
  201. package/dist/parquet-writer.js.map +0 -1
  202. package/dist/parquetjs/LICENSE +0 -20
  203. package/dist/parquetjs/codecs/declare.js.map +0 -1
  204. package/dist/parquetjs/codecs/dictionary.js.map +0 -1
  205. package/dist/parquetjs/codecs/index.js.map +0 -1
  206. package/dist/parquetjs/codecs/plain.js.map +0 -1
  207. package/dist/parquetjs/codecs/rle.js.map +0 -1
  208. package/dist/parquetjs/compression.js.map +0 -1
  209. package/dist/parquetjs/encoder/parquet-encoder.js.map +0 -1
  210. package/dist/parquetjs/modules.d.ts +0 -21
  211. package/dist/parquetjs/parquet-thrift/BoundaryOrder.js.map +0 -1
  212. package/dist/parquetjs/parquet-thrift/BsonType.js.map +0 -1
  213. package/dist/parquetjs/parquet-thrift/ColumnChunk.js.map +0 -1
  214. package/dist/parquetjs/parquet-thrift/ColumnIndex.js.map +0 -1
  215. package/dist/parquetjs/parquet-thrift/ColumnMetaData.js.map +0 -1
  216. package/dist/parquetjs/parquet-thrift/ColumnOrder.js.map +0 -1
  217. package/dist/parquetjs/parquet-thrift/CompressionCodec.js.map +0 -1
  218. package/dist/parquetjs/parquet-thrift/ConvertedType.js.map +0 -1
  219. package/dist/parquetjs/parquet-thrift/DataPageHeader.js.map +0 -1
  220. package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.js.map +0 -1
  221. package/dist/parquetjs/parquet-thrift/DateType.js.map +0 -1
  222. package/dist/parquetjs/parquet-thrift/DecimalType.js.map +0 -1
  223. package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.js.map +0 -1
  224. package/dist/parquetjs/parquet-thrift/Encoding.js.map +0 -1
  225. package/dist/parquetjs/parquet-thrift/EnumType.js.map +0 -1
  226. package/dist/parquetjs/parquet-thrift/FieldRepetitionType.js.map +0 -1
  227. package/dist/parquetjs/parquet-thrift/FileMetaData.js.map +0 -1
  228. package/dist/parquetjs/parquet-thrift/IndexPageHeader.js.map +0 -1
  229. package/dist/parquetjs/parquet-thrift/IntType.js.map +0 -1
  230. package/dist/parquetjs/parquet-thrift/JsonType.js.map +0 -1
  231. package/dist/parquetjs/parquet-thrift/KeyValue.js.map +0 -1
  232. package/dist/parquetjs/parquet-thrift/ListType.js.map +0 -1
  233. package/dist/parquetjs/parquet-thrift/LogicalType.js.map +0 -1
  234. package/dist/parquetjs/parquet-thrift/MapType.js.map +0 -1
  235. package/dist/parquetjs/parquet-thrift/MicroSeconds.js.map +0 -1
  236. package/dist/parquetjs/parquet-thrift/MilliSeconds.js.map +0 -1
  237. package/dist/parquetjs/parquet-thrift/NullType.js.map +0 -1
  238. package/dist/parquetjs/parquet-thrift/OffsetIndex.js.map +0 -1
  239. package/dist/parquetjs/parquet-thrift/PageEncodingStats.js.map +0 -1
  240. package/dist/parquetjs/parquet-thrift/PageHeader.js.map +0 -1
  241. package/dist/parquetjs/parquet-thrift/PageLocation.js.map +0 -1
  242. package/dist/parquetjs/parquet-thrift/PageType.js.map +0 -1
  243. package/dist/parquetjs/parquet-thrift/RowGroup.js.map +0 -1
  244. package/dist/parquetjs/parquet-thrift/SchemaElement.js.map +0 -1
  245. package/dist/parquetjs/parquet-thrift/SortingColumn.js.map +0 -1
  246. package/dist/parquetjs/parquet-thrift/Statistics.js.map +0 -1
  247. package/dist/parquetjs/parquet-thrift/StringType.js.map +0 -1
  248. package/dist/parquetjs/parquet-thrift/TimeType.js.map +0 -1
  249. package/dist/parquetjs/parquet-thrift/TimeUnit.js.map +0 -1
  250. package/dist/parquetjs/parquet-thrift/TimestampType.js.map +0 -1
  251. package/dist/parquetjs/parquet-thrift/Type.js.map +0 -1
  252. package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.js.map +0 -1
  253. package/dist/parquetjs/parquet-thrift/UUIDType.js.map +0 -1
  254. package/dist/parquetjs/parquet-thrift/index.js.map +0 -1
  255. package/dist/parquetjs/parser/decoders.js.map +0 -1
  256. package/dist/parquetjs/parser/parquet-reader.js.map +0 -1
  257. package/dist/parquetjs/schema/declare.js.map +0 -1
  258. package/dist/parquetjs/schema/schema.js.map +0 -1
  259. package/dist/parquetjs/schema/shred.js.map +0 -1
  260. package/dist/parquetjs/schema/types.js.map +0 -1
  261. package/dist/parquetjs/utils/file-utils.js.map +0 -1
  262. package/dist/parquetjs/utils/read-utils.js.map +0 -1
  263. package/dist/polyfills/buffer/buffer-polyfill.browser.js.map +0 -1
  264. package/dist/polyfills/buffer/buffer-polyfill.node.js.map +0 -1
  265. package/dist/polyfills/buffer/buffer.js.map +0 -1
  266. package/dist/polyfills/buffer/index.js.map +0 -1
  267. package/dist/polyfills/buffer/install-buffer-polyfill.js.map +0 -1
  268. package/dist/polyfills/util.js.map +0 -1
  269. package/dist/workers/parquet-worker.js.map +0 -1
@@ -1,35 +1,46 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { ParquetReader } from "../../parquetjs/parser/parquet-reader.js";
2
5
  import { materializeColumns } from "../../parquetjs/schema/shred.js";
3
6
  import { getSchemaFromParquetReader } from "./get-parquet-schema.js";
4
7
  import { installBufferPolyfill } from "../../polyfills/buffer/index.js";
8
+ /**
9
+ * @deprecated
10
+ */
5
11
  export async function parseParquetFileInColumns(file, options) {
6
- installBufferPolyfill();
7
- for await (const batch of parseParquetFileInColumnarBatches(file, options)) {
8
- return {
9
- shape: 'columnar-table',
10
- schema: batch.schema,
11
- data: batch.data
12
- };
13
- }
14
- throw new Error('empty table');
12
+ installBufferPolyfill();
13
+ for await (const batch of parseParquetFileInColumnarBatches(file, options)) {
14
+ return {
15
+ shape: 'columnar-table',
16
+ schema: batch.schema,
17
+ data: batch.data
18
+ };
19
+ }
20
+ throw new Error('empty table');
15
21
  }
22
+ /**
23
+ * @deprecated
24
+ */
16
25
  export async function* parseParquetFileInColumnarBatches(file, options) {
17
- const reader = new ParquetReader(file);
18
- const schema = await getSchemaFromParquetReader(reader);
19
- const parquetSchema = await reader.getSchema();
20
- const rowGroups = reader.rowGroupIterator(options === null || options === void 0 ? void 0 : options.parquet);
21
- for await (const rowGroup of rowGroups) {
22
- yield convertRowGroupToTableBatch(rowGroup, parquetSchema, schema);
23
- }
26
+ const reader = new ParquetReader(file);
27
+ // Extract schema and geo metadata
28
+ const schema = await getSchemaFromParquetReader(reader);
29
+ const parquetSchema = await reader.getSchema();
30
+ // Iterate over row batches
31
+ const rowGroups = reader.rowGroupIterator(options?.parquet);
32
+ for await (const rowGroup of rowGroups) {
33
+ yield convertRowGroupToTableBatch(rowGroup, parquetSchema, schema);
34
+ }
24
35
  }
25
36
  function convertRowGroupToTableBatch(rowGroup, parquetSchema, schema) {
26
- const data = materializeColumns(parquetSchema, rowGroup);
27
- return {
28
- shape: 'columnar-table',
29
- batchType: 'data',
30
- schema,
31
- data,
32
- length: rowGroup.rowCount
33
- };
37
+ // const data = convertParquetRowGroupToColumns(schema, rowGroup);
38
+ const data = materializeColumns(parquetSchema, rowGroup);
39
+ return {
40
+ shape: 'columnar-table',
41
+ batchType: 'data',
42
+ schema,
43
+ data,
44
+ length: rowGroup.rowCount
45
+ };
34
46
  }
35
- //# sourceMappingURL=parse-parquet-to-columns.js.map
@@ -1,6 +1,6 @@
1
1
  import type { ReadableFile } from '@loaders.gl/loader-utils';
2
2
  import type { ObjectRowTable, ObjectRowTableBatch } from '@loaders.gl/schema';
3
- import type { ParquetLoaderOptions } from '../../parquet-loader';
3
+ import type { ParquetLoaderOptions } from "../../parquet-loader.js";
4
4
  /**
5
5
  * * Parse a parquet file using parquetjs
6
6
  * @param file
@@ -1 +1 @@
1
- {"version":3,"file":"parse-parquet.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-parquet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAE5E,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAM/D;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,cAAc,CAAC,CA0BzB;AAED;;;;GAIG;AACH,wBAAuB,yBAAyB,CAC9C,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,aAAa,CAAC,mBAAmB,CAAC,CAuBpC"}
1
+ {"version":3,"file":"parse-parquet.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-parquet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAE5E,OAAO,KAAK,EAAC,oBAAoB,EAAC,gCAA6B;AAM/D;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,cAAc,CAAC,CA0BzB;AAED;;;;GAIG;AACH,wBAAuB,yBAAyB,CAC9C,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,aAAa,CAAC,mBAAmB,CAAC,CAuBpC"}
@@ -1,60 +1,72 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { ParquetReader } from "../../parquetjs/parser/parquet-reader.js";
2
5
  import { getSchemaFromParquetReader } from "./get-parquet-schema.js";
3
6
  import { installBufferPolyfill } from "../../polyfills/buffer/index.js";
7
+ /**
8
+ * * Parse a parquet file using parquetjs
9
+ * @param file
10
+ * @param options
11
+ * @returns
12
+ */
4
13
  export async function parseParquetFile(file, options) {
5
- var _options$parquet, _options$parquet2;
6
- installBufferPolyfill();
7
- const reader = new ParquetReader(file, {
8
- preserveBinary: options === null || options === void 0 ? void 0 : (_options$parquet = options.parquet) === null || _options$parquet === void 0 ? void 0 : _options$parquet.preserveBinary
9
- });
10
- const schema = await getSchemaFromParquetReader(reader);
11
- const rows = [];
12
- const rowBatches = reader.rowBatchIterator(options === null || options === void 0 ? void 0 : options.parquet);
13
- for await (const rowBatch of rowBatches) {
14
- for (const row of rowBatch) {
15
- rows.push(row);
14
+ installBufferPolyfill();
15
+ const reader = new ParquetReader(file, {
16
+ preserveBinary: options?.parquet?.preserveBinary
17
+ });
18
+ const schema = await getSchemaFromParquetReader(reader);
19
+ const rows = [];
20
+ const rowBatches = reader.rowBatchIterator(options?.parquet);
21
+ for await (const rowBatch of rowBatches) {
22
+ // we have only one input batch so return
23
+ for (const row of rowBatch) {
24
+ rows.push(row);
25
+ }
16
26
  }
17
- }
18
- const objectRowTable = {
19
- shape: 'object-row-table',
20
- schema,
21
- data: rows
22
- };
23
- const shape = options === null || options === void 0 ? void 0 : (_options$parquet2 = options.parquet) === null || _options$parquet2 === void 0 ? void 0 : _options$parquet2.shape;
24
- return convertTable(objectRowTable, shape);
25
- }
26
- export async function* parseParquetFileInBatches(file, options) {
27
- var _options$parquet3;
28
- const reader = new ParquetReader(file, {
29
- preserveBinary: options === null || options === void 0 ? void 0 : (_options$parquet3 = options.parquet) === null || _options$parquet3 === void 0 ? void 0 : _options$parquet3.preserveBinary
30
- });
31
- const schema = await getSchemaFromParquetReader(reader);
32
- const rowBatches = reader.rowBatchIterator(options === null || options === void 0 ? void 0 : options.parquet);
33
- for await (const rows of rowBatches) {
34
- var _options$parquet4;
35
27
  const objectRowTable = {
36
- shape: 'object-row-table',
37
- schema,
38
- data: rows
28
+ shape: 'object-row-table',
29
+ schema,
30
+ data: rows
39
31
  };
40
- const shape = options === null || options === void 0 ? void 0 : (_options$parquet4 = options.parquet) === null || _options$parquet4 === void 0 ? void 0 : _options$parquet4.shape;
41
- const table = convertTable(objectRowTable, shape);
42
- yield {
43
- batchType: 'data',
44
- schema,
45
- ...table,
46
- length: rows.length
47
- };
48
- }
32
+ const shape = options?.parquet?.shape;
33
+ return convertTable(objectRowTable, shape);
34
+ }
35
+ /**
36
+ * Parse a parquet file in batches using parquetjs
37
+ * @param file
38
+ * @param options
39
+ */
40
+ export async function* parseParquetFileInBatches(file, options) {
41
+ const reader = new ParquetReader(file, {
42
+ preserveBinary: options?.parquet?.preserveBinary
43
+ });
44
+ const schema = await getSchemaFromParquetReader(reader);
45
+ const rowBatches = reader.rowBatchIterator(options?.parquet);
46
+ for await (const rows of rowBatches) {
47
+ const objectRowTable = {
48
+ shape: 'object-row-table',
49
+ schema,
50
+ data: rows
51
+ };
52
+ const shape = options?.parquet?.shape;
53
+ const table = convertTable(objectRowTable, shape);
54
+ yield {
55
+ batchType: 'data',
56
+ schema,
57
+ ...table,
58
+ length: rows.length
59
+ };
60
+ }
49
61
  }
50
62
  function convertTable(objectRowTable, shape) {
51
- switch (shape) {
52
- case 'object-row-table':
53
- return objectRowTable;
54
- case 'geojson-table':
55
- return objectRowTable;
56
- default:
57
- throw new Error(shape);
58
- }
63
+ switch (shape) {
64
+ case 'object-row-table':
65
+ return objectRowTable;
66
+ // Hack until geoparquet fixes up forwarded shape
67
+ case 'geojson-table':
68
+ return objectRowTable;
69
+ default:
70
+ throw new Error(shape);
71
+ }
59
72
  }
60
- //# sourceMappingURL=parse-parquet.js.map
@@ -1,5 +1,5 @@
1
1
  import type { ArrowTable } from '@loaders.gl/arrow';
2
- import type { ParquetWriterOptions } from '../../parquet-wasm-writer';
2
+ import type { ParquetWriterOptions } from "../../parquet-wasm-writer.js";
3
3
  /**
4
4
  * Encode Arrow arrow.Table to Parquet buffer
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"encode-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/encode-parquet-wasm.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAKlD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAEpE;;GAEG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,WAAW,CAAC,CAsBtB"}
1
+ {"version":3,"file":"encode-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/encode-parquet-wasm.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAKlD,OAAO,KAAK,EAAC,oBAAoB,EAAC,qCAAkC;AAEpE;;GAEG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,WAAW,CAAC,CAsBtB"}
@@ -1,16 +1,53 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import * as arrow from 'apache-arrow';
2
5
  import { loadWasm } from "./load-wasm.js";
6
+ /**
7
+ * Encode Arrow arrow.Table to Parquet buffer
8
+ */
3
9
  export async function encode(table, options) {
4
- var _options$parquet;
5
- const wasmUrl = (_options$parquet = options.parquet) === null || _options$parquet === void 0 ? void 0 : _options$parquet.wasmUrl;
6
- const wasm = await loadWasm(wasmUrl);
7
- const arrowTable = table.data;
8
- const ipcStream = arrow.tableToIPC(arrowTable);
9
- const wasmTable = wasm.Table.fromIPCStream(ipcStream);
10
- const wasmProperties = new wasm.WriterPropertiesBuilder().build();
11
- try {
12
- const parquetBytes = wasm.writeParquet(wasmTable, wasmProperties);
13
- return parquetBytes.buffer.slice(parquetBytes.byteOffset, parquetBytes.byteLength + parquetBytes.byteOffset);
14
- } finally {}
10
+ const wasmUrl = options.parquet?.wasmUrl;
11
+ const wasm = await loadWasm(wasmUrl);
12
+ // Serialize the table to the IPC format.
13
+ const arrowTable = table.data;
14
+ const ipcStream = arrow.tableToIPC(arrowTable);
15
+ // Pass the IPC stream to the Parquet writer.
16
+ const wasmTable = wasm.Table.fromIPCStream(ipcStream);
17
+ const wasmProperties = new wasm.WriterPropertiesBuilder().build();
18
+ try {
19
+ const parquetBytes = wasm.writeParquet(wasmTable, wasmProperties);
20
+ // const parquetBytes = wasm.writeParquet(wasmTable, wasmProperties);
21
+ return parquetBytes.buffer.slice(parquetBytes.byteOffset, parquetBytes.byteLength + parquetBytes.byteOffset);
22
+ }
23
+ finally {
24
+ // wasmTable.free();
25
+ // wasmProperties.free();
26
+ }
15
27
  }
16
- //# sourceMappingURL=encode-parquet-wasm.js.map
28
+ // type WriteOptions = {
29
+ // compression?: number;
30
+ // dictionaryEnabled?: boolean;
31
+ // encoding?: number;
32
+ // maxRowGroupSize?: number;
33
+ // maxStatisticsSize?: number;
34
+ // statisticsEnabled?: boolean;
35
+ // writeBatchSize?: number;
36
+ // dataPageSizeLimit?: number;
37
+ // dictionaryPageSizeLimit?: number;
38
+ // };
39
+ // columnCompression: Record<string, number>;
40
+ // columnDictionaryEnabled: Record<string, boolean>;
41
+ // columnEncoding: Record<string, number>;
42
+ // columnMaxStatisticsSize
43
+ // compression:Record<string, number>;
44
+ // setCreatedBy
45
+ // setDataPageSizeLimit
46
+ // setDictionaryEnabled
47
+ // setDictionaryPageSizeLimit
48
+ // setEncoding
49
+ // setMaxRowGroupSize
50
+ // setMaxStatisticsSize
51
+ // setStatisticsEnabled
52
+ // setWriteBatchSize
53
+ // setWriterVersion
@@ -1,16 +1,19 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ // eslint-disable-next-line import/default
1
5
  import initWasm from 'parquet-wasm';
2
6
  import * as parquetWasm from 'parquet-wasm';
3
7
  import { PARQUET_WASM_URL } from "../constants.js";
4
8
  let initializePromise;
5
- export async function loadWasm() {
6
- let wasmUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PARQUET_WASM_URL;
7
- if (!initializePromise && typeof initWasm === 'function') {
8
- if (!wasmUrl) {
9
- throw new Error('ParquetLoader: No wasmUrl provided');
9
+ export async function loadWasm(wasmUrl = PARQUET_WASM_URL) {
10
+ if (!initializePromise && typeof initWasm === 'function') {
11
+ if (!wasmUrl) {
12
+ throw new Error('ParquetLoader: No wasmUrl provided');
13
+ }
14
+ // @ts-ignore
15
+ initializePromise = initWasm(wasmUrl);
10
16
  }
11
- initializePromise = initWasm(wasmUrl);
12
- }
13
- await initializePromise;
14
- return parquetWasm;
17
+ await initializePromise;
18
+ return parquetWasm;
15
19
  }
16
- //# sourceMappingURL=load-wasm.js.map
@@ -1,4 +1,4 @@
1
1
  import type { ArrowTable } from '@loaders.gl/arrow';
2
- import type { ParquetWasmLoaderOptions } from '../../parquet-wasm-loader';
2
+ import type { ParquetWasmLoaderOptions } from "../../parquet-wasm-loader.js";
3
3
  export declare function parseParquetWasm(arrayBuffer: ArrayBuffer, options: ParquetWasmLoaderOptions): Promise<ArrowTable>;
4
4
  //# sourceMappingURL=parse-parquet-wasm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/parse-parquet-wasm.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AAIxE,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,UAAU,CAAC,CAkBrB"}
1
+ {"version":3,"file":"parse-parquet-wasm.d.ts","sourceRoot":"","sources":["../../../src/lib/wasm/parse-parquet-wasm.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAC,wBAAwB,EAAC,qCAAkC;AAIxE,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,UAAU,CAAC,CAkBrB"}
@@ -1,20 +1,24 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { serializeArrowSchema } from '@loaders.gl/arrow';
2
5
  import { loadWasm } from "./load-wasm.js";
3
6
  import * as arrow from 'apache-arrow';
4
7
  export async function parseParquetWasm(arrayBuffer, options) {
5
- var _options$parquet;
6
- const arr = new Uint8Array(arrayBuffer);
7
- const wasmUrl = options === null || options === void 0 ? void 0 : (_options$parquet = options.parquet) === null || _options$parquet === void 0 ? void 0 : _options$parquet.wasmUrl;
8
- const wasm = await loadWasm(wasmUrl);
9
- const wasmTable = wasm.readParquet(arr);
10
- try {
11
- const ipcStream = wasmTable.intoIPCStream();
12
- const arrowTable = arrow.tableFromIPC(ipcStream);
13
- return {
14
- shape: 'arrow-table',
15
- schema: serializeArrowSchema(arrowTable.schema),
16
- data: arrowTable
17
- };
18
- } finally {}
8
+ const arr = new Uint8Array(arrayBuffer);
9
+ const wasmUrl = options?.parquet?.wasmUrl;
10
+ const wasm = await loadWasm(wasmUrl);
11
+ const wasmTable = wasm.readParquet(arr);
12
+ try {
13
+ const ipcStream = wasmTable.intoIPCStream();
14
+ const arrowTable = arrow.tableFromIPC(ipcStream);
15
+ return {
16
+ shape: 'arrow-table',
17
+ schema: serializeArrowSchema(arrowTable.schema),
18
+ data: arrowTable
19
+ };
20
+ }
21
+ finally {
22
+ // wasmTable.free();
23
+ }
19
24
  }
20
- //# sourceMappingURL=parse-parquet-wasm.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Loader, LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
2
2
  import type { ObjectRowTable, ObjectRowTableBatch, GeoJSONTable, GeoJSONTableBatch, ColumnarTable, ColumnarTableBatch } from '@loaders.gl/schema';
3
- export { Buffer } from './polyfills/buffer/install-buffer-polyfill';
3
+ export { Buffer } from "./polyfills/buffer/install-buffer-polyfill.js";
4
4
  /** Options for the parquet loader */
5
5
  export type ParquetLoaderOptions = LoaderOptions & {
6
6
  /** Options for the parquet loader */
@@ -1 +1 @@
1
- {"version":3,"file":"parquet-loader.d.ts","sourceRoot":"","sources":["../src/parquet-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAC,MAAM,EAAC,MAAM,4CAA4C,CAAC;AAMlE,qCAAqC;AACrC,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,qCAAqC;IACrC,OAAO,CAAC,EAAE;QACR,qCAAqC;QACrC,KAAK,CAAC,EAAE,kBAAkB,GAAG,eAAe,CAAC;QAC7C,0FAA0F;QAC1F,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QACnC,0DAA0D;QAC1D,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,qFAAqF;QACrF,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gEAAgE;QAChE,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,cAAc,EACd,mBAAmB,EACnB,oBAAoB,CAqBrB,CAAC;AAEF,6BAA6B;AAC7B,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAC1C,cAAc,GAAG,YAAY,EAC7B,mBAAmB,GAAG,iBAAiB,EACvC,oBAAoB,CAQrB,CAAC;AAMF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,CAqB9F,CAAC;AAEJ,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAC7C,cAAc,GAAG,YAAY,EAC7B,mBAAmB,GAAG,iBAAiB,EACvC,oBAAoB,CAQrB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CAarB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAClD,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CAQrB,CAAC"}
1
+ {"version":3,"file":"parquet-loader.d.ts","sourceRoot":"","sources":["../src/parquet-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAC,MAAM,EAAC,sDAAmD;AAMlE,qCAAqC;AACrC,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,qCAAqC;IACrC,OAAO,CAAC,EAAE;QACR,qCAAqC;QACrC,KAAK,CAAC,EAAE,kBAAkB,GAAG,eAAe,CAAC;QAC7C,0FAA0F;QAC1F,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QACnC,0DAA0D;QAC1D,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,qFAAqF;QACrF,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gEAAgE;QAChE,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,cAAc,EACd,mBAAmB,EACnB,oBAAoB,CAqBrB,CAAC;AAEF,6BAA6B;AAC7B,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAC1C,cAAc,GAAG,YAAY,EAC7B,mBAAmB,GAAG,iBAAiB,EACvC,oBAAoB,CAQrB,CAAC;AAMF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,CAqB9F,CAAC;AAEJ,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAC7C,cAAc,GAAG,YAAY,EAC7B,mBAAmB,GAAG,iBAAiB,EACvC,oBAAoB,CAQrB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CAarB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAClD,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CAQrB,CAAC"}
@@ -1,85 +1,98 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { BlobFile } from '@loaders.gl/loader-utils';
2
5
  import { parseParquetFile, parseParquetFileInBatches } from "./lib/parsers/parse-parquet.js";
3
6
  import { parseGeoParquetFile, parseGeoParquetFileInBatches } from "./lib/parsers/parse-geoparquet.js";
4
7
  import { parseParquetFileInColumns, parseParquetFileInColumnarBatches } from "./lib/parsers/parse-parquet-to-columns.js";
5
8
  export { Buffer } from "./polyfills/buffer/install-buffer-polyfill.js";
6
- const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
9
+ // __VERSION__ is injected by babel-plugin-version-inline
10
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
11
+ const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
12
+ /**
13
+ * ParquetJS table loader
14
+ */
7
15
  export const ParquetWorkerLoader = {
8
- name: 'Apache Parquet',
9
- id: 'parquet',
10
- module: 'parquet',
11
- version: VERSION,
12
- worker: true,
13
- category: 'table',
14
- extensions: ['parquet'],
15
- mimeTypes: ['application/octet-stream'],
16
- binary: true,
17
- tests: ['PAR1', 'PARE'],
18
- options: {
19
- parquet: {
20
- shape: 'object-row-table',
21
- columnList: [],
22
- geoparquet: true,
23
- url: undefined,
24
- preserveBinary: false
16
+ name: 'Apache Parquet',
17
+ id: 'parquet',
18
+ module: 'parquet',
19
+ version: VERSION,
20
+ worker: true,
21
+ category: 'table',
22
+ extensions: ['parquet'],
23
+ mimeTypes: ['application/octet-stream'],
24
+ binary: true,
25
+ tests: ['PAR1', 'PARE'],
26
+ options: {
27
+ parquet: {
28
+ shape: 'object-row-table',
29
+ columnList: [],
30
+ geoparquet: true,
31
+ url: undefined,
32
+ preserveBinary: false
33
+ }
25
34
  }
26
- }
27
35
  };
36
+ /** ParquetJS table loader */
28
37
  export const ParquetLoader = {
29
- ...ParquetWorkerLoader,
30
- parse: (arrayBuffer, options) => parseParquetFile(new BlobFile(arrayBuffer), options),
31
- parseFile: parseParquetFile,
32
- parseFileInBatches: parseParquetFileInBatches
38
+ ...ParquetWorkerLoader,
39
+ parse: (arrayBuffer, options) => parseParquetFile(new BlobFile(arrayBuffer), options),
40
+ parseFile: parseParquetFile,
41
+ parseFileInBatches: parseParquetFileInBatches
33
42
  };
43
+ // Defeat tree shaking
44
+ // @ts-ignore
34
45
  ParquetLoader.Buffer = Buffer;
35
46
  export const GeoParquetWorkerLoader = {
36
- name: 'Apache Parquet',
37
- id: 'parquet',
38
- module: 'parquet',
39
- version: VERSION,
40
- worker: true,
41
- category: 'table',
42
- extensions: ['parquet'],
43
- mimeTypes: ['application/octet-stream'],
44
- binary: true,
45
- tests: ['PAR1', 'PARE'],
46
- options: {
47
- parquet: {
48
- shape: 'geojson-table',
49
- columnList: [],
50
- geoparquet: true,
51
- url: undefined,
52
- preserveBinary: false
47
+ name: 'Apache Parquet',
48
+ id: 'parquet',
49
+ module: 'parquet',
50
+ version: VERSION,
51
+ worker: true,
52
+ category: 'table',
53
+ extensions: ['parquet'],
54
+ mimeTypes: ['application/octet-stream'],
55
+ binary: true,
56
+ tests: ['PAR1', 'PARE'],
57
+ options: {
58
+ parquet: {
59
+ shape: 'geojson-table',
60
+ columnList: [],
61
+ geoparquet: true,
62
+ url: undefined,
63
+ preserveBinary: false
64
+ }
53
65
  }
54
- }
55
66
  };
67
+ /** ParquetJS table loader */
56
68
  export const GeoParquetLoader = {
57
- ...GeoParquetWorkerLoader,
58
- parse(arrayBuffer, options) {
59
- return parseGeoParquetFile(new BlobFile(arrayBuffer), options);
60
- },
61
- parseFile: parseGeoParquetFile,
62
- parseFileInBatches: parseGeoParquetFileInBatches
69
+ ...GeoParquetWorkerLoader,
70
+ parse(arrayBuffer, options) {
71
+ return parseGeoParquetFile(new BlobFile(arrayBuffer), options);
72
+ },
73
+ parseFile: parseGeoParquetFile,
74
+ parseFileInBatches: parseGeoParquetFileInBatches
63
75
  };
76
+ /** @deprecated Test to see if we can improve perf of parquetjs loader */
64
77
  export const ParquetColumnarWorkerLoader = {
65
- name: 'Apache Parquet',
66
- id: 'parquet',
67
- module: 'parquet',
68
- version: VERSION,
69
- worker: true,
70
- category: 'table',
71
- extensions: ['parquet'],
72
- mimeTypes: ['application/octet-stream'],
73
- binary: true,
74
- tests: ['PAR1', 'PARE'],
75
- options: ParquetLoader.options
78
+ name: 'Apache Parquet',
79
+ id: 'parquet',
80
+ module: 'parquet',
81
+ version: VERSION,
82
+ worker: true,
83
+ category: 'table',
84
+ extensions: ['parquet'],
85
+ mimeTypes: ['application/octet-stream'],
86
+ binary: true,
87
+ tests: ['PAR1', 'PARE'],
88
+ options: ParquetLoader.options
76
89
  };
90
+ /** @deprecated Test to see if we can improve perf of parquetjs loader */
77
91
  export const ParquetColumnarLoader = {
78
- ...ParquetColumnarWorkerLoader,
79
- parse(arrayBuffer, options) {
80
- return parseParquetFileInColumns(new BlobFile(arrayBuffer), options);
81
- },
82
- parseFile: parseParquetFileInColumns,
83
- parseFileInBatches: parseParquetFileInColumnarBatches
92
+ ...ParquetColumnarWorkerLoader,
93
+ parse(arrayBuffer, options) {
94
+ return parseParquetFileInColumns(new BlobFile(arrayBuffer), options);
95
+ },
96
+ parseFile: parseParquetFileInColumns,
97
+ parseFileInBatches: parseParquetFileInColumnarBatches
84
98
  };
85
- //# sourceMappingURL=parquet-loader.js.map
@@ -1,35 +1,32 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { parseParquetWasm } from "./lib/wasm/parse-parquet-wasm.js";
2
5
  import { VERSION, PARQUET_WASM_URL } from "./lib/constants.js";
6
+ /** Parquet WASM table loader */
3
7
  export const ParquetWasmWorkerLoader = {
4
- name: 'Apache Parquet',
5
- id: 'parquet-wasm',
6
- module: 'parquet',
7
- version: VERSION,
8
- worker: false,
9
- category: 'table',
10
- extensions: ['parquet'],
11
- mimeTypes: ['application/octet-stream'],
12
- binary: true,
13
- tests: ['PAR1', 'PARE'],
14
- options: {
15
- parquet: {
16
- type: 'arrow-table',
17
- wasmUrl: PARQUET_WASM_URL
8
+ name: 'Apache Parquet',
9
+ id: 'parquet-wasm',
10
+ module: 'parquet',
11
+ version: VERSION,
12
+ worker: false,
13
+ category: 'table',
14
+ extensions: ['parquet'],
15
+ mimeTypes: ['application/octet-stream'],
16
+ binary: true,
17
+ tests: ['PAR1', 'PARE'],
18
+ options: {
19
+ parquet: {
20
+ type: 'arrow-table',
21
+ wasmUrl: PARQUET_WASM_URL
22
+ }
18
23
  }
19
- }
20
24
  };
25
+ /** Parquet WASM table loader */
21
26
  export const ParquetWasmLoader = {
22
- ...ParquetWasmWorkerLoader,
23
- parse(arrayBuffer, options) {
24
- var _options;
25
- options = {
26
- parquet: {
27
- ...ParquetWasmLoader.options.parquet,
28
- ...((_options = options) === null || _options === void 0 ? void 0 : _options.parquet)
29
- },
30
- ...options
31
- };
32
- return parseParquetWasm(arrayBuffer, options);
33
- }
27
+ ...ParquetWasmWorkerLoader,
28
+ parse(arrayBuffer, options) {
29
+ options = { parquet: { ...ParquetWasmLoader.options.parquet, ...options?.parquet }, ...options };
30
+ return parseParquetWasm(arrayBuffer, options);
31
+ }
34
32
  };
35
- //# sourceMappingURL=parquet-wasm-loader.js.map