Skip to content

Commit 20ebbc3

Browse files
Merge branch 'master' into format-settings-parsing
2 parents 3c40c17 + b7f1bea commit 20ebbc3

20 files changed

+72
-55
lines changed

cmake/limit_jobs.cmake

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,9 @@ endif ()
4242
# But use 2 parallel jobs, since:
4343
# - this is what llvm does
4444
# - and I've verfied that lld-11 does not use all available CPU time (in peak) while linking one binary
45-
if (CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO" AND ENABLE_THINLTO)
46-
if (ARCH_AARCH64)
47-
# aarch64 builds start to often fail with OOMs (reason not yet clear), for now let's limit the concurrency
48-
message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 1.")
49-
set (PARALLEL_LINK_JOBS 1)
50-
if (LINKER_NAME MATCHES "lld")
51-
math(EXPR LTO_JOBS ${NUMBER_OF_LOGICAL_CORES}/4)
52-
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -Wl,--thinlto-jobs=${LTO_JOBS}")
53-
endif()
54-
elseif (PARALLEL_LINK_JOBS GREATER 2)
55-
message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.")
56-
set (PARALLEL_LINK_JOBS 2)
57-
endif ()
45+
if (CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO" AND ENABLE_THINLTO AND PARALLEL_LINK_JOBS GREATER 2)
46+
message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.")
47+
set (PARALLEL_LINK_JOBS 2)
5848
endif()
5949

6050
message(STATUS "Building sub-tree with ${PARALLEL_COMPILE_JOBS} compile jobs and ${PARALLEL_LINK_JOBS} linker jobs (system: ${NUMBER_OF_LOGICAL_CORES} cores, ${TOTAL_PHYSICAL_MEMORY} MB RAM, 'OFF' means the native core count).")

programs/keeper/Keeper.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
/// A minimal file used when the keeper is run without installation
6767
INCBIN(keeper_resource_embedded_xml, SOURCE_DIR "/programs/keeper/keeper_embedded.xml");
6868

69+
extern const char * GIT_HASH;
70+
6971
int mainEntryClickHouseKeeper(int argc, char ** argv)
7072
{
7173
DB::Keeper app;
@@ -675,7 +677,7 @@ void Keeper::logRevision() const
675677
"Starting ClickHouse Keeper {} (revision: {}, git hash: {}, build id: {}), PID {}",
676678
VERSION_STRING,
677679
ClickHouseRevision::getVersionRevision(),
678-
git_hash.empty() ? "<unknown>" : git_hash,
680+
GIT_HASH,
679681
build_id.empty() ? "<unknown>" : build_id,
680682
getpid());
681683
}

programs/local/LocalServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ std::string LocalServer::getInitialCreateTableQuery()
367367
else
368368
table_structure = "(" + table_structure + ")";
369369

370-
return fmt::format("CREATE TABLE {} {} ENGINE = File({}, {});",
370+
return fmt::format("CREATE TEMPORARY TABLE {} {} ENGINE = File({}, {});",
371371
table_name, table_structure, data_format, table_file);
372372
}
373373

src/Access/HTTPAuthClient.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ class HTTPBasicAuthClient : private HTTPAuthClient<TResponseParser>
8282

8383
Result authenticate(const String & user_name, const String & password) const
8484
{
85-
Poco::Net::HTTPRequest request{Poco::Net::HTTPRequest::HTTP_GET, this->getURI().getPathAndQuery()};
85+
Poco::Net::HTTPRequest request{
86+
Poco::Net::HTTPRequest::HTTP_GET, this->getURI().getPathAndQuery(), Poco::Net::HTTPRequest::HTTP_1_1};
8687
Poco::Net::HTTPBasicCredentials basic_credentials{user_name, password};
8788
basic_credentials.authenticate(request);
8889

src/Common/SignalHandlers.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@
1818

1919
namespace DB
2020
{
21+
2122
namespace ErrorCodes
2223
{
2324
extern const int CANNOT_SET_SIGNAL_HANDLER;
2425
extern const int CANNOT_SEND_SIGNAL;
2526
}
27+
2628
}
2729

30+
extern const char * GIT_HASH;
31+
2832
using namespace DB;
2933

3034

@@ -334,7 +338,7 @@ void SignalListener::onTerminate(std::string_view message, UInt32 thread_num) co
334338
size_t pos = message.find('\n');
335339

336340
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) {}",
337-
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", daemon ? daemon->git_hash : "", thread_num, message.substr(0, pos));
341+
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH, thread_num, message.substr(0, pos));
338342

