tiny-presto 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22d98c71de7a327595dd05b6a59a8ed1ff747208995eb9ab5c02bc4ef954dade
4
- data.tar.gz: 86b59421bc8379e130956108781965da6d51bad55bb274b907ba53ae688c0d4a
3
+ metadata.gz: 938398a2ef1f907c63890cc11389d86bfe9560157ad87a79612d141f0be68be7
4
+ data.tar.gz: 533ecedfa97e00887022f3cccdfe015213e43974eff8a9c677ccd011504d6ce1
5
5
  SHA512:
6
- metadata.gz: 47f6d98e15f9071f31c424fcb63f8521f7b99a09c796bbac4df5447da5ba494101460f56d6a242b213737b9ba57af3fdc2bc2498cb390a961bdc5a2366fe467d
7
- data.tar.gz: a1801999ed1897d976e70d90b8728f92b428a91b08a8fd29a703d852728b2f1e4cc895b0ecaeac7dd09f650bc6ebb24f505f3de362e6f942fa48f10e96411920
6
+ metadata.gz: f5fbcc42461d7cbeb4a05cd69a46eca6cb9ae4869d467b798180896fbafc22b7941bf884d2833a9f28293130712ee921fee2bd9f8cfa643d84a48ae9f8dc28d8
7
+ data.tar.gz: cbcf3ff9bdb6ddad85e0d22db795fdcca10ed13c82be0e6c0cd4e1b9063f4ee2c02698f8abfcd6f8a3800d4af6a49f400c219ecff54f21f07f2e3d6919adfb19
data/lib/tiny-presto.rb CHANGED
@@ -32,18 +32,15 @@ module TinyPresto
32
32
  end
33
33
 
34
34
  def self.print_record(record)
35
- ret = '('
36
- record.each_with_index do |v, idx|
37
- ret << ',' if idx != 0
38
- ret << if v.is_a? Numeric
39
- v.to_s
40
- else
41
- # Non numeric value is interpreted as string
42
- "'#{v}'"
43
- end
35
+ ret = record.map do |v|
36
+ if v.is_a? Numeric
37
+ v.to_s
38
+ else
39
+ # Non numeric value is interpreted as string
40
+ "'#{v}'"
41
+ end
44
42
  end
45
- ret << ')'
46
- ret
43
+ "(#{ret.join(',')})"
47
44
  end
48
45
 
49
46
  def self.prepare(table_name, table_data)
@@ -59,13 +56,11 @@ module TinyPresto
59
56
  end
60
57
  end
61
58
  end
62
- values_clause = '(values '
63
- records.each_with_index do |record, idx|
64
- values_clause << ',' if idx != 0
59
+ values_clause = []
60
+ records.each do |record|
65
61
  values_clause << print_record(record)
66
62
  end
67
- values_clause << ')'
68
- query = "CREATE TABLE #{table_name} AS SELECT * FROM #{values_clause} t(#{columns.join(',')})"
63
+ query = "CREATE TABLE #{table_name} AS SELECT * FROM (values #{values_clause.join(',')}) t(#{columns.join(',')})"
69
64
  run_with_retry(query)
70
65
  end
71
66
 
@@ -90,6 +85,7 @@ module TinyPresto
90
85
  # Cluster may be in the initialization phase.
91
86
  raise unless e.message.match?(/^No nodes available to run query/)
92
87
 
88
+ sleep(1000)
93
89
  next
94
90
  end
95
91
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TinyPresto
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'.freeze
5
5
  end
data/spec/version_spec.rb CHANGED
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  RSpec.describe TinyPresto do
6
6
  describe '#version' do
7
7
  it 'correct' do
8
- expect(TinyPresto::VERSION).to eq('0.0.3')
8
+ expect(TinyPresto::VERSION).to eq('0.0.5')
9
9
  end
10
10
  end
11
11
  end
data/tiny-presto.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.description = 'Wrapper for Lightweight Presto Cluster'
12
12
  gem.summary = 'For Presto functionality testing'
13
13
  gem.homepage = 'https://github.com/Lewuathe/tiny-presto'
14
- gem.license = 'Apache 2.0'
14
+ gem.license = 'Apache-2.0'
15
15
 
16
16
  gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny-presto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kai Sasaki
@@ -93,7 +93,7 @@ files:
93
93
  - tiny-presto.gemspec
94
94
  homepage: https://github.com/Lewuathe/tiny-presto
95
95
  licenses:
96
- - Apache 2.0
96
+ - Apache-2.0
97
97
  metadata: {}
98
98
  post_install_message:
99
99
  rdoc_options: []