module Impala

Constants

DEFAULT_HOST
DEFAULT_PORT
VERSION

Public Class Methods

connect(host=DEFAULT_HOST, port=DEFAULT_PORT, options={}) { |connection| ... } click to toggle source

Connect to an Impala server. If a block is given, it will close the

connection after yielding the connection to the block.

@param [String] host the hostname or IP address of the Impala server @param [int] port the port that the Impala server is listening on @param [Hash] options connection options @option options [int] :timeout the timeout in seconds to use when connecting @option options [Hash] :sasl if present, used to connect with SASL PLAIN

authentication. Should have two properties:
- *:username* (String)
- *:password* (String)

@option options [Hash] :kerberos if present, used to connect with SASL

GSSAPI authentication using whatever context is available. Should have two
properties:
- *:host* (String)
- *:provider* (String)

@yieldparam [Connection] conn the open connection. Will be closed once the block

finishes

@return [Connection] the open connection, or, if a block is

passed, the return value of the block
# File lib/impala.rb, line 44
def self.connect(host=DEFAULT_HOST, port=DEFAULT_PORT, options={})
  connection = Connection.new(host, port, options)

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

  ret
end