339343
/// Print trace from std::terminate exception line-by-line to make it easy for grep.
340344
while (pos != std::string_view::npos)
@@ -368,7 +372,7 @@ try
368372

369373
LOG_FATAL(log, "########## Short fault info ############");
370374
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) Received signal {}",
371-
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", daemon ? daemon->git_hash : "",
375+
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH,
372376
thread_num, sig);
373377

374378
std::string signal_description = "Unknown signal";
@@ -434,13 +438,13 @@ try
434438
if (query_id.empty())
435439
{
436440
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (no query) Received signal {} ({})",
437-
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", daemon ? daemon->git_hash : "",
441+
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH,
438442
thread_num, signal_description, sig);
439443
}
440444
else
441445
{
442446
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (query_id: {}) (query: {}) Received signal {} ({})",
443-
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", daemon ? daemon->git_hash : "",
447+
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH,
444448
thread_num, query_id, query, signal_description, sig);
445449
}
446450

src/Daemon/BaseDaemon.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,6 @@ void BaseDaemon::initializeTerminationAndSignalProcessing()
452452
build_id = SymbolIndex::instance().getBuildIDHex();
453453
#endif
454454

455-
git_hash = GIT_HASH;
456-
457455
#if defined(OS_LINUX)
458456
std::string executable_path = getExecutablePath();
459457

@@ -466,7 +464,7 @@ void BaseDaemon::logRevision() const
466464
{
467465
logger().information("Starting " + std::string{VERSION_FULL}
468466
+ " (revision: " + std::to_string(ClickHouseRevision::getVersionRevision())
469-
+ ", git hash: " + (git_hash.empty() ? "<unknown>" : git_hash)
467+
+ ", git hash: " + std::string(GIT_HASH)
470468
+ ", build id: " + (build_id.empty() ? "<unknown>" : build_id) + ")"
471469
+ ", PID " + std::to_string(getpid()));
472470
}

src/Daemon/BaseDaemon.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ class BaseDaemon : public Poco::Util::ServerApplication, public Loggers
165165
Poco::Util::AbstractConfiguration * last_configuration = nullptr;
166166

167167
String build_id;
168-
String git_hash;
169168
String stored_binary_hash;
170169

171170
bool should_setup_watchdog = false;

