You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by zs...@apache.org on 2008/12/08 05:25:51 UTC
svn commit: r724247 [4/6] - in /hadoop/hive/trunk/service: ./ if/ include/
include/thrift/ include/thrift/concurrency/ include/thrift/fb303/
include/thrift/fb303/if/ include/thrift/if/ include/thrift/processor/
include/thrift/protocol/ include/thrift/s...
Added: hadoop/hive/trunk/service/include/thrift/transport/TTransportUtils.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/transport/TTransportUtils.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/transport/TTransportUtils.h (added)
+++ hadoop/hive/trunk/service/include/thrift/transport/TTransportUtils.h Sun Dec 7 20:25:22 2008
@@ -0,0 +1,677 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#ifndef _THRIFT_TRANSPORT_TTRANSPORTUTILS_H_
+#define _THRIFT_TRANSPORT_TTRANSPORTUTILS_H_ 1
+
+#include <string>
+#include <algorithm>
+#include <transport/TTransport.h>
+#include <transport/TFileTransport.h>
+
+namespace facebook { namespace thrift { namespace transport {
+
+/**
+ * The null transport is a dummy transport that doesn't actually do anything.
+ * It's sort of an analogy to /dev/null, you can never read anything from it
+ * and it will let you write anything you want to it, though it won't actually
+ * go anywhere.
+ *
+ * @author Mark Slee <mc...@facebook.com>
+ */
+class TNullTransport : public TTransport {
+ public:
+ TNullTransport() {}
+
+ ~TNullTransport() {}
+
+ bool isOpen() {
+ return true;
+ }
+
+ void open() {}
+
+ void write(const uint8_t* buf, uint32_t len) {
+ return;
+ }
+
+};
+
+
+/**
+ * Buffered transport. For reads it will read more data than is requested
+ * and will serve future data out of a local buffer. For writes, data is
+ * stored to an in memory buffer before being written out.
+ *
+ * @author Mark Slee <mc...@facebook.com>
+ */
+class TBufferedTransport : public TTransport {
+ public:
+ TBufferedTransport(boost::shared_ptr<TTransport> transport) :
+ transport_(transport),
+ rBufSize_(512), rPos_(0), rLen_(0),
+ wBufSize_(512), wLen_(0) {
+ rBuf_ = new uint8_t[rBufSize_];
+ wBuf_ = new uint8_t[wBufSize_];
+ }
+
+ TBufferedTransport(boost::shared_ptr<TTransport> transport, uint32_t sz) :
+ transport_(transport),
+ rBufSize_(sz), rPos_(0), rLen_(0),
+ wBufSize_(sz), wLen_(0) {
+ rBuf_ = new uint8_t[rBufSize_];
+ wBuf_ = new uint8_t[wBufSize_];
+ }
+
+ TBufferedTransport(boost::shared_ptr<TTransport> transport, uint32_t rsz, uint32_t wsz) :
+ transport_(transport),
+ rBufSize_(rsz), rPos_(0), rLen_(0),
+ wBufSize_(wsz), wLen_(0) {
+ rBuf_ = new uint8_t[rBufSize_];
+ wBuf_ = new uint8_t[wBufSize_];
+ }
+
+ ~TBufferedTransport() {
+ delete [] rBuf_;
+ delete [] wBuf_;
+ }
+
+ bool isOpen() {
+ return transport_->isOpen();
+ }
+
+ bool peek() {
+ if (rPos_ >= rLen_) {
+ rLen_ = transport_->read(rBuf_, rBufSize_);
+ rPos_ = 0;
+ }
+ return (rLen_ > rPos_);
+ }
+
+ void open() {
+ transport_->open();
+ }
+
+ void close() {
+ flush();
+ transport_->close();
+ }
+
+ uint32_t read(uint8_t* buf, uint32_t len);
+
+ void write(const uint8_t* buf, uint32_t len);
+
+ void flush();
+
+ bool borrow(uint8_t* buf, uint32_t len);
+
+ void consume(uint32_t len);
+
+ boost::shared_ptr<TTransport> getUnderlyingTransport() {
+ return transport_;
+ }
+
+ protected:
+ boost::shared_ptr<TTransport> transport_;
+ uint8_t* rBuf_;
+ uint32_t rBufSize_;
+ uint32_t rPos_;
+ uint32_t rLen_;
+
+ uint8_t* wBuf_;
+ uint32_t wBufSize_;
+ uint32_t wLen_;
+};
+
+/**
+ * Wraps a transport into a buffered one.
+ *
+ * @author Mark Slee <mc...@facebook.com>
+ */
+class TBufferedTransportFactory : public TTransportFactory {
+ public:
+ TBufferedTransportFactory() {}
+
+ virtual ~TBufferedTransportFactory() {}
+
+ /**
+ * Wraps the transport into a buffered one.
+ */
+ virtual boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> trans) {
+ return boost::shared_ptr<TTransport>(new TBufferedTransport(trans));
+ }
+
+};
+
+/**
+ * Framed transport. All writes go into an in-memory buffer until flush is
+ * called, at which point the transport writes the length of the entire
+ * binary chunk followed by the data payload. This allows the receiver on the
+ * other end to always do fixed-length reads.
+ *
+ * @author Mark Slee <mc...@facebook.com>
+ */
+class TFramedTransport : public TTransport {
+ public:
+ TFramedTransport(boost::shared_ptr<TTransport> transport) :
+ transport_(transport),
+ rPos_(0),
+ rLen_(0),
+ read_(true),
+ wBufSize_(512),
+ wLen_(0),
+ write_(true) {
+ rBuf_ = NULL;
+ wBuf_ = new uint8_t[wBufSize_];
+ }
+
+ TFramedTransport(boost::shared_ptr<TTransport> transport, uint32_t sz) :
+ transport_(transport),
+ rPos_(0),
+ rLen_(0),
+ read_(true),
+ wBufSize_(sz),
+ wLen_(0),
+ write_(true) {
+ rBuf_ = NULL;
+ wBuf_ = new uint8_t[wBufSize_];
+ }
+
+ ~TFramedTransport() {
+ if (rBuf_ != NULL) {
+ delete [] rBuf_;
+ }
+ if (wBuf_ != NULL) {
+ delete [] wBuf_;
+ }
+ }
+
+ void setRead(bool read) {
+ read_ = read;
+ }
+
+ void setWrite(bool write) {
+ write_ = write;
+ }
+
+ void open() {
+ transport_->open();
+ }
+
+ bool isOpen() {
+ return transport_->isOpen();
+ }
+
+ bool peek() {
+ if (rPos_ < rLen_) {
+ return true;
+ }
+ return transport_->peek();
+ }
+
+ void close() {
+ if (wLen_ > 0) {
+ flush();
+ }
+ transport_->close();
+ }
+
+ uint32_t read(uint8_t* buf, uint32_t len);
+
+ void write(const uint8_t* buf, uint32_t len);
+
+ void flush();
+
+ bool borrow(uint8_t* buf, uint32_t len);
+
+ void consume(uint32_t len);
+
+ boost::shared_ptr<TTransport> getUnderlyingTransport() {
+ return transport_;
+ }
+
+ protected:
+ boost::shared_ptr<TTransport> transport_;
+ uint8_t* rBuf_;
+ uint32_t rPos_;
+ uint32_t rLen_;
+ bool read_;
+
+ uint8_t* wBuf_;
+ uint32_t wBufSize_;
+ uint32_t wLen_;
+ bool write_;
+
+ /**
+ * Reads a frame of input from the underlying stream.
+ */
+ void readFrame();
+};
+
+/**
+ * Wraps a transport into a framed one.
+ *
+ * @author Dave Simpson <da...@powerset.com>
+ */
+class TFramedTransportFactory : public TTransportFactory {
+ public:
+ TFramedTransportFactory() {}
+
+ virtual ~TFramedTransportFactory() {}
+
+ /**
+ * Wraps the transport into a framed one.
+ */
+ virtual boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> trans) {
+ return boost::shared_ptr<TTransport>(new TFramedTransport(trans));
+ }
+
+};
+
+
+/**
+ * A memory buffer is a tranpsort that simply reads from and writes to an
+ * in memory buffer. Anytime you call write on it, the data is simply placed
+ * into a buffer, and anytime you call read, data is read from that buffer.
+ *
+ * The buffers are allocated using C constructs malloc,realloc, and the size
+ * doubles as necessary.
+ *
+ * @author Mark Slee <mc...@facebook.com>
+ */
+class TMemoryBuffer : public TTransport {
+ private:
+
+ // Common initialization done by all constructors.
+ void initCommon(uint8_t* buf, uint32_t size, bool owner, uint32_t wPos) {
+ if (buf == NULL && size != 0) {
+ assert(owner);
+ buf = (uint8_t*)malloc(size);
+ if (buf == NULL) {
+ throw TTransportException("Out of memory");
+ }
+ }
+
+ buffer_ = buf;
+ bufferSize_ = size;
+ owner_ = owner;
+ wPos_ = wPos;
+ rPos_ = 0;
+ }
+
+ public:
+ static const uint32_t defaultSize = 1024;
+
+ TMemoryBuffer() {
+ initCommon(NULL, defaultSize, true, 0);
+ }
+
+ TMemoryBuffer(uint32_t sz) {
+ initCommon(NULL, sz, true, 0);
+ }
+
+ // transferOwnership should be true if you want TMemoryBuffer to call free(buf).
+ TMemoryBuffer(uint8_t* buf, int sz, bool transferOwnership = false) {
+ initCommon(buf, sz, transferOwnership, sz);
+ }
+
+ // copy should be true if you want TMemoryBuffer to make a copy of the string.
+ // If you set copy to false, the string must not be destroyed before you are
+ // done with the TMemoryBuffer.
+ TMemoryBuffer(const std::string& str, bool copy = false) {
+ if (copy) {
+ initCommon(NULL, str.length(), true, 0);
+ this->write(reinterpret_cast<const uint8_t*>(str.data()), str.length());
+ } else {
+ // This first argument should be equivalent to the following:
+ // const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(str.data()))
+ initCommon((uint8_t*)str.data(), str.length(), false, str.length());
+ }
+ }
+
+ ~TMemoryBuffer() {
+ if (owner_) {
+ free(buffer_);
+ buffer_ = NULL;
+ }
+ }
+
+ bool isOpen() {
+ return true;
+ }
+
+ bool peek() {
+ return (rPos_ < wPos_);
+ }
+
+ void open() {}
+
+ void close() {}
+
+ void getBuffer(uint8_t** bufPtr, uint32_t* sz) {
+ *bufPtr = buffer_;
+ *sz = wPos_;
+ }
+
+ std::string getBufferAsString() {
+ if (buffer_ == NULL) {
+ return "";
+ }
+ return std::string((char*)buffer_, (std::string::size_type)wPos_);
+ }
+
+ void appendBufferToString(std::string& str) {
+ if (buffer_ == NULL) {
+ return;
+ }
+ str.append((char*)buffer_, wPos_);
+ }
+
+ void resetBuffer() {
+ wPos_ = 0;
+ rPos_ = 0;
+ }
+
+ // transferOwnership should be true if you want TMemoryBuffer to call free(buf).
+ void resetBuffer(uint8_t* buf, uint32_t sz, bool transferOwnership = false) {
+ if (owner_) {
+ free(buffer_);
+ }
+ owner_ = transferOwnership;
+ buffer_ = buf;
+ bufferSize_ = sz;
+ wPos_ = sz;
+ rPos_ = 0;
+ }
+
+ // See the constructor that takes a string.
+ void resetFromString(const std::string& str, bool copy = false) {
+ if (copy) {
+ uint8_t* buf = (uint8_t*)malloc(str.length());
+ if (buf == NULL) {
+ throw TTransportException("Out of memory");
+ }
+ std::copy(str.begin(), str.end(), buf);
+ resetBuffer(buf, str.length(), true);
+ } else {
+ // See the above comment about const_cast.
+ resetBuffer((uint8_t*)str.data(), str.length(), false);
+ }
+ }
+
+ uint32_t read(uint8_t* buf, uint32_t len);
+
+ std::string readAsString(uint32_t len) {
+ std::string str;
+ (void)readAppendToString(str, len);
+ return str;
+ }
+
+ uint32_t readAppendToString(std::string& str, uint32_t len);
+
+ void readEnd() {
+ if (rPos_ == wPos_) {
+ resetBuffer();
+ }
+ }
+
+ void write(const uint8_t* buf, uint32_t len);
+
+ uint32_t available() {
+ return wPos_ - rPos_;
+ }
+
+ bool borrow(uint8_t* buf, uint32_t len);
+
+ void consume(uint32_t len);
+
+ private:
+ // Data buffer
+ uint8_t* buffer_;
+
+ // Allocated buffer size
+ uint32_t bufferSize_;
+
+ // Where the write is at
+ uint32_t wPos_;
+
+ // Where the reader is at
+ uint32_t rPos_;
+
+ // Is this object the owner of the buffer?
+ bool owner_;
+
+};
+
+/**
+ * TPipedTransport. This transport allows piping of a request from one
+ * transport to another either when readEnd() or writeEnd(). The typical
+ * use case for this is to log a request or a reply to disk.
+ * The underlying buffer expands to a keep a copy of the entire
+ * request/response.
+ *
+ * @author Aditya Agarwal <ad...@facebook.com>
+ */
+class TPipedTransport : virtual public TTransport {
+ public:
+ TPipedTransport(boost::shared_ptr<TTransport> srcTrans,
+ boost::shared_ptr<TTransport> dstTrans) :
+ srcTrans_(srcTrans),
+ dstTrans_(dstTrans),
+ rBufSize_(512), rPos_(0), rLen_(0),
+ wBufSize_(512), wLen_(0) {
+
+ // default is to to pipe the request when readEnd() is called
+ pipeOnRead_ = true;
+ pipeOnWrite_ = false;
+
+ rBuf_ = (uint8_t*) malloc(sizeof(uint8_t) * rBufSize_);
+ wBuf_ = (uint8_t*) malloc(sizeof(uint8_t) * wBufSize_);
+ }
+
+ TPipedTransport(boost::shared_ptr<TTransport> srcTrans,
+ boost::shared_ptr<TTransport> dstTrans,
+ uint32_t sz) :
+ srcTrans_(srcTrans),
+ dstTrans_(dstTrans),
+ rBufSize_(512), rPos_(0), rLen_(0),
+ wBufSize_(sz), wLen_(0) {
+
+ rBuf_ = (uint8_t*) malloc(sizeof(uint8_t) * rBufSize_);
+ wBuf_ = (uint8_t*) malloc(sizeof(uint8_t) * wBufSize_);
+ }
+
+ ~TPipedTransport() {
+ free(rBuf_);
+ free(wBuf_);
+ }
+
+ bool isOpen() {
+ return srcTrans_->isOpen();
+ }
+
+ bool peek() {
+ if (rPos_ >= rLen_) {
+ // Double the size of the underlying buffer if it is full
+ if (rLen_ == rBufSize_) {
+ rBufSize_ *=2;
+ rBuf_ = (uint8_t *)realloc(rBuf_, sizeof(uint8_t) * rBufSize_);
+ }
+
+ // try to fill up the buffer
+ rLen_ += srcTrans_->read(rBuf_+rPos_, rBufSize_ - rPos_);
+ }
+ return (rLen_ > rPos_);
+ }
+
+
+ void open() {
+ srcTrans_->open();
+ }
+
+ void close() {
+ srcTrans_->close();
+ }
+
+ void setPipeOnRead(bool pipeVal) {
+ pipeOnRead_ = pipeVal;
+ }
+
+ void setPipeOnWrite(bool pipeVal) {
+ pipeOnWrite_ = pipeVal;
+ }
+
+ uint32_t read(uint8_t* buf, uint32_t len);
+
+ void readEnd() {
+
+ if (pipeOnRead_) {
+ dstTrans_->write(rBuf_, rLen_);
+ dstTrans_->flush();
+ }
+
+ srcTrans_->readEnd();
+
+ // reset state
+ rLen_ = 0;
+ rPos_ = 0;
+ }
+
+ void write(const uint8_t* buf, uint32_t len);
+
+ void writeEnd() {
+ if (pipeOnWrite_) {
+ dstTrans_->write(wBuf_, wLen_);
+ dstTrans_->flush();
+ }
+ }
+
+ void flush();
+
+ boost::shared_ptr<TTransport> getTargetTransport() {
+ return dstTrans_;
+ }
+
+ protected:
+ boost::shared_ptr<TTransport> srcTrans_;
+ boost::shared_ptr<TTransport> dstTrans_;
+
+ uint8_t* rBuf_;
+ uint32_t rBufSize_;
+ uint32_t rPos_;
+ uint32_t rLen_;
+
+ uint8_t* wBuf_;
+ uint32_t wBufSize_;
+ uint32_t wLen_;
+
+ bool pipeOnRead_;
+ bool pipeOnWrite_;
+};
+
+
+/**
+ * Wraps a transport into a pipedTransport instance.
+ *
+ * @author Aditya Agarwal <ad...@facebook.com>
+ */
+class TPipedTransportFactory : public TTransportFactory {
+ public:
+ TPipedTransportFactory() {}
+ TPipedTransportFactory(boost::shared_ptr<TTransport> dstTrans) {
+ initializeTargetTransport(dstTrans);
+ }
+ virtual ~TPipedTransportFactory() {}
+
+ /**
+ * Wraps the base transport into a piped transport.
+ */
+ virtual boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> srcTrans) {
+ return boost::shared_ptr<TTransport>(new TPipedTransport(srcTrans, dstTrans_));
+ }
+
+ virtual void initializeTargetTransport(boost::shared_ptr<TTransport> dstTrans) {
+ if (dstTrans_.get() == NULL) {
+ dstTrans_ = dstTrans;
+ } else {
+ throw TException("Target transport already initialized");
+ }
+ }
+
+ protected:
+ boost::shared_ptr<TTransport> dstTrans_;
+};
+
+/**
+ * TPipedFileTransport. This is just like a TTransport, except that
+ * it is a templatized class, so that clients who rely on a specific
+ * TTransport can still access the original transport.
+ *
+ * @author James Wang <jw...@facebook.com>
+ */
+class TPipedFileReaderTransport : public TPipedTransport,
+ public TFileReaderTransport {
+ public:
+ TPipedFileReaderTransport(boost::shared_ptr<TFileReaderTransport> srcTrans, boost::shared_ptr<TTransport> dstTrans);
+
+ ~TPipedFileReaderTransport();
+
+ // TTransport functions
+ bool isOpen();
+ bool peek();
+ void open();
+ void close();
+ uint32_t read(uint8_t* buf, uint32_t len);
+ uint32_t readAll(uint8_t* buf, uint32_t len);
+ void readEnd();
+ void write(const uint8_t* buf, uint32_t len);
+ void writeEnd();
+ void flush();
+
+ // TFileReaderTransport functions
+ int32_t getReadTimeout();
+ void setReadTimeout(int32_t readTimeout);
+ uint32_t getNumChunks();
+ uint32_t getCurChunk();
+ void seekToChunk(int32_t chunk);
+ void seekToEnd();
+
+ protected:
+ // shouldn't be used
+ TPipedFileReaderTransport();
+ boost::shared_ptr<TFileReaderTransport> srcTrans_;
+};
+
+/**
+ * Creates a TPipedFileReaderTransport from a filepath and a destination transport
+ *
+ * @author James Wang <jw...@facebook.com>
+ */
+class TPipedFileReaderTransportFactory : public TPipedTransportFactory {
+ public:
+ TPipedFileReaderTransportFactory() {}
+ TPipedFileReaderTransportFactory(boost::shared_ptr<TTransport> dstTrans)
+ : TPipedTransportFactory(dstTrans)
+ {}
+ virtual ~TPipedFileReaderTransportFactory() {}
+
+ boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> srcTrans) {
+ boost::shared_ptr<TFileReaderTransport> pFileReaderTransport = boost::dynamic_pointer_cast<TFileReaderTransport>(srcTrans);
+ if (pFileReaderTransport.get() != NULL) {
+ return getFileReaderTransport(pFileReaderTransport);
+ } else {
+ return boost::shared_ptr<TTransport>();
+ }
+ }
+
+ boost::shared_ptr<TFileReaderTransport> getFileReaderTransport(boost::shared_ptr<TFileReaderTransport> srcTrans) {
+ return boost::shared_ptr<TFileReaderTransport>(new TPipedFileReaderTransport(srcTrans, dstTrans_));
+ }
+};
+
+}}} // facebook::thrift::transport
+
+#endif // #ifndef _THRIFT_TRANSPORT_TTRANSPORTUTILS_H_
Added: hadoop/hive/trunk/service/include/thrift/transport/TZlibTransport.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/transport/TZlibTransport.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/transport/TZlibTransport.h (added)
+++ hadoop/hive/trunk/service/include/thrift/transport/TZlibTransport.h Sun Dec 7 20:25:22 2008
@@ -0,0 +1,207 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#ifndef _THRIFT_TRANSPORT_TZLIBTRANSPORT_H_
+#define _THRIFT_TRANSPORT_TZLIBTRANSPORT_H_ 1
+
+#include <boost/lexical_cast.hpp>
+#include <transport/TTransport.h>
+
+struct z_stream_s;
+
+namespace facebook { namespace thrift { namespace transport {
+
+class TZlibTransportException : public TTransportException {
+ public:
+ TZlibTransportException(int status, const char* msg) :
+ TTransportException(TTransportException::INTERNAL_ERROR,
+ errorMessage(status, msg)),
+ zlib_status_(status),
+ zlib_msg_(msg == NULL ? "(null)" : msg) {}
+
+ virtual ~TZlibTransportException() throw() {}
+
+ int getZlibStatus() { return zlib_status_; }
+ std::string getZlibMessage() { return zlib_msg_; }
+
+ static std::string errorMessage(int status, const char* msg) {
+ std::string rv = "zlib error: ";
+ if (msg) {
+ rv += msg;
+ } else {
+ rv += "(no message)";
+ }
+ rv += " (status = ";
+ rv += boost::lexical_cast<std::string>(status);
+ rv += ")";
+ return rv;
+ }
+
+ int zlib_status_;
+ std::string zlib_msg_;
+};
+
+/**
+ * This transport uses zlib's compressed format on the "far" side.
+ *
+ * There are two kinds of TZlibTransport objects:
+ * - Standalone objects are used to encode self-contained chunks of data
+ * (like structures). They include checksums.
+ * - Non-standalone transports are used for RPC. They are not implemented yet.
+ *
+ * TODO(dreiss): Don't do an extra copy of the compressed data if
+ * the underlying transport is TBuffered or TMemory.
+ *
+ * @author David Reiss <dr...@facebook.com>
+ */
+class TZlibTransport : public TTransport {
+ public:
+
+ /**
+ * @param transport The transport to read compressed data from
+ * and write compressed data to.
+ * @param use_for_rpc True if this object will be used for RPC,
+ * false if this is a standalone object.
+ * @param urbuf_size Uncompressed buffer size for reading.
+ * @param crbuf_size Compressed buffer size for reading.
+ * @param uwbuf_size Uncompressed buffer size for writing.
+ * @param cwbuf_size Compressed buffer size for writing.
+ *
+ * TODO(dreiss): Write a constructor that isn't a pain.
+ */
+ TZlibTransport(boost::shared_ptr<TTransport> transport,
+ bool use_for_rpc,
+ int urbuf_size = DEFAULT_URBUF_SIZE,
+ int crbuf_size = DEFAULT_CRBUF_SIZE,
+ int uwbuf_size = DEFAULT_UWBUF_SIZE,
+ int cwbuf_size = DEFAULT_CWBUF_SIZE) :
+ transport_(transport),
+ standalone_(!use_for_rpc),
+ urpos_(0),
+ uwpos_(0),
+ input_ended_(false),
+ output_flushed_(false),
+ urbuf_size_(urbuf_size),
+ crbuf_size_(crbuf_size),
+ uwbuf_size_(uwbuf_size),
+ cwbuf_size_(cwbuf_size),
+ urbuf_(NULL),
+ crbuf_(NULL),
+ uwbuf_(NULL),
+ cwbuf_(NULL),
+ rstream_(NULL),
+ wstream_(NULL)
+ {
+
+ if (!standalone_) {
+ throw TTransportException(
+ TTransportException::BAD_ARGS,
+ "TZLibTransport has not been tested for RPC.");
+ }
+
+ if (uwbuf_size_ < MIN_DIRECT_DEFLATE_SIZE) {
+ // Have to copy this into a local because of a linking issue.
+ int minimum = MIN_DIRECT_DEFLATE_SIZE;
+ throw TTransportException(
+ TTransportException::BAD_ARGS,
+ "TZLibTransport: uncompressed write buffer must be at least"
+ + boost::lexical_cast<std::string>(minimum) + ".");
+ }
+
+ try {
+ urbuf_ = new uint8_t[urbuf_size];
+ crbuf_ = new uint8_t[crbuf_size];
+ uwbuf_ = new uint8_t[uwbuf_size];
+ cwbuf_ = new uint8_t[cwbuf_size];
+
+ // Don't call this outside of the constructor.
+ initZlib();
+
+ } catch (...) {
+ delete[] urbuf_;
+ delete[] crbuf_;
+ delete[] uwbuf_;
+ delete[] cwbuf_;
+ throw;
+ }
+ }
+
+ // Don't call this outside of the constructor.
+ void initZlib();
+
+ ~TZlibTransport();
+
+ bool isOpen();
+
+ void open() {
+ transport_->open();
+ }
+
+ void close() {
+ transport_->close();
+ }
+
+ uint32_t read(uint8_t* buf, uint32_t len);
+
+ void write(const uint8_t* buf, uint32_t len);
+
+ void flush();
+
+ bool borrow(uint8_t* buf, uint32_t len);
+
+ void consume(uint32_t len);
+
+ void verifyChecksum();
+
+ /**
+ * TODO(someone_smart): Choose smart defaults.
+ */
+ static const int DEFAULT_URBUF_SIZE = 128;
+ static const int DEFAULT_CRBUF_SIZE = 1024;
+ static const int DEFAULT_UWBUF_SIZE = 128;
+ static const int DEFAULT_CWBUF_SIZE = 1024;
+
+ protected:
+
+ inline void checkZlibRv(int status, const char* msg);
+ inline void checkZlibRvNothrow(int status, const char* msg);
+ inline int readAvail();
+ void flushToZlib(const uint8_t* buf, int len, bool finish = false);
+
+ // Writes smaller than this are buffered up.
+ // Larger (or equal) writes are dumped straight to zlib.
+ static const int MIN_DIRECT_DEFLATE_SIZE = 32;
+
+ boost::shared_ptr<TTransport> transport_;
+ bool standalone_;
+
+ int urpos_;
+ int uwpos_;
+
+ /// True iff zlib has reached the end of a stream.
+ /// This is only ever true in standalone protcol objects.
+ bool input_ended_;
+ /// True iff we have flushed the output stream.
+ /// This is only ever true in standalone protcol objects.
+ bool output_flushed_;
+
+ int urbuf_size_;
+ int crbuf_size_;
+ int uwbuf_size_;
+ int cwbuf_size_;
+
+ uint8_t* urbuf_;
+ uint8_t* crbuf_;
+ uint8_t* uwbuf_;
+ uint8_t* cwbuf_;
+
+ struct z_stream_s* rstream_;
+ struct z_stream_s* wstream_;
+};
+
+}}} // facebook::thrift::transport
+
+#endif // #ifndef _THRIFT_TRANSPORT_TZLIBTRANSPORT_H_
Added: hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/Constants.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/Constants.java?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/Constants.java (added)
+++ hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/Constants.java Sun Dec 7 20:25:22 2008
@@ -0,0 +1,18 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package org.apache.hadoop.hive.service;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import com.facebook.thrift.*;
+
+public class Constants {
+
+}
Added: hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/HiveServerException.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/HiveServerException.java?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/HiveServerException.java (added)
+++ hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/HiveServerException.java Sun Dec 7 20:25:22 2008
@@ -0,0 +1,132 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package org.apache.hadoop.hive.service;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import com.facebook.thrift.*;
+
+import com.facebook.thrift.protocol.*;
+import com.facebook.thrift.transport.*;
+
+public class HiveServerException extends Exception implements TBase, java.io.Serializable {
+ private String message;
+
+ public final Isset __isset = new Isset();
+ public static final class Isset implements java.io.Serializable {
+ public boolean message = false;
+ }
+
+ public HiveServerException() {
+ }
+
+ public HiveServerException(
+ String message)
+ {
+ this();
+ this.message = message;
+ this.__isset.message = true;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ this.__isset.message = true;
+ }
+
+ public void unsetMessage() {
+ this.__isset.message = false;
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof HiveServerException)
+ return this.equals((HiveServerException)that);
+ return false;
+ }
+
+ public boolean equals(HiveServerException that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_message = true && (this.message != null);
+ boolean that_present_message = true && (that.message != null);
+ if (this_present_message || that_present_message) {
+ if (!(this_present_message && that_present_message))
+ return false;
+ if (!this.message.equals(that.message))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case -1:
+ if (field.type == TType.STRING) {
+ this.message = iprot.readString();
+ this.__isset.message = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("HiveServerException");
+ oprot.writeStructBegin(struct);
+ TField field = new TField();
+ if (this.message != null) {
+ field.name = "message";
+ field.type = TType.STRING;
+ field.id = -1;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("HiveServerException(");
+ sb.append("message:");
+ sb.append(this.message);
+ sb.append(")");
+ return sb.toString();
+ }
+
+}
+
Added: hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/ThriftHive.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/ThriftHive.java?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/ThriftHive.java (added)
+++ hadoop/hive/trunk/service/src/gen-javabean/org/apache/hadoop/hive/service/ThriftHive.java Sun Dec 7 20:25:22 2008
@@ -0,0 +1,1609 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package org.apache.hadoop.hive.service;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import com.facebook.thrift.*;
+
+import com.facebook.thrift.protocol.*;
+import com.facebook.thrift.transport.*;
+
+public class ThriftHive {
+
+ public interface Iface extends org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface {
+
+ public void execute(String query) throws HiveServerException, TException;
+
+ public String fetchOne() throws HiveServerException, TException;
+
+ public List<String> fetchN(int numRows) throws HiveServerException, TException;
+
+ public List<String> fetchAll() throws HiveServerException, TException;
+
+ public String getSchema() throws HiveServerException, TException;
+
+ }
+
+ public static class Client extends org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Client implements Iface {
+ public Client(TProtocol prot)
+ {
+ this(prot, prot);
+ }
+
+ public Client(TProtocol iprot, TProtocol oprot)
+ {
+ super(iprot, oprot);
+ }
+
+ public void execute(String query) throws HiveServerException, TException
+ {
+ send_execute(query);
+ recv_execute();
+ }
+
+ public void send_execute(String query) throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("execute", TMessageType.CALL, seqid_));
+ execute_args args = new execute_args();
+ args.query = query;
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public void recv_execute() throws HiveServerException, TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ execute_result result = new execute_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.ex) {
+ throw result.ex;
+ }
+ return;
+ }
+
+ public String fetchOne() throws HiveServerException, TException
+ {
+ send_fetchOne();
+ return recv_fetchOne();
+ }
+
+ public void send_fetchOne() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("fetchOne", TMessageType.CALL, seqid_));
+ fetchOne_args args = new fetchOne_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public String recv_fetchOne() throws HiveServerException, TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ fetchOne_result result = new fetchOne_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ if (result.__isset.ex) {
+ throw result.ex;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "fetchOne failed: unknown result");
+ }
+
+ public List<String> fetchN(int numRows) throws HiveServerException, TException
+ {
+ send_fetchN(numRows);
+ return recv_fetchN();
+ }
+
+ public void send_fetchN(int numRows) throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("fetchN", TMessageType.CALL, seqid_));
+ fetchN_args args = new fetchN_args();
+ args.numRows = numRows;
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public List<String> recv_fetchN() throws HiveServerException, TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ fetchN_result result = new fetchN_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ if (result.__isset.ex) {
+ throw result.ex;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "fetchN failed: unknown result");
+ }
+
+ public List<String> fetchAll() throws HiveServerException, TException
+ {
+ send_fetchAll();
+ return recv_fetchAll();
+ }
+
+ public void send_fetchAll() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("fetchAll", TMessageType.CALL, seqid_));
+ fetchAll_args args = new fetchAll_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public List<String> recv_fetchAll() throws HiveServerException, TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ fetchAll_result result = new fetchAll_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ if (result.__isset.ex) {
+ throw result.ex;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "fetchAll failed: unknown result");
+ }
+
+ public String getSchema() throws HiveServerException, TException
+ {
+ send_getSchema();
+ return recv_getSchema();
+ }
+
+ public void send_getSchema() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getSchema", TMessageType.CALL, seqid_));
+ getSchema_args args = new getSchema_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public String recv_getSchema() throws HiveServerException, TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getSchema_result result = new getSchema_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ if (result.__isset.ex) {
+ throw result.ex;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getSchema failed: unknown result");
+ }
+
+ }
+ public static class Processor extends org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Processor implements TProcessor {
+ public Processor(Iface iface)
+ {
+ super(iface);
+ iface_ = iface;
+ processMap_.put("execute", new execute());
+ processMap_.put("fetchOne", new fetchOne());
+ processMap_.put("fetchN", new fetchN());
+ processMap_.put("fetchAll", new fetchAll());
+ processMap_.put("getSchema", new getSchema());
+ }
+
+ private Iface iface_;
+
+ public boolean process(TProtocol iprot, TProtocol oprot) throws TException
+ {
+ TMessage msg = iprot.readMessageBegin();
+ ProcessFunction fn = processMap_.get(msg.name);
+ if (fn == null) {
+ TProtocolUtil.skip(iprot, TType.STRUCT);
+ iprot.readMessageEnd();
+ TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
+ oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
+ x.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ return true;
+ }
+ fn.process(msg.seqid, iprot, oprot);
+ return true;
+ }
+
+ private class execute implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ execute_args args = new execute_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ execute_result result = new execute_result();
+ try {
+ iface_.execute(args.query);
+ } catch (HiveServerException ex) {
+ result.ex = ex;
+ result.__isset.ex = true;
+ }
+ oprot.writeMessageBegin(new TMessage("execute", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class fetchOne implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ fetchOne_args args = new fetchOne_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ fetchOne_result result = new fetchOne_result();
+ try {
+ result.success = iface_.fetchOne();
+ result.__isset.success = true;
+ } catch (HiveServerException ex) {
+ result.ex = ex;
+ result.__isset.ex = true;
+ }
+ oprot.writeMessageBegin(new TMessage("fetchOne", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class fetchN implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ fetchN_args args = new fetchN_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ fetchN_result result = new fetchN_result();
+ try {
+ result.success = iface_.fetchN(args.numRows);
+ result.__isset.success = true;
+ } catch (HiveServerException ex) {
+ result.ex = ex;
+ result.__isset.ex = true;
+ }
+ oprot.writeMessageBegin(new TMessage("fetchN", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class fetchAll implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ fetchAll_args args = new fetchAll_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ fetchAll_result result = new fetchAll_result();
+ try {
+ result.success = iface_.fetchAll();
+ result.__isset.success = true;
+ } catch (HiveServerException ex) {
+ result.ex = ex;
+ result.__isset.ex = true;
+ }
+ oprot.writeMessageBegin(new TMessage("fetchAll", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getSchema implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getSchema_args args = new getSchema_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getSchema_result result = new getSchema_result();
+ try {
+ result.success = iface_.getSchema();
+ result.__isset.success = true;
+ } catch (HiveServerException ex) {
+ result.ex = ex;
+ result.__isset.ex = true;
+ }
+ oprot.writeMessageBegin(new TMessage("getSchema", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ }
+
+ public static class execute_args implements TBase, java.io.Serializable {
+ private String query;
+
+ public final Isset __isset = new Isset();
+ public static final class Isset implements java.io.Serializable {
+ public boolean query = false;
+ }
+
+ public execute_args() {
+ }
+
+ public execute_args(
+ String query)
+ {
+ this();
+ this.query = query;
+ this.__isset.query = true;
+ }
+
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ this.__isset.query = true;
+ }
+
+ public void unsetQuery() {
+ this.__isset.query = false;
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof execute_args)
+ return this.equals((execute_args)that);
+ return false;
+ }
+
+ public boolean equals(execute_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_query = true && (this.query != null);
+ boolean that_present_query = true && (that.query != null);
+ if (this_present_query || that_present_query) {
+ if (!(this_present_query && that_present_query))
+ return false;
+ if (!this.query.equals(that.query))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 1:
+ if (field.type == TType.STRING) {
+ this.query = iprot.readString();
+ this.__isset.query = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("execute_args");
+ oprot.writeStructBegin(struct);
+ TField field = new TField();
+ if (this.query != null) {
+ field.name = "query";
+ field.type = TType.STRING;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.query);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("execute_args(");
+ sb.append("query:");
+ sb.append(this.query);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class execute_result implements TBase, java.io.Serializable {
+ private HiveServerException ex;
+
+ public final Isset __isset = new Isset();
+ public static final class Isset implements java.io.Serializable {
+ public boolean ex = false;
+ }
+
+ public execute_result() {
+ }
+
+ public execute_result(
+ HiveServerException ex)
+ {
+ this();
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public HiveServerException getEx() {
+ return this.ex;
+ }
+
+ public void setEx(HiveServerException ex) {
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public void unsetEx() {
+ this.ex = null;
+ this.__isset.ex = false;
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof execute_result)
+ return this.equals((execute_result)that);
+ return false;
+ }
+
+ public boolean equals(execute_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_ex = true && (this.ex != null);
+ boolean that_present_ex = true && (that.ex != null);
+ if (this_present_ex || that_present_ex) {
+ if (!(this_present_ex && that_present_ex))
+ return false;
+ if (!this.ex.equals(that.ex))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 1:
+ if (field.type == TType.STRUCT) {
+ this.ex = new HiveServerException();
+ this.ex.read(iprot);
+ this.__isset.ex = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("execute_result");
+ oprot.writeStructBegin(struct);
+ TField field = new TField();
+
+ if (this.__isset.ex) {
+ if (this.ex != null) {
+ field.name = "ex";
+ field.type = TType.STRUCT;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ this.ex.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("execute_result(");
+ sb.append("ex:");
+ sb.append(this.ex.toString());
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class fetchOne_args implements TBase, java.io.Serializable {
+ public fetchOne_args() {
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof fetchOne_args)
+ return this.equals((fetchOne_args)that);
+ return false;
+ }
+
+ public boolean equals(fetchOne_args that) {
+ if (that == null)
+ return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("fetchOne_args");
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("fetchOne_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class fetchOne_result implements TBase, java.io.Serializable {
+ private String success;
+ private HiveServerException ex;
+
+ public final Isset __isset = new Isset();
+ public static final class Isset implements java.io.Serializable {
+ public boolean success = false;
+ public boolean ex = false;
+ }
+
+ public fetchOne_result() {
+ }
+
+ public fetchOne_result(
+ String success,
+ HiveServerException ex)
+ {
+ this();
+ this.success = success;
+ this.__isset.success = true;
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public String getSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(String success) {
+ this.success = success;
+ this.__isset.success = true;
+ }
+
+ public void unsetSuccess() {
+ this.__isset.success = false;
+ }
+
+ public HiveServerException getEx() {
+ return this.ex;
+ }
+
+ public void setEx(HiveServerException ex) {
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public void unsetEx() {
+ this.ex = null;
+ this.__isset.ex = false;
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof fetchOne_result)
+ return this.equals((fetchOne_result)that);
+ return false;
+ }
+
+ public boolean equals(fetchOne_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && (this.success != null);
+ boolean that_present_success = true && (that.success != null);
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ boolean this_present_ex = true && (this.ex != null);
+ boolean that_present_ex = true && (that.ex != null);
+ if (this_present_ex || that_present_ex) {
+ if (!(this_present_ex && that_present_ex))
+ return false;
+ if (!this.ex.equals(that.ex))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.STRING) {
+ this.success = iprot.readString();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 1:
+ if (field.type == TType.STRUCT) {
+ this.ex = new HiveServerException();
+ this.ex.read(iprot);
+ this.__isset.ex = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("fetchOne_result");
+ oprot.writeStructBegin(struct);
+ TField field = new TField();
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.STRING;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.success);
+ oprot.writeFieldEnd();
+ }
+ } else if (this.__isset.ex) {
+ if (this.ex != null) {
+ field.name = "ex";
+ field.type = TType.STRUCT;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ this.ex.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("fetchOne_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(",ex:");
+ sb.append(this.ex.toString());
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class fetchN_args implements TBase, java.io.Serializable {
+ private int numRows;
+
+ public final Isset __isset = new Isset();
+ public static final class Isset implements java.io.Serializable {
+ public boolean numRows = false;
+ }
+
+ public fetchN_args() {
+ }
+
+ public fetchN_args(
+ int numRows)
+ {
+ this();
+ this.numRows = numRows;
+ this.__isset.numRows = true;
+ }
+
+ public int getNumRows() {
+ return this.numRows;
+ }
+
+ public void setNumRows(int numRows) {
+ this.numRows = numRows;
+ this.__isset.numRows = true;
+ }
+
+ public void unsetNumRows() {
+ this.__isset.numRows = false;
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof fetchN_args)
+ return this.equals((fetchN_args)that);
+ return false;
+ }
+
+ public boolean equals(fetchN_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_numRows = true;
+ boolean that_present_numRows = true;
+ if (this_present_numRows || that_present_numRows) {
+ if (!(this_present_numRows && that_present_numRows))
+ return false;
+ if (this.numRows != that.numRows)
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 1:
+ if (field.type == TType.I32) {
+ this.numRows = iprot.readI32();
+ this.__isset.numRows = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("fetchN_args");
+ oprot.writeStructBegin(struct);
+ TField field = new TField();
+ field.name = "numRows";
+ field.type = TType.I32;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ oprot.writeI32(this.numRows);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("fetchN_args(");
+ sb.append("numRows:");
+ sb.append(this.numRows);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class fetchN_result implements TBase, java.io.Serializable {
+ private List<String> success;
+ private HiveServerException ex;
+
+ public final Isset __isset = new Isset();
+ public static final class Isset implements java.io.Serializable {
+ public boolean success = false;
+ public boolean ex = false;
+ }
+
+ public fetchN_result() {
+ }
+
+ public fetchN_result(
+ List<String> success,
+ HiveServerException ex)
+ {
+ this();
+ this.success = success;
+ this.__isset.success = true;
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public int getSuccessSize() {
+ return (this.success == null) ? 0 : this.success.size();
+ }
+
+ public java.util.Iterator<String> getSuccessIterator() {
+ return (this.success == null) ? null : this.success.iterator();
+ }
+
+ public void addToSuccess(String elem) {
+ if (this.success == null) {
+ this.success = new ArrayList<String>();
+ }
+ this.success.add(elem);
+ this.__isset.success = true;
+ }
+
+ public List<String> getSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(List<String> success) {
+ this.success = success;
+ this.__isset.success = true;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ this.__isset.success = false;
+ }
+
+ public HiveServerException getEx() {
+ return this.ex;
+ }
+
+ public void setEx(HiveServerException ex) {
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public void unsetEx() {
+ this.ex = null;
+ this.__isset.ex = false;
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof fetchN_result)
+ return this.equals((fetchN_result)that);
+ return false;
+ }
+
+ public boolean equals(fetchN_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && (this.success != null);
+ boolean that_present_success = true && (that.success != null);
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ boolean this_present_ex = true && (this.ex != null);
+ boolean that_present_ex = true && (that.ex != null);
+ if (this_present_ex || that_present_ex) {
+ if (!(this_present_ex && that_present_ex))
+ return false;
+ if (!this.ex.equals(that.ex))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.LIST) {
+ {
+ TList _list0 = iprot.readListBegin();
+ this.success = new ArrayList<String>(_list0.size);
+ for (int _i1 = 0; _i1 < _list0.size; ++_i1)
+ {
+ String _elem2 = null;
+ _elem2 = iprot.readString();
+ this.success.add(_elem2);
+ }
+ iprot.readListEnd();
+ }
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 1:
+ if (field.type == TType.STRUCT) {
+ this.ex = new HiveServerException();
+ this.ex.read(iprot);
+ this.__isset.ex = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("fetchN_result");
+ oprot.writeStructBegin(struct);
+ TField field = new TField();
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.LIST;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ {
+ oprot.writeListBegin(new TList(TType.STRING, this.success.size()));
+ for (String _iter3 : this.success) {
+ oprot.writeString(_iter3);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ } else if (this.__isset.ex) {
+ if (this.ex != null) {
+ field.name = "ex";
+ field.type = TType.STRUCT;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ this.ex.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("fetchN_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(",ex:");
+ sb.append(this.ex.toString());
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class fetchAll_args implements TBase, java.io.Serializable {
+ public fetchAll_args() {
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof fetchAll_args)
+ return this.equals((fetchAll_args)that);
+ return false;
+ }
+
+ public boolean equals(fetchAll_args that) {
+ if (that == null)
+ return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("fetchAll_args");
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("fetchAll_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class fetchAll_result implements TBase, java.io.Serializable {
+ private List<String> success;
+ private HiveServerException ex;
+
+ public final Isset __isset = new Isset();
+ public static final class Isset implements java.io.Serializable {
+ public boolean success = false;
+ public boolean ex = false;
+ }
+
+ public fetchAll_result() {
+ }
+
+ public fetchAll_result(
+ List<String> success,
+ HiveServerException ex)
+ {
+ this();
+ this.success = success;
+ this.__isset.success = true;
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public int getSuccessSize() {
+ return (this.success == null) ? 0 : this.success.size();
+ }
+
+ public java.util.Iterator<String> getSuccessIterator() {
+ return (this.success == null) ? null : this.success.iterator();
+ }
+
+ public void addToSuccess(String elem) {
+ if (this.success == null) {
+ this.success = new ArrayList<String>();
+ }
+ this.success.add(elem);
+ this.__isset.success = true;
+ }
+
+ public List<String> getSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(List<String> success) {
+ this.success = success;
+ this.__isset.success = true;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ this.__isset.success = false;
+ }
+
+ public HiveServerException getEx() {
+ return this.ex;
+ }
+
+ public void setEx(HiveServerException ex) {
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public void unsetEx() {
+ this.ex = null;
+ this.__isset.ex = false;
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof fetchAll_result)
+ return this.equals((fetchAll_result)that);
+ return false;
+ }
+
+ public boolean equals(fetchAll_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && (this.success != null);
+ boolean that_present_success = true && (that.success != null);
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ boolean this_present_ex = true && (this.ex != null);
+ boolean that_present_ex = true && (that.ex != null);
+ if (this_present_ex || that_present_ex) {
+ if (!(this_present_ex && that_present_ex))
+ return false;
+ if (!this.ex.equals(that.ex))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.LIST) {
+ {
+ TList _list4 = iprot.readListBegin();
+ this.success = new ArrayList<String>(_list4.size);
+ for (int _i5 = 0; _i5 < _list4.size; ++_i5)
+ {
+ String _elem6 = null;
+ _elem6 = iprot.readString();
+ this.success.add(_elem6);
+ }
+ iprot.readListEnd();
+ }
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 1:
+ if (field.type == TType.STRUCT) {
+ this.ex = new HiveServerException();
+ this.ex.read(iprot);
+ this.__isset.ex = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("fetchAll_result");
+ oprot.writeStructBegin(struct);
+ TField field = new TField();
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.LIST;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ {
+ oprot.writeListBegin(new TList(TType.STRING, this.success.size()));
+ for (String _iter7 : this.success) {
+ oprot.writeString(_iter7);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ } else if (this.__isset.ex) {
+ if (this.ex != null) {
+ field.name = "ex";
+ field.type = TType.STRUCT;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ this.ex.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("fetchAll_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(",ex:");
+ sb.append(this.ex.toString());
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getSchema_args implements TBase, java.io.Serializable {
+ public getSchema_args() {
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getSchema_args)
+ return this.equals((getSchema_args)that);
+ return false;
+ }
+
+ public boolean equals(getSchema_args that) {
+ if (that == null)
+ return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getSchema_args");
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getSchema_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getSchema_result implements TBase, java.io.Serializable {
+ private String success;
+ private HiveServerException ex;
+
+ public final Isset __isset = new Isset();
+ public static final class Isset implements java.io.Serializable {
+ public boolean success = false;
+ public boolean ex = false;
+ }
+
+ public getSchema_result() {
+ }
+
+ public getSchema_result(
+ String success,
+ HiveServerException ex)
+ {
+ this();
+ this.success = success;
+ this.__isset.success = true;
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public String getSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(String success) {
+ this.success = success;
+ this.__isset.success = true;
+ }
+
+ public void unsetSuccess() {
+ this.__isset.success = false;
+ }
+
+ public HiveServerException getEx() {
+ return this.ex;
+ }
+
+ public void setEx(HiveServerException ex) {
+ this.ex = ex;
+ this.__isset.ex = true;
+ }
+
+ public void unsetEx() {
+ this.ex = null;
+ this.__isset.ex = false;
+ }
+
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getSchema_result)
+ return this.equals((getSchema_result)that);
+ return false;
+ }
+
+ public boolean equals(getSchema_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && (this.success != null);
+ boolean that_present_success = true && (that.success != null);
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ boolean this_present_ex = true && (this.ex != null);
+ boolean that_present_ex = true && (that.ex != null);
+ if (this_present_ex || that_present_ex) {
+ if (!(this_present_ex && that_present_ex))
+ return false;
+ if (!this.ex.equals(that.ex))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.STRING) {
+ this.success = iprot.readString();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 1:
+ if (field.type == TType.STRUCT) {
+ this.ex = new HiveServerException();
+ this.ex.read(iprot);
+ this.__isset.ex = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getSchema_result");
+ oprot.writeStructBegin(struct);
+ TField field = new TField();
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.STRING;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.success);
+ oprot.writeFieldEnd();
+ }
+ } else if (this.__isset.ex) {
+ if (this.ex != null) {
+ field.name = "ex";
+ field.type = TType.STRUCT;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ this.ex.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getSchema_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(",ex:");
+ sb.append(this.ex.toString());
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+}