Skip to content

Commit 25d7cd1

Browse files
authored
Merge pull request #233 from Enmk/deprecation_attributes
Minor: Deprecated some APIs
2 parents 8816d02 + 43f8dc4 commit 25d7cd1

File tree

13 files changed

+25
-24
lines changed

13 files changed

+25
-24
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ PROJECT (CLICKHOUSE-CLIENT)
2323
ENDIF ()
2424
SET (CMAKE_EXE_LINKER_FLAGS, "${CMAKE_EXE_LINKER_FLAGS} -lpthread")
2525
# -Wpedantic makes int128 support somewhat harder and less performant (by not allowing builtin __int128)
26-
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
26+
# -Wno-deprecated-declarations to produce less cluttered output when building library itself (`deprecated` attributes are for library users)
27+
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-deprecated-declarations")
2728
ENDIF ()
2829

2930
INCLUDE_DIRECTORIES (.)

clickhouse/base/sslsocket.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ void configureSSL(const clickhouse::SSLParams::ConfigurationType & configuration
7878
else if (err == 1 && value_present)
7979
throw clickhouse::OpenSSLError("Failed to configure OpenSSL: command '" + kv.first + "' needs no value");
8080
else if (err == -2)
81-
throw clickhouse::OpenSSLError("Failed to cofigure OpenSSL: unknown command '" + kv.first + "'");
81+
throw clickhouse::OpenSSLError("Failed to configure OpenSSL: unknown command '" + kv.first + "'");
8282
else if (err == -3)
83-
throw clickhouse::OpenSSLError("Failed to cofigure OpenSSL: command '" + kv.first + "' requires a value");
83+
throw clickhouse::OpenSSLError("Failed to configure OpenSSL: command '" + kv.first + "' requires a value");
8484
else
85-
throw clickhouse::OpenSSLError("Failed to cofigure OpenSSL: command '" + kv.first + "' unknown error: " + std::to_string(err));
85+
throw clickhouse::OpenSSLError("Failed to configure OpenSSL: command '" + kv.first + "' unknown error: " + std::to_string(err));
8686
}
8787
}
8888

