forward3d / rbhive

Ruby gem for querying Apache Hive
http://www.forward3d.com
MIT License
98 stars 75 forks source link

Add batch fetching method to hiveserver2 API #9

Closed kovyrin closed 10 years ago

kovyrin commented 10 years ago

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.
andytinycat commented 10 years ago

Thanks for this!