class Blazer::Adapters::DrillAdapter

Public Instance Methods

parameter_binding() click to toggle source

issues.apache.org/jira/browse/DRILL-5079

# File lib/blazer/adapters/drill_adapter.rb, line 27
def parameter_binding
  # not supported
end
quoting() click to toggle source

drill.apache.org/docs/lexical-structure/#string

# File lib/blazer/adapters/drill_adapter.rb, line 22
def quoting
  :single_quote_escape
end
run_statement(statement, comment) click to toggle source
# File lib/blazer/adapters/drill_adapter.rb, line 4
def run_statement(statement, comment)
  columns = []
  rows = []
  error = nil

  begin
    # remove trailing semicolon
    response = drill.query(statement.sub(/;\s*\z/, ""))
    rows = response.map { |r| r.values }
    columns = rows.any? ? response.first.keys : []
  rescue => e
    error = e.message
  end

  [columns, rows, error]
end

Private Instance Methods

drill() click to toggle source
# File lib/blazer/adapters/drill_adapter.rb, line 33
def drill
  @drill ||= ::Drill.new(url: settings["url"])
end