UNPKG

parquets

Version:

TypeScript implementation of the Parquet file format, based on parquet.js

198 lines (197 loc) 6.51 kB
/* tslint:disable */ /* eslint-disable */ /* * Autogenerated by @creditkarma/thrift-typescript v3.7.2 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ import Int64 = require("node-int64"); import * as thrift from "thrift"; import * as ColumnMetaData from "./ColumnMetaData"; export interface IColumnChunkArgs { file_path?: string; file_offset: number | Int64; meta_data?: ColumnMetaData.ColumnMetaData; offset_index_offset?: number | Int64; offset_index_length?: number; column_index_offset?: number | Int64; column_index_length?: number; } export class ColumnChunk { public file_path?: string; public file_offset: Int64; public meta_data?: ColumnMetaData.ColumnMetaData; public offset_index_offset?: Int64; public offset_index_length?: number; public column_index_offset?: Int64; public column_index_length?: number; constructor(args: IColumnChunkArgs) { if (args != null && args.file_path != null) { this.file_path = args.file_path; } if (args != null && args.file_offset != null) { if (typeof args.file_offset === "number") { this.file_offset = new Int64(args.file_offset); } else { this.file_offset = args.file_offset; } } else { throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[file_offset] is unset!"); } if (args != null && args.meta_data != null) { this.meta_data = args.meta_data; } if (args != null && args.offset_index_offset != null) { if (typeof args.offset_index_offset === "number") { this.offset_index_offset = new Int64(args.offset_index_offset); } else { this.offset_index_offset = args.offset_index_offset; } } if (args != null && args.offset_index_length != null) { this.offset_index_length = args.offset_index_length; } if (args != null && args.column_index_offset != null) { if (typeof args.column_index_offset === "number") { this.column_index_offset = new Int64(args.column_index_offset); } else { this.column_index_offset = args.column_index_offset; } } if (args != null && args.column_index_length != null) { this.column_index_length = args.column_index_length; } } public write(output: thrift.TProtocol): void { output.writeStructBegin("ColumnChunk"); if (this.file_path != null) { output.writeFieldBegin("file_path", thrift.Thrift.Type.STRING, 1); output.writeString(this.file_path); output.writeFieldEnd(); } if (this.file_offset != null) { output.writeFieldBegin("file_offset", thrift.Thrift.Type.I64, 2); output.writeI64(this.file_offset); output.writeFieldEnd(); } if (this.meta_data != null) { output.writeFieldBegin("meta_data", thrift.Thrift.Type.STRUCT, 3); this.meta_data.write(output); output.writeFieldEnd(); } if (this.offset_index_offset != null) { output.writeFieldBegin("offset_index_offset", thrift.Thrift.Type.I64, 4); output.writeI64(this.offset_index_offset); output.writeFieldEnd(); } if (this.offset_index_length != null) { output.writeFieldBegin("offset_index_length", thrift.Thrift.Type.I32, 5); output.writeI32(this.offset_index_length); output.writeFieldEnd(); } if (this.column_index_offset != null) { output.writeFieldBegin("column_index_offset", thrift.Thrift.Type.I64, 6); output.writeI64(this.column_index_offset); output.writeFieldEnd(); } if (this.column_index_length != null) { output.writeFieldBegin("column_index_length", thrift.Thrift.Type.I32, 7); output.writeI32(this.column_index_length); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } public static read(input: thrift.TProtocol): ColumnChunk { input.readStructBegin(); let _args: any = {}; while (true) { const ret: thrift.TField = input.readFieldBegin(); const fieldType: thrift.Thrift.Type = ret.ftype; const fieldId: number = ret.fid; if (fieldType === thrift.Thrift.Type.STOP) { break; } switch (fieldId) { case 1: if (fieldType === thrift.Thrift.Type.STRING) { const value_1: string = input.readString(); _args.file_path = value_1; } else { input.skip(fieldType); } break; case 2: if (fieldType === thrift.Thrift.Type.I64) { const value_2: Int64 = input.readI64(); _args.file_offset = value_2; } else { input.skip(fieldType); } break; case 3: if (fieldType === thrift.Thrift.Type.STRUCT) { const value_3: ColumnMetaData.ColumnMetaData = ColumnMetaData.ColumnMetaData.read(input); _args.meta_data = value_3; } else { input.skip(fieldType); } break; case 4: if (fieldType === thrift.Thrift.Type.I64) { const value_4: Int64 = input.readI64(); _args.offset_index_offset = value_4; } else { input.skip(fieldType); } break; case 5: if (fieldType === thrift.Thrift.Type.I32) { const value_5: number = input.readI32(); _args.offset_index_length = value_5; } else { input.skip(fieldType); } break; case 6: if (fieldType === thrift.Thrift.Type.I64) { const value_6: Int64 = input.readI64(); _args.column_index_offset = value_6; } else { input.skip(fieldType); } break; case 7: if (fieldType === thrift.Thrift.Type.I32) { const value_7: number = input.readI32(); _args.column_index_length = value_7; } else { input.skip(fieldType); } break; default: { input.skip(fieldType); } } input.readFieldEnd(); } input.readStructEnd(); if (_args.file_offset !== undefined) { return new ColumnChunk(_args); } else { throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Unable to read ColumnChunk from input"); } } }