Do you want to do it offline - I mean, insert in a hive table - that will be done parallely using map-reduce.
This is a jira on export-import for hive being worked on. It might be simpler to just export the data and import it into another db table. It might take some work to get the format compatible. But, this approach might be simpler to maintain. On 1/23/11 9:14 PM, "abhinav narain" <abhinavnarai...@gmail.com> wrote: >hi, >I would like to elaborate on what I wish to do. > >I want to store the results of hive query in a database instead of just >displaying it on the hive shell. >For this I need to modify/ add code at two places. >1. To fetch the schema from metastore, so that i can create a table in >mySql >database >2. Get a handle of a cursor, so that i can dump the result into the >database. > >I am unable to figure out how to write my code by implementing an >interface >and create jar file so that I can see the results when I run hive again. > >I have imported Hive src folder to eclipse, but I am not sure what should >I >do next. >Your help would be greatly appreciated. > >regards, >Abhinav Narain > >On Fri, Jan 21, 2011 at 2:30 PM, abhinav narain ><abhinavnarai...@gmail.com>wrote: > >> Thanks for the prompt replies. >> I have gone through the code. >> But i am unable to understand how can I integrate my own class and >>compile >> the code in a jar to be executed later. >> I am undergraduate and have not worked on such big project. >> >> Some hints will be very helpful. >> >> thanks again for the replies. >> >> regards, >> Abhinav Narain >> >> On Thu, Jan 20, 2011 at 1:02 PM, Carl Steinbach <c...@cloudera.com> >>wrote: >> >>> Hi Abhinav, >>> >>> 1. >>> > How does one have access to metastore of Hive, to retrieve the schema >>> > information from it. >>> > I cant find a file or other such thing in source code. >>> > >>> >>> Take a look at the IMetaStoreClient interface and HiveMetaStoreClient >>> class, >>> but bear in mind that the fundamental definition of the MetaStore >>> interface >>> is contained in the Thrift IDL file located >>> here: metastore/if/hive_metastore.thrift. IMetaStoreClient actually >>> defines >>> a wrapper interface around the code generated by the Thrift compiler >>>based >>> on the definitions in hive_metastore.thrift >>> >>> You can also find some good code examples in TestHiveMetaStore. >>> >>> >>> > 2. >>> > How does one get the handle of the result that is produced after the >>> query. >>> > >>> > If someone can tell about where to look for the answers, that will >>>also >>> > help >>> > >>> >>> Here are the relevant pieces of code that you should look at: >>> >>> service/if/hive_service.thrift >>> service/src/java/org/apache/hadoop/hive/service/HiveServer.java >>> service/src/test/org/apache/hadoop/hive/service/TestHiveServer.java >>> >>> The interface for executing queries and fetching results is defined in >>> hive_service.thrift and consists of the following methods: >>> >>> void execute(string query) >>> string fetchOne() >>> list<string> fetchN(i32 numRows) >>> list<string> fetchAll() >>> >>> Since execute() does not return a query ID the Thrift client is >>>limited to >>> executing/fetching the results of a single query at a time. >>> >>> Hope this helps. >>> >>> Carl >>> >> >>