Skip to content

Commit 14bbb97

Browse files
waylandliWayland LiWayland Li
authored
Convertinging util.js to typescript 3/3 (#39)
Converted util.js into typescript Co-authored-by: Wayland Li <[email protected]> Co-authored-by: Wayland Li <[email protected]>
1 parent f1bee25 commit 14bbb97

File tree

5 files changed

+149
-130
lines changed

5 files changed

+149
-130
lines changed

gen-nodejs/parquet_types.d.ts

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Autogenerated by Thrift Compiler (0.14.1)
2+
// Autogenerated by Thrift Compiler (0.16.0)
33
//
44
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
55
//
@@ -122,14 +122,14 @@ export declare enum BoundaryOrder {
122122
* All fields are optional.
123123
*/
124124
export declare class Statistics {
125-
max: string;
126-
min: string;
127-
null_count: Int64;
128-
distinct_count: Int64;
129-
max_value: string;
130-
min_value: string;
125+
max?: Buffer;
126+
min?: Buffer;
127+
null_count?: Int64;
128+
distinct_count?: Int64;
129+
max_value?: Buffer;
130+
min_value?: Buffer;
131131

132-
constructor(args?: { max?: string; min?: string; null_count?: Int64; distinct_count?: Int64; max_value?: string; min_value?: string; });
132+
constructor(args?: { max?: Buffer; min?: Buffer; null_count?: Int64; distinct_count?: Int64; max_value?: Buffer; min_value?: Buffer; });
133133
}
134134

135135
/**
@@ -191,9 +191,9 @@ export declare class NanoSeconds {
191191
}
192192

193193
export declare class TimeUnit {
194-
MILLIS: MilliSeconds;
195-
MICROS: MicroSeconds;
196-
NANOS: NanoSeconds;
194+
MILLIS?: MilliSeconds;
195+
MICROS?: MicroSeconds;
196+
NANOS?: NanoSeconds;
197197

198198
constructor(args?: { MILLIS?: MilliSeconds; MICROS?: MicroSeconds; NANOS?: NanoSeconds; });
199199
}
@@ -260,19 +260,19 @@ export declare class BsonType {
260260
* from the following table.
261261
*/
262262
export declare class LogicalType {
263-
STRING: StringType;
264-
MAP: MapType;
265-
LIST: ListType;
266-
ENUM: EnumType;
267-
DECIMAL: DecimalType;
268-
DATE: DateType;
269-
TIME: TimeType;
270-
TIMESTAMP: TimestampType;
271-
INTEGER: IntType;
272-
UNKNOWN: NullType;
273-
JSON: JsonType;
274-
BSON: BsonType;
275-
UUID: UUIDType;
263+
STRING?: StringType;
264+
MAP?: MapType;
265+
LIST?: ListType;
266+
ENUM?: EnumType;
267+
DECIMAL?: DecimalType;
268+
DATE?: DateType;
269+
TIME?: TimeType;
270+
TIMESTAMP?: TimestampType;
271+
INTEGER?: IntType;
272+
UNKNOWN?: NullType;
273+
JSON?: JsonType;
274+
BSON?: BsonType;
275+
UUID?: UUIDType;
276276

277277
constructor(args?: { STRING?: StringType; MAP?: MapType; LIST?: ListType; ENUM?: EnumType; DECIMAL?: DecimalType; DATE?: DateType; TIME?: TimeType; TIMESTAMP?: TimestampType; INTEGER?: IntType; UNKNOWN?: NullType; JSON?: JsonType; BSON?: BsonType; UUID?: UUIDType; });
278278
}
@@ -284,16 +284,16 @@ export declare class LogicalType {
284284
* the nodes are listed in depth first traversal order.
285285
*/
286286
export declare class SchemaElement {
287-
type: Type;
288-
type_length: number;
289-
repetition_type: FieldRepetitionType;
287+
type?: Type;
288+
type_length?: number;
289+
repetition_type?: FieldRepetitionType;
290290
name: string;
291-
num_children: number;
292-
converted_type: ConvertedType;
293-
scale: number;
294-
precision: number;
295-
field_id: number;
296-
logicalType: LogicalType;
291+
num_children?: number;
292+
converted_type?: ConvertedType;
293+
scale?: number;
294+
precision?: number;
295+
field_id?: number;
296+
logicalType?: LogicalType;
297297

298298
constructor(args?: { type?: Type; type_length?: number; repetition_type?: FieldRepetitionType; name: string; num_children?: number; converted_type?: ConvertedType; scale?: number; precision?: number; field_id?: number; logicalType?: LogicalType; });
299299
}
@@ -306,7 +306,7 @@ export declare class DataPageHeader {
306306
encoding: Encoding;
307307
definition_level_encoding: Encoding;
308308
repetition_level_encoding: Encoding;
309-
statistics: Statistics;
309+
statistics?: Statistics;
310310

311311
constructor(args?: { num_values: number; encoding: Encoding; definition_level_encoding: Encoding; repetition_level_encoding: Encoding; statistics?: Statistics; });
312312
}
@@ -317,7 +317,7 @@ export declare class IndexPageHeader {
317317
export declare class DictionaryPageHeader {
318318
num_values: number;
319319
encoding: Encoding;
320-
is_sorted: boolean;
320+
is_sorted?: boolean;
321321

322322
constructor(args?: { num_values: number; encoding: Encoding; is_sorted?: boolean; });
323323
}
@@ -335,8 +335,8 @@ export declare class DataPageHeaderV2 {
335335
encoding: Encoding;
336336
definition_levels_byte_length: number;
337337
repetition_levels_byte_length: number;
338-
is_compressed: boolean;
339-
statistics: Statistics;
338+
is_compressed?: boolean;
339+
statistics?: Statistics;
340340

341341
constructor(args?: { num_values: number; num_nulls: number; num_rows: number; encoding: Encoding; definition_levels_byte_length: number; repetition_levels_byte_length: number; is_compressed?: boolean; statistics?: Statistics; });
342342
}
@@ -351,7 +351,7 @@ export declare class SplitBlockAlgorithm {
351351
* The algorithm used in Bloom filter. *
352352
*/
353353
export declare class BloomFilterAlgorithm {
354-
BLOCK: SplitBlockAlgorithm;
354+
BLOCK?: SplitBlockAlgorithm;
355355

356356
constructor(args?: { BLOCK?: SplitBlockAlgorithm; });
357357
}
@@ -370,7 +370,7 @@ export declare class XxHash {
370370
*
371371
*/
372372
export declare class BloomFilterHash {
373-
XXHASH: XxHash;
373+
XXHASH?: XxHash;
374374

375375
constructor(args?: { XXHASH?: XxHash; });
376376
}
@@ -383,7 +383,7 @@ export declare class Uncompressed {
383383
}
384384

385385
export declare class BloomFilterCompression {
386-
UNCOMPRESSED: Uncompressed;
386+
UNCOMPRESSED?: Uncompressed;
387387

388388
constructor(args?: { UNCOMPRESSED?: Uncompressed; });
389389
}
@@ -406,11 +406,11 @@ export declare class PageHeader {
406406
type: PageType;
407407
uncompressed_page_size: number;
408408
compressed_page_size: number;
409-
crc: number;
410-
data_page_header: DataPageHeader;
411-
index_page_header: IndexPageHeader;
412-
dictionary_page_header: DictionaryPageHeader;
413-
data_page_header_v2: DataPageHeaderV2;
409+
crc?: number;
410+
data_page_header?: DataPageHeader;
411+
index_page_header?: IndexPageHeader;
412+
dictionary_page_header?: DictionaryPageHeader;
413+
data_page_header_v2?: DataPageHeaderV2;
414414

415415
constructor(args?: { type: PageType; uncompressed_page_size: number; compressed_page_size: number; crc?: number; data_page_header?: DataPageHeader; index_page_header?: IndexPageHeader; dictionary_page_header?: DictionaryPageHeader; data_page_header_v2?: DataPageHeaderV2; });
416416
}
@@ -420,7 +420,7 @@ export declare class PageHeader {
420420
*/
421421
export declare class KeyValue {
422422
key: string;
423-
value: string;
423+
value?: string;
424424

425425
constructor(args?: { key: string; value?: string; });
426426
}
@@ -458,13 +458,13 @@ export declare class ColumnMetaData {
458458
num_values: Int64;
459459
total_uncompressed_size: Int64;
460460
total_compressed_size: Int64;
461-
key_value_metadata: KeyValue[];
461+
key_value_metadata?: KeyValue[];
462462
data_page_offset: Int64;
463-
index_page_offset: Int64;
464-
dictionary_page_offset: Int64;
465-
statistics: Statistics;
466-
encoding_stats: PageEncodingStats[];
467-
bloom_filter_offset: Int64;
463+
index_page_offset?: Int64;
464+
dictionary_page_offset?: Int64;
465+
statistics?: Statistics;
466+
encoding_stats?: PageEncodingStats[];
467+
bloom_filter_offset?: Int64;
468468

469469
constructor(args?: { type: Type; encodings: Encoding[]; path_in_schema: string[]; codec: CompressionCodec; num_values: Int64; total_uncompressed_size: Int64; total_compressed_size: Int64; key_value_metadata?: KeyValue[]; data_page_offset: Int64; index_page_offset?: Int64; dictionary_page_offset?: Int64; statistics?: Statistics; encoding_stats?: PageEncodingStats[]; bloom_filter_offset?: Int64; });
470470
}
@@ -474,40 +474,40 @@ export declare class EncryptionWithFooterKey {
474474

475475
export declare class EncryptionWithColumnKey {
476476
path_in_schema: string[];
477-
key_metadata: string;
477+
key_metadata?: Buffer;
478478

479-
constructor(args?: { path_in_schema: string[]; key_metadata?: string; });
479+
constructor(args?: { path_in_schema: string[]; key_metadata?: Buffer; });
480480
}
481481

482482
export declare class ColumnCryptoMetaData {
483-
ENCRYPTION_WITH_FOOTER_KEY: EncryptionWithFooterKey;
484-
ENCRYPTION_WITH_COLUMN_KEY: EncryptionWithColumnKey;
483+
ENCRYPTION_WITH_FOOTER_KEY?: EncryptionWithFooterKey;
484+
ENCRYPTION_WITH_COLUMN_KEY?: EncryptionWithColumnKey;
485485

486486
constructor(args?: { ENCRYPTION_WITH_FOOTER_KEY?: EncryptionWithFooterKey; ENCRYPTION_WITH_COLUMN_KEY?: EncryptionWithColumnKey; });
487487
}
488488

489489
export declare class ColumnChunk {
490-
file_path: string;
490+
file_path?: string;
491491
file_offset: Int64;
492-
meta_data: ColumnMetaData;
493-
offset_index_offset: Int64;
494-
offset_index_length: number;
495-
column_index_offset: Int64;
496-
column_index_length: number;
497-
crypto_metadata: ColumnCryptoMetaData;
498-
encrypted_column_metadata: string;
492+
meta_data?: ColumnMetaData;
493+
offset_index_offset?: Int64;
494+
offset_index_length?: number;
495+
column_index_offset?: Int64;
496+
column_index_length?: number;
497+
crypto_metadata?: ColumnCryptoMetaData;
498+
encrypted_column_metadata?: Buffer;
499499

500-
constructor(args?: { file_path?: string; file_offset: Int64; meta_data?: ColumnMetaData; offset_index_offset?: Int64; offset_index_length?: number; column_index_offset?: Int64; column_index_length?: number; crypto_metadata?: ColumnCryptoMetaData; encrypted_column_metadata?: string; });
500+
constructor(args?: { file_path?: string; file_offset: Int64; meta_data?: ColumnMetaData; offset_index_offset?: Int64; offset_index_length?: number; column_index_offset?: Int64; column_index_length?: number; crypto_metadata?: ColumnCryptoMetaData; encrypted_column_metadata?: Buffer; });
501501
}
502502

503503
export declare class RowGroup {
504504
columns: ColumnChunk[];
505505
total_byte_size: Int64;
506506
num_rows: Int64;
507-
sorting_columns: SortingColumn[];
508-
file_offset: Int64;
509-
total_compressed_size: Int64;
510-
ordinal: number;
507+
sorting_columns?: SortingColumn[];
508+
file_offset?: Int64;
509+
total_compressed_size?: Int64;
510+
ordinal?: number;
511511

512512
constructor(args?: { columns: ColumnChunk[]; total_byte_size: Int64; num_rows: Int64; sorting_columns?: SortingColumn[]; file_offset?: Int64; total_compressed_size?: Int64; ordinal?: number; });
513513
}
@@ -531,7 +531,7 @@ export declare class TypeDefinedOrder {
531531
* for this column should be ignored.
532532
*/
533533
export declare class ColumnOrder {
534-
TYPE_ORDER: TypeDefinedOrder;
534+
TYPE_ORDER?: TypeDefinedOrder;
535535

536536
constructor(args?: { TYPE_ORDER?: TypeDefinedOrder; });
537537
}
@@ -556,33 +556,33 @@ export declare class OffsetIndex {
556556
*/
557557
export declare class ColumnIndex {
558558
null_pages: boolean[];
559-
min_values: string[];
560-
max_values: string[];
559+
min_values: Buffer[];
560+
max_values: Buffer[];
561561
boundary_order: BoundaryOrder;
562-
null_counts: Int64[];
562+
null_counts?: Int64[];
563563

564-
constructor(args?: { null_pages: boolean[]; min_values: string[]; max_values: string[]; boundary_order: BoundaryOrder; null_counts?: Int64[]; });
564+
constructor(args?: { null_pages: boolean[]; min_values: Buffer[]; max_values: Buffer[]; boundary_order: BoundaryOrder; null_counts?: Int64[]; });
565565
}
566566

567567
export declare class AesGcmV1 {
568-
aad_prefix: string;
569-
aad_file_unique: string;
570-
supply_aad_prefix: boolean;
568+
aad_prefix?: Buffer;
569+
aad_file_unique?: Buffer;
570+
supply_aad_prefix?: boolean;
571571

572-
constructor(args?: { aad_prefix?: string; aad_file_unique?: string; supply_aad_prefix?: boolean; });
572+
constructor(args?: { aad_prefix?: Buffer; aad_file_unique?: Buffer; supply_aad_prefix?: boolean; });
573573
}
574574

575575
export declare class AesGcmCtrV1 {
576-
aad_prefix: string;
577-
aad_file_unique: string;
578-
supply_aad_prefix: boolean;
576+
aad_prefix?: Buffer;
577+
aad_file_unique?: Buffer;
578+
supply_aad_prefix?: boolean;
579579

580-
constructor(args?: { aad_prefix?: string; aad_file_unique?: string; supply_aad_prefix?: boolean; });
580+
constructor(args?: { aad_prefix?: Buffer; aad_file_unique?: Buffer; supply_aad_prefix?: boolean; });
581581
}
582582

583583
export declare class EncryptionAlgorithm {
584-
AES_GCM_V1: AesGcmV1;
585-
AES_GCM_CTR_V1: AesGcmCtrV1;
584+
AES_GCM_V1?: AesGcmV1;
585+
AES_GCM_CTR_V1?: AesGcmCtrV1;
586586

587587
constructor(args?: { AES_GCM_V1?: AesGcmV1; AES_GCM_CTR_V1?: AesGcmCtrV1; });
588588
}
@@ -595,21 +595,21 @@ export declare class FileMetaData {
595595
schema: SchemaElement[];
596596
num_rows: Int64;
597597
row_groups: RowGroup[];
598-
key_value_metadata: KeyValue[];
599-
created_by: string;
600-
column_orders: ColumnOrder[];
601-
encryption_algorithm: EncryptionAlgorithm;
602-
footer_signing_key_metadata: string;
598+
key_value_metadata?: KeyValue[];
599+
created_by?: string;
600+
column_orders?: ColumnOrder[];
601+
encryption_algorithm?: EncryptionAlgorithm;
602+
footer_signing_key_metadata?: Buffer;
603603

604-
constructor(args?: { version: number; schema: SchemaElement[]; num_rows: Int64; row_groups: RowGroup[]; key_value_metadata?: KeyValue[]; created_by?: string; column_orders?: ColumnOrder[]; encryption_algorithm?: EncryptionAlgorithm; footer_signing_key_metadata?: string; });
604+
constructor(args?: { version: number; schema: SchemaElement[]; num_rows: Int64; row_groups: RowGroup[]; key_value_metadata?: KeyValue[]; created_by?: string; column_orders?: ColumnOrder[]; encryption_algorithm?: EncryptionAlgorithm; footer_signing_key_metadata?: Buffer; });
605605
}
606606

607607
/**
608608
* Crypto metadata for files with encrypted footer *
609609
*/
610610
export declare class FileCryptoMetaData {
611611
encryption_algorithm: EncryptionAlgorithm;
612-
key_metadata: string;
612+
key_metadata?: Buffer;
613613

614-
constructor(args?: { encryption_algorithm: EncryptionAlgorithm; key_metadata?: string; });
614+
constructor(args?: { encryption_algorithm: EncryptionAlgorithm; key_metadata?: Buffer; });
615615
}

gen-nodejs/parquet_types.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bloomFilterIO/bloomFilterReader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import parquet_util from "../util";
1+
import * as parquet_util from "../util";
22
import parquet_thrift from "../../gen-nodejs/parquet_types";
33
import sbbf from "../bloom/sbbf";
44
import { ParquetEnvelopeReader } from "../reader"

lib/bloomFilterIO/bloomFilterWriter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import parquet_util from "../util";
1+
import * as parquet_util from "../util";
22
import parquet_thrift from "../../gen-nodejs/parquet_types";
33
import SplitBlockBloomFilter from "../bloom/sbbf";
44

0 commit comments

Comments
 (0)