class Blazer::Adapters::HiveAdapter
Public Instance Methods
Source
# File lib/blazer/adapters/hive_adapter.rb, line 35 def parameter_binding end
has variable substitution, but sets for session cwiki.apache.org/confluence/display/Hive/LanguageManual+VariableSubstitution
Source
# File lib/blazer/adapters/hive_adapter.rb, line 24 def preview_statement "SELECT * FROM {table} LIMIT 10" end
Source
# File lib/blazer/adapters/hive_adapter.rb, line 29 def quoting :backslash_escape end
Source
# File lib/blazer/adapters/hive_adapter.rb, line 4 def run_statement(statement, comment) columns = [] rows = [] error = nil begin result = client.execute("#{statement} /*#{comment}*/") columns = result.any? ? result.first.keys : [] rows = result.map(&:values) rescue => e error = e.message end [columns, rows, error] end
Source
# File lib/blazer/adapters/hive_adapter.rb, line 20 def tables client.execute("SHOW TABLES").map { |r| r["tab_name"] } end
Protected Instance Methods
Source
# File lib/blazer/adapters/hive_adapter.rb, line 40 def client @client ||= begin uri = URI.parse(settings["url"]) Hexspace::Client.new( host: uri.host, port: uri.port, username: uri.user, password: uri.password, database: uri.path.delete_prefix("/"), mode: uri.scheme.to_sym ) end end