Module: Impaler

Defined in:
lib/impaler.rb,
lib/impaler/manager.rb,
lib/impaler/version.rb

Defined Under Namespace

Classes: ConnectionError, ImpalerDefaultLogger, ImpalerError, Manager, QueryError

Constant Summary collapse

DEFAULT_LOGGER =
ImpalerDefaultLogger.new()
IMPALA_THEN_HIVE =
1
HIVE_ONLY =
2
IMPALA_ONLY =
3
VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.connect(impala_servers, hivethrift_servers, logger = Impaler::DEFAULT_LOGGER) {|conn| ... } ⇒ Connection

Connect to the servers and optionally execute a block of code with the servers.

Parameters:

  • host:port (String)

    for the impala server or an array of host:port to pick from many

  • host:port (String)

    for the hive thirft server (v1) or an array of host:port to pick from many

Yield Parameters:

  • conn (Connection)

    the open connection. Will be closed once the block finishes

Returns:

  • (Connection)

    the open connection, or, if a block is passed, the return value of the block



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/impaler.rb', line 27

def self.connect(impala_servers, hivethrift_servers, logger=Impaler::DEFAULT_LOGGER)
  manager = Manager.new(impala_servers, hivethrift_servers, logger=logger)

  if block_given?
    begin
      ret = yield manager
    ensure
      manager.close
    end
  else
    ret = manager
  end

  ret
end