parquets
Version:
TypeScript implementation of the Parquet file format, based on parquet.js
242 lines (241 loc) • 7.67 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 * as thrift from "thrift";
import * as ConvertedType from "./ConvertedType";
import * as FieldRepetitionType from "./FieldRepetitionType";
import * as LogicalType from "./LogicalType";
import * as Type from "./Type";
export interface ISchemaElementArgs {
type?: Type.Type;
type_length?: number;
repetition_type?: FieldRepetitionType.FieldRepetitionType;
name: string;
num_children?: number;
converted_type?: ConvertedType.ConvertedType;
scale?: number;
precision?: number;
field_id?: number;
logicalType?: LogicalType.LogicalType;
}
export class SchemaElement {
public type?: Type.Type;
public type_length?: number;
public repetition_type?: FieldRepetitionType.FieldRepetitionType;
public name: string;
public num_children?: number;
public converted_type?: ConvertedType.ConvertedType;
public scale?: number;
public precision?: number;
public field_id?: number;
public logicalType?: LogicalType.LogicalType;
constructor(args: ISchemaElementArgs) {
if (args != null && args.type != null) {
this.type = args.type;
}
if (args != null && args.type_length != null) {
this.type_length = args.type_length;
}
if (args != null && args.repetition_type != null) {
this.repetition_type = args.repetition_type;
}
if (args != null && args.name != null) {
this.name = args.name;
}
else {
throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[name] is unset!");
}
if (args != null && args.num_children != null) {
this.num_children = args.num_children;
}
if (args != null && args.converted_type != null) {
this.converted_type = args.converted_type;
}
if (args != null && args.scale != null) {
this.scale = args.scale;
}
if (args != null && args.precision != null) {
this.precision = args.precision;
}
if (args != null && args.field_id != null) {
this.field_id = args.field_id;
}
if (args != null && args.logicalType != null) {
this.logicalType = args.logicalType;
}
}
public write(output: thrift.TProtocol): void {
output.writeStructBegin("SchemaElement");
if (this.type != null) {
output.writeFieldBegin("type", thrift.Thrift.Type.I32, 1);
output.writeI32(this.type);
output.writeFieldEnd();
}
if (this.type_length != null) {
output.writeFieldBegin("type_length", thrift.Thrift.Type.I32, 2);
output.writeI32(this.type_length);
output.writeFieldEnd();
}
if (this.repetition_type != null) {
output.writeFieldBegin("repetition_type", thrift.Thrift.Type.I32, 3);
output.writeI32(this.repetition_type);
output.writeFieldEnd();
}
if (this.name != null) {
output.writeFieldBegin("name", thrift.Thrift.Type.STRING, 4);
output.writeString(this.name);
output.writeFieldEnd();
}
if (this.num_children != null) {
output.writeFieldBegin("num_children", thrift.Thrift.Type.I32, 5);
output.writeI32(this.num_children);
output.writeFieldEnd();
}
if (this.converted_type != null) {
output.writeFieldBegin("converted_type", thrift.Thrift.Type.I32, 6);
output.writeI32(this.converted_type);
output.writeFieldEnd();
}
if (this.scale != null) {
output.writeFieldBegin("scale", thrift.Thrift.Type.I32, 7);
output.writeI32(this.scale);
output.writeFieldEnd();
}
if (this.precision != null) {
output.writeFieldBegin("precision", thrift.Thrift.Type.I32, 8);
output.writeI32(this.precision);
output.writeFieldEnd();
}
if (this.field_id != null) {
output.writeFieldBegin("field_id", thrift.Thrift.Type.I32, 9);
output.writeI32(this.field_id);
output.writeFieldEnd();
}
if (this.logicalType != null) {
output.writeFieldBegin("logicalType", thrift.Thrift.Type.STRUCT, 10);
this.logicalType.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
}
public static read(input: thrift.TProtocol): SchemaElement {
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.I32) {
const value_1: Type.Type = input.readI32();
_args.type = value_1;
}
else {
input.skip(fieldType);
}
break;
case 2:
if (fieldType === thrift.Thrift.Type.I32) {
const value_2: number = input.readI32();
_args.type_length = value_2;
}
else {
input.skip(fieldType);
}
break;
case 3:
if (fieldType === thrift.Thrift.Type.I32) {
const value_3: FieldRepetitionType.FieldRepetitionType = input.readI32();
_args.repetition_type = value_3;
}
else {
input.skip(fieldType);
}
break;
case 4:
if (fieldType === thrift.Thrift.Type.STRING) {
const value_4: string = input.readString();
_args.name = value_4;
}
else {
input.skip(fieldType);
}
break;
case 5:
if (fieldType === thrift.Thrift.Type.I32) {
const value_5: number = input.readI32();
_args.num_children = value_5;
}
else {
input.skip(fieldType);
}
break;
case 6:
if (fieldType === thrift.Thrift.Type.I32) {
const value_6: ConvertedType.ConvertedType = input.readI32();
_args.converted_type = value_6;
}
else {
input.skip(fieldType);
}
break;
case 7:
if (fieldType === thrift.Thrift.Type.I32) {
const value_7: number = input.readI32();
_args.scale = value_7;
}
else {
input.skip(fieldType);
}
break;
case 8:
if (fieldType === thrift.Thrift.Type.I32) {
const value_8: number = input.readI32();
_args.precision = value_8;
}
else {
input.skip(fieldType);
}
break;
case 9:
if (fieldType === thrift.Thrift.Type.I32) {
const value_9: number = input.readI32();
_args.field_id = value_9;
}
else {
input.skip(fieldType);
}
break;
case 10:
if (fieldType === thrift.Thrift.Type.STRUCT) {
const value_10: LogicalType.LogicalType = LogicalType.LogicalType.read(input);
_args.logicalType = value_10;
}
else {
input.skip(fieldType);
}
break;
default: {
input.skip(fieldType);
}
}
input.readFieldEnd();
}
input.readStructEnd();
if (_args.name !== undefined) {
return new SchemaElement(_args);
}
else {
throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Unable to read SchemaElement from input");
}
}
}