clickhouse/base/string_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace clickhouse {
99

1010
template <typename T>
11+
[[deprecated("Not used by clickhosue-cpp itself, and will be removed in next major release (3.0) ")]]
1112
inline T FromString(const std::string& s) {
1213
std::istringstream iss(s);
1314
T result;
@@ -16,6 +17,7 @@ inline T FromString(const std::string& s) {
1617
}
1718

1819
template <typename T>
20+
[[deprecated("Not used by clickhosue-cpp itself, and will be removed in next major release (3.0) ")]]
1921
inline T FromString(const StringView& s) {
2022
std::istringstream iss((std::string(s)));
2123
T result;

clickhouse/client.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,20 @@ struct ClientOptions {
9090
DECLARE_FIELD(connection_recv_timeout, std::chrono::seconds, SetConnectionRecvTimeout, std::chrono::seconds(0));
9191
DECLARE_FIELD(connection_send_timeout, std::chrono::seconds, SetConnectionSendTimeout, std::chrono::seconds(0));
9292

93-
// TODO deprecate setting
9493
/** It helps to ease migration of the old codebases, which can't afford to switch
9594
* to using ColumnLowCardinalityT or ColumnLowCardinality directly,
9695
* but still want to benefit from smaller on-wire LowCardinality bandwidth footprint.
9796
*
9897
* @see LowCardinalitySerializationAdaptor, CreateColumnByType
9998
*/
99+
[[deprecated("Makes implementation of LC(X) harder and code uglier. Will be removed in next major release (3.0) ")]]
100100
DECLARE_FIELD(backward_compatibility_lowcardinality_as_wrapped_column, bool, SetBakcwardCompatibilityFeatureLowCardinalityAsWrappedColumn, true);
101101

102102
/** Set max size data to compress if compression enabled.
103103
*
104-
* Allows choosing tradeoff betwen RAM\CPU:
104+
* Allows choosing tradeoff between RAM\CPU:
105105
* - Lower value reduces RAM usage, but slightly increases CPU usage.
106106
* - Higher value increases RAM usage but slightly decreases CPU usage.
107-
*
108-
* Default is 0, use natural implementation-defined chunk size.
109107
*/
110108
DECLARE_FIELD(max_compression_chunk_size, unsigned int, SetMaxCompressionChunkSize, 65535);
111109

@@ -133,7 +131,7 @@ struct ClientOptions {
133131
* If no CAs are configured, the server's identity can't be validated, and the Client would err.
134132
* See https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_default_verify_paths.html
135133
*/
136-
/// Load deafult CA certificates from deafult locations.
134+
/// Load default CA certificates from default locations.
137135
DECLARE_FIELD(use_default_ca_locations, bool, SetUseDefaultCALocations, true);
138136
/// Path to the CA files to verify server certificate, may be empty.
139137
DECLARE_FIELD(path_to_ca_files, std::vector<std::string>, SetPathToCAFiles, {});

clickhouse/columns/array.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ColumnArray : public Column {
1919

2020
/** Create an array of given type.
2121
*
22-
* `data` is used internaly (and modified) by ColumnArray.
22+
* `data` is used internally (and modified) by ColumnArray.
2323
* Users are strongly advised against supplying non-empty columns and/or modifying
2424
* contents of `data` afterwards.
2525
*/
@@ -35,7 +35,7 @@ class ColumnArray : public Column {
3535
/// Converts input column to array and appends as one row to the current column.
3636
void AppendAsColumn(ColumnRef array);
3737

38-
/// Convets array at pos n to column.
38+
/// Converts array at pos n to column.
3939
/// Type of element of result column same as type of array element.
4040
ColumnRef GetAsColumn(size_t n) const;
4141

clickhouse/columns/date.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ class ColumnDateTime64 : public Column {
145145

146146
/// Appends one element to the end of column.
147147
void Append(const Int64& value);
148-
// It is a bit controversal: users might expect it to parse string of ISO8601 or some other human-friendly format,
149-
// but current implemntation parses it as fractional integer with decimal point, e.g. "123.456".
148+
// It is a bit controversial: users might expect it to parse string of ISO8601 or some other human-friendly format,
149+
// but current implementation parses it as fractional integer with decimal point, e.g. "123.456".
150150
// void Append(const std::string& value);
151151

152152
/// Returns element at given row number.

clickhouse/columns/itemview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void ItemView::ValidateData(Type::Code type, DataType data) {
9090
return AssertSize({4, 8, 16});
9191

9292
default:
93-
throw UnimplementedError("Unknon type code:" + std::to_string(static_cast<int>(type)));
93+
throw UnimplementedError("Unknown type code:" + std::to_string(static_cast<int>(type)));
9494
}
9595
}
9696

clickhouse/protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace clickhouse {
77
enum {
88
Hello = 0, /// Name, version, revision.
99
Data = 1, /// `Block` of data, may be compressed.
10-
Exception = 2, /// Exception that occured on server side during query execution.
10+
Exception = 2, /// Exception that occurred on server side during query execution.
1111
Progress = 3, /// Query execcution progress: rows and bytes read.
1212
Pong = 4, /// response to Ping sent by client.
1313
EndOfStream = 5, /// All packets were sent.

clickhouse/query.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class Query : public QueryEvents {
123123
return *this;
124124
}
125125

126-
/// Set handler for receiving a progress of query exceution.
126+
/// Set handler for receiving a progress of query execution.
127127
inline Query& OnProgress(ProgressCallback cb) {
128128
progress_cb_ = std::move(cb);
129129
return *this;

ut/Column_ut.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,14 @@ TYPED_TEST(GenericColumnTest, RoundTrip) {
283283
// Date32 first appeared in v21.9.2.17-stable
284284
const auto server_info = client.GetServerInfo();
285285
if (versionNumber(server_info) < versionNumber(21, 9)) {
286-
GTEST_SKIP() << "Date32 is availble since v21.9.2.17-stable and can't be tested against server: " << server_info;
286+
GTEST_SKIP() << "Date32 is available since v21.9.2.17-stable and can't be tested against server: " << server_info;
287287
}
288288
}
289289

290290
if constexpr (std::is_same_v<typename TestFixture::ColumnType, ColumnInt128>) {
291291
const auto server_info = client.GetServerInfo();
292292
if (versionNumber(server_info) < versionNumber(21, 7)) {
293-
GTEST_SKIP() << "ColumnInt128 is availble since v21.7.2.7-stable and can't be tested against server: " << server_info;
293+
GTEST_SKIP() << "ColumnInt128 is available since v21.7.2.7-stable and can't be tested against server: " << server_info;
294294
}
295295
}
296296

0 commit comments

Comments
 (0)