c++ - hbase thrift2 TGet.columns not working -
i want retrieve column family1:qualifier1,but columns in row '123'
tget get; tcolumn tcolumn; tcolumn.family="family1"; tcolumn.qualifier="qualifier1"; //i want column family1:qualifier1 get.row = "123"; get.columns.push_back(tcolumn); tresult result; std::cout<<"family:" << get.columns[0].family << " qualifier:" << get.columns[0].qualifier <<" get.columns size:" << get.columns.size() << std::endl; transport->open(); client.get(result, "mytable", get); transport->close(); int columnsize = result.columnvalues.size(); // got columns in th row if (columnsize > 0) { for(int = 0;i < columnsize ; ++i){ std::string columnname = result.columnvalues[i].qualifier; std::string columnvalue = result.columnvalues[i].value; std::cout << "columnname: " << columnname << std::endl; std::cout << "columnvalue: " << columnvalue << std::endl; } }
use function set value, void __set_family(const std::string& val);
do not set data member directly. std::string family;
class tcolumn { public: static const char* ascii_fingerprint; // = "354b89a42ce318bbbce588a386d5d6cd"; static const uint8_t binary_fingerprint[16]; // = {0x35,0x4b,0x89,0xa4,0x2c,0xe3,0x18,0xbb,0xbc,0xe5,0x88,0xa3,0x86,0xd5,0xd6,0xcd}; tcolumn() : family(), qualifier(), timestamp(0) { } virtual ~tcolumn() throw() {} std::string family; std::string qualifier; int64_t timestamp; _tcolumn__isset __isset; void __set_family(const std::string& val) { family = val; } void __set_qualifier(const std::string& val) { qualifier = val; __isset.qualifier = true; } void __set_timestamp(const int64_t val) { timestamp = val; __isset.timestamp = true; } bool operator == (const tcolumn & rhs) const { if (!(family == rhs.family)) return false; if (__isset.qualifier != rhs.__isset.qualifier) return false; else if (__isset.qualifier && !(qualifier == rhs.qualifier)) return false; if (__isset.timestamp != rhs.__isset.timestamp) return false; else if (__isset.timestamp && !(timestamp == rhs.timestamp)) return false; return true; } bool operator != (const tcolumn &rhs) const { return !(*this == rhs); } bool operator < (const tcolumn & ) const; uint32_t read(::apache::thrift::protocol::tprotocol* iprot); uint32_t write(::apache::thrift::protocol::tprotocol* oprot) const; };
Comments
Post a Comment