src/DataTypes/Serializations/SerializationDynamic.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ void SerializationDynamic::serializeBinaryBulkStatePrefix(
115115
dynamic_state->max_dynamic_types = column_dynamic.getMaxDynamicTypes();
116116
/// Write max_dynamic_types parameter, because it can differ from the max_dynamic_types
117117
/// that is specified in the Dynamic type (we could decrease it before merge).
118-
writeBinaryLittleEndian(dynamic_state->max_dynamic_types, *stream);
118+
writeVarUInt(dynamic_state->max_dynamic_types, *stream);
119119

120120
dynamic_state->variant_type = variant_info.variant_type;
121121
dynamic_state->variant_names = variant_info.variant_names;
122122
const auto & variant_column = column_dynamic.getVariantColumn();
123123

124124
/// Write information about variants.
125125
size_t num_variants = dynamic_state->variant_names.size() - 1; /// Don't write shared variant, Dynamic column should always have it.
126-
writeBinaryLittleEndian(num_variants, *stream);
126+
writeVarUInt(num_variants, *stream);
127127
if (settings.data_types_binary_encoding)
128128
{
129129
const auto & variants = assert_cast<const DataTypeVariant &>(*dynamic_state->variant_type).getVariants();
@@ -252,11 +252,11 @@ ISerialization::DeserializeBinaryBulkStatePtr SerializationDynamic::deserializeD
252252
readBinaryLittleEndian(structure_version, *structure_stream);
253253
auto structure_state = std::make_shared<DeserializeBinaryBulkStateDynamicStructure>(structure_version);
254254
/// Read max_dynamic_types parameter.
255-
readBinaryLittleEndian(structure_state->max_dynamic_types, *structure_stream);
255+
readVarUInt(structure_state->max_dynamic_types, *structure_stream);
256256
/// Read information about variants.
257257
DataTypes variants;
258258
size_t num_variants;
259-
readBinaryLittleEndian(num_variants, *structure_stream);
259+
readVarUInt(num_variants, *structure_stream);
260260
variants.reserve(num_variants + 1); /// +1 for shared variant.
261261
if (settings.data_types_binary_encoding)
262262
{

src/DataTypes/Serializations/SerializationObject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void SerializationObject::serializeBinaryBulkStatePrefix(
199199
auto object_state = std::make_shared<SerializeBinaryBulkStateObject>(serialization_version);
200200
object_state->max_dynamic_paths = column_object.getMaxDynamicPaths();
201201
/// Write max_dynamic_paths parameter.
202-
writeBinaryLittleEndian(object_state->max_dynamic_paths, *stream);
202+
writeVarUInt(object_state->max_dynamic_paths, *stream);
203203
/// Write all dynamic paths in sorted order.
204204
object_state->sorted_dynamic_paths.reserve(dynamic_paths.size());
205205
for (const auto & [path, _] : dynamic_paths)
@@ -354,7 +354,7 @@ ISerialization::DeserializeBinaryBulkStatePtr SerializationObject::deserializeOb
354354
readBinaryLittleEndian(serialization_version, *structure_stream);
355355
auto structure_state = std::make_shared<DeserializeBinaryBulkStateObjectStructure>(serialization_version);
356356
/// Read max_dynamic_paths parameter.
357-
readBinaryLittleEndian(structure_state->max_dynamic_paths, *structure_stream);
357+
readVarUInt(structure_state->max_dynamic_paths, *structure_stream);
358358
/// Read the sorted list of dynamic paths.
359359
size_t dynamic_paths_size;
360360
readVarUInt(dynamic_paths_size, *structure_stream);

src/Parsers/ExpressionElementParsers.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,10 @@ bool ParserCastOperator::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
853853

854854
/// Parse numbers (including decimals), strings, arrays and tuples of them.
855855

856+
Pos begin = pos;
856857
const char * data_begin = pos->begin;
857858
const char * data_end = pos->end;
858-
bool is_string_literal = pos->type == StringLiteral;
859+
ASTPtr string_literal;
859860

860861
if (pos->type == Minus)
861862
{
@@ -866,10 +867,15 @@ bool ParserCastOperator::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
866867
data_end = pos->end;
867868
++pos;
868869
}
869-
else if (pos->type == Number || is_string_literal)
870+
else if (pos->type == Number)
870871
{
871872
++pos;
872873
}
874+
else if (pos->type == StringLiteral)
875+
{
876+
if (!ParserStringLiteral().parse(begin, string_literal, expected))
877+
return false;
878+
}
873879
else if (isOneOf<OpeningSquareBracket, OpeningRoundBracket>(pos->type))
874880
{
875881
TokenType last_token = OpeningSquareBracket;
@@ -937,20 +943,18 @@ bool ParserCastOperator::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
937943
if (ParserToken(DoubleColon).ignore(pos, expected)
938944
&& ParserDataType().parse(pos, type_ast, expected))
939945
{
940-
String s;
941946
size_t data_size = data_end - data_begin;
942-
if (is_string_literal)
947+
if (string_literal)
943948
{
944-
ReadBufferFromMemory buf(data_begin, data_size);
945-
readQuotedStringWithSQLStyle(s, buf);
946-
assert(buf.count() == data_size);
949+
node = createFunctionCast(string_literal, type_ast);
950+
return true;
947951
}
948952
else
949-
s = String(data_begin, data_size);
950-
951-
auto literal = std::make_shared<ASTLiteral>(std::move(s));
952-
node = createFunctionCast(literal, type_ast);
953-
return true;
953+
{
954+
auto literal = std::make_shared<ASTLiteral>(String(data_begin, data_size));
955+
node = createFunctionCast(literal, type_ast);
956+
return true;
957+
}
954958
}
955959

956960
return false;

0 commit comments

Comments
 (0)