UNPKG

parquets

Version:

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

87 lines 3.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* 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 */ const thrift = require("thrift"); const TimeUnit = require("./TimeUnit"); class TimestampType { constructor(args) { if (args != null && args.isAdjustedToUTC != null) { this.isAdjustedToUTC = args.isAdjustedToUTC; } else { throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[isAdjustedToUTC] is unset!"); } if (args != null && args.unit != null) { this.unit = args.unit; } else { throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[unit] is unset!"); } } write(output) { output.writeStructBegin("TimestampType"); if (this.isAdjustedToUTC != null) { output.writeFieldBegin("isAdjustedToUTC", thrift.Thrift.Type.BOOL, 1); output.writeBool(this.isAdjustedToUTC); output.writeFieldEnd(); } if (this.unit != null) { output.writeFieldBegin("unit", thrift.Thrift.Type.STRUCT, 2); this.unit.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; } static read(input) { input.readStructBegin(); let _args = {}; while (true) { const ret = input.readFieldBegin(); const fieldType = ret.ftype; const fieldId = ret.fid; if (fieldType === thrift.Thrift.Type.STOP) { break; } switch (fieldId) { case 1: if (fieldType === thrift.Thrift.Type.BOOL) { const value_1 = input.readBool(); _args.isAdjustedToUTC = value_1; } else { input.skip(fieldType); } break; case 2: if (fieldType === thrift.Thrift.Type.STRUCT) { const value_2 = TimeUnit.TimeUnit.read(input); _args.unit = value_2; } else { input.skip(fieldType); } break; default: { input.skip(fieldType); } } input.readFieldEnd(); } input.readStructEnd(); if (_args.isAdjustedToUTC !== undefined && _args.unit !== undefined) { return new TimestampType(_args); } else { throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Unable to read TimestampType from input"); } } } exports.TimestampType = TimestampType; //# sourceMappingURL=TimestampType.js.map