nopala
Version:
Impala and Hive client for Nodejs
580 lines (567 loc) • 17.7 kB
JavaScript
//
// 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 Status_ttypes = require('./Status_types');
var Types_ttypes = require('./Types_types');
var ttypes = module.exports = {};
ttypes.TExecState = {
'REGISTERED' : 0,
'PLANNING' : 1,
'QUEUED' : 2,
'RUNNING' : 3,
'FINISHED' : 4,
'CANCELLED' : 5,
'FAILED' : 6
};
var TExecStats = module.exports.TExecStats = function(args) {
this.latency_ns = null;
this.cpu_time_ns = null;
this.cardinality = null;
this.memory_used = null;
if (args) {
if (args.latency_ns !== undefined && args.latency_ns !== null) {
this.latency_ns = args.latency_ns;
}
if (args.cpu_time_ns !== undefined && args.cpu_time_ns !== null) {
this.cpu_time_ns = args.cpu_time_ns;
}
if (args.cardinality !== undefined && args.cardinality !== null) {
this.cardinality = args.cardinality;
}
if (args.memory_used !== undefined && args.memory_used !== null) {
this.memory_used = args.memory_used;
}
}
};
TExecStats.prototype = {};
TExecStats.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.I64) {
this.latency_ns = input.readI64();
} else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.I64) {
this.cpu_time_ns = input.readI64();
} else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.I64) {
this.cardinality = input.readI64();
} else {
input.skip(ftype);
}
break;
case 4:
if (ftype == Thrift.Type.I64) {
this.memory_used = input.readI64();
} else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
TExecStats.prototype.write = function(output) {
output.writeStructBegin('TExecStats');
if (this.latency_ns !== null && this.latency_ns !== undefined) {
output.writeFieldBegin('latency_ns', Thrift.Type.I64, 1);
output.writeI64(this.latency_ns);
output.writeFieldEnd();
}
if (this.cpu_time_ns !== null && this.cpu_time_ns !== undefined) {
output.writeFieldBegin('cpu_time_ns', Thrift.Type.I64, 2);
output.writeI64(this.cpu_time_ns);
output.writeFieldEnd();
}
if (this.cardinality !== null && this.cardinality !== undefined) {
output.writeFieldBegin('cardinality', Thrift.Type.I64, 3);
output.writeI64(this.cardinality);
output.writeFieldEnd();
}
if (this.memory_used !== null && this.memory_used !== undefined) {
output.writeFieldBegin('memory_used', Thrift.Type.I64, 4);
output.writeI64(this.memory_used);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var TPlanNodeExecSummary = module.exports.TPlanNodeExecSummary = function(args) {
this.node_id = null;
this.fragment_idx = null;
this.label = null;
this.label_detail = null;
this.num_children = null;
this.estimated_stats = null;
this.exec_stats = null;
this.is_broadcast = null;
if (args) {
if (args.node_id !== undefined && args.node_id !== null) {
this.node_id = args.node_id;
} else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field node_id is unset!');
}
if (args.fragment_idx !== undefined && args.fragment_idx !== null) {
this.fragment_idx = args.fragment_idx;
} else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field fragment_idx is unset!');
}
if (args.label !== undefined && args.label !== null) {
this.label = args.label;
} else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field label is unset!');
}
if (args.label_detail !== undefined && args.label_detail !== null) {
this.label_detail = args.label_detail;
}
if (args.num_children !== undefined && args.num_children !== null) {
this.num_children = args.num_children;
} else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field num_children is unset!');
}
if (args.estimated_stats !== undefined && args.estimated_stats !== null) {
this.estimated_stats = new ttypes.TExecStats(args.estimated_stats);
}
if (args.exec_stats !== undefined && args.exec_stats !== null) {
this.exec_stats = Thrift.copyList(args.exec_stats, [ttypes.TExecStats]);
}
if (args.is_broadcast !== undefined && args.is_broadcast !== null) {
this.is_broadcast = args.is_broadcast;
}
}
};
TPlanNodeExecSummary.prototype = {};
TPlanNodeExecSummary.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.node_id = input.readI32();
} else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.I32) {
this.fragment_idx = input.readI32();
} else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.STRING) {
this.label = input.readString();
} else {
input.skip(ftype);
}
break;
case 4:
if (ftype == Thrift.Type.STRING) {
this.label_detail = 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.STRUCT) {
this.estimated_stats = new ttypes.TExecStats();
this.estimated_stats.read(input);
} else {
input.skip(ftype);
}
break;
case 7:
if (ftype == Thrift.Type.LIST) {
this.exec_stats = [];
var _rtmp31 = input.readListBegin();
var _size0 = _rtmp31.size || 0;
for (var _i2 = 0; _i2 < _size0; ++_i2) {
var elem3 = null;
elem3 = new ttypes.TExecStats();
elem3.read(input);
this.exec_stats.push(elem3);
}
input.readListEnd();
} else {
input.skip(ftype);
}
break;
case 8:
if (ftype == Thrift.Type.BOOL) {
this.is_broadcast = input.readBool();
} else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
TPlanNodeExecSummary.prototype.write = function(output) {
output.writeStructBegin('TPlanNodeExecSummary');
if (this.node_id !== null && this.node_id !== undefined) {
output.writeFieldBegin('node_id', Thrift.Type.I32, 1);
output.writeI32(this.node_id);
output.writeFieldEnd();
}
if (this.fragment_idx !== null && this.fragment_idx !== undefined) {
output.writeFieldBegin('fragment_idx', Thrift.Type.I32, 2);
output.writeI32(this.fragment_idx);
output.writeFieldEnd();
}
if (this.label !== null && this.label !== undefined) {
output.writeFieldBegin('label', Thrift.Type.STRING, 3);
output.writeString(this.label);
output.writeFieldEnd();
}
if (this.label_detail !== null && this.label_detail !== undefined) {
output.writeFieldBegin('label_detail', Thrift.Type.STRING, 4);
output.writeString(this.label_detail);
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.estimated_stats !== null && this.estimated_stats !== undefined) {
output.writeFieldBegin('estimated_stats', Thrift.Type.STRUCT, 6);
this.estimated_stats.write(output);
output.writeFieldEnd();
}
if (this.exec_stats !== null && this.exec_stats !== undefined) {
output.writeFieldBegin('exec_stats', Thrift.Type.LIST, 7);
output.writeListBegin(Thrift.Type.STRUCT, this.exec_stats.length);
for (var iter4 in this.exec_stats) {
if (this.exec_stats.hasOwnProperty(iter4)) {
iter4 = this.exec_stats[iter4];
iter4.write(output);
}
}
output.writeListEnd();
output.writeFieldEnd();
}
if (this.is_broadcast !== null && this.is_broadcast !== undefined) {
output.writeFieldBegin('is_broadcast', Thrift.Type.BOOL, 8);
output.writeBool(this.is_broadcast);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var TExecProgress = module.exports.TExecProgress = function(args) {
this.total_scan_ranges = null;
this.num_completed_scan_ranges = null;
if (args) {
if (args.total_scan_ranges !== undefined && args.total_scan_ranges !== null) {
this.total_scan_ranges = args.total_scan_ranges;
}
if (args.num_completed_scan_ranges !== undefined && args.num_completed_scan_ranges !== null) {
this.num_completed_scan_ranges = args.num_completed_scan_ranges;
}
}
};
TExecProgress.prototype = {};
TExecProgress.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.I64) {
this.total_scan_ranges = input.readI64();
} else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.I64) {
this.num_completed_scan_ranges = input.readI64();
} else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
TExecProgress.prototype.write = function(output) {
output.writeStructBegin('TExecProgress');
if (this.total_scan_ranges !== null && this.total_scan_ranges !== undefined) {
output.writeFieldBegin('total_scan_ranges', Thrift.Type.I64, 1);
output.writeI64(this.total_scan_ranges);
output.writeFieldEnd();
}
if (this.num_completed_scan_ranges !== null && this.num_completed_scan_ranges !== undefined) {
output.writeFieldBegin('num_completed_scan_ranges', Thrift.Type.I64, 2);
output.writeI64(this.num_completed_scan_ranges);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};
var TExecSummary = module.exports.TExecSummary = function(args) {
this.state = null;
this.status = null;
this.nodes = null;
this.exch_to_sender_map = null;
this.error_logs = null;
this.progress = null;
this.is_queued = null;
this.queued_reason = null;
if (args) {
if (args.state !== undefined && args.state !== null) {
this.state = args.state;
} else {
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field state is unset!');
}
if (args.status !== undefined && args.status !== null) {
this.status = new Status_ttypes.TStatus(args.status);
}
if (args.nodes !== undefined && args.nodes !== null) {
this.nodes = Thrift.copyList(args.nodes, [ttypes.TPlanNodeExecSummary]);
}
if (args.exch_to_sender_map !== undefined && args.exch_to_sender_map !== null) {
this.exch_to_sender_map = Thrift.copyMap(args.exch_to_sender_map, [null]);
}
if (args.error_logs !== undefined && args.error_logs !== null) {
this.error_logs = Thrift.copyList(args.error_logs, [null]);
}
if (args.progress !== undefined && args.progress !== null) {
this.progress = new ttypes.TExecProgress(args.progress);
}
if (args.is_queued !== undefined && args.is_queued !== null) {
this.is_queued = args.is_queued;
}
if (args.queued_reason !== undefined && args.queued_reason !== null) {
this.queued_reason = args.queued_reason;
}
}
};
TExecSummary.prototype = {};
TExecSummary.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.state = input.readI32();
} else {
input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRUCT) {
this.status = new Status_ttypes.TStatus();
this.status.read(input);
} else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.LIST) {
this.nodes = [];
var _rtmp36 = input.readListBegin();
var _size5 = _rtmp36.size || 0;
for (var _i7 = 0; _i7 < _size5; ++_i7) {
var elem8 = null;
elem8 = new ttypes.TPlanNodeExecSummary();
elem8.read(input);
this.nodes.push(elem8);
}
input.readListEnd();
} else {
input.skip(ftype);
}
break;
case 4:
if (ftype == Thrift.Type.MAP) {
this.exch_to_sender_map = {};
var _rtmp310 = input.readMapBegin();
var _size9 = _rtmp310.size || 0;
for (var _i11 = 0; _i11 < _size9; ++_i11) {
var key12 = null;
var val13 = null;
key12 = input.readI32();
val13 = input.readI32();
this.exch_to_sender_map[key12] = val13;
}
input.readMapEnd();
} else {
input.skip(ftype);
}
break;
case 5:
if (ftype == Thrift.Type.LIST) {
this.error_logs = [];
var _rtmp315 = input.readListBegin();
var _size14 = _rtmp315.size || 0;
for (var _i16 = 0; _i16 < _size14; ++_i16) {
var elem17 = null;
elem17 = input.readString();
this.error_logs.push(elem17);
}
input.readListEnd();
} else {
input.skip(ftype);
}
break;
case 6:
if (ftype == Thrift.Type.STRUCT) {
this.progress = new ttypes.TExecProgress();
this.progress.read(input);
} else {
input.skip(ftype);
}
break;
case 7:
if (ftype == Thrift.Type.BOOL) {
this.is_queued = input.readBool();
} else {
input.skip(ftype);
}
break;
case 8:
if (ftype == Thrift.Type.STRING) {
this.queued_reason = input.readString();
} else {
input.skip(ftype);
}
break;
default:
input.skip(ftype);
}
input.readFieldEnd();
}
input.readStructEnd();
return;
};
TExecSummary.prototype.write = function(output) {
output.writeStructBegin('TExecSummary');
if (this.state !== null && this.state !== undefined) {
output.writeFieldBegin('state', Thrift.Type.I32, 1);
output.writeI32(this.state);
output.writeFieldEnd();
}
if (this.status !== null && this.status !== undefined) {
output.writeFieldBegin('status', Thrift.Type.STRUCT, 2);
this.status.write(output);
output.writeFieldEnd();
}
if (this.nodes !== null && this.nodes !== undefined) {
output.writeFieldBegin('nodes', Thrift.Type.LIST, 3);
output.writeListBegin(Thrift.Type.STRUCT, this.nodes.length);
for (var iter18 in this.nodes) {
if (this.nodes.hasOwnProperty(iter18)) {
iter18 = this.nodes[iter18];
iter18.write(output);
}
}
output.writeListEnd();
output.writeFieldEnd();
}
if (this.exch_to_sender_map !== null && this.exch_to_sender_map !== undefined) {
output.writeFieldBegin('exch_to_sender_map', Thrift.Type.MAP, 4);
output.writeMapBegin(Thrift.Type.I32, Thrift.Type.I32, Thrift.objectLength(this.exch_to_sender_map));
for (var kiter19 in this.exch_to_sender_map) {
if (this.exch_to_sender_map.hasOwnProperty(kiter19)) {
var viter20 = this.exch_to_sender_map[kiter19];
output.writeI32(kiter19);
output.writeI32(viter20);
}
}
output.writeMapEnd();
output.writeFieldEnd();
}
if (this.error_logs !== null && this.error_logs !== undefined) {
output.writeFieldBegin('error_logs', Thrift.Type.LIST, 5);
output.writeListBegin(Thrift.Type.STRING, this.error_logs.length);
for (var iter21 in this.error_logs) {
if (this.error_logs.hasOwnProperty(iter21)) {
iter21 = this.error_logs[iter21];
output.writeString(iter21);
}
}
output.writeListEnd();
output.writeFieldEnd();
}
if (this.progress !== null && this.progress !== undefined) {
output.writeFieldBegin('progress', Thrift.Type.STRUCT, 6);
this.progress.write(output);
output.writeFieldEnd();
}
if (this.is_queued !== null && this.is_queued !== undefined) {
output.writeFieldBegin('is_queued', Thrift.Type.BOOL, 7);
output.writeBool(this.is_queued);
output.writeFieldEnd();
}
if (this.queued_reason !== null && this.queued_reason !== undefined) {
output.writeFieldBegin('queued_reason', Thrift.Type.STRING, 8);
output.writeString(this.queued_reason);
output.writeFieldEnd();
}
output.writeFieldStop();
output.writeStructEnd();
return;
};