You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Saptarshi Guha <sa...@revolution-computing.com> on 2010/11/30 02:42:52 UTC
Hive thrift C++ client
Hello,
Does anyone have some example code of using building this?
My steps, I'm trying to build a shared library using the thrift api
1. Checked out from SVN (trunk)
2. Made a directory called thrift, into which I place fb303.thrift,
hive_metastore.thrift,hive_service.thrift,queryplan.thrift
- I made changes to the include paths in the thrift files
- Also changed the namespace of the queryplan thrift file to match those of
- hive_metastore and hive_service (i.e Apache::Hadoop::Hive)
3. Do thrift -r --gen hive_service.thrift
which creates all the cpp and .h files in gen-cpp
3. Build all the files, but this error occurs
g++ -m64 -I/usr/include/R -I/usr/local/include -I. -g -DHAVE_UINTPTR_T -I./gen-cpp `pkg-config --cflags thrift` -Wall -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ThriftHiveMetastore_server.skeleton.cpp -o ThriftHiveMetastore_server.skeleton.o
ThriftHiveMetastore_server.skeleton.cpp: In function 'int main(int, char**)':
ThriftHiveMetastore_server.skeleton.cpp:224: error: cannot allocate an object of abstract type 'ThriftHiveMetastoreHandler'
ThriftHiveMetastore_server.skeleton.cpp:19: note: because the following virtual functions are pure within 'ThriftHiveMetastoreHandler':
FacebookService.h:17: note: virtual void facebook::fb303::FacebookServiceIf::getName(std::string&)
FacebookService.h:18: note: virtual void facebook::fb303::FacebookServiceIf::getVersion(std::string&)
FacebookService.h:19: note: virtual facebook::fb303::fb_status::type facebook::fb303::FacebookServiceIf::getStatus()
FacebookService.h:20: note: virtual void facebook::fb303::FacebookServiceIf::getStatusDetails(std::string&)
FacebookService.h:21: note: virtual void facebook::fb303::FacebookServiceIf::getCounters(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, long int, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, long int> > >&)
FacebookService.h:22: note: virtual int64_t facebook::fb303::FacebookServiceIf::getCounter(const std::string&)
FacebookService.h:23: note: virtual void facebook::fb303::FacebookServiceIf::setOption(const std::string&, const std::string&)
FacebookService.h:24: note: virtual void facebook::fb303::FacebookServiceIf::getOption(std::string&, const std::string&)
FacebookService.h:25: note: virtual void facebook::fb303::FacebookServiceIf::getOptions(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)
FacebookService.h:26: note: virtual void facebook::fb303::FacebookServiceIf::getCpuProfile(std::string&, int32_t)
FacebookService.h:27: note: virtual int64_t facebook::fb303::FacebookServiceIf::aliveSince()
FacebookService.h:28: note: virtual void facebook::fb303::FacebookServiceIf::reinitialize()
FacebookService.h:29: note: virtual void facebook::fb303::FacebookServiceIf::shutdown()
Any pointers would be appreciated. I know that a language called C++ exists
:). I rarely use it. So this could be something to obvious (and silly of me).
Thanks
Joy
Re: Hive thrift C++ client
Posted by Saptarshi Guha <sa...@revolutionanalytics.com>.
Thanks! I'll look into it tomorrow.
Cheers
J
On Mon, Nov 29, 2010 at 6:42 PM, Carl Steinbach <ca...@cloudera.com> wrote:
> Hi Joy,
>
> The Hive C++ client library is located in odbc/src/cpp. It's actually a
> wrapper around the C++ code generated by the Thrift compiler. Directions
> describing how to build the library are located on the wiki here:
> http://wiki.apache.org/hadoop/Hive/HiveODBC
>
> Thanks.
>
> Carl
>
> On Mon, Nov 29, 2010 at 5:42 PM, Saptarshi Guha <
> saptarshi@revolution-computing.com> wrote:
>
>> Hello,
>> Does anyone have some example code of using building this?
>> My steps, I'm trying to build a shared library using the thrift api
>>
>> 1. Checked out from SVN (trunk)
>>
>> 2. Made a directory called thrift, into which I place fb303.thrift,
>> hive_metastore.thrift,hive_service.thrift,queryplan.thrift
>>
>> - I made changes to the include paths in the thrift files
>> - Also changed the namespace of the queryplan thrift file to match those
>> of
>> - hive_metastore and hive_service (i.e Apache::Hadoop::Hive)
>>
>> 3. Do thrift -r --gen hive_service.thrift
>> which creates all the cpp and .h files in gen-cpp
>>
>> 3. Build all the files, but this error occurs
>>
>> g++ -m64 -I/usr/include/R -I/usr/local/include -I. -g -DHAVE_UINTPTR_T
>> -I./gen-cpp `pkg-config --cflags thrift` -Wall -fpic -O2 -g -pipe -Wall
>> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
>> --param=ssp-buffer-size=4 -m64 -mtune=generic -c
>> ThriftHiveMetastore_server.skeleton.cpp -o
>> ThriftHiveMetastore_server.skeleton.o
>>
>> ThriftHiveMetastore_server.skeleton.cpp: In function 'int main(int,
>> char**)':
>> ThriftHiveMetastore_server.skeleton.cpp:224: error: cannot allocate an
>> object of abstract type 'ThriftHiveMetastoreHandler'
>> ThriftHiveMetastore_server.skeleton.cpp:19: note: because the following
>> virtual functions are pure within 'ThriftHiveMetastoreHandler':
>> FacebookService.h:17: note: virtual void
>> facebook::fb303::FacebookServiceIf::getName(std::string&)
>> FacebookService.h:18: note: virtual void
>> facebook::fb303::FacebookServiceIf::getVersion(std::string&)
>> FacebookService.h:19: note: virtual facebook::fb303::fb_status::type
>> facebook::fb303::FacebookServiceIf::getStatus()
>> FacebookService.h:20: note: virtual void
>> facebook::fb303::FacebookServiceIf::getStatusDetails(std::string&)
>> FacebookService.h:21: note: virtual void
>> facebook::fb303::FacebookServiceIf::getCounters(std::map<std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> >, long int,
>> std::less<std::basic_string<char, std::char_traits<char>,
>> std::allocator<char> > >, std::allocator<std::pair<const
>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >, long
>> int> > >&)
>> FacebookService.h:22: note: virtual int64_t
>> facebook::fb303::FacebookServiceIf::getCounter(const std::string&)
>> FacebookService.h:23: note: virtual void
>> facebook::fb303::FacebookServiceIf::setOption(const std::string&, const
>> std::string&)
>> FacebookService.h:24: note: virtual void
>> facebook::fb303::FacebookServiceIf::getOption(std::string&, const
>> std::string&)
>> FacebookService.h:25: note: virtual void
>> facebook::fb303::FacebookServiceIf::getOptions(std::map<std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> >,
>> std::less<std::basic_string<char, std::char_traits<char>,
>> std::allocator<char> > >, std::allocator<std::pair<const
>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
>> std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
>> >&)
>> FacebookService.h:26: note: virtual void
>> facebook::fb303::FacebookServiceIf::getCpuProfile(std::string&, int32_t)
>> FacebookService.h:27: note: virtual int64_t
>> facebook::fb303::FacebookServiceIf::aliveSince()
>> FacebookService.h:28: note: virtual void
>> facebook::fb303::FacebookServiceIf::reinitialize()
>> FacebookService.h:29: note: virtual void
>> facebook::fb303::FacebookServiceIf::shutdown()
>>
>>
>> Any pointers would be appreciated. I know that a language called C++
>> exists
>> :). I rarely use it. So this could be something to obvious (and silly of
>> me).
>>
>> Thanks
>> Joy
>>
>>
>
Re: Hive thrift C++ client
Posted by Carl Steinbach <ca...@cloudera.com>.
Hi Joy,
The Hive C++ client library is located in odbc/src/cpp. It's actually a
wrapper around the C++ code generated by the Thrift compiler. Directions
describing how to build the library are located on the wiki here:
http://wiki.apache.org/hadoop/Hive/HiveODBC
Thanks.
Carl
On Mon, Nov 29, 2010 at 5:42 PM, Saptarshi Guha <
saptarshi@revolution-computing.com> wrote:
> Hello,
> Does anyone have some example code of using building this?
> My steps, I'm trying to build a shared library using the thrift api
>
> 1. Checked out from SVN (trunk)
>
> 2. Made a directory called thrift, into which I place fb303.thrift,
> hive_metastore.thrift,hive_service.thrift,queryplan.thrift
>
> - I made changes to the include paths in the thrift files
> - Also changed the namespace of the queryplan thrift file to match those
> of
> - hive_metastore and hive_service (i.e Apache::Hadoop::Hive)
>
> 3. Do thrift -r --gen hive_service.thrift
> which creates all the cpp and .h files in gen-cpp
>
> 3. Build all the files, but this error occurs
>
> g++ -m64 -I/usr/include/R -I/usr/local/include -I. -g -DHAVE_UINTPTR_T
> -I./gen-cpp `pkg-config --cflags thrift` -Wall -fpic -O2 -g -pipe -Wall
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic -c
> ThriftHiveMetastore_server.skeleton.cpp -o
> ThriftHiveMetastore_server.skeleton.o
>
> ThriftHiveMetastore_server.skeleton.cpp: In function 'int main(int,
> char**)':
> ThriftHiveMetastore_server.skeleton.cpp:224: error: cannot allocate an
> object of abstract type 'ThriftHiveMetastoreHandler'
> ThriftHiveMetastore_server.skeleton.cpp:19: note: because the following
> virtual functions are pure within 'ThriftHiveMetastoreHandler':
> FacebookService.h:17: note: virtual void
> facebook::fb303::FacebookServiceIf::getName(std::string&)
> FacebookService.h:18: note: virtual void
> facebook::fb303::FacebookServiceIf::getVersion(std::string&)
> FacebookService.h:19: note: virtual facebook::fb303::fb_status::type
> facebook::fb303::FacebookServiceIf::getStatus()
> FacebookService.h:20: note: virtual void
> facebook::fb303::FacebookServiceIf::getStatusDetails(std::string&)
> FacebookService.h:21: note: virtual void
> facebook::fb303::FacebookServiceIf::getCounters(std::map<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >, long int,
> std::less<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >, std::allocator<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >, long
> int> > >&)
> FacebookService.h:22: note: virtual int64_t
> facebook::fb303::FacebookServiceIf::getCounter(const std::string&)
> FacebookService.h:23: note: virtual void
> facebook::fb303::FacebookServiceIf::setOption(const std::string&, const
> std::string&)
> FacebookService.h:24: note: virtual void
> facebook::fb303::FacebookServiceIf::getOption(std::string&, const
> std::string&)
> FacebookService.h:25: note: virtual void
> facebook::fb303::FacebookServiceIf::getOptions(std::map<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> std::less<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >, std::allocator<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
> >&)
> FacebookService.h:26: note: virtual void
> facebook::fb303::FacebookServiceIf::getCpuProfile(std::string&, int32_t)
> FacebookService.h:27: note: virtual int64_t
> facebook::fb303::FacebookServiceIf::aliveSince()
> FacebookService.h:28: note: virtual void
> facebook::fb303::FacebookServiceIf::reinitialize()
> FacebookService.h:29: note: virtual void
> facebook::fb303::FacebookServiceIf::shutdown()
>
>
> Any pointers would be appreciated. I know that a language called C++ exists
> :). I rarely use it. So this could be something to obvious (and silly of
> me).
>
> Thanks
> Joy
>
>