vertica 0.11.2 → 0.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -5
- data/lib/vertica/column.rb +14 -1
- data/lib/vertica/version.rb +1 -1
- data/test/functional/value_conversion_test.rb +15 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f70e87a9728a36bfe03176834b8fdbba03de8a11
|
4
|
+
data.tar.gz: 0b7740fb975d18b6a2b8fb9dba0e7a7de73ccb11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d68f03b0c9a890a2b8cfdd4aae363870caada376aaa0da7fb531bc78f65dde4f545b35c94509f8aec4766e6b46b6c9f45971b3890dea0ce2a6a065b083828d7
|
7
|
+
data.tar.gz: fb4b97a7925d04670793731ae3a72db70cc968a473dbca52b809dfc4102786cc4c0c87d52a0ebbc0ded7c70879a5c571d12ef33431c4a912051c2cbc0859adef
|
data/.travis.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
4
|
-
- 2.
|
5
|
-
- 2.
|
3
|
+
- "2.0"
|
4
|
+
- "2.1"
|
5
|
+
- "2.2"
|
6
6
|
|
7
7
|
before_install:
|
8
8
|
- sudo wget -nv https://s3.amazonaws.com/circle-support-bucket/vertica_7.0.1-0_amd64.deb
|
@@ -17,5 +17,3 @@ before_install:
|
|
17
17
|
|
18
18
|
before_script:
|
19
19
|
- cp ./test/connection.yml.example ./test/connection.yml
|
20
|
-
|
21
|
-
sudo: false
|
data/lib/vertica/column.rb
CHANGED
@@ -8,6 +8,19 @@ module Vertica
|
|
8
8
|
|
9
9
|
STRING_CONVERTER = lambda { |s| s.force_encoding('utf-8') }
|
10
10
|
|
11
|
+
FLOAT_CONVERTER = lambda do |s|
|
12
|
+
case s
|
13
|
+
when 'Infinity'
|
14
|
+
Float::INFINITY
|
15
|
+
when '-Infinity'
|
16
|
+
-Float::INFINITY
|
17
|
+
when 'NaN'
|
18
|
+
Float::NAN
|
19
|
+
else
|
20
|
+
s.to_f
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
11
24
|
DATA_TYPE_CONVERSIONS = [
|
12
25
|
[:unspecified, nil],
|
13
26
|
[:tuple, nil],
|
@@ -16,7 +29,7 @@ module Vertica
|
|
16
29
|
[:unknown, nil],
|
17
30
|
[:bool, lambda { |s| s == 't' }],
|
18
31
|
[:integer, lambda { |s| s.to_i }],
|
19
|
-
[:float,
|
32
|
+
[:float, FLOAT_CONVERTER],
|
20
33
|
[:char, STRING_CONVERTER],
|
21
34
|
[:varchar, STRING_CONVERTER],
|
22
35
|
[:date, lambda { |s| Date.new(*s.split("-").map{|x| x.to_i}) }],
|
data/lib/vertica/version.rb
CHANGED
@@ -14,7 +14,9 @@ class ValueConversionTest < Minitest::Test
|
|
14
14
|
"timestamp_field" timestamp,
|
15
15
|
"time_field" time,
|
16
16
|
"interval_field" interval,
|
17
|
-
"boolean_field" boolean
|
17
|
+
"boolean_field" boolean,
|
18
|
+
"float_field" float,
|
19
|
+
"float_zero" float
|
18
20
|
)
|
19
21
|
SQL
|
20
22
|
end
|
@@ -26,8 +28,11 @@ class ValueConversionTest < Minitest::Test
|
|
26
28
|
end
|
27
29
|
|
28
30
|
def test_value_conversions
|
29
|
-
@connection.query "INSERT INTO conversions_table VALUES (123, 'hello world', '2010-01-01', '2010-01-01 12:00:00', '12:00:00', INTERVAL '1 DAY', TRUE)"
|
30
|
-
result = @connection.query "SELECT
|
31
|
+
@connection.query "INSERT INTO conversions_table VALUES (123, 'hello world', '2010-01-01', '2010-01-01 12:00:00', '12:00:00', INTERVAL '1 DAY', TRUE, 1.0, 0.0)"
|
32
|
+
result = @connection.query "SELECT *,
|
33
|
+
float_field / float_zero as infinity,
|
34
|
+
float_field / float_zero - float_field / float_zero as nan
|
35
|
+
FROM conversions_table LIMIT 1"
|
31
36
|
assert_equal result.rows.length, 1
|
32
37
|
assert_equal [
|
33
38
|
123,
|
@@ -36,14 +41,18 @@ class ValueConversionTest < Minitest::Test
|
|
36
41
|
DateTime.parse('2010-01-01 12:00:00'),
|
37
42
|
"12:00:00",
|
38
43
|
"1",
|
39
|
-
true
|
44
|
+
true,
|
45
|
+
1.0,
|
46
|
+
0.0,
|
47
|
+
Float::INFINITY,
|
48
|
+
Float::NAN], result.rows.first
|
40
49
|
end
|
41
50
|
|
42
51
|
def test_nil_conversions
|
43
|
-
@connection.query "INSERT INTO conversions_table VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
|
52
|
+
@connection.query "INSERT INTO conversions_table VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
|
44
53
|
result = @connection.query "SELECT * FROM conversions_table LIMIT 1"
|
45
54
|
assert_equal result.rows.length, 1
|
46
|
-
assert_equal [nil, nil, nil, nil, nil, nil, nil], result.rows.first
|
55
|
+
assert_equal [nil, nil, nil, nil, nil, nil, nil, nil, nil], result.rows.first
|
47
56
|
end
|
48
57
|
|
49
58
|
def test_string_encoding
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vertica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Smick
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|