UNPKG

nopala

Version:

Impala and Hive client for Nodejs

1,530 lines (1,468 loc) 46.8 kB
// // Autogenerated by Thrift Compiler (0.12.0) // // 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 ExecStats_ttypes = require('./ExecStats_types'); var Status_ttypes = require('./Status_types'); var Types_ttypes = require('./Types_types'); var beeswax_ttypes = require('./beeswax_types'); var TCLIService_ttypes = require('./TCLIService_types'); var RuntimeProfile_ttypes = require('./RuntimeProfile_types'); var BeeswaxService = require('./BeeswaxService'); var BeeswaxServiceClient = BeeswaxService.Client; var BeeswaxServiceProcessor = BeeswaxService.Processor; var ttypes = require('./ImpalaService_types'); //HELPER FUNCTIONS AND STRUCTURES var ImpalaService_Cancel_args = function(args) { this.query_id = null; if (args) { if (args.query_id !== undefined && args.query_id !== null) { this.query_id = new beeswax_ttypes.QueryHandle(args.query_id); } } }; ImpalaService_Cancel_args.prototype = {}; ImpalaService_Cancel_args.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.query_id = new beeswax_ttypes.QueryHandle(); this.query_id.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_Cancel_args.prototype.write = function(output) { output.writeStructBegin('ImpalaService_Cancel_args'); if (this.query_id !== null && this.query_id !== undefined) { output.writeFieldBegin('query_id', Thrift.Type.STRUCT, 1); this.query_id.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_Cancel_result = function(args) { this.success = null; this.error = null; if (args instanceof beeswax_ttypes.BeeswaxException) { this.error = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new Status_ttypes.TStatus(args.success); } if (args.error !== undefined && args.error !== null) { this.error = args.error; } } }; ImpalaService_Cancel_result.prototype = {}; ImpalaService_Cancel_result.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 0: if (ftype == Thrift.Type.STRUCT) { this.success = new Status_ttypes.TStatus(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.error = new beeswax_ttypes.BeeswaxException(); this.error.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_Cancel_result.prototype.write = function(output) { output.writeStructBegin('ImpalaService_Cancel_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } if (this.error !== null && this.error !== undefined) { output.writeFieldBegin('error', Thrift.Type.STRUCT, 1); this.error.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_ResetCatalog_args = function(args) { }; ImpalaService_ResetCatalog_args.prototype = {}; ImpalaService_ResetCatalog_args.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; }; ImpalaService_ResetCatalog_args.prototype.write = function(output) { output.writeStructBegin('ImpalaService_ResetCatalog_args'); output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_ResetCatalog_result = function(args) { this.success = null; if (args) { if (args.success !== undefined && args.success !== null) { this.success = new Status_ttypes.TStatus(args.success); } } }; ImpalaService_ResetCatalog_result.prototype = {}; ImpalaService_ResetCatalog_result.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 0: if (ftype == Thrift.Type.STRUCT) { this.success = new Status_ttypes.TStatus(); this.success.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_ResetCatalog_result.prototype.write = function(output) { output.writeStructBegin('ImpalaService_ResetCatalog_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_ResetTable_args = function(args) { this.request = null; if (args) { if (args.request !== undefined && args.request !== null) { this.request = new ttypes.TResetTableReq(args.request); } } }; ImpalaService_ResetTable_args.prototype = {}; ImpalaService_ResetTable_args.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.request = new ttypes.TResetTableReq(); this.request.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_ResetTable_args.prototype.write = function(output) { output.writeStructBegin('ImpalaService_ResetTable_args'); if (this.request !== null && this.request !== undefined) { output.writeFieldBegin('request', Thrift.Type.STRUCT, 1); this.request.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_ResetTable_result = function(args) { this.success = null; if (args) { if (args.success !== undefined && args.success !== null) { this.success = new Status_ttypes.TStatus(args.success); } } }; ImpalaService_ResetTable_result.prototype = {}; ImpalaService_ResetTable_result.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 0: if (ftype == Thrift.Type.STRUCT) { this.success = new Status_ttypes.TStatus(); this.success.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_ResetTable_result.prototype.write = function(output) { output.writeStructBegin('ImpalaService_ResetTable_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_GetRuntimeProfile_args = function(args) { this.query_id = null; if (args) { if (args.query_id !== undefined && args.query_id !== null) { this.query_id = new beeswax_ttypes.QueryHandle(args.query_id); } } }; ImpalaService_GetRuntimeProfile_args.prototype = {}; ImpalaService_GetRuntimeProfile_args.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.query_id = new beeswax_ttypes.QueryHandle(); this.query_id.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_GetRuntimeProfile_args.prototype.write = function(output) { output.writeStructBegin('ImpalaService_GetRuntimeProfile_args'); if (this.query_id !== null && this.query_id !== undefined) { output.writeFieldBegin('query_id', Thrift.Type.STRUCT, 1); this.query_id.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_GetRuntimeProfile_result = function(args) { this.success = null; this.error = null; if (args instanceof beeswax_ttypes.BeeswaxException) { this.error = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = args.success; } if (args.error !== undefined && args.error !== null) { this.error = args.error; } } }; ImpalaService_GetRuntimeProfile_result.prototype = {}; ImpalaService_GetRuntimeProfile_result.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 0: if (ftype == Thrift.Type.STRING) { this.success = input.readString(); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.error = new beeswax_ttypes.BeeswaxException(); this.error.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_GetRuntimeProfile_result.prototype.write = function(output) { output.writeStructBegin('ImpalaService_GetRuntimeProfile_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRING, 0); output.writeString(this.success); output.writeFieldEnd(); } if (this.error !== null && this.error !== undefined) { output.writeFieldBegin('error', Thrift.Type.STRUCT, 1); this.error.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_CloseInsert_args = function(args) { this.handle = null; if (args) { if (args.handle !== undefined && args.handle !== null) { this.handle = new beeswax_ttypes.QueryHandle(args.handle); } } }; ImpalaService_CloseInsert_args.prototype = {}; ImpalaService_CloseInsert_args.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.handle = new beeswax_ttypes.QueryHandle(); this.handle.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_CloseInsert_args.prototype.write = function(output) { output.writeStructBegin('ImpalaService_CloseInsert_args'); if (this.handle !== null && this.handle !== undefined) { output.writeFieldBegin('handle', Thrift.Type.STRUCT, 1); this.handle.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_CloseInsert_result = function(args) { this.success = null; this.error = null; this.error2 = null; if (args instanceof beeswax_ttypes.QueryNotFoundException) { this.error = args; return; } if (args instanceof beeswax_ttypes.BeeswaxException) { this.error2 = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new ttypes.TInsertResult(args.success); } if (args.error !== undefined && args.error !== null) { this.error = args.error; } if (args.error2 !== undefined && args.error2 !== null) { this.error2 = args.error2; } } }; ImpalaService_CloseInsert_result.prototype = {}; ImpalaService_CloseInsert_result.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 0: if (ftype == Thrift.Type.STRUCT) { this.success = new ttypes.TInsertResult(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.error = new beeswax_ttypes.QueryNotFoundException(); this.error.read(input); } else { input.skip(ftype); } break; case 2: if (ftype == Thrift.Type.STRUCT) { this.error2 = new beeswax_ttypes.BeeswaxException(); this.error2.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_CloseInsert_result.prototype.write = function(output) { output.writeStructBegin('ImpalaService_CloseInsert_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } if (this.error !== null && this.error !== undefined) { output.writeFieldBegin('error', Thrift.Type.STRUCT, 1); this.error.write(output); output.writeFieldEnd(); } if (this.error2 !== null && this.error2 !== undefined) { output.writeFieldBegin('error2', Thrift.Type.STRUCT, 2); this.error2.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_PingImpalaService_args = function(args) { }; ImpalaService_PingImpalaService_args.prototype = {}; ImpalaService_PingImpalaService_args.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; }; ImpalaService_PingImpalaService_args.prototype.write = function(output) { output.writeStructBegin('ImpalaService_PingImpalaService_args'); output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_PingImpalaService_result = function(args) { this.success = null; if (args) { if (args.success !== undefined && args.success !== null) { this.success = new ttypes.TPingImpalaServiceResp(args.success); } } }; ImpalaService_PingImpalaService_result.prototype = {}; ImpalaService_PingImpalaService_result.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 0: if (ftype == Thrift.Type.STRUCT) { this.success = new ttypes.TPingImpalaServiceResp(); this.success.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_PingImpalaService_result.prototype.write = function(output) { output.writeStructBegin('ImpalaService_PingImpalaService_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_GetExecSummary_args = function(args) { this.handle = null; if (args) { if (args.handle !== undefined && args.handle !== null) { this.handle = new beeswax_ttypes.QueryHandle(args.handle); } } }; ImpalaService_GetExecSummary_args.prototype = {}; ImpalaService_GetExecSummary_args.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.handle = new beeswax_ttypes.QueryHandle(); this.handle.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_GetExecSummary_args.prototype.write = function(output) { output.writeStructBegin('ImpalaService_GetExecSummary_args'); if (this.handle !== null && this.handle !== undefined) { output.writeFieldBegin('handle', Thrift.Type.STRUCT, 1); this.handle.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaService_GetExecSummary_result = function(args) { this.success = null; this.error = null; this.error2 = null; if (args instanceof beeswax_ttypes.QueryNotFoundException) { this.error = args; return; } if (args instanceof beeswax_ttypes.BeeswaxException) { this.error2 = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new ExecStats_ttypes.TExecSummary(args.success); } if (args.error !== undefined && args.error !== null) { this.error = args.error; } if (args.error2 !== undefined && args.error2 !== null) { this.error2 = args.error2; } } }; ImpalaService_GetExecSummary_result.prototype = {}; ImpalaService_GetExecSummary_result.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 0: if (ftype == Thrift.Type.STRUCT) { this.success = new ExecStats_ttypes.TExecSummary(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.error = new beeswax_ttypes.QueryNotFoundException(); this.error.read(input); } else { input.skip(ftype); } break; case 2: if (ftype == Thrift.Type.STRUCT) { this.error2 = new beeswax_ttypes.BeeswaxException(); this.error2.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; ImpalaService_GetExecSummary_result.prototype.write = function(output) { output.writeStructBegin('ImpalaService_GetExecSummary_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } if (this.error !== null && this.error !== undefined) { output.writeFieldBegin('error', Thrift.Type.STRUCT, 1); this.error.write(output); output.writeFieldEnd(); } if (this.error2 !== null && this.error2 !== undefined) { output.writeFieldBegin('error2', Thrift.Type.STRUCT, 2); this.error2.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var ImpalaServiceClient = exports.Client = function(output, pClass) { this.output = output; this.pClass = pClass; this._seqid = 0; this._reqs = {}; }; Thrift.inherits(ImpalaServiceClient, BeeswaxServiceClient); ImpalaServiceClient.prototype.seqid = function() { return this._seqid; }; ImpalaServiceClient.prototype.new_seqid = function() { return this._seqid += 1; }; ImpalaServiceClient.prototype.Cancel = function(query_id, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_Cancel(query_id); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_Cancel(query_id); } }; ImpalaServiceClient.prototype.send_Cancel = function(query_id) { var output = new this.pClass(this.output); var params = { query_id: query_id }; var args = new ImpalaService_Cancel_args(params); try { output.writeMessageBegin('Cancel', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } }; ImpalaServiceClient.prototype.recv_Cancel = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new ImpalaService_Cancel_result(); result.read(input); input.readMessageEnd(); if (null !== result.error) { return callback(result.error); } if (null !== result.success) { return callback(null, result.success); } return callback('Cancel failed: unknown result'); }; ImpalaServiceClient.prototype.ResetCatalog = function(callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_ResetCatalog(); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_ResetCatalog(); } }; ImpalaServiceClient.prototype.send_ResetCatalog = function() { var output = new this.pClass(this.output); var args = new ImpalaService_ResetCatalog_args(); try { output.writeMessageBegin('ResetCatalog', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } }; ImpalaServiceClient.prototype.recv_ResetCatalog = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new ImpalaService_ResetCatalog_result(); result.read(input); input.readMessageEnd(); if (null !== result.success) { return callback(null, result.success); } return callback('ResetCatalog failed: unknown result'); }; ImpalaServiceClient.prototype.ResetTable = function(request, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_ResetTable(request); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_ResetTable(request); } }; ImpalaServiceClient.prototype.send_ResetTable = function(request) { var output = new this.pClass(this.output); var params = { request: request }; var args = new ImpalaService_ResetTable_args(params); try { output.writeMessageBegin('ResetTable', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } }; ImpalaServiceClient.prototype.recv_ResetTable = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new ImpalaService_ResetTable_result(); result.read(input); input.readMessageEnd(); if (null !== result.success) { return callback(null, result.success); } return callback('ResetTable failed: unknown result'); }; ImpalaServiceClient.prototype.GetRuntimeProfile = function(query_id, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_GetRuntimeProfile(query_id); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_GetRuntimeProfile(query_id); } }; ImpalaServiceClient.prototype.send_GetRuntimeProfile = function(query_id) { var output = new this.pClass(this.output); var params = { query_id: query_id }; var args = new ImpalaService_GetRuntimeProfile_args(params); try { output.writeMessageBegin('GetRuntimeProfile', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } }; ImpalaServiceClient.prototype.recv_GetRuntimeProfile = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new ImpalaService_GetRuntimeProfile_result(); result.read(input); input.readMessageEnd(); if (null !== result.error) { return callback(result.error); } if (null !== result.success) { return callback(null, result.success); } return callback('GetRuntimeProfile failed: unknown result'); }; ImpalaServiceClient.prototype.CloseInsert = function(handle, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_CloseInsert(handle); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_CloseInsert(handle); } }; ImpalaServiceClient.prototype.send_CloseInsert = function(handle) { var output = new this.pClass(this.output); var params = { handle: handle }; var args = new ImpalaService_CloseInsert_args(params); try { output.writeMessageBegin('CloseInsert', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } }; ImpalaServiceClient.prototype.recv_CloseInsert = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new ImpalaService_CloseInsert_result(); result.read(input); input.readMessageEnd(); if (null !== result.error) { return callback(result.error); } if (null !== result.error2) { return callback(result.error2); } if (null !== result.success) { return callback(null, result.success); } return callback('CloseInsert failed: unknown result'); }; ImpalaServiceClient.prototype.PingImpalaService = function(callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_PingImpalaService(); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_PingImpalaService(); } }; ImpalaServiceClient.prototype.send_PingImpalaService = function() { var output = new this.pClass(this.output); var args = new ImpalaService_PingImpalaService_args(); try { output.writeMessageBegin('PingImpalaService', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } }; ImpalaServiceClient.prototype.recv_PingImpalaService = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new ImpalaService_PingImpalaService_result(); result.read(input); input.readMessageEnd(); if (null !== result.success) { return callback(null, result.success); } return callback('PingImpalaService failed: unknown result'); }; ImpalaServiceClient.prototype.GetExecSummary = function(handle, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_GetExecSummary(handle); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_GetExecSummary(handle); } }; ImpalaServiceClient.prototype.send_GetExecSummary = function(handle) { var output = new this.pClass(this.output); var params = { handle: handle }; var args = new ImpalaService_GetExecSummary_args(params); try { output.writeMessageBegin('GetExecSummary', Thrift.MessageType.CALL, this.seqid()); args.write(output); output.writeMessageEnd(); return this.output.flush(); } catch (e) { delete this._reqs[this.seqid()]; if (typeof output.reset === 'function') { output.reset(); } throw e; } }; ImpalaServiceClient.prototype.recv_GetExecSummary = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new ImpalaService_GetExecSummary_result(); result.read(input); input.readMessageEnd(); if (null !== result.error) { return callback(result.error); } if (null !== result.error2) { return callback(result.error2); } if (null !== result.success) { return callback(null, result.success); } return callback('GetExecSummary failed: unknown result'); }; var ImpalaServiceProcessor = exports.Processor = function(handler) { this._handler = handler; }; Thrift.inherits(ImpalaServiceProcessor, BeeswaxServiceProcessor); ImpalaServiceProcessor.prototype.process = function(input, output) { var r = input.readMessageBegin(); if (this['process_' + r.fname]) { return this['process_' + r.fname].call(this, r.rseqid, input, output); } else { input.skip(Thrift.Type.STRUCT); input.readMessageEnd(); var x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname); output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid); x.write(output); output.writeMessageEnd(); output.flush(); } }; ImpalaServiceProcessor.prototype.process_Cancel = function(seqid, input, output) { var args = new ImpalaService_Cancel_args(); args.read(input); input.readMessageEnd(); if (this._handler.Cancel.length === 1) { Q.fcall(this._handler.Cancel.bind(this._handler), args.query_id ).then(function(result) { var result_obj = new ImpalaService_Cancel_result({success: result}); output.writeMessageBegin("Cancel", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(function (err) { var result; if (err instanceof beeswax_ttypes.BeeswaxException) { result = new ImpalaService_Cancel_result(err); output.writeMessageBegin("Cancel", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("Cancel", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.Cancel(args.query_id, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof beeswax_ttypes.BeeswaxException) { result_obj = new ImpalaService_Cancel_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("Cancel", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("Cancel", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; ImpalaServiceProcessor.prototype.process_ResetCatalog = function(seqid, input, output) { var args = new ImpalaService_ResetCatalog_args(); args.read(input); input.readMessageEnd(); if (this._handler.ResetCatalog.length === 0) { Q.fcall(this._handler.ResetCatalog.bind(this._handler) ).then(function(result) { var result_obj = new ImpalaService_ResetCatalog_result({success: result}); output.writeMessageBegin("ResetCatalog", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(function (err) { var result; result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("ResetCatalog", Thrift.MessageType.EXCEPTION, seqid); result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.ResetCatalog(function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined')) { result_obj = new ImpalaService_ResetCatalog_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("ResetCatalog", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("ResetCatalog", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; ImpalaServiceProcessor.prototype.process_ResetTable = function(seqid, input, output) { var args = new ImpalaService_ResetTable_args(); args.read(input); input.readMessageEnd(); if (this._handler.ResetTable.length === 1) { Q.fcall(this._handler.ResetTable.bind(this._handler), args.request ).then(function(result) { var result_obj = new ImpalaService_ResetTable_result({success: result}); output.writeMessageBegin("ResetTable", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(function (err) { var result; result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("ResetTable", Thrift.MessageType.EXCEPTION, seqid); result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.ResetTable(args.request, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined')) { result_obj = new ImpalaService_ResetTable_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("ResetTable", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("ResetTable", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; ImpalaServiceProcessor.prototype.process_GetRuntimeProfile = function(seqid, input, output) { var args = new ImpalaService_GetRuntimeProfile_args(); args.read(input); input.readMessageEnd(); if (this._handler.GetRuntimeProfile.length === 1) { Q.fcall(this._handler.GetRuntimeProfile.bind(this._handler), args.query_id ).then(function(result) { var result_obj = new ImpalaService_GetRuntimeProfile_result({success: result}); output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(function (err) { var result; if (err instanceof beeswax_ttypes.BeeswaxException) { result = new ImpalaService_GetRuntimeProfile_result(err); output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.GetRuntimeProfile(args.query_id, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof beeswax_ttypes.BeeswaxException) { result_obj = new ImpalaService_GetRuntimeProfile_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("GetRuntimeProfile", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; ImpalaServiceProcessor.prototype.process_CloseInsert = function(seqid, input, output) { var args = new ImpalaService_CloseInsert_args(); args.read(input); input.readMessageEnd(); if (this._handler.CloseInsert.length === 1) { Q.fcall(this._handler.CloseInsert.bind(this._handler), args.handle ).then(function(result) { var result_obj = new ImpalaService_CloseInsert_result({success: result}); output.writeMessageBegin("CloseInsert", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(function (err) { var result; if (err instanceof beeswax_ttypes.QueryNotFoundException || err instanceof beeswax_ttypes.BeeswaxException) { result = new ImpalaService_CloseInsert_result(err); output.writeMessageBegin("CloseInsert", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("CloseInsert", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.CloseInsert(args.handle, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof beeswax_ttypes.QueryNotFoundException || err instanceof beeswax_ttypes.BeeswaxException) { result_obj = new ImpalaService_CloseInsert_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("CloseInsert", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("CloseInsert", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; ImpalaServiceProcessor.prototype.process_PingImpalaService = function(seqid, input, output) { var args = new ImpalaService_PingImpalaService_args(); args.read(input); input.readMessageEnd(); if (this._handler.PingImpalaService.length === 0) { Q.fcall(this._handler.PingImpalaService.bind(this._handler) ).then(function(result) { var result_obj = new ImpalaService_PingImpalaService_result({success: result}); output.writeMessageBegin("PingImpalaService", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(function (err) { var result; result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("PingImpalaService", Thrift.MessageType.EXCEPTION, seqid); result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.PingImpalaService(function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined')) { result_obj = new ImpalaService_PingImpalaService_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("PingImpalaService", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("PingImpalaService", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; ImpalaServiceProcessor.prototype.process_GetExecSummary = function(seqid, input, output) { var args = new ImpalaService_GetExecSummary_args(); args.read(input); input.readMessageEnd(); if (this._handler.GetExecSummary.length === 1) { Q.fcall(this._handler.GetExecSummary.bind(this._handler), args.handle ).then(function(result) { var result_obj = new ImpalaService_GetExecSummary_result({success: result}); output.writeMessageBegin("GetExecSummary", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }).catch(function (err) { var result; if (err instanceof beeswax_ttypes.QueryNotFoundException || err instanceof beeswax_ttypes.BeeswaxException) { result = new ImpalaService_GetExecSummary_result(err); output.writeMessageBegin("GetExecSummary", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("GetExecSummary", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.GetExecSummary(args.handle, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof beeswax_ttypes.QueryNotFoundException || err instanceof beeswax_ttypes.BeeswaxException) { result_obj = new ImpalaService_GetExecSummary_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("GetExecSummary", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("GetExecSummary", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } };