@dsnp/parquetjs
Version:
fully asynchronous, pure JavaScript implementation of the Parquet file format
1,570 lines (1,569 loc) • 152 kB
JavaScript
//
// Autogenerated by Thrift Compiler (0.18.1)
//
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
//
"use strict";
var thrift = require('thrift');
var Thrift = thrift.Thrift;
var Q = thrift.Q;
var Int64 = require('node-int64');
var ttypes = module.exports = {};
ttypes.Type = {
'BOOLEAN': 0,
'INT32': 1,
'INT64': 2,
'INT96': 3,
'FLOAT': 4,
'DOUBLE': 5,
'BYTE_ARRAY': 6,
'FIXED_LEN_BYTE_ARRAY': 7
};
ttypes.ConvertedType = {
'UTF8': 0,
'MAP': 1,
'MAP_KEY_VALUE': 2,
'LIST': 3,
'ENUM': 4,
'DECIMAL': 5,
'DATE': 6,
'TIME_MILLIS': 7,
'TIME_MICROS': 8,
'TIMESTAMP_MILLIS': 9,
'TIMESTAMP_MICROS': 10,
'UINT_8': 11,
'UINT_16': 12,
'UINT_32': 13,
'UINT_64': 14,
'INT_8': 15,
'INT_16': 16,
'INT_32': 17,
'INT_64': 18,
'JSON': 19,
'BSON': 20,
'INTERVAL': 21
};
ttypes.FieldRepetitionType = {
'REQUIRED': 0,
'OPTIONAL': 1,
'REPEATED': 2
};
ttypes.Encoding = {
'PLAIN': 0,
'PLAIN_DICTIONARY': 2,
'RLE': 3,
'BIT_PACKED': 4,
'DELTA_BINARY_PACKED': 5,
'DELTA_LENGTH_BYTE_ARRAY': 6,
'DELTA_BYTE_ARRAY': 7,
'RLE_DICTIONARY': 8,
'BYTE_STREAM_SPLIT': 9
};
ttypes.CompressionCodec = {
'UNCOMPRESSED': 0,
'SNAPPY': 1,
'GZIP': 2,
'LZO': 3,
'BROTLI': 4,
'LZ4': 5,
'ZSTD': 6,
'LZ4_RAW': 7
};
ttypes.PageType = {
'DATA_PAGE': 0,
'INDEX_PAGE': 1,
'DICTIONARY_PAGE': 2,
'DATA_PAGE_V2': 3
};
ttypes.BoundaryOrder = {
'UNORDERED': 0,
'ASCENDING': 1,
'DESCENDING': 2
};
var Statistics = module.exports.Statistics = function (args) {
this.max = null;
this.min = null;
this.null_count = null;
this.distinct_count = null;
this.max_value = null;
this.min_value = null;
if (args) {
if (args.max !== undefined && args.max !== null) {
this.max = args.max;
}
if (args.min !== undefined && args.min !== null) {
this.min = args.min;
}
if (args.null_count !== undefined && args.null_count !== null) {
this.null_count = args.null_count;
}
if (args.distinct_count !== undefined && args.distinct_count !== null) {
this.distinct_count = args.distinct_count;
}
if (args.max_value !== undefined && args.max_value !== null) {
this.max_value = args.max_value;
}
if (args.min_value !== undefined && args.min_value !== null) {
this.min_value = args.min_value;
}
}
};
Statistics.prototype = {};
Statistics.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.STRING) {
this.max = input.readBinary();
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRING) {
this.min = input.readBinary();
}
else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.I64) {
this.null_count = input.readI64();
}
else {
input.skip(ftype);
}
break;
case 4:
if (ftype == Thrift.Type.I64) {
this.distinct_count = input.readI64();
}
else {
input.skip(ftype);
}
break;
case 5:
if (ftype == Thrift.Type.STRING) {
this.max_value = input.readBinary();
}
else {
input.skip(ftype);
}
break;
case 6:
if (ftype == Thrift.Type.STRING) {
this.min_value = input.readBinary();
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
Statistics.prototype.write = function (output) {
output.writeStructBegin('Statistics');
if (this.max !== null && this.max !== undefined) {
output.writeFieldBegin('max', Thrift.Type.STRING, 1);
output.writeBinary(this.max);
output.writeFieldEnd();
}
if (this.min !== null && this.min !== undefined) {
output.writeFieldBegin('min', Thrift.Type.STRING, 2);
output.writeBinary(this.min);
output.writeFieldEnd();
}
if (this.null_count !== null && this.null_count !== undefined) {
output.writeFieldBegin('null_count', Thrift.Type.I64, 3);
output.writeI64(this.null_count);
output.writeFieldEnd();
}
if (this.distinct_count !== null && this.distinct_count !== undefined) {
output.writeFieldBegin('distinct_count', Thrift.Type.I64, 4);
output.writeI64(this.distinct_count);
output.writeFieldEnd();
}
if (this.max_value !== null && this.max_value !== undefined) {
output.writeFieldBegin('max_value', Thrift.Type.STRING, 5);
output.writeBinary(this.max_value);
output.writeFieldEnd();
}
if (this.min_value !== null && this.min_value !== undefined) {
output.writeFieldBegin('min_value', Thrift.Type.STRING, 6);
output.writeBinary(this.min_value);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var StringType = module.exports.StringType = function (args) {
};
StringType.prototype = {};
StringType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
StringType.prototype.write = function (output) {
output.writeStructBegin('StringType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var UUIDType = module.exports.UUIDType = function (args) {
};
UUIDType.prototype = {};
UUIDType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
UUIDType.prototype.write = function (output) {
output.writeStructBegin('UUIDType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var MapType = module.exports.MapType = function (args) {
};
MapType.prototype = {};
MapType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
MapType.prototype.write = function (output) {
output.writeStructBegin('MapType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var ListType = module.exports.ListType = function (args) {
};
ListType.prototype = {};
ListType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
ListType.prototype.write = function (output) {
output.writeStructBegin('ListType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var EnumType = module.exports.EnumType = function (args) {
};
EnumType.prototype = {};
EnumType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
EnumType.prototype.write = function (output) {
output.writeStructBegin('EnumType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var DateType = module.exports.DateType = function (args) {
};
DateType.prototype = {};
DateType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
DateType.prototype.write = function (output) {
output.writeStructBegin('DateType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var NullType = module.exports.NullType = function (args) {
};
NullType.prototype = {};
NullType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
NullType.prototype.write = function (output) {
output.writeStructBegin('NullType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var DecimalType = module.exports.DecimalType = function (args) {
this.scale = null;
this.precision = null;
if (args) {
if (args.scale !== undefined && args.scale !== null) {
this.scale = args.scale;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field scale is unset!');
}
if (args.precision !== undefined && args.precision !== null) {
this.precision = args.precision;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field precision is unset!');
}
}
};
DecimalType.prototype = {};
DecimalType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.I32) {
this.scale = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.I32) {
this.precision = input.readI32();
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
DecimalType.prototype.write = function (output) {
output.writeStructBegin('DecimalType');
if (this.scale !== null && this.scale !== undefined) {
output.writeFieldBegin('scale', Thrift.Type.I32, 1);
output.writeI32(this.scale);
output.writeFieldEnd();
}
if (this.precision !== null && this.precision !== undefined) {
output.writeFieldBegin('precision', Thrift.Type.I32, 2);
output.writeI32(this.precision);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var MilliSeconds = module.exports.MilliSeconds = function (args) {
};
MilliSeconds.prototype = {};
MilliSeconds.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
MilliSeconds.prototype.write = function (output) {
output.writeStructBegin('MilliSeconds');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var MicroSeconds = module.exports.MicroSeconds = function (args) {
};
MicroSeconds.prototype = {};
MicroSeconds.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
MicroSeconds.prototype.write = function (output) {
output.writeStructBegin('MicroSeconds');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var NanoSeconds = module.exports.NanoSeconds = function (args) {
};
NanoSeconds.prototype = {};
NanoSeconds.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
NanoSeconds.prototype.write = function (output) {
output.writeStructBegin('NanoSeconds');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var TimeUnit = module.exports.TimeUnit = function (args) {
this.MILLIS = null;
this.MICROS = null;
this.NANOS = null;
if (args) {
if (args.MILLIS !== undefined && args.MILLIS !== null) {
this.MILLIS = new ttypes.MilliSeconds(args.MILLIS);
}
if (args.MICROS !== undefined && args.MICROS !== null) {
this.MICROS = new ttypes.MicroSeconds(args.MICROS);
}
if (args.NANOS !== undefined && args.NANOS !== null) {
this.NANOS = new ttypes.NanoSeconds(args.NANOS);
}
}
};
TimeUnit.prototype = {};
TimeUnit.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.STRUCT) {
this.MILLIS = new ttypes.MilliSeconds();
this.MILLIS.read(input);
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRUCT) {
this.MICROS = new ttypes.MicroSeconds();
this.MICROS.read(input);
}
else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.STRUCT) {
this.NANOS = new ttypes.NanoSeconds();
this.NANOS.read(input);
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
TimeUnit.prototype.write = function (output) {
output.writeStructBegin('TimeUnit');
if (this.MILLIS !== null && this.MILLIS !== undefined) {
output.writeFieldBegin('MILLIS', Thrift.Type.STRUCT, 1);
this.MILLIS.write(output);
output.writeFieldEnd();
}
if (this.MICROS !== null && this.MICROS !== undefined) {
output.writeFieldBegin('MICROS', Thrift.Type.STRUCT, 2);
this.MICROS.write(output);
output.writeFieldEnd();
}
if (this.NANOS !== null && this.NANOS !== undefined) {
output.writeFieldBegin('NANOS', Thrift.Type.STRUCT, 3);
this.NANOS.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var TimestampType = module.exports.TimestampType = function (args) {
this.isAdjustedToUTC = null;
this.unit = null;
if (args) {
if (args.isAdjustedToUTC !== undefined && args.isAdjustedToUTC !== null) {
this.isAdjustedToUTC = args.isAdjustedToUTC;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field isAdjustedToUTC is unset!');
}
if (args.unit !== undefined && args.unit !== null) {
this.unit = new ttypes.TimeUnit(args.unit);
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field unit is unset!');
}
}
};
TimestampType.prototype = {};
TimestampType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.BOOL) {
this.isAdjustedToUTC = input.readBool();
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRUCT) {
this.unit = new ttypes.TimeUnit();
this.unit.read(input);
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
TimestampType.prototype.write = function (output) {
output.writeStructBegin('TimestampType');
if (this.isAdjustedToUTC !== null && this.isAdjustedToUTC !== undefined) {
output.writeFieldBegin('isAdjustedToUTC', Thrift.Type.BOOL, 1);
output.writeBool(this.isAdjustedToUTC);
output.writeFieldEnd();
}
if (this.unit !== null && this.unit !== undefined) {
output.writeFieldBegin('unit', Thrift.Type.STRUCT, 2);
this.unit.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var TimeType = module.exports.TimeType = function (args) {
this.isAdjustedToUTC = null;
this.unit = null;
if (args) {
if (args.isAdjustedToUTC !== undefined && args.isAdjustedToUTC !== null) {
this.isAdjustedToUTC = args.isAdjustedToUTC;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field isAdjustedToUTC is unset!');
}
if (args.unit !== undefined && args.unit !== null) {
this.unit = new ttypes.TimeUnit(args.unit);
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field unit is unset!');
}
}
};
TimeType.prototype = {};
TimeType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.BOOL) {
this.isAdjustedToUTC = input.readBool();
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRUCT) {
this.unit = new ttypes.TimeUnit();
this.unit.read(input);
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
TimeType.prototype.write = function (output) {
output.writeStructBegin('TimeType');
if (this.isAdjustedToUTC !== null && this.isAdjustedToUTC !== undefined) {
output.writeFieldBegin('isAdjustedToUTC', Thrift.Type.BOOL, 1);
output.writeBool(this.isAdjustedToUTC);
output.writeFieldEnd();
}
if (this.unit !== null && this.unit !== undefined) {
output.writeFieldBegin('unit', Thrift.Type.STRUCT, 2);
this.unit.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var IntType = module.exports.IntType = function (args) {
this.bitWidth = null;
this.isSigned = null;
if (args) {
if (args.bitWidth !== undefined && args.bitWidth !== null) {
this.bitWidth = args.bitWidth;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field bitWidth is unset!');
}
if (args.isSigned !== undefined && args.isSigned !== null) {
this.isSigned = args.isSigned;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field isSigned is unset!');
}
}
};
IntType.prototype = {};
IntType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.BYTE) {
this.bitWidth = input.readByte();
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.BOOL) {
this.isSigned = input.readBool();
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
IntType.prototype.write = function (output) {
output.writeStructBegin('IntType');
if (this.bitWidth !== null && this.bitWidth !== undefined) {
output.writeFieldBegin('bitWidth', Thrift.Type.BYTE, 1);
output.writeByte(this.bitWidth);
output.writeFieldEnd();
}
if (this.isSigned !== null && this.isSigned !== undefined) {
output.writeFieldBegin('isSigned', Thrift.Type.BOOL, 2);
output.writeBool(this.isSigned);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var JsonType = module.exports.JsonType = function (args) {
};
JsonType.prototype = {};
JsonType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
JsonType.prototype.write = function (output) {
output.writeStructBegin('JsonType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var BsonType = module.exports.BsonType = function (args) {
};
BsonType.prototype = {};
BsonType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
BsonType.prototype.write = function (output) {
output.writeStructBegin('BsonType');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var LogicalType = module.exports.LogicalType = function (args) {
this.STRING = null;
this.MAP = null;
this.LIST = null;
this.ENUM = null;
this.DECIMAL = null;
this.DATE = null;
this.TIME = null;
this.TIMESTAMP = null;
this.INTEGER = null;
this.UNKNOWN = null;
this.JSON = null;
this.BSON = null;
this.UUID = null;
if (args) {
if (args.STRING !== undefined && args.STRING !== null) {
this.STRING = new ttypes.StringType(args.STRING);
}
if (args.MAP !== undefined && args.MAP !== null) {
this.MAP = new ttypes.MapType(args.MAP);
}
if (args.LIST !== undefined && args.LIST !== null) {
this.LIST = new ttypes.ListType(args.LIST);
}
if (args.ENUM !== undefined && args.ENUM !== null) {
this.ENUM = new ttypes.EnumType(args.ENUM);
}
if (args.DECIMAL !== undefined && args.DECIMAL !== null) {
this.DECIMAL = new ttypes.DecimalType(args.DECIMAL);
}
if (args.DATE !== undefined && args.DATE !== null) {
this.DATE = new ttypes.DateType(args.DATE);
}
if (args.TIME !== undefined && args.TIME !== null) {
this.TIME = new ttypes.TimeType(args.TIME);
}
if (args.TIMESTAMP !== undefined && args.TIMESTAMP !== null) {
this.TIMESTAMP = new ttypes.TimestampType(args.TIMESTAMP);
}
if (args.INTEGER !== undefined && args.INTEGER !== null) {
this.INTEGER = new ttypes.IntType(args.INTEGER);
}
if (args.UNKNOWN !== undefined && args.UNKNOWN !== null) {
this.UNKNOWN = new ttypes.NullType(args.UNKNOWN);
}
if (args.JSON !== undefined && args.JSON !== null) {
this.JSON = new ttypes.JsonType(args.JSON);
}
if (args.BSON !== undefined && args.BSON !== null) {
this.BSON = new ttypes.BsonType(args.BSON);
}
if (args.UUID !== undefined && args.UUID !== null) {
this.UUID = new ttypes.UUIDType(args.UUID);
}
}
};
LogicalType.prototype = {};
LogicalType.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.STRUCT) {
this.STRING = new ttypes.StringType();
this.STRING.read(input);
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRUCT) {
this.MAP = new ttypes.MapType();
this.MAP.read(input);
}
else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.STRUCT) {
this.LIST = new ttypes.ListType();
this.LIST.read(input);
}
else {
input.skip(ftype);
}
break;
case 4:
if (ftype == Thrift.Type.STRUCT) {
this.ENUM = new ttypes.EnumType();
this.ENUM.read(input);
}
else {
input.skip(ftype);
}
break;
case 5:
if (ftype == Thrift.Type.STRUCT) {
this.DECIMAL = new ttypes.DecimalType();
this.DECIMAL.read(input);
}
else {
input.skip(ftype);
}
break;
case 6:
if (ftype == Thrift.Type.STRUCT) {
this.DATE = new ttypes.DateType();
this.DATE.read(input);
}
else {
input.skip(ftype);
}
break;
case 7:
if (ftype == Thrift.Type.STRUCT) {
this.TIME = new ttypes.TimeType();
this.TIME.read(input);
}
else {
input.skip(ftype);
}
break;
case 8:
if (ftype == Thrift.Type.STRUCT) {
this.TIMESTAMP = new ttypes.TimestampType();
this.TIMESTAMP.read(input);
}
else {
input.skip(ftype);
}
break;
case 10:
if (ftype == Thrift.Type.STRUCT) {
this.INTEGER = new ttypes.IntType();
this.INTEGER.read(input);
}
else {
input.skip(ftype);
}
break;
case 11:
if (ftype == Thrift.Type.STRUCT) {
this.UNKNOWN = new ttypes.NullType();
this.UNKNOWN.read(input);
}
else {
input.skip(ftype);
}
break;
case 12:
if (ftype == Thrift.Type.STRUCT) {
this.JSON = new ttypes.JsonType();
this.JSON.read(input);
}
else {
input.skip(ftype);
}
break;
case 13:
if (ftype == Thrift.Type.STRUCT) {
this.BSON = new ttypes.BsonType();
this.BSON.read(input);
}
else {
input.skip(ftype);
}
break;
case 14:
if (ftype == Thrift.Type.STRUCT) {
this.UUID = new ttypes.UUIDType();
this.UUID.read(input);
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
LogicalType.prototype.write = function (output) {
output.writeStructBegin('LogicalType');
if (this.STRING !== null && this.STRING !== undefined) {
output.writeFieldBegin('STRING', Thrift.Type.STRUCT, 1);
this.STRING.write(output);
output.writeFieldEnd();
}
if (this.MAP !== null && this.MAP !== undefined) {
output.writeFieldBegin('MAP', Thrift.Type.STRUCT, 2);
this.MAP.write(output);
output.writeFieldEnd();
}
if (this.LIST !== null && this.LIST !== undefined) {
output.writeFieldBegin('LIST', Thrift.Type.STRUCT, 3);
this.LIST.write(output);
output.writeFieldEnd();
}
if (this.ENUM !== null && this.ENUM !== undefined) {
output.writeFieldBegin('ENUM', Thrift.Type.STRUCT, 4);
this.ENUM.write(output);
output.writeFieldEnd();
}
if (this.DECIMAL !== null && this.DECIMAL !== undefined) {
output.writeFieldBegin('DECIMAL', Thrift.Type.STRUCT, 5);
this.DECIMAL.write(output);
output.writeFieldEnd();
}
if (this.DATE !== null && this.DATE !== undefined) {
output.writeFieldBegin('DATE', Thrift.Type.STRUCT, 6);
this.DATE.write(output);
output.writeFieldEnd();
}
if (this.TIME !== null && this.TIME !== undefined) {
output.writeFieldBegin('TIME', Thrift.Type.STRUCT, 7);
this.TIME.write(output);
output.writeFieldEnd();
}
if (this.TIMESTAMP !== null && this.TIMESTAMP !== undefined) {
output.writeFieldBegin('TIMESTAMP', Thrift.Type.STRUCT, 8);
this.TIMESTAMP.write(output);
output.writeFieldEnd();
}
if (this.INTEGER !== null && this.INTEGER !== undefined) {
output.writeFieldBegin('INTEGER', Thrift.Type.STRUCT, 10);
this.INTEGER.write(output);
output.writeFieldEnd();
}
if (this.UNKNOWN !== null && this.UNKNOWN !== undefined) {
output.writeFieldBegin('UNKNOWN', Thrift.Type.STRUCT, 11);
this.UNKNOWN.write(output);
output.writeFieldEnd();
}
if (this.JSON !== null && this.JSON !== undefined) {
output.writeFieldBegin('JSON', Thrift.Type.STRUCT, 12);
this.JSON.write(output);
output.writeFieldEnd();
}
if (this.BSON !== null && this.BSON !== undefined) {
output.writeFieldBegin('BSON', Thrift.Type.STRUCT, 13);
this.BSON.write(output);
output.writeFieldEnd();
}
if (this.UUID !== null && this.UUID !== undefined) {
output.writeFieldBegin('UUID', Thrift.Type.STRUCT, 14);
this.UUID.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var SchemaElement = module.exports.SchemaElement = function (args) {
this.type = null;
this.type_length = null;
this.repetition_type = null;
this.name = null;
this.num_children = null;
this.converted_type = null;
this.scale = null;
this.precision = null;
this.field_id = null;
this.logicalType = null;
if (args) {
if (args.type !== undefined && args.type !== null) {
this.type = args.type;
}
if (args.type_length !== undefined && args.type_length !== null) {
this.type_length = args.type_length;
}
if (args.repetition_type !== undefined && args.repetition_type !== null) {
this.repetition_type = args.repetition_type;
}
if (args.name !== undefined && args.name !== null) {
this.name = args.name;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field name is unset!');
}
if (args.num_children !== undefined && args.num_children !== null) {
this.num_children = args.num_children;
}
if (args.converted_type !== undefined && args.converted_type !== null) {
this.converted_type = args.converted_type;
}
if (args.scale !== undefined && args.scale !== null) {
this.scale = args.scale;
}
if (args.precision !== undefined && args.precision !== null) {
this.precision = args.precision;
}
if (args.field_id !== undefined && args.field_id !== null) {
this.field_id = args.field_id;
}
if (args.logicalType !== undefined && args.logicalType !== null) {
this.logicalType = new ttypes.LogicalType(args.logicalType);
}
}
};
SchemaElement.prototype = {};
SchemaElement.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.I32) {
this.type = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.I32) {
this.type_length = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.I32) {
this.repetition_type = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 4:
if (ftype == Thrift.Type.STRING) {
this.name = input.readString();
}
else {
input.skip(ftype);
}
break;
case 5:
if (ftype == Thrift.Type.I32) {
this.num_children = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 6:
if (ftype == Thrift.Type.I32) {
this.converted_type = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 7:
if (ftype == Thrift.Type.I32) {
this.scale = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 8:
if (ftype == Thrift.Type.I32) {
this.precision = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 9:
if (ftype == Thrift.Type.I32) {
this.field_id = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 10:
if (ftype == Thrift.Type.STRUCT) {
this.logicalType = new ttypes.LogicalType();
this.logicalType.read(input);
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
SchemaElement.prototype.write = function (output) {
output.writeStructBegin('SchemaElement');
if (this.type !== null && this.type !== undefined) {
output.writeFieldBegin('type', Thrift.Type.I32, 1);
output.writeI32(this.type);
output.writeFieldEnd();
}
if (this.type_length !== null && this.type_length !== undefined) {
output.writeFieldBegin('type_length', Thrift.Type.I32, 2);
output.writeI32(this.type_length);
output.writeFieldEnd();
}
if (this.repetition_type !== null && this.repetition_type !== undefined) {
output.writeFieldBegin('repetition_type', Thrift.Type.I32, 3);
output.writeI32(this.repetition_type);
output.writeFieldEnd();
}
if (this.name !== null && this.name !== undefined) {
output.writeFieldBegin('name', Thrift.Type.STRING, 4);
output.writeString(this.name);
output.writeFieldEnd();
}
if (this.num_children !== null && this.num_children !== undefined) {
output.writeFieldBegin('num_children', Thrift.Type.I32, 5);
output.writeI32(this.num_children);
output.writeFieldEnd();
}
if (this.converted_type !== null && this.converted_type !== undefined) {
output.writeFieldBegin('converted_type', Thrift.Type.I32, 6);
output.writeI32(this.converted_type);
output.writeFieldEnd();
}
if (this.scale !== null && this.scale !== undefined) {
output.writeFieldBegin('scale', Thrift.Type.I32, 7);
output.writeI32(this.scale);
output.writeFieldEnd();
}
if (this.precision !== null && this.precision !== undefined) {
output.writeFieldBegin('precision', Thrift.Type.I32, 8);
output.writeI32(this.precision);
output.writeFieldEnd();
}
if (this.field_id !== null && this.field_id !== undefined) {
output.writeFieldBegin('field_id', Thrift.Type.I32, 9);
output.writeI32(this.field_id);
output.writeFieldEnd();
}
if (this.logicalType !== null && this.logicalType !== undefined) {
output.writeFieldBegin('logicalType', Thrift.Type.STRUCT, 10);
this.logicalType.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var DataPageHeader = module.exports.DataPageHeader = function (args) {
this.num_values = null;
this.encoding = null;
this.definition_level_encoding = null;
this.repetition_level_encoding = null;
this.statistics = null;
if (args) {
if (args.num_values !== undefined && args.num_values !== null) {
this.num_values = args.num_values;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field num_values is unset!');
}
if (args.encoding !== undefined && args.encoding !== null) {
this.encoding = args.encoding;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field encoding is unset!');
}
if (args.definition_level_encoding !== undefined && args.definition_level_encoding !== null) {
this.definition_level_encoding = args.definition_level_encoding;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field definition_level_encoding is unset!');
}
if (args.repetition_level_encoding !== undefined && args.repetition_level_encoding !== null) {
this.repetition_level_encoding = args.repetition_level_encoding;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field repetition_level_encoding is unset!');
}
if (args.statistics !== undefined && args.statistics !== null) {
this.statistics = new ttypes.Statistics(args.statistics);
}
}
};
DataPageHeader.prototype = {};
DataPageHeader.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.I32) {
this.num_values = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.I32) {
this.encoding = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.I32) {
this.definition_level_encoding = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 4:
if (ftype == Thrift.Type.I32) {
this.repetition_level_encoding = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 5:
if (ftype == Thrift.Type.STRUCT) {
this.statistics = new ttypes.Statistics();
this.statistics.read(input);
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
DataPageHeader.prototype.write = function (output) {
output.writeStructBegin('DataPageHeader');
if (this.num_values !== null && this.num_values !== undefined) {
output.writeFieldBegin('num_values', Thrift.Type.I32, 1);
output.writeI32(this.num_values);
output.writeFieldEnd();
}
if (this.encoding !== null && this.encoding !== undefined) {
output.writeFieldBegin('encoding', Thrift.Type.I32, 2);
output.writeI32(this.encoding);
output.writeFieldEnd();
}
if (this.definition_level_encoding !== null && this.definition_level_encoding !== undefined) {
output.writeFieldBegin('definition_level_encoding', Thrift.Type.I32, 3);
output.writeI32(this.definition_level_encoding);
output.writeFieldEnd();
}
if (this.repetition_level_encoding !== null && this.repetition_level_encoding !== undefined) {
output.writeFieldBegin('repetition_level_encoding', Thrift.Type.I32, 4);
output.writeI32(this.repetition_level_encoding);
output.writeFieldEnd();
}
if (this.statistics !== null && this.statistics !== undefined) {
output.writeFieldBegin('statistics', Thrift.Type.STRUCT, 5);
this.statistics.write(output);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var IndexPageHeader = module.exports.IndexPageHeader = function (args) {
};
IndexPageHeader.prototype = {};
IndexPageHeader.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
if (ftype == Thrift.Type.STOP) {
break;
}
input.skip(ftype);
input.readFieldEnd();
}
input.readStructEnd();
return;
};
IndexPageHeader.prototype.write = function (output) {
output.writeStructBegin('IndexPageHeader');
output.writeFieldStop();
output.writeStructEnd();
return;
};
var DictionaryPageHeader = module.exports.DictionaryPageHeader = function (args) {
this.num_values = null;
this.encoding = null;
this.is_sorted = null;
if (args) {
if (args.num_values !== undefined && args.num_values !== null) {
this.num_values = args.num_values;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field num_values is unset!');
}
if (args.encoding !== undefined && args.encoding !== null) {
this.encoding = args.encoding;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field encoding is unset!');
}
if (args.is_sorted !== undefined && args.is_sorted !== null) {
this.is_sorted = args.is_sorted;
}
}
};
DictionaryPageHeader.prototype = {};
DictionaryPageHeader.prototype.read = function (input) {
input.readStructBegin();
while (true) {
var ret = input.readFieldBegin();
var ftype = ret.ftype;
var fid = ret.fid;
if (ftype == Thrift.Type.STOP) {
break;
}
switch (fid) {
case 1:
if (ftype == Thrift.Type.I32) {
this.num_values = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.I32) {
this.encoding = input.readI32();
}
else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.BOOL) {
this.is_sorted = input.readBool();
}
else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
DictionaryPageHeader.prototype.write = function (output) {
output.writeStructBegin('DictionaryPageHeader');
if (this.num_values !== null && this.num_values !== undefined) {
output.writeFieldBegin('num_values', Thrift.Type.I32, 1);
output.writeI32(this.num_values);
output.writeFieldEnd();
}
if (this.encoding !== null && this.encoding !== undefined) {
output.writeFieldBegin('encoding', Thrift.Type.I32, 2);
output.writeI32(this.encoding);
output.writeFieldEnd();
}
if (this.is_sorted !== null && this.is_sorted !== undefined) {
output.writeFieldBegin('is_sorted', Thrift.Type.BOOL, 3);
output.writeBool(this.is_sorted);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var DataPageHeaderV2 = module.exports.DataPageHeaderV2 = function (args) {
this.num_values = null;
this.num_nulls = null;
this.num_rows = null;
this.encoding = null;
this.definition_levels_byte_length = null;
this.repetition_levels_byte_length = null;
this.is_compressed = true;
this.statistics = null;
if (args) {
if (args.num_values !== undefined && args.num_values !== null) {
this.num_values = args.num_values;
}
else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field num_values is unset!');
}
if (args.num_nulls !== undefined && args.num_nulls !== null) {