Sha256: e410ea19112d5eb5d9e7e4bbe72b1f7c4e017b7b635af87de38168766aa4084c

Contents?: true

Size: 848 Bytes

Versions: 20

Compression:

Stored size: 848 Bytes

Contents

module Blazer
  module Adapters
    class DrillAdapter < BaseAdapter
      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

      # https://drill.apache.org/docs/lexical-structure/#string
      def quoting
        :single_quote_escape
      end

      # https://issues.apache.org/jira/browse/DRILL-5079
      def parameter_binding
        # not supported
      end

      private

      def drill
        @drill ||= ::Drill.new(url: settings["url"])
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
blazer-3.1.0 lib/blazer/adapters/drill_adapter.rb
blazer-3.0.4 lib/blazer/adapters/drill_adapter.rb
blazer_xlsx-3.0.8 lib/blazer/adapters/drill_adapter.rb
blazer_xlsx-3.0.7 lib/blazer/adapters/drill_adapter.rb
blazer_xlsx-3.0.6 lib/blazer/adapters/drill_adapter.rb
blazer_xlsx-3.0.5 lib/blazer/adapters/drill_adapter.rb
blazer-3.0.3 lib/blazer/adapters/drill_adapter.rb
blazer-3.0.2 lib/blazer/adapters/drill_adapter.rb
finery-3.0.3 lib/blazer/adapters/drill_adapter.rb
finery-3.0.2 lib/blazer/adapters/drill_adapter.rb
blazer-3.0.1 lib/blazer/adapters/drill_adapter.rb
finery-3.0.1 lib/blazer/adapters/drill_adapter.rb
finery-3.0.0 lib/blazer/adapters/drill_adapter.rb
blazer-3.0.0 lib/blazer/adapters/drill_adapter.rb
blazer-2.6.5 lib/blazer/adapters/drill_adapter.rb
blazer-2.6.4 lib/blazer/adapters/drill_adapter.rb
blazer-2.6.3 lib/blazer/adapters/drill_adapter.rb
blazer-2.6.2 lib/blazer/adapters/drill_adapter.rb
blazer-2.6.1 lib/blazer/adapters/drill_adapter.rb
blazer-2.6.0 lib/blazer/adapters/drill_adapter.rb