@loaders.gl/parquet 4.2.0-beta.1 → 4.2.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.
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  // __VERSION__ is injected by babel-plugin-version-inline
5
5
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
- export const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
6
+ export const VERSION = typeof "4.2.0-beta.2" !== 'undefined' ? "4.2.0-beta.2" : 'latest';
7
7
  export const PARQUET_WASM_URL = 'https://unpkg.com/parquet-wasm@0.6.0-beta.1/esm/arrow1_bg.wasm';
8
8
  /**
9
9
  * Parquet File Magic String
@@ -8,7 +8,7 @@ import { parseParquetFileInColumns, parseParquetFileInColumnarBatches } from "./
8
8
  export { Buffer } from "./polyfills/buffer/install-buffer-polyfill.js";
9
9
  // __VERSION__ is injected by babel-plugin-version-inline
10
10
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
11
- const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
11
+ const VERSION = typeof "4.2.0-beta.2" !== 'undefined' ? "4.2.0-beta.2" : 'latest';
12
12
  /**
13
13
  * ParquetJS table loader
14
14
  */
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  // __VERSION__ is injected by babel-plugin-version-inline
5
5
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
- const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
6
+ const VERSION = typeof "4.2.0-beta.2" !== 'undefined' ? "4.2.0-beta.2" : 'latest';
7
7
  export const ParquetWriter = {
8
8
  name: 'Apache Parquet',
9
9
  id: 'parquet',
@@ -1 +1 @@
1
- {"version":3,"file":"rle.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/codecs/rle.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,6BAA0B;AACrD,OAAO,KAAK,EAAC,YAAY,EAAE,mBAAmB,EAAC,qBAAkB;AAIjE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,GAAG,EAAE,EACb,IAAI,EAAE,mBAAmB,GACxB,MAAM,CA4DR;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,mBAAmB,GACxB,MAAM,EAAE,CA4BV"}
1
+ {"version":3,"file":"rle.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/codecs/rle.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,6BAA0B;AACrD,OAAO,KAAK,EAAC,YAAY,EAAE,mBAAmB,EAAC,qBAAkB;AAIjE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,GAAG,EAAE,EACb,IAAI,EAAE,mBAAmB,GACxB,MAAM,CA4DR;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,mBAAmB,GACxB,MAAM,EAAE,CAgCV"}
@@ -67,13 +67,17 @@ export function decodeValues(type, cursor, count, opts) {
67
67
  while (values.length < count) {
68
68
  const header = varint.decode(cursor.buffer, cursor.offset);
69
69
  cursor.offset += varint.encodingLength(header);
70
+ let decodedValues;
70
71
  if (header & 1) {
71
72
  const count = (header >> 1) * 8;
72
- values.push(...decodeRunBitpacked(cursor, count, opts));
73
+ decodedValues = decodeRunBitpacked(cursor, count, opts);
73
74
  }
74
75
  else {
75
76
  const count = header >> 1;
76
- values.push(...decodeRunRepeated(cursor, count, opts));
77
+ decodedValues = decodeRunRepeated(cursor, count, opts);
78
+ }
79
+ for (const value of decodedValues) {
80
+ values.push(value);
77
81
  }
78
82
  }
79
83
  values = values.slice(0, count);
@@ -1 +1 @@
1
- {"version":3,"file":"decoders.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/parser/decoders.ts"],"names":[],"mappings":";AACA,OAAO,EAEL,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EAGf,gBAAgB,EACjB,6BAA0B;AAC3B,OAAO,EAAC,YAAY,EAAsC,2BAAwB;AAClF,OAAO,EAML,aAAa,EAEd,mCAAgC;AAKjC;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CAmD7B;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,eAAe,CAAC,CA0B1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,cAAc,EAAE,aAAa,EAAE,EAC/B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV;IACD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CA4DA"}
1
+ {"version":3,"file":"decoders.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/parser/decoders.ts"],"names":[],"mappings":";AACA,OAAO,EAEL,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EAGf,gBAAgB,EACjB,6BAA0B;AAC3B,OAAO,EAAC,YAAY,EAAsC,2BAAwB;AAClF,OAAO,EAML,aAAa,EAEd,mCAAgC;AAKjC;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CAyD7B;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,eAAe,CAAC,CA0B1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,cAAc,EAAE,aAAa,EAAE,EAC/B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV;IACD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CA4DA"}
@@ -35,7 +35,10 @@ export async function decodeDataPages(buffer, context) {
35
35
  // eslint-disable-next-line no-continue
36
36
  continue;
37
37
  }
