Module: RBHive
- Defined in:
- lib/rbhive/version.rb,
lib/rbhive/connection.rb,
lib/rbhive/result_set.rb,
lib/rbhive/table_schema.rb,
lib/rbhive/schema_definition.rb,
lib/rbhive/t_c_l_i_connection.rb,
lib/rbhive/t_c_l_i_result_set.rb,
lib/rbhive/t_c_l_i_schema_definition.rb
Defined Under Namespace
Classes: Connection, ResultSet, SchemaDefinition, StdOutLogger, TCLIConnection, TCLIConnectionError, TCLIResultSet, TCLISchemaDefinition, TableSchema
Constant Summary
collapse
- VERSION =
'1.0.2'
- HIVE_THRIFT_MAPPING =
{
10 => 0,
11 => 1,
12 => 2,
13 => 6,
:cdh4 => 0,
:cdh5 => 4,
:PROTOCOL_V1 => 0,
:PROTOCOL_V2 => 1,
:PROTOCOL_V3 => 2,
:PROTOCOL_V4 => 3,
:PROTOCOL_V5 => 4,
:PROTOCOL_V6 => 5,
:PROTOCOL_V7 => 6
}
Class Method Summary
collapse
Class Method Details
.connect(server, port = 10_000, logger = StdOutLogger.new) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/rbhive/connection.rb', line 10
def connect(server, port=10_000, logger=StdOutLogger.new)
connection = RBHive::Connection.new(server, port, logger)
ret = nil
begin
connection.open
ret = yield(connection)
ensure
connection.close
ret
end
end
|
.tcli_connect(server, port = 10_000, options) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/rbhive/t_c_l_i_connection.rb', line 50
def tcli_connect(server, port = 10_000, options)
logger = options.key?(:logger) ? options.delete(:logger) : StdOutLogger.new
connection = RBHive::TCLIConnection.new(server, port, options, logger)
ret = nil
begin
connection.open
connection.open_session
ret = yield(connection)
ensure
begin
connection.close_session if connection.session
connection.close
rescue IOError => e
end
end
ret
end
|