Skip to content

Commit 4ed6037

Browse files
authored
Merge branch 'master' into SparceColumns
2 parents 5ae4fa1 + 4251535 commit 4ed6037

35 files changed

+1246
-53
lines changed

.github/workflows/linux.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Linux
22

33
on:
4+
schedule:
5+
- cron: '0 0 * * 1'
46
push:
57
branches: [ master ]
68
pull_request:
@@ -12,7 +14,7 @@ env:
1214

1315
jobs:
1416
build:
15-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-20.04
1618
strategy:
1719
matrix:
1820
compiler: [clang-6, gcc-7, gcc-8, gcc-9]

.github/workflows/macos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: macOS
22

33
on:
4+
schedule:
5+
- cron: '0 0 * * 1'
46
push:
57
branches: [ master ]
68
pull_request:

.github/workflows/windows_mingw.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Windows mingw
22

33
on:
4+
schedule:
5+
- cron: '0 0 * * 1'
46
push:
57
branches: [ master ]
68
pull_request:

.github/workflows/windows_msvc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Windows
22

33
on:
4+
schedule:
5+
- cron: '0 0 * * 1'
46
push:
57
branches: [ master ]
68
pull_request:

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ PROJECT (CLICKHOUSE-CLIENT)
2727
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-deprecated-declarations")
2828
ENDIF ()
2929

