@loaders.gl/parquet 3.3.0-alpha.7 → 3.3.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es5/parquet-loader.js +1 -1
- package/dist/es5/parquet-wasm-loader.js +1 -1
- package/dist/es5/parquet-wasm-writer.js +1 -1
- package/dist/es5/parquet-writer.js +1 -1
- package/dist/esm/parquet-loader.js +1 -1
- package/dist/esm/parquet-wasm-loader.js +1 -1
- package/dist/esm/parquet-wasm-writer.js +1 -1
- package/dist/esm/parquet-writer.js +1 -1
- package/dist/lib/wasm/encode-parquet-wasm.d.ts +1 -1
- package/dist/lib/wasm/encode-parquet-wasm.d.ts.map +1 -1
- package/dist/lib/wasm/parse-parquet-wasm.d.ts +1 -1
- package/dist/lib/wasm/parse-parquet-wasm.d.ts.map +1 -1
- package/dist/parquet-loader.d.ts +1 -1
- package/dist/parquet-loader.d.ts.map +1 -1
- package/dist/parquet-wasm-loader.d.ts +1 -1
- package/dist/parquet-wasm-loader.d.ts.map +1 -1
- package/dist/parquet-worker.js +1 -1
- package/dist/parquet-writer.d.ts +1 -1
- package/dist/parquet-writer.d.ts.map +1 -1
- package/dist/parquetjs/encoder/writer.js +22 -22
- package/dist/parquetjs/parser/parquet-envelope-reader.js +5 -5
- package/dist/parquetjs/parser/parquet-reader.js +16 -16
- package/dist/parquetjs/schema/declare.d.ts +7 -7
- package/dist/parquetjs/schema/declare.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/parquet-writer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parquet-writer.d.ts","sourceRoot":"","sources":["../src/parquet-writer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAMrD,
|
|
1
|
+
{"version":3,"file":"parquet-writer.d.ts","sourceRoot":"","sources":["../src/parquet-writer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAMrD,MAAM,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAItC,eAAO,MAAM,aAAa,EAAE,MAU3B,CAAC"}
|
|
@@ -62,20 +62,6 @@ const PARQUET_RDLVL_ENCODING = 'RLE';
|
|
|
62
62
|
*/
|
|
63
63
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
64
64
|
class ParquetWriter {
|
|
65
|
-
/**
|
|
66
|
-
* Create a new buffered parquet writer for a given envelope writer
|
|
67
|
-
*/
|
|
68
|
-
constructor(schema, envelopeWriter, opts) {
|
|
69
|
-
this.schema = schema;
|
|
70
|
-
this.envelopeWriter = envelopeWriter;
|
|
71
|
-
// @ts-ignore Row buffer typings...
|
|
72
|
-
this.rowBuffer = {};
|
|
73
|
-
this.rowGroupSize = opts.rowGroupSize || PARQUET_DEFAULT_ROW_GROUP_SIZE;
|
|
74
|
-
this.closed = false;
|
|
75
|
-
this.userMetadata = {};
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
77
|
-
this.writeHeader();
|
|
78
|
-
}
|
|
79
65
|
/**
|
|
80
66
|
* Convenience method to create a new buffered parquet writer that writes to
|
|
81
67
|
* the specified file
|
|
@@ -96,6 +82,20 @@ class ParquetWriter {
|
|
|
96
82
|
const envelopeWriter = await ParquetEnvelopeWriter.openStream(schema, outputStream, opts);
|
|
97
83
|
return new ParquetWriter(schema, envelopeWriter, opts);
|
|
98
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a new buffered parquet writer for a given envelope writer
|
|
87
|
+
*/
|
|
88
|
+
constructor(schema, envelopeWriter, opts) {
|
|
89
|
+
this.schema = schema;
|
|
90
|
+
this.envelopeWriter = envelopeWriter;
|
|
91
|
+
// @ts-ignore Row buffer typings...
|
|
92
|
+
this.rowBuffer = {};
|
|
93
|
+
this.rowGroupSize = opts.rowGroupSize || PARQUET_DEFAULT_ROW_GROUP_SIZE;
|
|
94
|
+
this.closed = false;
|
|
95
|
+
this.userMetadata = {};
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
97
|
+
this.writeHeader();
|
|
98
|
+
}
|
|
99
99
|
async writeHeader() {
|
|
100
100
|
// TODO - better not mess with promises in the constructor
|
|
101
101
|
try {
|
|
@@ -174,6 +174,14 @@ exports.ParquetWriter = ParquetWriter;
|
|
|
174
174
|
* called in the correct order to produce a valid file.
|
|
175
175
|
*/
|
|
176
176
|
class ParquetEnvelopeWriter {
|
|
177
|
+
/**
|
|
178
|
+
* Create a new parquet envelope writer that writes to the specified stream
|
|
179
|
+
*/
|
|
180
|
+
static async openStream(schema, outputStream, opts) {
|
|
181
|
+
const writeFn = file_utils_1.oswrite.bind(undefined, outputStream);
|
|
182
|
+
const closeFn = file_utils_1.osclose.bind(undefined, outputStream);
|
|
183
|
+
return new ParquetEnvelopeWriter(schema, writeFn, closeFn, 0, opts);
|
|
184
|
+
}
|
|
177
185
|
constructor(schema, writeFn, closeFn, fileOffset, opts) {
|
|
178
186
|
this.schema = schema;
|
|
179
187
|
this.write = writeFn;
|
|
@@ -184,14 +192,6 @@ class ParquetEnvelopeWriter {
|
|
|
184
192
|
this.pageSize = opts.pageSize || PARQUET_DEFAULT_PAGE_SIZE;
|
|
185
193
|
this.useDataPageV2 = 'useDataPageV2' in opts ? Boolean(opts.useDataPageV2) : false;
|
|
186
194
|
}
|
|
187
|
-
/**
|
|
188
|
-
* Create a new parquet envelope writer that writes to the specified stream
|
|
189
|
-
*/
|
|
190
|
-
static async openStream(schema, outputStream, opts) {
|
|
191
|
-
const writeFn = file_utils_1.oswrite.bind(undefined, outputStream);
|
|
192
|
-
const closeFn = file_utils_1.osclose.bind(undefined, outputStream);
|
|
193
|
-
return new ParquetEnvelopeWriter(schema, writeFn, closeFn, 0, opts);
|
|
194
|
-
}
|
|
195
195
|
writeSection(buf) {
|
|
196
196
|
this.offset += buf.length;
|
|
197
197
|
return this.write(buf);
|
|
@@ -13,17 +13,17 @@ const DEFAULT_DICTIONARY_SIZE = 1e6;
|
|
|
13
13
|
* rows from a parquet file use the ParquetReader instead
|
|
14
14
|
*/
|
|
15
15
|
class ParquetEnvelopeReader {
|
|
16
|
+
static async openBuffer(buffer) {
|
|
17
|
+
const readFn = (position, length) => Promise.resolve(buffer.slice(position, position + length));
|
|
18
|
+
const closeFn = () => Promise.resolve();
|
|
19
|
+
return new ParquetEnvelopeReader(readFn, closeFn, buffer.length);
|
|
20
|
+
}
|
|
16
21
|
constructor(read, close, fileSize, options) {
|
|
17
22
|
this.read = read;
|
|
18
23
|
this.close = close;
|
|
19
24
|
this.fileSize = fileSize;
|
|
20
25
|
this.defaultDictionarySize = options?.defaultDictionarySize || DEFAULT_DICTIONARY_SIZE;
|
|
21
26
|
}
|
|
22
|
-
static async openBuffer(buffer) {
|
|
23
|
-
const readFn = (position, length) => Promise.resolve(buffer.slice(position, position + length));
|
|
24
|
-
const closeFn = () => Promise.resolve();
|
|
25
|
-
return new ParquetEnvelopeReader(readFn, closeFn, buffer.length);
|
|
26
|
-
}
|
|
27
27
|
async readHeader() {
|
|
28
28
|
const buffer = await this.read(0, constants_1.PARQUET_MAGIC.length);
|
|
29
29
|
const magic = buffer.toString();
|
|
@@ -15,22 +15,6 @@ const decoders_1 = require("./decoders");
|
|
|
15
15
|
* avoid leaking file descriptors.
|
|
16
16
|
*/
|
|
17
17
|
class ParquetReader {
|
|
18
|
-
/**
|
|
19
|
-
* Create a new parquet reader from the file metadata and an envelope reader.
|
|
20
|
-
* It is not recommended to call this constructor directly except for advanced
|
|
21
|
-
* and internal use cases. Consider using one of the open{File,Buffer} methods
|
|
22
|
-
* instead
|
|
23
|
-
*/
|
|
24
|
-
constructor(metadata, envelopeReader) {
|
|
25
|
-
if (metadata.version !== constants_1.PARQUET_VERSION) {
|
|
26
|
-
throw new Error('invalid parquet version');
|
|
27
|
-
}
|
|
28
|
-
this.metadata = metadata;
|
|
29
|
-
this.envelopeReader = envelopeReader;
|
|
30
|
-
const root = this.metadata.schema[0];
|
|
31
|
-
const { schema } = (0, decoders_1.decodeSchema)(this.metadata.schema, 1, root.num_children);
|
|
32
|
-
this.schema = new schema_1.ParquetSchema(schema);
|
|
33
|
-
}
|
|
34
18
|
/**
|
|
35
19
|
* return a new parquet reader initialized with a read function
|
|
36
20
|
*/
|
|
@@ -82,6 +66,22 @@ class ParquetReader {
|
|
|
82
66
|
throw err;
|
|
83
67
|
}
|
|
84
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a new parquet reader from the file metadata and an envelope reader.
|
|
71
|
+
* It is not recommended to call this constructor directly except for advanced
|
|
72
|
+
* and internal use cases. Consider using one of the open{File,Buffer} methods
|
|
73
|
+
* instead
|
|
74
|
+
*/
|
|
75
|
+
constructor(metadata, envelopeReader) {
|
|
76
|
+
if (metadata.version !== constants_1.PARQUET_VERSION) {
|
|
77
|
+
throw new Error('invalid parquet version');
|
|
78
|
+
}
|
|
79
|
+
this.metadata = metadata;
|
|
80
|
+
this.envelopeReader = envelopeReader;
|
|
81
|
+
const root = this.metadata.schema[0];
|
|
82
|
+
const { schema } = (0, decoders_1.decodeSchema)(this.metadata.schema, 1, root.num_children);
|
|
83
|
+
this.schema = new schema_1.ParquetSchema(schema);
|
|
84
|
+
}
|
|
85
85
|
/**
|
|
86
86
|
* Close this parquet reader. You MUST call this method once you're finished
|
|
87
87
|
* reading rows
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import Int64 from 'node-int64';
|
|
2
2
|
import type { PageHeader } from '../parquet-thrift';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
3
|
+
export type ParquetCodec = 'PLAIN' | 'RLE' | 'PLAIN_DICTIONARY';
|
|
4
|
+
export type ParquetCompression = 'UNCOMPRESSED' | 'GZIP' | 'SNAPPY' | 'LZO' | 'BROTLI' | 'LZ4' | 'LZ4_RAW' | 'ZSTD';
|
|
5
|
+
export type RepetitionType = 'REQUIRED' | 'OPTIONAL' | 'REPEATED';
|
|
6
|
+
export type ParquetType = PrimitiveType | OriginalType;
|
|
7
7
|
/**
|
|
8
8
|
* Physical type
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type PrimitiveType = 'BOOLEAN' | 'INT32' | 'INT64' | 'INT96' | 'FLOAT' | 'DOUBLE' | 'BYTE_ARRAY' | 'FIXED_LEN_BYTE_ARRAY';
|
|
11
11
|
/**
|
|
12
12
|
* Logical type
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
15
|
-
export
|
|
14
|
+
export type OriginalType = 'UTF8' | 'DECIMAL_INT32' | 'DECIMAL_INT64' | 'DECIMAL_BYTE_ARRAY' | 'DECIMAL_FIXED_LEN_BYTE_ARRAY' | 'DATE' | 'TIME_MILLIS' | 'TIME_MICROS' | 'TIMESTAMP_MILLIS' | 'TIMESTAMP_MICROS' | 'UINT_8' | 'UINT_16' | 'UINT_32' | 'UINT_64' | 'INT_8' | 'INT_16' | 'INT_32' | 'INT_64' | 'JSON' | 'BSON' | 'INTERVAL';
|
|
15
|
+
export type ParquetDictionary = string[];
|
|
16
16
|
export interface SchemaDefinition {
|
|
17
17
|
[string: string]: FieldDefinition;
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/schema/declare.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAElD,
|
|
1
|
+
{"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/schema/declare.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG,kBAAkB,CAAC;AAChE,MAAM,MAAM,kB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MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,aAAa;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;gBAC5B,QAAQ,GAAE,MAAU,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAM;CAI/E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/parquet",
|
|
3
|
-
"version": "3.3.0-alpha.
|
|
3
|
+
"version": "3.3.0-alpha.8",
|
|
4
4
|
"description": "Framework-independent loader for Apache Parquet files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"./src/lib/wasm/load-wasm/load-wasm-node.ts": "./src/lib/wasm/load-wasm/load-wasm-browser.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@loaders.gl/compression": "3.3.0-alpha.
|
|
44
|
-
"@loaders.gl/loader-utils": "3.3.0-alpha.
|
|
45
|
-
"@loaders.gl/schema": "3.3.0-alpha.
|
|
43
|
+
"@loaders.gl/compression": "3.3.0-alpha.8",
|
|
44
|
+
"@loaders.gl/loader-utils": "3.3.0-alpha.8",
|
|
45
|
+
"@loaders.gl/schema": "3.3.0-alpha.8",
|
|
46
46
|
"async-mutex": "^0.2.2",
|
|
47
47
|
"brotli": "^1.3.2",
|
|
48
48
|
"bson": "^1.0.4",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"@types/varint": "^5.0.0",
|
|
69
69
|
"apache-arrow": "^4.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "69cfde0340328dd800c7c90151b56b406f47e9ae"
|
|
72
72
|
}
|