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