30-
INCLUDE_DIRECTORIES (.)
31-
INCLUDE_DIRECTORIES (contrib)
32-
3330
SUBDIRS (
3431
clickhouse
3532
contrib/absl

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ C++ client for [ClickHouse](https://clickhouse.com/).
2121
* UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
2222
* Int128
2323
* UUID
24+
* Map
25+
* Point, Ring, Polygon, MultiPolygon
2426

2527
## Building
2628

@@ -87,7 +89,7 @@ int main()
8789

8890
## Retries
8991
If you wish to implement some retry logic atop of `clickhouse::Client` there are few simple rules to make you life easier:
90-
- If previous attempt threw an exception, then make sure to call `clickhouse::Client::ResetConnection()` before the next try.
92+
- If previous attempt threw an exception, then make sure to call `clickhouse::Client::ResetConnection()` before the next try.
9193
- For `clickhouse::Client::Insert()` you can reuse a block from previous try, no need to rebuild it from scratch.
9294

9395
See https://github.com/ClickHouse/clickhouse-cpp/issues/184 for details.

bench/bench.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <benchmark/benchmark.h>
22

33
#include <clickhouse/client.h>
4+
#include <ut/utils.h>
45

56
namespace clickhouse {
67

clickhouse/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ SET ( clickhouse-cpp-lib-src
1212
columns/decimal.cpp
1313
columns/enum.cpp
1414
columns/factory.cpp
15+
columns/geo.cpp
1516
columns/ip4.cpp
1617
columns/ip6.cpp
1718
columns/lowcardinality.cpp
1819
columns/lowcardinalityadaptor.h
1920
columns/nullable.cpp
2021
columns/numeric.cpp
2122
columns/serialization.cpp
23+
columns/map.cpp
2224
columns/string.cpp
2325
columns/tuple.cpp
2426
columns/uuid.cpp
@@ -44,13 +46,19 @@ TARGET_LINK_LIBRARIES (clickhouse-cpp-lib
4446
cityhash-lib
4547
lz4-lib
4648
)
49+
TARGET_INCLUDE_DIRECTORIES (clickhouse-cpp-lib
50+
PUBLIC ${PROJECT_SOURCE_DIR}
51+
)
4752

4853
ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src})
4954
TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static
5055
absl-lib
5156
cityhash-lib
5257
lz4-lib
5358
)
59+
TARGET_INCLUDE_DIRECTORIES (clickhouse-cpp-lib-static
60+
PUBLIC ${PROJECT_SOURCE_DIR}
61+
)
5462

5563
IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
5664
INCLUDE (CheckCXXSourceCompiles)
@@ -96,6 +104,7 @@ INSTALL(FILES base/input.h DESTINATION include/clickhouse/base/)
96104
INSTALL(FILES base/open_telemetry.h DESTINATION include/clickhouse/base/)
97105
INSTALL(FILES base/output.h DESTINATION include/clickhouse/base/)
98106
INSTALL(FILES base/platform.h DESTINATION include/clickhouse/base/)
107+
INSTALL(FILES base/projected_iterator.h DESTINATION include/clickhouse/base/)
99108
INSTALL(FILES base/singleton.h DESTINATION include/clickhouse/base/)
100109
INSTALL(FILES base/socket.h DESTINATION include/clickhouse/base/)
101110
INSTALL(FILES base/string_utils.h DESTINATION include/clickhouse/base/)
@@ -110,13 +119,15 @@ INSTALL(FILES columns/date.h DESTINATION include/clickhouse/columns/)
110119
INSTALL(FILES columns/decimal.h DESTINATION include/clickhouse/columns/)
111120
INSTALL(FILES columns/enum.h DESTINATION include/clickhouse/columns/)
112121
INSTALL(FILES columns/factory.h DESTINATION include/clickhouse/columns/)
122+
INSTALL(FILES columns/geo.h DESTINATION include/clickhouse/columns/)
113123
INSTALL(FILES columns/ip4.h DESTINATION include/clickhouse/columns/)
114124
INSTALL(FILES columns/ip6.h DESTINATION include/clickhouse/columns/)
115125
INSTALL(FILES columns/itemview.h DESTINATION include/clickhouse/columns/)
116126
INSTALL(FILES columns/lowcardinality.h DESTINATION include/clickhouse/columns/)
117127
INSTALL(FILES columns/nullable.h DESTINATION include/clickhouse/columns/)
118128
INSTALL(FILES columns/numeric.h DESTINATION include/clickhouse/columns/)
119129
INSTALL(FILES columns/serialization.h DESTINATION include/clickhouse/columns/)
130+
INSTALL(FILES columns/map.h DESTINATION include/clickhouse/columns/)
120131
INSTALL(FILES columns/string.h DESTINATION include/clickhouse/columns/)
121132
INSTALL(FILES columns/tuple.h DESTINATION include/clickhouse/columns/)
122133
INSTALL(FILES columns/utils.h DESTINATION include/clickhouse/columns/)

clickhouse/base/projected_iterator.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#pragma once
2+
3+
#include <iterator>
4+
#include <type_traits>
5+
#include <utility>
6+
7+
namespace clickhouse {
8+
9+
template <typename UnaryFunction, typename Iterator, typename Reference = decltype(std::declval<UnaryFunction>()(std::declval<Iterator>())),
10+
typename Value = std::decay_t<Reference>>
11+
class ProjectedIterator {
12+
public:
13+
using value_type = Value;
14+
using reference = Reference;
15+
using pointer = Reference;
16+
using difference_type = typename std::iterator_traits<Iterator>::difference_type;
17+
using iterator_category = typename std::iterator_traits<Iterator>::iterator_category;
18+
19+
ProjectedIterator() = default;
20+
21+
inline ProjectedIterator(Iterator const& iterator, UnaryFunction functor)
22+
: iterator_(iterator)
23+
, functor_(std::move(functor)) {
24+
}
25+
26+
inline UnaryFunction functor() const { return functor; }
27+
28+
inline Iterator const& base() const { return iterator_; }
29+
30+
inline reference operator*() const { return functor_(iterator_); }
31+
32+
inline ProjectedIterator& operator++() {
33+
++iterator_;
34+
return *this;
35+
}
36+
37+
inline ProjectedIterator& operator--() {
38+
--iterator_;
39+
return *this;
40+
}
41+
42+
inline bool operator==(const ProjectedIterator& other) const {
43+
return this->iterator_ == other.iterator_;
44+
}
45+
46+
inline bool operator!=(const ProjectedIterator& other) const {
47+
return !(*this == other);
48+
}
49+
50+
private:
51+
Iterator iterator_;
52+
UnaryFunction functor_;
53+
};
54+
55+
} // namespace clickhouse

clickhouse/base/string_view.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ template <
1111
typename TChar,
1212
typename TTraits = std::char_traits<TChar>
1313
>
14-
class StringViewImpl {
14+
class
15+
[[deprecated("Obsolete due to C++17's std::string_view. Will be removed in next major release (3.0) ")]]
16+
StringViewImpl {
1517
public:
1618
using size_type = size_t;
1719
using traits_type = TTraits;

0 commit comments

Comments
 (0)