您的位置:首页 > 其它

hive 12及以后,可以使用非同步查询

2014-10-31 00:00 483 查看
摘要: rbhive hive

hive 12及以后,可以使用非同步查询

rbhive1.0对此的支持函数如下

# encoding: UTF-8

$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'pp'
require 'rbhive'

def abc_function()
RBHive.tcli_connect('1.2.3.4', 10000,{hive_version: 12, transport: :sasl, :sasl_params => {}}) do |connection|
handles =connection.async_execute('select * from abc limit 2')
state= connection.async_state(handles)
while true do
sleep 10
state= connection.async_state(handles)
if(state == :finished)
result = connection.async_fetch(handles,1000)
pp result
connection.async_close_session(handles)
break
end
end
end
end

begin
abc_function()
rescue Exception => e
puts "#{e}"
puts "#{e.backtrace}"

end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  rbhive hive12
相关文章推荐