Repository: hive Updated Branches: refs/heads/master b38544f69 -> 96c2fa86b
http://git-wip-us.apache.org/repos/asf/hive/blob/96c2fa86/service-rpc/src/gen/thrift/gen-php/TCLIService.php ---------------------------------------------------------------------- diff --git a/service-rpc/src/gen/thrift/gen-php/TCLIService.php b/service-rpc/src/gen/thrift/gen-php/TCLIService.php index c76b24c..313d79d 100644 --- a/service-rpc/src/gen/thrift/gen-php/TCLIService.php +++ b/service-rpc/src/gen/thrift/gen-php/TCLIService.php @@ -126,6 +126,11 @@ interface TCLIServiceIf { * @return \TGetQueryIdResp */ public function GetQueryId(\TGetQueryIdReq $req); + /** + * @param \TSetClientInfoReq $req + * @return \TSetClientInfoResp + */ + public function SetClientInfo(\TSetClientInfoReq $req); } class TCLIServiceClient implements \TCLIServiceIf { @@ -1261,6 +1266,57 @@ class TCLIServiceClient implements \TCLIServiceIf { throw new \Exception("GetQueryId failed: unknown result"); } + public function SetClientInfo(\TSetClientInfoReq $req) + { + $this->send_SetClientInfo($req); + return $this->recv_SetClientInfo(); + } + + public function send_SetClientInfo(\TSetClientInfoReq $req) + { + $args = new \TCLIService_SetClientInfo_args(); + $args->req = $req; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'SetClientInfo', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('SetClientInfo', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_SetClientInfo() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\TCLIService_SetClientInfo_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new \TCLIService_SetClientInfo_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("SetClientInfo failed: unknown result"); + } + } // HELPER FUNCTIONS AND STRUCTURES @@ -4785,4 +4841,164 @@ class TCLIService_GetQueryId_result { } +class TCLIService_SetClientInfo_args { + static $_TSPEC; + + /** + * @var \TSetClientInfoReq + */ + public $req = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'req', + 'type' => TType::STRUCT, + 'class' => '\TSetClientInfoReq', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['req'])) { + $this->req = $vals['req']; + } + } + } + + public function getName() { + return 'TCLIService_SetClientInfo_args'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRUCT) { + $this->req = new \TSetClientInfoReq(); + $xfer += $this->req->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('TCLIService_SetClientInfo_args'); + if ($this->req !== null) { + if (!is_object($this->req)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('req', TType::STRUCT, 1); + $xfer += $this->req->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TCLIService_SetClientInfo_result { + static $_TSPEC; + + /** + * @var \TSetClientInfoResp + */ + public $success = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRUCT, + 'class' => '\TSetClientInfoResp', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + } + } + + public function getName() { + return 'TCLIService_SetClientInfo_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 0: + if ($ftype == TType::STRUCT) { + $this->success = new \TSetClientInfoResp(); + $xfer += $this->success->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('TCLIService_SetClientInfo_result'); + if ($this->success !== null) { + if (!is_object($this->success)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0); + $xfer += $this->success->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + http://git-wip-us.apache.org/repos/asf/hive/blob/96c2fa86/service-rpc/src/gen/thrift/gen-php/Types.php ---------------------------------------------------------------------- diff --git a/service-rpc/src/gen/thrift/gen-php/Types.php b/service-rpc/src/gen/thrift/gen-php/Types.php index f450e8a..abb7c1f 100644 --- a/service-rpc/src/gen/thrift/gen-php/Types.php +++ b/service-rpc/src/gen/thrift/gen-php/Types.php @@ -4889,6 +4889,223 @@ class TOpenSessionResp { } +class TSetClientInfoReq { + static $_TSPEC; + + /** + * @var \TSessionHandle + */ + public $sessionHandle = null; + /** + * @var array + */ + public $configuration = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'sessionHandle', + 'type' => TType::STRUCT, + 'class' => '\TSessionHandle', + ), + 2 => array( + 'var' => 'configuration', + 'type' => TType::MAP, + 'ktype' => TType::STRING, + 'vtype' => TType::STRING, + 'key' => array( + 'type' => TType::STRING, + ), + 'val' => array( + 'type' => TType::STRING, + ), + ), + ); + } + if (is_array($vals)) { + if (isset($vals['sessionHandle'])) { + $this->sessionHandle = $vals['sessionHandle']; + } + if (isset($vals['configuration'])) { + $this->configuration = $vals['configuration']; + } + } + } + + public function getName() { + return 'TSetClientInfoReq'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRUCT) { + $this->sessionHandle = new \TSessionHandle(); + $xfer += $this->sessionHandle->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::MAP) { + $this->configuration = array(); + $_size143 = 0; + $_ktype144 = 0; + $_vtype145 = 0; + $xfer += $input->readMapBegin($_ktype144, $_vtype145, $_size143); + for ($_i147 = 0; $_i147 < $_size143; ++$_i147) + { + $key148 = ''; + $val149 = ''; + $xfer += $input->readString($key148); + $xfer += $input->readString($val149); + $this->configuration[$key148] = $val149; + } + $xfer += $input->readMapEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('TSetClientInfoReq'); + if ($this->sessionHandle !== null) { + if (!is_object($this->sessionHandle)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1); + $xfer += $this->sessionHandle->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->configuration !== null) { + if (!is_array($this->configuration)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('configuration', TType::MAP, 2); + { + $output->writeMapBegin(TType::STRING, TType::STRING, count($this->configuration)); + { + foreach ($this->configuration as $kiter150 => $viter151) + { + $xfer += $output->writeString($kiter150); + $xfer += $output->writeString($viter151); + } + } + $output->writeMapEnd(); + } + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class TSetClientInfoResp { + static $_TSPEC; + + /** + * @var \TStatus + */ + public $status = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'status', + 'type' => TType::STRUCT, + 'class' => '\TStatus', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['status'])) { + $this->status = $vals['status']; + } + } + } + + public function getName() { + return 'TSetClientInfoResp'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRUCT) { + $this->status = new \TStatus(); + $xfer += $this->status->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('TSetClientInfoResp'); + if ($this->status !== null) { + if (!is_object($this->status)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1); + $xfer += $this->status->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + class TCloseSessionReq { static $_TSPEC; @@ -5564,17 +5781,17 @@ class TExecuteStatementReq { case 3: if ($ftype == TType::MAP) { $this->confOverlay = array(); - $_size143 = 0; - $_ktype144 = 0; - $_vtype145 = 0; - $xfer += $input->readMapBegin($_ktype144, $_vtype145, $_size143); - for ($_i147 = 0; $_i147 < $_size143; ++$_i147) + $_size152 = 0; + $_ktype153 = 0; + $_vtype154 = 0; + $xfer += $input->readMapBegin($_ktype153, $_vtype154, $_size152); + for ($_i156 = 0; $_i156 < $_size152; ++$_i156) { - $key148 = ''; - $val149 = ''; - $xfer += $input->readString($key148); - $xfer += $input->readString($val149); - $this->confOverlay[$key148] = $val149; + $key157 = ''; + $val158 = ''; + $xfer += $input->readString($key157); + $xfer += $input->readString($val158); + $this->confOverlay[$key157] = $val158; } $xfer += $input->readMapEnd(); } else { @@ -5629,10 +5846,10 @@ class TExecuteStatementReq { { $output->writeMapBegin(TType::STRING, TType::STRING, count($this->confOverlay)); { - foreach ($this->confOverlay as $kiter150 => $viter151) + foreach ($this->confOverlay as $kiter159 => $viter160) { - $xfer += $output->writeString($kiter150); - $xfer += $output->writeString($viter151); + $xfer += $output->writeString($kiter159); + $xfer += $output->writeString($viter160); } } $output->writeMapEnd(); @@ -6498,14 +6715,14 @@ class TGetTablesReq { case 5: if ($ftype == TType::LST) { $this->tableTypes = array(); - $_size152 = 0; - $_etype155 = 0; - $xfer += $input->readListBegin($_etype155, $_size152); - for ($_i156 = 0; $_i156 < $_size152; ++$_i156) + $_size161 = 0; + $_etype164 = 0; + $xfer += $input->readListBegin($_etype164, $_size161); + for ($_i165 = 0; $_i165 < $_size161; ++$_i165) { - $elem157 = null; - $xfer += $input->readString($elem157); - $this->tableTypes []= $elem157; + $elem166 = null; + $xfer += $input->readString($elem166); + $this->tableTypes []= $elem166; } $xfer += $input->readListEnd(); } else { @@ -6556,9 +6773,9 @@ class TGetTablesReq { { $output->writeListBegin(TType::STRING, count($this->tableTypes)); { - foreach ($this->tableTypes as $iter158) + foreach ($this->tableTypes as $iter167) { - $xfer += $output->writeString($iter158); + $xfer += $output->writeString($iter167); } } $output->writeListEnd(); @@ -9879,14 +10096,14 @@ class TProgressUpdateResp { case 1: if ($ftype == TType::LST) { $this->headerNames = array(); - $_size159 = 0; - $_etype162 = 0; - $xfer += $input->readListBegin($_etype162, $_size159); - for ($_i163 = 0; $_i163 < $_size159; ++$_i163) + $_size168 = 0; + $_etype171 = 0; + $xfer += $input->readListBegin($_etype171, $_size168); + for ($_i172 = 0; $_i172 < $_size168; ++$_i172) { - $elem164 = null; - $xfer += $input->readString($elem164); - $this->headerNames []= $elem164; + $elem173 = null; + $xfer += $input->readString($elem173); + $this->headerNames []= $elem173; } $xfer += $input->readListEnd(); } else { @@ -9896,24 +10113,24 @@ class TProgressUpdateResp { case 2: if ($ftype == TType::LST) { $this->rows = array(); - $_size165 = 0; - $_etype168 = 0; - $xfer += $input->readListBegin($_etype168, $_size165); - for ($_i169 = 0; $_i169 < $_size165; ++$_i169) + $_size174 = 0; + $_etype177 = 0; + $xfer += $input->readListBegin($_etype177, $_size174); + for ($_i178 = 0; $_i178 < $_size174; ++$_i178) { - $elem170 = null; - $elem170 = array(); - $_size171 = 0; - $_etype174 = 0; - $xfer += $input->readListBegin($_etype174, $_size171); - for ($_i175 = 0; $_i175 < $_size171; ++$_i175) + $elem179 = null; + $elem179 = array(); + $_size180 = 0; + $_etype183 = 0; + $xfer += $input->readListBegin($_etype183, $_size180); + for ($_i184 = 0; $_i184 < $_size180; ++$_i184) { - $elem176 = null; - $xfer += $input->readString($elem176); - $elem170 []= $elem176; + $elem185 = null; + $xfer += $input->readString($elem185); + $elem179 []= $elem185; } $xfer += $input->readListEnd(); - $this->rows []= $elem170; + $this->rows []= $elem179; } $xfer += $input->readListEnd(); } else { @@ -9969,9 +10186,9 @@ class TProgressUpdateResp { { $output->writeListBegin(TType::STRING, count($this->headerNames)); { - foreach ($this->headerNames as $iter177) + foreach ($this->headerNames as $iter186) { - $xfer += $output->writeString($iter177); + $xfer += $output->writeString($iter186); } } $output->writeListEnd(); @@ -9986,14 +10203,14 @@ class TProgressUpdateResp { { $output->writeListBegin(TType::LST, count($this->rows)); { - foreach ($this->rows as $iter178) + foreach ($this->rows as $iter187) { { - $output->writeListBegin(TType::STRING, count($iter178)); + $output->writeListBegin(TType::STRING, count($iter187)); { - foreach ($iter178 as $iter179) + foreach ($iter187 as $iter188) { - $xfer += $output->writeString($iter179); + $xfer += $output->writeString($iter188); } } $output->writeListEnd(); http://git-wip-us.apache.org/repos/asf/hive/blob/96c2fa86/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote ---------------------------------------------------------------------- diff --git a/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote b/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote index 915ee13..fbbf9a6 100755 --- a/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote +++ b/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService-remote @@ -46,6 +46,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' TCancelDelegationTokenResp CancelDelegationToken(TCancelDelegationTokenReq req)') print(' TRenewDelegationTokenResp RenewDelegationToken(TRenewDelegationTokenReq req)') print(' TGetQueryIdResp GetQueryId(TGetQueryIdReq req)') + print(' TSetClientInfoResp SetClientInfo(TSetClientInfoReq req)') print('') sys.exit(0) @@ -234,6 +235,12 @@ elif cmd == 'GetQueryId': sys.exit(1) pp.pprint(client.GetQueryId(eval(args[0]),)) +elif cmd == 'SetClientInfo': + if len(args) != 1: + print('SetClientInfo requires 1 args') + sys.exit(1) + pp.pprint(client.SetClientInfo(eval(args[0]),)) + else: print('Unrecognized method %s' % cmd) sys.exit(1) http://git-wip-us.apache.org/repos/asf/hive/blob/96c2fa86/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py ---------------------------------------------------------------------- diff --git a/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py b/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py index 6054b7f..0725df9 100644 --- a/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py +++ b/service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py @@ -173,6 +173,13 @@ class Iface: """ pass + def SetClientInfo(self, req): + """ + Parameters: + - req + """ + pass + class Client(Iface): def __init__(self, iprot, oprot=None): @@ -863,6 +870,37 @@ class Client(Iface): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "GetQueryId failed: unknown result") + def SetClientInfo(self, req): + """ + Parameters: + - req + """ + self.send_SetClientInfo(req) + return self.recv_SetClientInfo() + + def send_SetClientInfo(self, req): + self._oprot.writeMessageBegin('SetClientInfo', TMessageType.CALL, self._seqid) + args = SetClientInfo_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_SetClientInfo(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = SetClientInfo_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "SetClientInfo failed: unknown result") + class Processor(Iface, TProcessor): def __init__(self, handler): @@ -890,6 +928,7 @@ class Processor(Iface, TProcessor): self._processMap["CancelDelegationToken"] = Processor.process_CancelDelegationToken self._processMap["RenewDelegationToken"] = Processor.process_RenewDelegationToken self._processMap["GetQueryId"] = Processor.process_GetQueryId + self._processMap["SetClientInfo"] = Processor.process_SetClientInfo def process(self, iprot, oprot): (name, type, seqid) = iprot.readMessageBegin() @@ -1324,6 +1363,25 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_SetClientInfo(self, seqid, iprot, oprot): + args = SetClientInfo_args() + args.read(iprot) + iprot.readMessageEnd() + result = SetClientInfo_result() + try: + result.success = self._handler.SetClientInfo(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("SetClientInfo", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + # HELPER FUNCTIONS AND STRUCTURES @@ -4208,3 +4266,134 @@ class GetQueryId_result: def __ne__(self, other): return not (self == other) + +class SetClientInfo_args: + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TSetClientInfoReq, TSetClientInfoReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TSetClientInfoReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('SetClientInfo_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.req) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class SetClientInfo_result: + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TSetClientInfoResp, TSetClientInfoResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TSetClientInfoResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('SetClientInfo_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.success) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) http://git-wip-us.apache.org/repos/asf/hive/blob/96c2fa86/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py ---------------------------------------------------------------------- diff --git a/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py b/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py index da11384..0f8fd07 100644 --- a/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py +++ b/service-rpc/src/gen/thrift/gen-py/TCLIService/ttypes.py @@ -3757,6 +3757,165 @@ class TOpenSessionResp: def __ne__(self, other): return not (self == other) +class TSetClientInfoReq: + """ + Attributes: + - sessionHandle + - configuration + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.MAP, 'configuration', (TType.STRING,None,TType.STRING,None), None, ), # 2 + ) + + def __init__(self, sessionHandle=None, configuration=None,): + self.sessionHandle = sessionHandle + self.configuration = configuration + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.MAP: + self.configuration = {} + (_ktype144, _vtype145, _size143 ) = iprot.readMapBegin() + for _i147 in xrange(_size143): + _key148 = iprot.readString() + _val149 = iprot.readString() + self.configuration[_key148] = _val149 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TSetClientInfoReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.configuration is not None: + oprot.writeFieldBegin('configuration', TType.MAP, 2) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration)) + for kiter150,viter151 in self.configuration.items(): + oprot.writeString(kiter150) + oprot.writeString(viter151) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocol.TProtocolException(message='Required field sessionHandle is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.sessionHandle) + value = (value * 31) ^ hash(self.configuration) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TSetClientInfoResp: + """ + Attributes: + - status + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + ) + + def __init__(self, status=None,): + self.status = status + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TSetClientInfoResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocol.TProtocolException(message='Required field status is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.status) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + class TCloseSessionReq: """ Attributes: @@ -4239,11 +4398,11 @@ class TExecuteStatementReq: elif fid == 3: if ftype == TType.MAP: self.confOverlay = {} - (_ktype144, _vtype145, _size143 ) = iprot.readMapBegin() - for _i147 in xrange(_size143): - _key148 = iprot.readString() - _val149 = iprot.readString() - self.confOverlay[_key148] = _val149 + (_ktype153, _vtype154, _size152 ) = iprot.readMapBegin() + for _i156 in xrange(_size152): + _key157 = iprot.readString() + _val158 = iprot.readString() + self.confOverlay[_key157] = _val158 iprot.readMapEnd() else: iprot.skip(ftype) @@ -4278,9 +4437,9 @@ class TExecuteStatementReq: if self.confOverlay is not None: oprot.writeFieldBegin('confOverlay', TType.MAP, 3) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.confOverlay)) - for kiter150,viter151 in self.confOverlay.items(): - oprot.writeString(kiter150) - oprot.writeString(viter151) + for kiter159,viter160 in self.confOverlay.items(): + oprot.writeString(kiter159) + oprot.writeString(viter160) oprot.writeMapEnd() oprot.writeFieldEnd() if self.runAsync is not None: @@ -4939,10 +5098,10 @@ class TGetTablesReq: elif fid == 5: if ftype == TType.LIST: self.tableTypes = [] - (_etype155, _size152) = iprot.readListBegin() - for _i156 in xrange(_size152): - _elem157 = iprot.readString() - self.tableTypes.append(_elem157) + (_etype164, _size161) = iprot.readListBegin() + for _i165 in xrange(_size161): + _elem166 = iprot.readString() + self.tableTypes.append(_elem166) iprot.readListEnd() else: iprot.skip(ftype) @@ -4975,8 +5134,8 @@ class TGetTablesReq: if self.tableTypes is not None: oprot.writeFieldBegin('tableTypes', TType.LIST, 5) oprot.writeListBegin(TType.STRING, len(self.tableTypes)) - for iter158 in self.tableTypes: - oprot.writeString(iter158) + for iter167 in self.tableTypes: + oprot.writeString(iter167) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -7467,25 +7626,25 @@ class TProgressUpdateResp: if fid == 1: if ftype == TType.LIST: self.headerNames = [] - (_etype162, _size159) = iprot.readListBegin() - for _i163 in xrange(_size159): - _elem164 = iprot.readString() - self.headerNames.append(_elem164) + (_etype171, _size168) = iprot.readListBegin() + for _i172 in xrange(_size168): + _elem173 = iprot.readString() + self.headerNames.append(_elem173) iprot.readListEnd() else: iprot.skip(ftype) elif fid == 2: if ftype == TType.LIST: self.rows = [] - (_etype168, _size165) = iprot.readListBegin() - for _i169 in xrange(_size165): - _elem170 = [] - (_etype174, _size171) = iprot.readListBegin() - for _i175 in xrange(_size171): - _elem176 = iprot.readString() - _elem170.append(_elem176) + (_etype177, _size174) = iprot.readListBegin() + for _i178 in xrange(_size174): + _elem179 = [] + (_etype183, _size180) = iprot.readListBegin() + for _i184 in xrange(_size180): + _elem185 = iprot.readString() + _elem179.append(_elem185) iprot.readListEnd() - self.rows.append(_elem170) + self.rows.append(_elem179) iprot.readListEnd() else: iprot.skip(ftype) @@ -7522,17 +7681,17 @@ class TProgressUpdateResp: if self.headerNames is not None: oprot.writeFieldBegin('headerNames', TType.LIST, 1) oprot.writeListBegin(TType.STRING, len(self.headerNames)) - for iter177 in self.headerNames: - oprot.writeString(iter177) + for iter186 in self.headerNames: + oprot.writeString(iter186) oprot.writeListEnd() oprot.writeFieldEnd() if self.rows is not None: oprot.writeFieldBegin('rows', TType.LIST, 2) oprot.writeListBegin(TType.LIST, len(self.rows)) - for iter178 in self.rows: - oprot.writeListBegin(TType.STRING, len(iter178)) - for iter179 in iter178: - oprot.writeString(iter179) + for iter187 in self.rows: + oprot.writeListBegin(TType.STRING, len(iter187)) + for iter188 in iter187: + oprot.writeString(iter188) oprot.writeListEnd() oprot.writeListEnd() oprot.writeFieldEnd() http://git-wip-us.apache.org/repos/asf/hive/blob/96c2fa86/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb ---------------------------------------------------------------------- diff --git a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb index 11e058c..6637c49 100644 --- a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb +++ b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service.rb @@ -341,6 +341,21 @@ module TCLIService raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'GetQueryId failed: unknown result') end + def SetClientInfo(req) + send_SetClientInfo(req) + return recv_SetClientInfo() + end + + def send_SetClientInfo(req) + send_message('SetClientInfo', SetClientInfo_args, :req => req) + end + + def recv_SetClientInfo() + result = receive_message(SetClientInfo_result) + return result.success unless result.success.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'SetClientInfo failed: unknown result') + end + end class Processor @@ -500,6 +515,13 @@ module TCLIService write_result(result, oprot, 'GetQueryId', seqid) end + def process_SetClientInfo(seqid, iprot, oprot) + args = read_args(iprot, SetClientInfo_args) + result = SetClientInfo_result.new() + result.success = @handler.SetClientInfo(args.req) + write_result(result, oprot, 'SetClientInfo', seqid) + end + end # HELPER FUNCTIONS AND STRUCTURES @@ -1208,5 +1230,37 @@ module TCLIService ::Thrift::Struct.generate_accessors self end + class SetClientInfo_args + include ::Thrift::Struct, ::Thrift::Struct_Union + REQ = 1 + + FIELDS = { + REQ => {:type => ::Thrift::Types::STRUCT, :name => 'req', :class => ::TSetClientInfoReq} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class SetClientInfo_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::TSetClientInfoResp} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + end http://git-wip-us.apache.org/repos/asf/hive/blob/96c2fa86/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb ---------------------------------------------------------------------- diff --git a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb index fe7aa69..60183da 100644 --- a/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb +++ b/service-rpc/src/gen/thrift/gen-rb/t_c_l_i_service_types.rb @@ -1013,6 +1013,42 @@ class TOpenSessionResp ::Thrift::Struct.generate_accessors self end +class TSetClientInfoReq + include ::Thrift::Struct, ::Thrift::Struct_Union + SESSIONHANDLE = 1 + CONFIGURATION = 2 + + FIELDS = { + SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::TSessionHandle}, + CONFIGURATION => {:type => ::Thrift::Types::MAP, :name => 'configuration', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field sessionHandle is unset!') unless @sessionHandle + end + + ::Thrift::Struct.generate_accessors self +end + +class TSetClientInfoResp + include ::Thrift::Struct, ::Thrift::Struct_Union + STATUS = 1 + + FIELDS = { + STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::TStatus} + } + + def struct_fields; FIELDS; end + + def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status + end + + ::Thrift::Struct.generate_accessors self +end + class TCloseSessionReq include ::Thrift::Struct, ::Thrift::Struct_Union SESSIONHANDLE = 1 http://git-wip-us.apache.org/repos/asf/hive/blob/96c2fa86/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java ---------------------------------------------------------------------- diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java index fc9e6b2..eef7a25 100644 --- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java +++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java @@ -20,15 +20,16 @@ package org.apache.hive.service.cli.thrift; import static com.google.common.base.Preconditions.checkArgument; +import org.apache.hive.service.rpc.thrift.TSetClientInfoReq; +import org.apache.hive.service.rpc.thrift.TSetClientInfoResp; + import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; - import javax.security.auth.login.LoginException; - import org.apache.hadoop.hive.common.ServerUtils; import org.apache.hadoop.hive.common.log.ProgressMonitor; import org.apache.hadoop.hive.conf.HiveConf; @@ -344,6 +345,28 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe return resp; } + @Override + public TSetClientInfoResp SetClientInfo(TSetClientInfoReq req) throws TException { + // TODO: We don't do anything for now, just log this for debugging. + // We may be able to make use of this later, e.g. for workload management. + if (req.isSetConfiguration()) { + StringBuilder sb = null; + for (Map.Entry<String, String> e : req.getConfiguration().entrySet()) { + if (sb == null) { + SessionHandle sh = new SessionHandle(req.getSessionHandle()); + sb = new StringBuilder("Client information for ").append(sh).append(": "); + } else { + sb.append(", "); + } + sb.append(e.getKey()).append(" = ").append(e.getValue()); + } + if (sb != null) { + LOG.info("{}", sb); + } + } + return new TSetClientInfoResp(OK_STATUS); + } + private String getIpAddress() { String clientIpAddress; // Http transport mode.
