click_house-client 0.8.5 → 0.8.6
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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/click_house/client/formatter.rb +11 -6
- data/lib/click_house/client/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: 963d26602a19bc060f4a8049157e645a1ab46b48c85285dced48816b4a63e89e
|
|
4
|
+
data.tar.gz: 882333606225305bd3be976985bfb82f8293e02c50d94edc43336b3d19e0a0c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56ec9aff3dd9ec9b885c311fbabb3e07d05496e318133294ffa1407c8893b17d66c033b55d68156a2cdca87967f0c2710f4cda66fbe288e54ee1132fe187b5c7
|
|
7
|
+
data.tar.gz: 3cefe2b27a7d759ae0831b048a12d9f39e0312071a1a7df9b2ff10c779b2ae2bdc011e068d03ca0eccb0c5fa811ca2f75e261f8d7dbf3932aad715fbede1e843
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
click_house-client (0.8.
|
|
4
|
+
click_house-client (0.8.6)
|
|
5
5
|
activerecord (>= 7.0, < 9.0)
|
|
6
6
|
activesupport (>= 7.0, < 9.0)
|
|
7
7
|
addressable (~> 2.8)
|
|
@@ -136,7 +136,7 @@ CHECKSUMS
|
|
|
136
136
|
benchmark (0.4.1) sha256=d4ef40037bba27f03b28013e219b950b82bace296549ec15a78016552f8d2cce
|
|
137
137
|
bigdecimal (3.2.2) sha256=39085f76b495eb39a79ce07af716f3a6829bc35eb44f2195e2753749f2fa5adc
|
|
138
138
|
byebug (12.0.0) sha256=d4a150d291cca40b66ec9ca31f754e93fed8aa266a17335f71bb0afa7fca1a1e
|
|
139
|
-
click_house-client (0.8.
|
|
139
|
+
click_house-client (0.8.6)
|
|
140
140
|
concurrent-ruby (1.3.5) sha256=813b3e37aca6df2a21a3b9f1d497f8cbab24a2b94cab325bffe65ee0f6cbebc6
|
|
141
141
|
connection_pool (2.5.3) sha256=cfd74a82b9b094d1ce30c4f1a346da23ee19dc8a062a16a85f58eab1ced4305b
|
|
142
142
|
diff-lcs (1.5.0) sha256=49b934001c8c6aedb37ba19daec5c634da27b318a7a3c654ae979d6ba1929b67
|
|
@@ -6,32 +6,37 @@ module ClickHouse
|
|
|
6
6
|
DEFAULT = ->(value) { value }
|
|
7
7
|
|
|
8
8
|
BASIC_TYPE_CASTERS = {
|
|
9
|
+
'UInt8' => ->(value) { Integer(value) },
|
|
9
10
|
'Int32' => ->(value) { Integer(value) },
|
|
10
11
|
'UInt32' => ->(value) { Integer(value) },
|
|
11
12
|
'Int64' => ->(value) { Integer(value) },
|
|
12
13
|
'UInt64' => ->(value) { Integer(value) },
|
|
14
|
+
'Float32' => ->(value) { Float(value) },
|
|
15
|
+
'Float64' => ->(value) { Float(value) },
|
|
13
16
|
"DateTime64(6, 'UTC')" => ->(value) { ActiveSupport::TimeZone['UTC'].parse(value) },
|
|
17
|
+
"DateTime64(3, 'UTC')" => ->(value) { ActiveSupport::TimeZone['UTC'].parse(value) },
|
|
18
|
+
"DateTime64(0, 'UTC')" => ->(value) { ActiveSupport::TimeZone['UTC'].parse(value) },
|
|
14
19
|
"DateTime('UTC')" => ->(value) { ActiveSupport::TimeZone['UTC'].parse(value) },
|
|
15
20
|
"Date" => ->(value) { Date.parse(value) },
|
|
21
|
+
"Date32" => ->(value) { Date.parse(value) },
|
|
16
22
|
"IntervalSecond" => ->(value) { ActiveSupport::Duration.build(value.to_i) },
|
|
17
23
|
"IntervalMillisecond" => ->(value) { ActiveSupport::Duration.build(value.to_i / 1000.0) }
|
|
18
24
|
}.freeze
|
|
19
25
|
|
|
20
26
|
TYPE_CASTERS = BASIC_TYPE_CASTERS.merge(
|
|
21
27
|
BASIC_TYPE_CASTERS.transform_keys { |type| "Nullable(#{type})" }
|
|
22
|
-
|
|
28
|
+
).merge(
|
|
29
|
+
BASIC_TYPE_CASTERS.transform_keys { |type| "LowCardinality(#{type})" }
|
|
23
30
|
)
|
|
24
31
|
|
|
25
32
|
def self.format(result)
|
|
26
|
-
|
|
27
|
-
hash[column['name']] = column['type']
|
|
33
|
+
column_typecasters = result['meta'].each_with_object({}) do |column, hash|
|
|
34
|
+
hash[column['name']] = TYPE_CASTERS.fetch(column['type'], DEFAULT)
|
|
28
35
|
end
|
|
29
36
|
|
|
30
37
|
result['data'].map do |row|
|
|
31
38
|
row.each_with_object({}) do |(column, value), casted_row|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
casted_row[column] = caster.call(value)
|
|
39
|
+
casted_row[column] = value.nil? ? value : column_typecasters[column].call(value)
|
|
35
40
|
end
|
|
36
41
|
end
|
|
37
42
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: click_house-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- group::optimize
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-12-
|
|
11
|
+
date: 2025-12-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|