|
3 | 3 | #include "readonly_client_test.h" |
4 | 4 | #include "connection_failed_client_test.h" |
5 | 5 | #include "utils.h" |
| 6 | +#include "roundtrip_column.h" |
6 | 7 |
|
7 | 8 | #include <gtest/gtest.h> |
8 | 9 |
|
9 | | -#include <cmath> |
10 | 10 | #include <thread> |
11 | 11 | #include <chrono> |
12 | 12 |
|
13 | 13 | using namespace clickhouse; |
14 | 14 |
|
15 | | -namespace { |
16 | | - |
17 | | -uint64_t versionNumber( |
18 | | - uint64_t version_major, |
19 | | - uint64_t version_minor, |
20 | | - uint64_t version_patch = 0, |
21 | | - uint64_t revision = 0) { |
22 | | - |
23 | | - // in this case version_major can be up to 1000 |
24 | | - static auto revision_decimal_places = 8; |
25 | | - static auto patch_decimal_places = 4; |
26 | | - static auto minor_decimal_places = 4; |
27 | | - |
28 | | - auto const result = version_major * static_cast<uint64_t>(std::pow(10, minor_decimal_places + patch_decimal_places + revision_decimal_places)) |
29 | | - + version_minor * static_cast<uint64_t>(std::pow(10, patch_decimal_places + revision_decimal_places)) |
30 | | - + version_patch * static_cast<uint64_t>(std::pow(10, revision_decimal_places)) |
31 | | - + revision; |
32 | | - |
33 | | - return result; |
34 | | -} |
35 | | - |
36 | | -uint64_t versionNumber(const ServerInfo & server_info) { |
37 | | - return versionNumber(server_info.version_major, server_info.version_minor, server_info.version_patch, server_info.revision); |
38 | | -} |
39 | | - |
40 | | -} |
41 | | - |
42 | 15 | // Use value-parameterized tests to run same tests with different client |
43 | 16 | // options. |
44 | 17 | class ClientCase : public testing::TestWithParam<ClientOptions> { |
@@ -978,35 +951,6 @@ TEST_P(ClientCase, DISABLED_ArrayArrayUInt64) { |
978 | 951 | } |
979 | 952 | } |
980 | 953 |
|
981 | | -ColumnRef RoundtripColumnValues(Client& client, ColumnRef expected) { |
982 | | - // Create a temporary table with a single column |
983 | | - // insert values from `expected` |
984 | | - // select and aggregate all values from block into `result` column |
985 | | - auto result = expected->CloneEmpty(); |
986 | | - |
987 | | - const std::string type_name = result->GetType().GetName(); |
988 | | - client.Execute("DROP TEMPORARY TABLE IF EXISTS temporary_roundtrip_table;"); |
989 | | - client.Execute("CREATE TEMPORARY TABLE IF NOT EXISTS temporary_roundtrip_table (col " + type_name + ");"); |
990 | | - { |
991 | | - Block block; |
992 | | - block.AppendColumn("col", expected); |
993 | | - block.RefreshRowCount(); |
994 | | - client.Insert("temporary_roundtrip_table", block); |
995 | | - } |
996 | | - |
997 | | - client.Select("SELECT col FROM temporary_roundtrip_table", [&result](const Block& b) { |
998 | | - if (b.GetRowCount() == 0) |
999 | | - return; |
1000 | | - |
1001 | | - ASSERT_EQ(1u, b.GetColumnCount()); |
1002 | | - result->Append(b[0]); |
1003 | | - }); |
1004 | | - |
1005 | | - EXPECT_EQ(expected->GetType(), result->GetType()); |
1006 | | - EXPECT_EQ(expected->Size(), result->Size()); |
1007 | | - return result; |
1008 | | -} |
1009 | | - |
1010 | 954 | TEST_P(ClientCase, RoundtripArrayTUint64) { |
1011 | 955 | auto array = std::make_shared<ColumnArrayT<ColumnUInt64>>(); |
1012 | 956 | array->Append({0, 1, 2}); |
|
0 commit comments