clickhouse-native 0.1.0 → 0.1.2
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/ext/clickhouse_native/client.cpp +22 -6
- data/lib/clickhouse-native.rb +5 -0
- data/lib/clickhouse_native/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 29b026c55ff211b775aead5f399ac0b3cee714481517d8b0025442c792590133
|
|
4
|
+
data.tar.gz: 63d45e2b6534ee453655c218008a7c7dd0ca3478c505bd23a8472198ddf3e337
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04f6129bdab791cfd33d2bd3f7a58d7bf5e017f7bc1979cf77d783db01b7d222b334d3d2b4a1bf243021e36bb2172618022a5352a0ae06260606900cb6459128
|
|
7
|
+
data.tar.gz: 23c0b9d52fca7b10c9682a0125c987abde5403ed477da29411edb6d4c989c92b3d0601fcf733b193516837e0131496fded8d94a472ae55f8653185fb21ab863b
|
|
@@ -31,12 +31,21 @@ static VALUE rb_cClient;
|
|
|
31
31
|
static VALUE err_base, err_connection, err_timeout, err_protocol,
|
|
32
32
|
err_server, err_encoder, err_decoder, err_unsupported;
|
|
33
33
|
|
|
34
|
-
// Internal
|
|
35
|
-
// raise_mapped_ex -> err_encoder
|
|
34
|
+
// Internal exceptions used to tag encoder / decoder failures and drive
|
|
35
|
+
// them through raise_mapped_ex -> err_encoder / err_unsupported /
|
|
36
|
+
// err_decoder without rb_raising from inside a try block. Critically,
|
|
37
|
+
// throwing (instead of rb_raise) lets the outer catch run
|
|
38
|
+
// ResetConnection() so the pooled client doesn't stay mid-packet.
|
|
36
39
|
namespace chn {
|
|
37
40
|
class EncoderFailure : public clickhouse::Error {
|
|
38
41
|
using clickhouse::Error::Error;
|
|
39
42
|
};
|
|
43
|
+
class UnsupportedType : public clickhouse::Error {
|
|
44
|
+
using clickhouse::Error::Error;
|
|
45
|
+
};
|
|
46
|
+
class DecoderFailure : public clickhouse::Error {
|
|
47
|
+
using clickhouse::Error::Error;
|
|
48
|
+
};
|
|
40
49
|
} // namespace chn
|
|
41
50
|
|
|
42
51
|
// ------------------------------------------------------------------
|
|
@@ -57,6 +66,12 @@ static void raise_mapped_ex(const std::exception& e) {
|
|
|
57
66
|
if (dynamic_cast<const chn::EncoderFailure*>(&e)) {
|
|
58
67
|
rb_raise(err_encoder, "%s", e.what());
|
|
59
68
|
}
|
|
69
|
+
if (dynamic_cast<const chn::UnsupportedType*>(&e)) {
|
|
70
|
+
rb_raise(err_unsupported, "%s", e.what());
|
|
71
|
+
}
|
|
72
|
+
if (dynamic_cast<const chn::DecoderFailure*>(&e)) {
|
|
73
|
+
rb_raise(err_decoder, "%s", e.what());
|
|
74
|
+
}
|
|
60
75
|
if (dynamic_cast<const ProtocolError*>(&e)) {
|
|
61
76
|
rb_raise(err_protocol, "%s", e.what());
|
|
62
77
|
}
|
|
@@ -212,7 +227,7 @@ static VALUE value_at(const ColumnRef& col, size_t idx) {
|
|
|
212
227
|
auto tuples = map_col->GetAsColumn(idx);
|
|
213
228
|
auto tuple = tuples->As<ColumnTuple>();
|
|
214
229
|
if (!tuple || tuple->TupleSize() != 2) {
|
|
215
|
-
|
|
230
|
+
throw chn::DecoderFailure("clickhouse-native: malformed Map column");
|
|
216
231
|
}
|
|
217
232
|
auto keys = (*tuple)[0];
|
|
218
233
|
auto vals = (*tuple)[1];
|
|
@@ -242,9 +257,10 @@ static VALUE value_at(const ColumnRef& col, size_t idx) {
|
|
|
242
257
|
}
|
|
243
258
|
|
|
244
259
|
default:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
260
|
+
throw chn::UnsupportedType(
|
|
261
|
+
std::string("clickhouse-native: unsupported column type ")
|
|
262
|
+
+ type->GetName()
|
|
263
|
+
+ " (code=" + std::to_string(static_cast<int>(type->GetCode())) + ")");
|
|
248
264
|
}
|
|
249
265
|
return Qnil;
|
|
250
266
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: clickhouse-native
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yuri Smirnov
|
|
@@ -285,6 +285,7 @@ files:
|
|
|
285
285
|
- ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zdict.h
|
|
286
286
|
- ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd.h
|
|
287
287
|
- ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd_errors.h
|
|
288
|
+
- lib/clickhouse-native.rb
|
|
288
289
|
- lib/clickhouse_native.rb
|
|
289
290
|
- lib/clickhouse_native/client.rb
|
|
290
291
|
- lib/clickhouse_native/errors.rb
|