@loaders.gl/parquet 4.0.0-alpha.4 → 4.0.0-alpha.5
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/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/constants.d.ts +15 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/dist.min.js +22 -6
- package/dist/dist.min.js.map +7 -1
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/convert-schema.d.ts +8 -0
- package/dist/lib/convert-schema.d.ts.map +1 -0
- package/dist/lib/parse-parquet.d.ts +4 -0
- package/dist/lib/parse-parquet.d.ts.map +1 -0
- package/dist/lib/read-array-buffer.d.ts +19 -0
- package/dist/lib/read-array-buffer.d.ts.map +1 -0
- package/dist/parquet-loader.d.ts +23 -0
- package/dist/parquet-loader.d.ts.map +1 -0
- package/dist/parquet-loader.js +1 -1
- package/dist/parquet-worker.js +27 -13
- package/dist/parquet-worker.js.map +7 -1
- package/dist/parquet-writer.d.ts +4 -0
- package/dist/parquet-writer.d.ts.map +1 -0
- package/dist/parquet-writer.js +1 -1
- package/dist/parquetjs/codecs/declare.d.ts +17 -0
- package/dist/parquetjs/codecs/declare.d.ts.map +1 -0
- package/dist/parquetjs/codecs/dictionary.d.ts +3 -0
- package/dist/parquetjs/codecs/dictionary.d.ts.map +1 -0
- package/dist/parquetjs/codecs/index.d.ts +5 -0
- package/dist/parquetjs/codecs/index.d.ts.map +1 -0
- package/dist/parquetjs/codecs/plain.d.ts +6 -0
- package/dist/parquetjs/codecs/plain.d.ts.map +1 -0
- package/dist/parquetjs/codecs/rle.d.ts +6 -0
- package/dist/parquetjs/codecs/rle.d.ts.map +1 -0
- package/dist/parquetjs/compression.d.ts +23 -0
- package/dist/parquetjs/compression.d.ts.map +1 -0
- package/dist/parquetjs/compression.js +1 -10
- package/dist/parquetjs/compression.js.map +1 -1
- package/dist/parquetjs/encoder/writer.d.ts +123 -0
- package/dist/parquetjs/encoder/writer.d.ts.map +1 -0
- package/dist/parquetjs/file.d.ts +10 -0
- package/dist/parquetjs/file.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/BoundaryOrder.d.ts +6 -0
- package/dist/parquetjs/parquet-thrift/BoundaryOrder.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/BsonType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/BsonType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts +25 -0
- package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts +22 -0
- package/dist/parquetjs/parquet-thrift/ColumnIndex.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts +42 -0
- package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/ColumnOrder.d.ts +13 -0
- package/dist/parquetjs/parquet-thrift/ColumnOrder.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/CompressionCodec.d.ts +11 -0
- package/dist/parquetjs/parquet-thrift/CompressionCodec.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/ConvertedType.d.ts +25 -0
- package/dist/parquetjs/parquet-thrift/ConvertedType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts +21 -0
- package/dist/parquetjs/parquet-thrift/DataPageHeader.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts +27 -0
- package/dist/parquetjs/parquet-thrift/DataPageHeaderV2.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/DateType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/DateType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/DecimalType.d.ts +13 -0
- package/dist/parquetjs/parquet-thrift/DecimalType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.d.ts +16 -0
- package/dist/parquetjs/parquet-thrift/DictionaryPageHeader.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/Encoding.d.ts +11 -0
- package/dist/parquetjs/parquet-thrift/Encoding.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/EnumType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/EnumType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/FieldRepetitionType.d.ts +6 -0
- package/dist/parquetjs/parquet-thrift/FieldRepetitionType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts +28 -0
- package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/IndexPageHeader.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/IntType.d.ts +13 -0
- package/dist/parquetjs/parquet-thrift/IntType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/JsonType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/JsonType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/KeyValue.d.ts +13 -0
- package/dist/parquetjs/parquet-thrift/KeyValue.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/ListType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/ListType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/LogicalType.d.ts +61 -0
- package/dist/parquetjs/parquet-thrift/LogicalType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/MapType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/MapType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/MicroSeconds.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/MicroSeconds.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/MilliSeconds.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/MilliSeconds.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/NullType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/NullType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/OffsetIndex.d.ts +12 -0
- package/dist/parquetjs/parquet-thrift/OffsetIndex.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts +17 -0
- package/dist/parquetjs/parquet-thrift/PageEncodingStats.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/PageHeader.d.ts +30 -0
- package/dist/parquetjs/parquet-thrift/PageHeader.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/PageLocation.d.ts +16 -0
- package/dist/parquetjs/parquet-thrift/PageLocation.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/PageType.d.ts +7 -0
- package/dist/parquetjs/parquet-thrift/PageType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/RowGroup.d.ts +20 -0
- package/dist/parquetjs/parquet-thrift/RowGroup.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts +33 -0
- package/dist/parquetjs/parquet-thrift/SchemaElement.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/SortingColumn.d.ts +15 -0
- package/dist/parquetjs/parquet-thrift/SortingColumn.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/Statistics.d.ts +23 -0
- package/dist/parquetjs/parquet-thrift/Statistics.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/StringType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/StringType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/TimeType.d.ts +14 -0
- package/dist/parquetjs/parquet-thrift/TimeType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts +17 -0
- package/dist/parquetjs/parquet-thrift/TimeUnit.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/TimestampType.d.ts +14 -0
- package/dist/parquetjs/parquet-thrift/TimestampType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/Type.d.ts +11 -0
- package/dist/parquetjs/parquet-thrift/Type.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/TypeDefinedOrder.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/UUIDType.d.ts +9 -0
- package/dist/parquetjs/parquet-thrift/UUIDType.d.ts.map +1 -0
- package/dist/parquetjs/parquet-thrift/index.d.ts +44 -0
- package/dist/parquetjs/parquet-thrift/index.d.ts.map +1 -0
- package/dist/parquetjs/parser/decoders.d.ts +34 -0
- package/dist/parquetjs/parser/decoders.d.ts.map +1 -0
- package/dist/parquetjs/parser/parquet-cursor.d.ts +36 -0
- package/dist/parquetjs/parser/parquet-cursor.d.ts.map +1 -0
- package/dist/parquetjs/parser/parquet-envelope-reader.d.ts +40 -0
- package/dist/parquetjs/parser/parquet-envelope-reader.d.ts.map +1 -0
- package/dist/parquetjs/parser/parquet-envelope-reader.js +0 -9
- package/dist/parquetjs/parser/parquet-envelope-reader.js.map +1 -1
- package/dist/parquetjs/parser/parquet-reader.d.ts +68 -0
- package/dist/parquetjs/parser/parquet-reader.d.ts.map +1 -0
- package/dist/parquetjs/parser/parquet-reader.js +0 -13
- package/dist/parquetjs/parser/parquet-reader.js.map +1 -1
- package/dist/parquetjs/schema/declare.d.ts +80 -0
- package/dist/parquetjs/schema/declare.d.ts.map +1 -0
- package/dist/parquetjs/schema/schema.d.ts +26 -0
- package/dist/parquetjs/schema/schema.d.ts.map +1 -0
- package/dist/parquetjs/schema/shred.d.ts +48 -0
- package/dist/parquetjs/schema/shred.d.ts.map +1 -0
- package/dist/parquetjs/schema/types.d.ts +20 -0
- package/dist/parquetjs/schema/types.d.ts.map +1 -0
- package/dist/parquetjs/utils/buffer-utils.d.ts +10 -0
- package/dist/parquetjs/utils/buffer-utils.d.ts.map +1 -0
- package/dist/parquetjs/utils/file-utils.d.ts +16 -0
- package/dist/parquetjs/utils/file-utils.d.ts.map +1 -0
- package/dist/parquetjs/utils/file-utils.js +0 -45
- package/dist/parquetjs/utils/file-utils.js.map +1 -1
- package/dist/parquetjs/utils/read-utils.d.ts +25 -0
- package/dist/parquetjs/utils/read-utils.d.ts.map +1 -0
- package/dist/workers/parquet-worker.d.ts +2 -0
- package/dist/workers/parquet-worker.d.ts.map +1 -0
- package/package.json +8 -8
- package/src/parquetjs/compression.ts +10 -10
- package/src/parquetjs/parser/parquet-envelope-reader.ts +0 -11
- package/src/parquetjs/parser/parquet-reader.ts +0 -16
- package/src/parquetjs/utils/file-utils.ts +0 -49
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OriginalType, ParquetField, ParquetType, PrimitiveType } from './declare';
|
|
2
|
+
export interface ParquetTypeKit {
|
|
3
|
+
primitiveType: PrimitiveType;
|
|
4
|
+
originalType?: OriginalType;
|
|
5
|
+
typeLength?: number;
|
|
6
|
+
toPrimitive: Function;
|
|
7
|
+
fromPrimitive?: Function;
|
|
8
|
+
}
|
|
9
|
+
export declare const PARQUET_LOGICAL_TYPES: Record<ParquetType, ParquetTypeKit>;
|
|
10
|
+
/**
|
|
11
|
+
* Convert a value from it's native representation to the internal/underlying
|
|
12
|
+
* primitive type
|
|
13
|
+
*/
|
|
14
|
+
export declare function toPrimitive(type: ParquetType, value: any, field?: ParquetField): any;
|
|
15
|
+
/**
|
|
16
|
+
* Convert a value from it's internal/underlying primitive representation to
|
|
17
|
+
* the native representation
|
|
18
|
+
*/
|
|
19
|
+
export declare function fromPrimitive(type: ParquetType, value: any, field?: ParquetField): any;
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/schema/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AAEjF,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,QAAQ,CAAC;IACtB,aAAa,CAAC,EAAE,QAAQ,CAAC;CAC1B;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,WAAW,EAAE,cAAc,CAuJrE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,YAAY,OAM9E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,YAAY,OAUhF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Convert Buffer to ArrayBuffer
|
|
4
|
+
*/
|
|
5
|
+
export declare function toArrayBuffer(buffer: Buffer): ArrayBuffer;
|
|
6
|
+
/**
|
|
7
|
+
* Convert (copy) ArrayBuffer to Buffer
|
|
8
|
+
*/
|
|
9
|
+
export declare function toBuffer(arrayBuffer: ArrayBuffer): Buffer;
|
|
10
|
+
//# sourceMappingURL=buffer-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-utils.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/utils/buffer-utils.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAOzD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAEzD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { Writable } from 'stream';
|
|
4
|
+
export declare function load(name: string): any;
|
|
5
|
+
export interface WriteStreamOptions {
|
|
6
|
+
flags?: string;
|
|
7
|
+
encoding?: string;
|
|
8
|
+
fd?: number;
|
|
9
|
+
mode?: number;
|
|
10
|
+
autoClose?: boolean;
|
|
11
|
+
start?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function oswrite(os: Writable, buf: Buffer): Promise<void>;
|
|
14
|
+
export declare function osclose(os: Writable): Promise<void>;
|
|
15
|
+
export declare function osopen(path: string, opts?: WriteStreamOptions): Promise<fs.WriteStream>;
|
|
16
|
+
//# sourceMappingURL=file-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/utils/file-utils.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAEhC,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAEtC;AACD,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhE;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAUnD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,CAMvF"}
|
|
@@ -2,51 +2,6 @@ import fs from 'fs';
|
|
|
2
2
|
export function load(name) {
|
|
3
3
|
return (module || global).require(name);
|
|
4
4
|
}
|
|
5
|
-
export function fopen(filePath) {
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
fs.open(filePath, 'r', (err, fd) => {
|
|
8
|
-
if (err) {
|
|
9
|
-
reject(err);
|
|
10
|
-
} else {
|
|
11
|
-
resolve(fd);
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
export function fstat(filePath) {
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
fs.stat(filePath, (err, stat) => {
|
|
19
|
-
if (err) {
|
|
20
|
-
reject(err);
|
|
21
|
-
} else {
|
|
22
|
-
resolve(stat);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
export function fread(fd, position, length) {
|
|
28
|
-
const buffer = Buffer.alloc(length);
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
fs.read(fd, buffer, 0, length, position, (err, bytesRead, buf) => {
|
|
31
|
-
if (err || bytesRead !== length) {
|
|
32
|
-
reject(err || Error('read failed'));
|
|
33
|
-
} else {
|
|
34
|
-
resolve(buf);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
export function fclose(fd) {
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
fs.close(fd, err => {
|
|
42
|
-
if (err) {
|
|
43
|
-
reject(err);
|
|
44
|
-
} else {
|
|
45
|
-
resolve();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
5
|
export function oswrite(os, buf) {
|
|
51
6
|
return new Promise((resolve, reject) => {
|
|
52
7
|
os.write(buf, err => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/parquetjs/utils/file-utils.ts"],"names":["fs","load","name","module","global","require","
|
|
1
|
+
{"version":3,"sources":["../../../src/parquetjs/utils/file-utils.ts"],"names":["fs","load","name","module","global","require","oswrite","os","buf","Promise","resolve","reject","write","err","osclose","close","osopen","path","opts","outputStream","createWriteStream","once","fd"],"mappings":"AACA,OAAOA,EAAP,MAAe,IAAf;AAGA,OAAO,SAASC,IAAT,CAAcC,IAAd,EAAiC;AACtC,SAAO,CAACC,MAAM,IAAKC,MAAZ,EAA4BC,OAA5B,CAAoCH,IAApC,CAAP;AACD;AAUD,OAAO,SAASI,OAAT,CAAiBC,EAAjB,EAA+BC,GAA/B,EAA2D;AAChE,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtCJ,IAAAA,EAAE,CAACK,KAAH,CAASJ,GAAT,EAAeK,GAAD,IAAS;AACrB,UAAIA,GAAJ,EAAS;AACPF,QAAAA,MAAM,CAACE,GAAD,CAAN;AACD,OAFD,MAEO;AACLH,QAAAA,OAAO;AACR;AACF,KAND;AAOD,GARM,CAAP;AASD;AAED,OAAO,SAASI,OAAT,CAAiBP,EAAjB,EAA8C;AACnD,SAAO,IAAIE,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACrCJ,IAAAA,EAAD,CAAYQ,KAAZ,CAAmBF,GAAD,IAAc;AAC9B,UAAIA,GAAJ,EAAS;AACPF,QAAAA,MAAM,CAACE,GAAD,CAAN;AACD,OAFD,MAEO;AACLH,QAAAA,OAAO;AACR;AACF,KAND;AAOD,GARM,CAAP;AASD;AAED,OAAO,SAASM,MAAT,CAAgBC,IAAhB,EAA8BC,IAA9B,EAAkF;AACvF,SAAO,IAAIT,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMQ,YAAY,GAAGnB,EAAE,CAACoB,iBAAH,CAAqBH,IAArB,EAA2BC,IAA3B,CAArB;AACAC,IAAAA,YAAY,CAACE,IAAb,CAAkB,MAAlB,EAA2BC,EAAD,IAAQZ,OAAO,CAACS,YAAD,CAAzC;AACAA,IAAAA,YAAY,CAACE,IAAb,CAAkB,OAAlB,EAA4BR,GAAD,IAASF,MAAM,CAACE,GAAD,CAA1C;AACD,GAJM,CAAP;AAKD","sourcesContent":["// Forked from https://github.com/kbajalc/parquets under MIT license (Copyright (c) 2017 ironSource Ltd.)\nimport fs from 'fs';\nimport {Writable} from 'stream';\n\nexport function load(name: string): any {\n return (module || (global as any)).require(name);\n}\nexport interface WriteStreamOptions {\n flags?: string;\n encoding?: string;\n fd?: number;\n mode?: number;\n autoClose?: boolean;\n start?: number;\n}\n\nexport function oswrite(os: Writable, buf: Buffer): Promise<void> {\n return new Promise((resolve, reject) => {\n os.write(buf, (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n });\n}\n\nexport function osclose(os: Writable): Promise<void> {\n return new Promise((resolve, reject) => {\n (os as any).close((err: any) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n });\n}\n\nexport function osopen(path: string, opts?: WriteStreamOptions): Promise<fs.WriteStream> {\n return new Promise((resolve, reject) => {\n const outputStream = fs.createWriteStream(path, opts as any);\n outputStream.once('open', (fd) => resolve(outputStream));\n outputStream.once('error', (err) => reject(err));\n });\n}\n"],"file":"file-utils.js"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { FileMetaData, PageHeader } from '../parquet-thrift';
|
|
3
|
+
/**
|
|
4
|
+
* Helper function that serializes a thrift object into a buffer
|
|
5
|
+
*/
|
|
6
|
+
export declare function serializeThrift(obj: any): Buffer;
|
|
7
|
+
export declare function decodeThrift(obj: any, buf: Buffer, offset?: number): number;
|
|
8
|
+
/**
|
|
9
|
+
* FIXME not ideal that this is linear
|
|
10
|
+
*/
|
|
11
|
+
export declare function getThriftEnum(klass: any, value: number | string): string;
|
|
12
|
+
export declare function decodeFileMetadata(buf: Buffer, offset?: number): {
|
|
13
|
+
length: number;
|
|
14
|
+
metadata: FileMetaData;
|
|
15
|
+
};
|
|
16
|
+
export declare function decodePageHeader(buf: Buffer, offset?: number): {
|
|
17
|
+
length: number;
|
|
18
|
+
pageHeader: PageHeader;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Get the number of bits required to store a given value
|
|
22
|
+
*/
|
|
23
|
+
export declare function getBitWidth(val: number): number;
|
|
24
|
+
export declare function fieldIndexOf(arr: string[][], elem: string[]): number;
|
|
25
|
+
//# sourceMappingURL=read-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-utils.d.ts","sourceRoot":"","sources":["../../../src/parquetjs/utils/read-utils.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAM3D;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAYhD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,UAWlE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAOxE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;;;EAW9D;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;;;EAW5D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/C;AAKD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAmBpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parquet-worker.d.ts","sourceRoot":"","sources":["../../src/workers/parquet-worker.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/parquet",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"description": "Framework-independent loader for Apache Parquet files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"Parquet",
|
|
19
19
|
"Apache Parquet"
|
|
20
20
|
],
|
|
21
|
-
"types": "
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
22
|
"main": "dist/index.js",
|
|
23
23
|
"module": "dist/index.js",
|
|
24
24
|
"sideEffects": false,
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
31
|
"pre-build": "npm run build-worker && npm run build-bundle",
|
|
32
|
-
"build-bundle": "
|
|
33
|
-
"build-worker": "
|
|
32
|
+
"build-bundle": "esbuild src/bundle.ts --outfile=dist/dist.min.js --bundle --minify --sourcemap --external:{util,fs,path,crypto}",
|
|
33
|
+
"build-worker": "esbuild src/workers/parquet-worker.ts --outfile=dist/parquet-worker.js --bundle --minify --sourcemap --external:{util,fs,path,crypto} --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
34
34
|
},
|
|
35
35
|
"browser": {
|
|
36
36
|
"child_process": false,
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"lzo": false
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@loaders.gl/compression": "4.0.0-alpha.
|
|
43
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
44
|
-
"@loaders.gl/schema": "4.0.0-alpha.
|
|
42
|
+
"@loaders.gl/compression": "4.0.0-alpha.5",
|
|
43
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.5",
|
|
44
|
+
"@loaders.gl/schema": "4.0.0-alpha.5",
|
|
45
45
|
"async-mutex": "^0.2.2",
|
|
46
46
|
"brotli": "^1.3.2",
|
|
47
47
|
"bson": "^1.0.4",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"@types/thrift": "^0.10.8",
|
|
63
63
|
"@types/varint": "^5.0.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
|
|
66
66
|
}
|
|
@@ -19,23 +19,23 @@ import {toArrayBuffer, toBuffer} from './utils/buffer-utils';
|
|
|
19
19
|
// TODO switch to worker compression to avoid bundling...
|
|
20
20
|
|
|
21
21
|
// import brotli from 'brotli'; - brotli has problems with decompress in browsers
|
|
22
|
-
import brotliDecompress from 'brotli/decompress';
|
|
22
|
+
// import brotliDecompress from 'brotli/decompress';
|
|
23
23
|
import lz4js from 'lz4js';
|
|
24
24
|
import lzo from 'lzo';
|
|
25
|
-
import {ZstdCodec} from 'zstd-codec';
|
|
25
|
+
// import {ZstdCodec} from 'zstd-codec';
|
|
26
26
|
|
|
27
27
|
// Inject large dependencies through Compression constructor options
|
|
28
28
|
const modules = {
|
|
29
29
|
// brotli has problems with decompress in browsers
|
|
30
|
-
brotli: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
30
|
+
// brotli: {
|
|
31
|
+
// decompress: brotliDecompress,
|
|
32
|
+
// compress: () => {
|
|
33
|
+
// throw new Error('brotli compress');
|
|
34
|
+
// }
|
|
35
|
+
// },
|
|
36
36
|
lz4js,
|
|
37
|
-
lzo
|
|
38
|
-
'zstd-codec': ZstdCodec
|
|
37
|
+
lzo
|
|
38
|
+
// 'zstd-codec': ZstdCodec
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// See https://github.com/apache/parquet-format/blob/master/Compression.md
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
PrimitiveType,
|
|
10
10
|
ParquetOptions
|
|
11
11
|
} from '../schema/declare';
|
|
12
|
-
import {fstat, fopen, fread, fclose} from '../utils/file-utils';
|
|
13
12
|
import {decodeFileMetadata, getThriftEnum, fieldIndexOf} from '../utils/read-utils';
|
|
14
13
|
import {decodeDataPages, decodePage} from './decoders';
|
|
15
14
|
|
|
@@ -31,16 +30,6 @@ export class ParquetEnvelopeReader {
|
|
|
31
30
|
public fileSize: number;
|
|
32
31
|
public defaultDictionarySize: number;
|
|
33
32
|
|
|
34
|
-
static async openFile(filePath: string): Promise<ParquetEnvelopeReader> {
|
|
35
|
-
const fileStat = await fstat(filePath);
|
|
36
|
-
const fileDescriptor = await fopen(filePath);
|
|
37
|
-
|
|
38
|
-
const readFn = fread.bind(undefined, fileDescriptor);
|
|
39
|
-
const closeFn = fclose.bind(undefined, fileDescriptor);
|
|
40
|
-
|
|
41
|
-
return new ParquetEnvelopeReader(readFn, closeFn, fileStat.size);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
33
|
static async openBuffer(buffer: Buffer): Promise<ParquetEnvelopeReader> {
|
|
45
34
|
const readFn = (position: number, length: number) =>
|
|
46
35
|
Promise.resolve(buffer.slice(position, position + length));
|
|
@@ -53,22 +53,6 @@ export class ParquetReader<T> implements AsyncIterable<T> {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* Open the parquet file pointed to by the specified path and return a new
|
|
58
|
-
* parquet reader
|
|
59
|
-
*/
|
|
60
|
-
static async openFile<T>(filePath: string): Promise<ParquetReader<T>> {
|
|
61
|
-
const envelopeReader = await ParquetEnvelopeReader.openFile(filePath);
|
|
62
|
-
try {
|
|
63
|
-
await envelopeReader.readHeader();
|
|
64
|
-
const metadata = await envelopeReader.readFooter();
|
|
65
|
-
return new ParquetReader<T>(metadata, envelopeReader);
|
|
66
|
-
} catch (err) {
|
|
67
|
-
await envelopeReader.close();
|
|
68
|
-
throw err;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
56
|
static async openBuffer<T>(buffer: Buffer): Promise<ParquetReader<T>> {
|
|
73
57
|
const envelopeReader = await ParquetEnvelopeReader.openBuffer(buffer);
|
|
74
58
|
try {
|
|
@@ -14,55 +14,6 @@ export interface WriteStreamOptions {
|
|
|
14
14
|
start?: number;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export function fopen(filePath: string): Promise<number> {
|
|
18
|
-
return new Promise((resolve, reject) => {
|
|
19
|
-
fs.open(filePath, 'r', (err, fd) => {
|
|
20
|
-
if (err) {
|
|
21
|
-
reject(err);
|
|
22
|
-
} else {
|
|
23
|
-
resolve(fd);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function fstat(filePath: string): Promise<fs.Stats> {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
fs.stat(filePath, (err, stat) => {
|
|
32
|
-
if (err) {
|
|
33
|
-
reject(err);
|
|
34
|
-
} else {
|
|
35
|
-
resolve(stat);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function fread(fd: number, position: number, length: number): Promise<Buffer> {
|
|
42
|
-
const buffer = Buffer.alloc(length);
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
fs.read(fd, buffer, 0, length, position, (err, bytesRead, buf) => {
|
|
45
|
-
if (err || bytesRead !== length) {
|
|
46
|
-
reject(err || Error('read failed'));
|
|
47
|
-
} else {
|
|
48
|
-
resolve(buf);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function fclose(fd: number): Promise<void> {
|
|
55
|
-
return new Promise((resolve, reject) => {
|
|
56
|
-
fs.close(fd, (err) => {
|
|
57
|
-
if (err) {
|
|
58
|
-
reject(err);
|
|
59
|
-
} else {
|
|
60
|
-
resolve();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
17
|
export function oswrite(os: Writable, buf: Buffer): Promise<void> {
|
|
67
18
|
return new Promise((resolve, reject) => {
|
|
68
19
|
os.write(buf, (err) => {
|