I would like to execute a Hive request on the server asynchronously. The catch request will probably take a long time, so I would prefer not to block the call. I am currently using Thirft to make a blocking call (blocks on client.execute ()), but I have not seen an example of how to make a non-blocking call. Here is the lock code:
TSocket transport = new TSocket("hive.example.com", 10000);
transport.setTimeout(999999999);
TBinaryProtocol protocol = new TBinaryProtocol(transport);
Client client = new ThriftHive.Client(protocol);
transport.open();
client.execute(hql);
List<String> rows;
while ((rows = client.fetchN(1000)) != null) {
for (String row : rows) {
}
}
transport.close();
There is no try / catch blocks in the above code to make it short.
Does anyone have any ideas how to make an asynchronous call? Can Hive / Thrift support it? Is there a better way?
Thank!
source
share