38
- if (dictionary.length) {
38
+ const valueEncoding = getThriftEnum(Encoding, page.pageHeader.data_page_header?.encoding);
39
+ // Pages might be in different encodings. We don't need to decode in case
40
+ // of 'PLAIN' encoding because all values are already in place
41
+ if (dictionary.length && valueEncoding !== 'PLAIN') {
39
42
  // eslint-disable-next-line no-loop-func
40
43
  page.values = page.values.map((value) => dictionary[value]);
41
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/parquet",
3
- "version": "4.2.0-beta.1",
3
+ "version": "4.2.0",
4
4
  "description": "Framework-independent loader for Apache Parquet files",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -60,13 +60,13 @@
60
60
  "base64-js and ieee754 are used by buffer polyfill"
61
61
  ],
62
62
  "dependencies": {
63
- "@loaders.gl/arrow": "4.2.0-beta.1",
64
- "@loaders.gl/bson": "4.2.0-beta.1",
65
- "@loaders.gl/compression": "4.2.0-beta.1",
66
- "@loaders.gl/gis": "4.2.0-beta.1",
67
- "@loaders.gl/loader-utils": "4.2.0-beta.1",
68
- "@loaders.gl/schema": "4.2.0-beta.1",
69
- "@loaders.gl/wkt": "4.2.0-beta.1",
63
+ "@loaders.gl/arrow": "4.2.0",
64
+ "@loaders.gl/bson": "4.2.0",
65
+ "@loaders.gl/compression": "4.2.0",
66
+ "@loaders.gl/gis": "4.2.0",
67
+ "@loaders.gl/loader-utils": "4.2.0",
68
+ "@loaders.gl/schema": "4.2.0",
69
+ "@loaders.gl/wkt": "4.2.0",
70
70
  "async-mutex": "^0.2.2",
71
71
  "base64-js": "^1.3.1",
72
72
  "brotli": "^1.3.2",
@@ -93,5 +93,5 @@
93
93
  "@loaders.gl/core": "^4.0.0",
94
94
  "apache-arrow": ">= 15.0.0"
95
95
  },
96
- "gitHead": "c386a9196516fe3ff24847b40e6c77be039cf905"
96
+ "gitHead": "0d9f54fca98dd1fae8998ef5829004af01feaaff"
97
97
  }
@@ -89,12 +89,16 @@ export function decodeValues(
89
89
  while (values.length < count) {
90
90
  const header = varint.decode(cursor.buffer, cursor.offset);
91
91
  cursor.offset += varint.encodingLength(header);
92
+ let decodedValues: number[];
92
93
  if (header & 1) {
93
94
  const count = (header >> 1) * 8;
94
- values.push(...decodeRunBitpacked(cursor, count, opts));
95
+ decodedValues = decodeRunBitpacked(cursor, count, opts);
95
96
  } else {
96
97
  const count = header >> 1;
97
- values.push(...decodeRunRepeated(cursor, count, opts));
98
+ decodedValues = decodeRunRepeated(cursor, count, opts);
99
+ }
100
+ for (const value of decodedValues) {
101
+ values.push(value);
98
102
  }
99
103
  }
100
104
  values = values.slice(0, count);
@@ -63,7 +63,13 @@ export async function decodeDataPages(
63
63
  continue;
64
64
  }
65
65
 
66
- if (dictionary.length) {
66
+ const valueEncoding = getThriftEnum(
67
+ Encoding,
68
+ page.pageHeader.data_page_header?.encoding!
69
+ ) as ParquetCodec;
70
+ // Pages might be in different encodings. We don't need to decode in case
71
+ // of 'PLAIN' encoding because all values are already in place
72
+ if (dictionary.length && valueEncoding !== 'PLAIN') {
67
73
  // eslint-disable-next-line no-loop-func
68
74
  page.values = page.values.map((value) => dictionary[value]);
69
75
  }