Sha256: cd1db466dc82ae5c0f29b77f8704fc82b07e276f1a0257c12f423817cc56c3eb

Contents?: true

Size: 1.84 KB

Versions: 7

Compression:

Stored size: 1.84 KB

Contents

require_relative './helper'
require 'embulk/input/presto'
require 'yaml'

Presto = Embulk::Input::Presto

module Embulk
  class Input::Presto
    class TestTransaction < Test::Unit::TestCase
      def control
        Proc.new {|task| task_reports = [] }
      end

      sub_test_case "transaction" do
        def test_normal
          yaml = YAML.load(%(
            host: presto01
            catalog: store
            schema: public
            query: |
              SELECT
                trim(upper(url_decode(keyword))) AS keyword,
                count(*) as count
              FROM search
              CROSS JOIN UNNEST(split(keywords, ',')) AS t (keyword)
              WHERE log_date >= (CURRENT_DATE - INTERVAL '90' DAY)
               AND length(keywords) != 256
              group by keyword
              having count(*) >= 10
              order by count(*) desc
            columns:
              - {name: keyword, type: string}
              - {name: count, type: long}
            )
          )
          config = DataSource.new(yaml)
          Presto.transaction(config, &control)
        end

        def test_minimum
          yaml = YAML.load(%(
            query: |
              SELECT
                trim(upper(url_decode(keyword))) AS keyword,
                count(*) as count
              FROM search
              CROSS JOIN UNNEST(split(keywords, ',')) AS t (keyword)
              WHERE log_date >= (CURRENT_DATE - INTERVAL '90' DAY)
               AND length(keywords) != 256
              group by keyword
              having count(*) >= 10
              order by count(*) desc
            columns:
              - {name: keyword, type: string}
              - {name: count, type: long}

            )
          )
          config = DataSource.new(yaml)
          Presto.transaction(config, &control)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
embulk-input-presto-0.2.5 test/test_transaction.rb
embulk-input-presto-0.2.4 test/test_transaction.rb
embulk-input-presto-0.2.3 test/test_transaction.rb
embulk-input-presto-0.2.2 test/test_transaction.rb
embulk-input-presto-0.2.1 test/test_transaction.rb
embulk-input-presto-0.2.0 test/test_transaction.rb
embulk-input-presto-0.1.2 test/test_transaction.rb