click_house 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -2
- data/docker-compose.yml +1 -1
- data/lib/click_house.rb +2 -10
- data/lib/click_house/definition/column_set.rb +1 -11
- data/lib/click_house/extend/type_definition.rb +9 -1
- data/lib/click_house/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55de5fd75c50aca5227537365eca6c1042bdff12833c8803f66b1022b6bbefd4
|
4
|
+
data.tar.gz: 101d57eeb3a903a9b95a9955a0ac093c80796ef5fc6163837d49fc7fc64464b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 860b3f17e95893e7cdd0d43c37ca42557492b7e44b8e0c61d326a8d83c9211a942775131d5a4705d53b6cdab3dc8acd716b5c2d629e7f95f9f95c74b9310398f
|
7
|
+
data.tar.gz: dc0fd575a9b1c22ae571fda8edb639a8d16df3ddb6497b97b63b3886933b8904e9d94a97f0f8b17619b4c4dca987282265a3002833c3318775e74d201c6f23fa
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/click_house.svg)](https://badge.fury.io/rb/click_house)
|
8
8
|
|
9
9
|
```bash
|
10
|
-
# Requires
|
10
|
+
# Requires Ruby >= 2.5
|
11
11
|
gem install click_house
|
12
12
|
```
|
13
13
|
|
@@ -346,7 +346,8 @@ data = @records.map do |record|
|
|
346
346
|
end
|
347
347
|
```
|
348
348
|
|
349
|
-
If native type supports arguments, define type with `%s`
|
349
|
+
If native type supports arguments, define *String* type with `%s`
|
350
|
+
argument and *Numeric* type with `%d` argument:
|
350
351
|
|
351
352
|
```ruby
|
352
353
|
class DateTimeType
|
data/docker-compose.yml
CHANGED
data/lib/click_house.rb
CHANGED
@@ -28,41 +28,33 @@ module ClickHouse
|
|
28
28
|
|
29
29
|
%w[Date].each do |column|
|
30
30
|
add_type column, Type::DateType.new
|
31
|
-
add_type "Nullable(#{column})", Type::NullableType.new(Type::DateType.new)
|
32
31
|
end
|
33
32
|
|
34
|
-
%w[String].each do |column|
|
33
|
+
%w[String FixedString(%d) UUID].each do |column|
|
35
34
|
add_type column, Type::StringType.new
|
36
|
-
add_type "Nullable(#{column})", Type::NullableType.new(Type::StringType.new)
|
37
35
|
end
|
38
36
|
|
39
37
|
['DateTime(%s)'].each do |column|
|
40
38
|
add_type column, Type::DateTimeType.new
|
41
|
-
add_type "Nullable(#{column})", Type::NullableType.new(Type::DateTimeType.new)
|
42
39
|
end
|
43
40
|
|
44
41
|
['DateTime64(%d, %s)'].each do |column|
|
45
42
|
add_type column, Type::DateTime64Type.new
|
46
|
-
add_type "Nullable(#{column})", Type::NullableType.new(Type::DateTime64Type.new)
|
47
43
|
end
|
48
44
|
|
49
|
-
['Decimal(%
|
45
|
+
['Decimal(%d, %d)', 'Decimal32(%d)', 'Decimal64(%d)', 'Decimal128(%d)'].each do |column|
|
50
46
|
add_type column, Type::DecimalType.new
|
51
|
-
add_type "Nullable(#{column})", Type::NullableType.new(Type::DecimalType.new)
|
52
47
|
end
|
53
48
|
|
54
49
|
%w[UInt8 UInt16 UInt32 UInt64 Int8 Int16 Int32 Int64].each do |column|
|
55
50
|
add_type column, Type::IntegerType.new
|
56
|
-
add_type "Nullable(#{column})", Type::NullableType.new(Type::IntegerType.new)
|
57
51
|
end
|
58
52
|
|
59
53
|
%w[Float32 Float64].each do |column|
|
60
54
|
add_type column, Type::FloatType.new
|
61
|
-
add_type "Nullable(#{column})", Type::NullableType.new(Type::IntegerType.new)
|
62
55
|
end
|
63
56
|
|
64
57
|
%w[IPv4 IPv6].each do |column|
|
65
58
|
add_type column, Type::IPType.new
|
66
|
-
add_type "Nullable(#{column})", Type::NullableType.new(Type::IPType.new)
|
67
59
|
end
|
68
60
|
end
|
@@ -3,17 +3,7 @@
|
|
3
3
|
module ClickHouse
|
4
4
|
module Definition
|
5
5
|
class ColumnSet
|
6
|
-
TYPES =
|
7
|
-
'UInt8', 'UInt16', 'UInt32', 'UInt64', 'Int8', 'Int16', 'Int32', 'Int64',
|
8
|
-
'Float32', 'Float64',
|
9
|
-
'Decimal(%d, %d)', 'Decimal32(%d)', 'Decimal64(%d)', 'Decimal128(%d)',
|
10
|
-
'String',
|
11
|
-
'FixedString(%d)',
|
12
|
-
'UUID',
|
13
|
-
'Date',
|
14
|
-
'IPv4', 'IPv6',
|
15
|
-
"DateTime('%s')", "DateTime64(%d, '%s')"
|
16
|
-
].freeze
|
6
|
+
TYPES = ClickHouse.type_names(nullable: false).map { |s| s.sub('%s', "'%s'") }.freeze
|
17
7
|
|
18
8
|
class << self
|
19
9
|
# @input "DateTime('%s')"
|
@@ -3,12 +3,20 @@
|
|
3
3
|
module ClickHouse
|
4
4
|
module Extend
|
5
5
|
module TypeDefinition
|
6
|
+
NULLABLE = 'Nullable'
|
7
|
+
|
6
8
|
def types
|
7
9
|
@types ||= Hash.new(Type::UndefinedType.new)
|
8
10
|
end
|
9
11
|
|
10
|
-
def add_type(type, klass)
|
12
|
+
def add_type(type, klass, nullable: true)
|
11
13
|
types[type] = klass
|
14
|
+
types["#{NULLABLE}(#{type})"] = Type::NullableType.new(klass) if nullable
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [Enum<String>]
|
18
|
+
def type_names(nullable:)
|
19
|
+
nullable ? types.keys : types.keys.grep_v(/#{NULLABLE}/i)
|
12
20
|
end
|
13
21
|
end
|
14
22
|
end
|
data/lib/click_house/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: click_house
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aliaksandr Shylau
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|