Skip to content

Commit

Permalink
Merge pull request #1 from Enmk/remove_deprecated
Browse files Browse the repository at this point in the history
Remove deprecated
  • Loading branch information
1261385937 authored Apr 20, 2024
2 parents 5bfac6c + 2df8781 commit 82c59a3
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 413 deletions.
1 change: 0 additions & 1 deletion .github/workflows/windows_mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ env:
BUILD_TYPE: Release
CLICKHOUSE_USER: clickhouse_cpp_cicd
CLICKHOUSE_PASSWORD: clickhouse_cpp_cicd

#
# CLICKHOUSE_HOST: localhost
# CLICKHOUSE_PORT: 9000
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED (VERSION 3.5.2)

LIST (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

INCLUDE (cpp17)
INCLUDE (cpp20)
INCLUDE (subdirs)
INCLUDE (openssl)
INCLUDE (version)
Expand All @@ -24,7 +24,7 @@ PROJECT (CLICKHOUSE-CLIENT
DESCRIPTION "ClickHouse C++ client library"
)

USE_CXX17 ()
USE_CXX20 ()
USE_OPENSSL ()

IF (CLICKHOUSE_CPP_CHECK_VERSION)
Expand Down
6 changes: 3 additions & 3 deletions clickhouse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ SET ( clickhouse-cpp-lib-src
base/singleton.h
base/socket.h
base/sslsocket.h
base/string_utils.h
base/string_view.h


base/uuid.h
base/wire_format.h

Expand All @@ -61,7 +61,7 @@ SET ( clickhouse-cpp-lib-src
columns/ip6.h
columns/itemview.h
columns/lowcardinality.h
columns/lowcardinalityadaptor.h

columns/map.h
columns/nothing.h
columns/nullable.h
Expand Down
28 changes: 0 additions & 28 deletions clickhouse/base/string_utils.h

This file was deleted.

142 changes: 0 additions & 142 deletions clickhouse/base/string_view.h

This file was deleted.

5 changes: 1 addition & 4 deletions clickhouse/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,6 @@ bool Client::Impl::ReadBlock(InputStream& input, Block* block) {
return false;
}

CreateColumnByTypeSettings create_column_settings;
create_column_settings.low_cardinality_as_wrapped_column = options_.backward_compatibility_lowcardinality_as_wrapped_column;

for (size_t i = 0; i < num_columns; ++i) {
std::string name;
std::string type;
Expand All @@ -634,7 +631,7 @@ bool Client::Impl::ReadBlock(InputStream& input, Block* block) {
return false;
}

if (ColumnRef col = CreateColumnByType(type, create_column_settings)) {
if (ColumnRef col = CreateColumnByType(type)) {
if (num_rows && !col->Load(&input, num_rows)) {
throw ProtocolError("can't load column '" + name + "' of type " + type);
}
Expand Down
9 changes: 0 additions & 9 deletions clickhouse/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ struct ClientOptions {
DECLARE_FIELD(connection_recv_timeout, std::chrono::milliseconds, SetConnectionRecvTimeout, std::chrono::milliseconds(0));
DECLARE_FIELD(connection_send_timeout, std::chrono::milliseconds, SetConnectionSendTimeout, std::chrono::milliseconds(0));

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

/** Set max size data to compress if compression enabled.
*
* Allows choosing tradeoff between RAM\CPU:
Expand Down
61 changes: 21 additions & 40 deletions clickhouse/columns/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "ip4.h"
#include "ip6.h"
#include "lowcardinality.h"
#include "lowcardinalityadaptor.h"
#include "map.h"
#include "nothing.h"
#include "nullable.h"
Expand Down Expand Up @@ -132,17 +131,17 @@ static ColumnRef CreateTerminalColumn(const TypeAst& ast) {
}
}

static ColumnRef CreateColumnFromAst(const TypeAst& ast, CreateColumnByTypeSettings settings) {
static ColumnRef CreateColumnFromAst(const TypeAst& ast) {
switch (ast.meta) {
case TypeAst::Array: {
return std::make_shared<ColumnArray>(
CreateColumnFromAst(GetASTChildElement(ast, 0), settings)
CreateColumnFromAst(GetASTChildElement(ast, 0))
);
}

case TypeAst::Nullable: {
return std::make_shared<ColumnNullable>(
CreateColumnFromAst(GetASTChildElement(ast, 0), settings),
CreateColumnFromAst(GetASTChildElement(ast, 0)),
std::make_shared<ColumnUInt8>()
);
}
Expand All @@ -156,7 +155,7 @@ static ColumnRef CreateColumnFromAst(const TypeAst& ast, CreateColumnByTypeSetti

columns.reserve(ast.elements.size());
for (const auto& elem : ast.elements) {
if (auto col = CreateColumnFromAst(elem, settings)) {
if (auto col = CreateColumnFromAst(elem)) {
columns.push_back(col);
} else {
return nullptr;
Expand Down Expand Up @@ -194,36 +193,20 @@ static ColumnRef CreateColumnFromAst(const TypeAst& ast, CreateColumnByTypeSetti
}
case TypeAst::LowCardinality: {
const auto nested = GetASTChildElement(ast, 0);
if (settings.low_cardinality_as_wrapped_column) {
switch (nested.code) {
// TODO (nemkov): update this to maximize code reuse.
case Type::String:
return std::make_shared<LowCardinalitySerializationAdaptor<ColumnString>>();
case Type::FixedString:
return std::make_shared<LowCardinalitySerializationAdaptor<ColumnFixedString>>(GetASTChildElement(nested, 0).value);
case Type::Nullable:
throw UnimplementedError("LowCardinality(" + nested.name + ") is not supported with LowCardinalityAsWrappedColumn on");
default:
throw UnimplementedError("LowCardinality(" + nested.name + ") is not supported");
}
}
else {
switch (nested.code) {
// TODO (nemkov): update this to maximize code reuse.
case Type::String:
return std::make_shared<ColumnLowCardinalityT<ColumnString>>();
case Type::FixedString:
return std::make_shared<ColumnLowCardinalityT<ColumnFixedString>>(GetASTChildElement(nested, 0).value);
case Type::Nullable:
return std::make_shared<ColumnLowCardinality>(
std::make_shared<ColumnNullable>(
CreateColumnFromAst(GetASTChildElement(nested, 0), settings),
std::make_shared<ColumnUInt8>()
)
);
default:
throw UnimplementedError("LowCardinality(" + nested.name + ") is not supported");
}
switch (nested.code) {
case Type::String:
return std::make_shared<ColumnLowCardinalityT<ColumnString>>();
case Type::FixedString:
return std::make_shared<ColumnLowCardinalityT<ColumnFixedString>>(GetASTChildElement(nested, 0).value);
case Type::Nullable:
return std::make_shared<ColumnLowCardinality>(
std::make_shared<ColumnNullable>(
CreateColumnFromAst(GetASTChildElement(nested, 0)),
std::make_shared<ColumnUInt8>()
)
);
default:
throw UnimplementedError("LowCardinality(" + nested.name + ") is not supported");
}
}
case TypeAst::SimpleAggregateFunction: {
Expand All @@ -239,7 +222,7 @@ static ColumnRef CreateColumnFromAst(const TypeAst& ast, CreateColumnByTypeSetti

columns.reserve(ast.elements.size());
for (const auto& elem : ast.elements) {
if (auto col = CreateColumnFromAst(elem, settings)) {
if (auto col = CreateColumnFromAst(elem)) {
columns.push_back(col);
} else {
return nullptr;
Expand All @@ -263,14 +246,12 @@ static ColumnRef CreateColumnFromAst(const TypeAst& ast, CreateColumnByTypeSetti

} // namespace


ColumnRef CreateColumnByType(const std::string& type_name, CreateColumnByTypeSettings settings) {
ColumnRef CreateColumnByType(const std::string& type_name) {
auto ast = ParseTypeName(type_name);
if (ast != nullptr) {
return CreateColumnFromAst(*ast, settings);
return CreateColumnFromAst(*ast);
}

return nullptr;
}

}
7 changes: 1 addition & 6 deletions clickhouse/columns/factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

namespace clickhouse {

struct CreateColumnByTypeSettings
{
bool low_cardinality_as_wrapped_column = false;
};

ColumnRef CreateColumnByType(const std::string& type_name, CreateColumnByTypeSettings settings = {});
ColumnRef CreateColumnByType(const std::string& type_name);

}
Loading

0 comments on commit 82c59a3

Please sign in to comment.