parquets
Version:
TypeScript implementation of the Parquet file format, based on parquet.js
122 lines (121 loc) • 3.98 kB
text/typescript
/* 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";
export interface IPageLocationArgs {
offset: number | Int64;
compressed_page_size: number;
first_row_index: number | Int64;
}
export class PageLocation {
public offset: Int64;
public compressed_page_size: number;
public first_row_index: Int64;
constructor(args: IPageLocationArgs) {
if (args != null && args.offset != null) {
if (typeof args.offset === "number") {
this.offset = new Int64(args.offset);
}
else {
this.offset = args.offset;
}
}
else {
throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[offset] is unset!");
}
if (args != null && args.compressed_page_size != null) {
this.compressed_page_size = args.compressed_page_size;
}
else {
throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[compressed_page_size] is unset!");
}
if (args != null && args.first_row_index != null) {
if (typeof args.first_row_index === "number") {
this.first_row_index = new Int64(args.first_row_index);
}
else {
this.first_row_index = args.first_row_index;
}
}
else {
throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[first_row_index] is unset!");
}
}
public write(output: thrift.TProtocol): void {
output.writeStructBegin("PageLocation");
if (this.offset != null) {
output.writeFieldBegin("offset", thrift.Thrift.Type.I64, 1);
output.writeI64(this.offset);
output.writeFieldEnd();
}
if (this.compressed_page_size != null) {
output.writeFieldBegin("compressed_page_size", thrift.Thrift.Type.I32, 2);
output.writeI32(this.compressed_page_size);
output.writeFieldEnd();
}
if (this.first_row_index != null) {
output.writeFieldBegin("first_row_index", thrift.Thrift.Type.I64, 3);
output.writeI64(this.first_row_index);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
}
public static read(input: thrift.TProtocol): PageLocation {
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.I64) {
const value_1: Int64 = input.readI64();
_args.offset = value_1;
}
else {
input.skip(fieldType);
}
break;
case 2:
if (fieldType === thrift.Thrift.Type.I32) {
const value_2: number = input.readI32();
_args.compressed_page_size = value_2;
}
else {
input.skip(fieldType);
}
break;
case 3:
if (fieldType === thrift.Thrift.Type.I64) {
const value_3: Int64 = input.readI64();
_args.first_row_index = value_3;
}
else {
input.skip(fieldType);
}
break;
default: {
input.skip(fieldType);
}
}
input.readFieldEnd();
}
input.readStructEnd();
if (_args.offset !== undefined && _args.compressed_page_size !== undefined && _args.first_row_index !== undefined) {
return new PageLocation(_args);
}
else {
throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Unable to read PageLocation from input");
}
}
}