forward/rbhive — pull request #9 by kovyrin (2013-07-31 23:20:42+00:00)
Title: Add batch fetching method to hiveserver2 API

After fixing an issue with rbhive and CDH 4.3.0 in #8, we have tried to switch our code to using hiverserver2 (multi-threading, better concurrency, etc) and noticed that hiveserver2 API does not match the one we've been using for the original hive server. In this branch I've done a few things while trying to add the method we needed:

1. Added code to ignore IO errors when trying to close connection to the server because it could already be closed and failure to catch those exceptions in `ensure` block when there is an exception being propagated from internal block would result in original exception being lost.
2. Added error handling to fetching methods to make sure any query execution errors are propagated to the caller instead of being ignored.
3. Fixed `prepare_fetch_results` method orientation parameter handling. Previously it would always use FETCH_NEXT because VALID_VALUES set contains actual integer encoded values, not constant names.
4. And finally, I've added a `fetch_in_batch` method, that mimics the behaviour of the original hiveserver API method.