lib/rbhive/connection.rb in rbhive-0.1.15 vs lib/rbhive/connection.rb in rbhive-0.1.16

- old
+ new

@@ -72,9 +72,16 @@ def fetch(query) execute(query) ResultSet.new(client.fetchAll) end + def fetch_in_batch(query, batch_size=100) + execute(query) + until (next_batch = client.fetchN(batch_size)).empty? + yield next_batch + end + end + def first(query) execute(query) ResultSet.new([client.fetchOne]) end