Skip to content

Commit 58de669

Browse files
Merge branch 'master' into fix-inconsistent-formatting-except
2 parents 8c86c2b + e1feaa5 commit 58de669

File tree

64 files changed

+849
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+849
-111
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Upcoming meetups
5252
* [Istanbul Meetup](https://www.meetup.com/clickhouse-turkiye-meetup-group/events/306978337/) - May 15, 2025
5353
* [Shenzhen Meetup](https://www.huodongxing.com/event/7803892350511) - May 17, 2025
5454
* [Seattle Meetup](https://www.meetup.com/clickhouse-seattle-user-group/events/307622716/) - May 20, 2025
55+
* [Tokyo Meetup](https://www.meetup.com/clickhouse-tokyo-user-group/events/307689645/) - June 5, 2025
5556
* [Washington DC Meetup](https://www.meetup.com/clickhouse-dc-user-group/events/307622954/) - June 12, 2025
5657
* [Atlanta Meetup](https://www.meetup.com/clickhouse-atlanta-meetup-group/events/307627590/) - July 8, 2025
5758
* [New York Meetup](https://www.meetup.com/clickhouse-new-york-user-group/events/307627675/) - July 15, 2025

docs/en/sql-reference/functions/splitting-merging-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ splitByChar(separator, s[, max_substrings]))
2121

2222
**Arguments**
2323

24-
- `separator` — The separator which should contain exactly one character. [String](../data-types/string.md).
24+
- `separator` — The separator must be a single-byte character. [String](../data-types/string.md).
2525
- `s` — The string to split. [String](../data-types/string.md).
2626
- `max_substrings` — An optional `Int64` defaulting to 0. If `max_substrings` > 0, the returned array will contain at most `max_substrings` substrings, otherwise the function will return as many substrings as possible.
2727

programs/client/Client.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ try
353353
initTTYBuffer(
354354
toProgressOption(config().getString("progress", "default")), toProgressOption(config().getString("progress-table", "default")));
355355
initKeystrokeInterceptor();
356-
ASTAlterCommand::setFormatAlterCommandsWithParentheses(true);
357356

358357
{
359358
// All that just to set DB::CurrentThread::get().getGlobalContext()

programs/format/Format.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ int mainEntryClickHouseFormat(int argc, char ** argv)
107107
("backslash", "add a backslash at the end of each line of the formatted query")
108108
("allow_settings_after_format_in_insert", "Allow SETTINGS after FORMAT, but note, that this is not always safe")
109109
("seed", po::value<std::string>(), "seed (arbitrary string) that determines the result of obfuscation")
110-
("format_alter_operations_with_parentheses", po::value<bool>()->default_value(true), "If set to `true`, then alter operations will be surrounded by parentheses in formatted queries. This makes the parsing of formatted alter queries less ambiguous.")
111110
;
112111

113112
Settings cmd_settings;
@@ -134,7 +133,6 @@ int mainEntryClickHouseFormat(int argc, char ** argv)
134133
bool obfuscate = options.count("obfuscate");
135134
bool backslash = options.count("backslash");
136135
bool allow_settings_after_format_in_insert = options.count("allow_settings_after_format_in_insert");
137-
bool format_alter_operations_with_parentheses = options["format_alter_operations_with_parentheses"].as<bool>();
138136

139137
if (quiet && (hilite || oneline || obfuscate))
140138
{
@@ -160,8 +158,6 @@ int mainEntryClickHouseFormat(int argc, char ** argv)
160158
return 2;
161159
}
162160

163-
ASTAlterCommand::setFormatAlterCommandsWithParentheses(format_alter_operations_with_parentheses);
164-
165161
String query;
166162

167163
if (options.count("query"))

programs/local/LocalServer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,6 @@ try
617617
initTTYBuffer(toProgressOption(getClientConfiguration().getString("progress", "default")),
618618
toProgressOption(config().getString("progress-table", "default")));
619619
initKeystrokeInterceptor();
620-
ASTAlterCommand::setFormatAlterCommandsWithParentheses(true);
621620

622621
/// try to load user defined executable functions, throw on error and die
623622
try

programs/server/Server.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ namespace ServerSetting
217217
extern const ServerSettingsInt32 dns_cache_update_period;
218218
extern const ServerSettingsUInt32 dns_max_consecutive_failures;
219219
extern const ServerSettingsBool enable_azure_sdk_logging;
220-
extern const ServerSettingsBool format_alter_operations_with_parentheses;
221220
extern const ServerSettingsUInt64 global_profiler_cpu_time_period_ns;
222221
extern const ServerSettingsUInt64 global_profiler_real_time_period_ns;
223222
extern const ServerSettingsUInt64 http_connections_soft_limit;
@@ -984,8 +983,6 @@ try
984983
ServerSettings server_settings;
985984
server_settings.loadSettingsFromConfig(config());
986985

987-
ASTAlterCommand::setFormatAlterCommandsWithParentheses(server_settings[ServerSetting::format_alter_operations_with_parentheses]);
988-
989986
StackTrace::setShowAddresses(server_settings[ServerSetting::show_addresses_in_stack_traces]);
990987

991988
#if USE_HDFS

src/Common/ProfileEvents.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,16 @@
136136
M(LocalWriteThrottlerBytes, "Bytes passed through 'max_local_write_bandwidth_for_server'/'max_local_write_bandwidth' throttler.", ValueType::Bytes) \
137137
M(LocalWriteThrottlerSleepMicroseconds, "Total time a query was sleeping to conform 'max_local_write_bandwidth_for_server'/'max_local_write_bandwidth' throttling.", ValueType::Microseconds) \
138138
M(ThrottlerSleepMicroseconds, "Total time a query was sleeping to conform all throttling settings.", ValueType::Microseconds) \
139-
M(ReadTasksWithAppliedMutationsOnFly, "Total number of parts for which there was any mutation applied on fly", ValueType::Number) \
140-
M(MutationsAppliedOnFlyInAllReadTasks, "The sum of number of applied mutations on-fly for part among all read parts", ValueType::Number) \
139+
M(ReadTasksWithAppliedPatches, "Total number of read tasks for which there was any patch part applied", ValueType::Number) \
140+
M(PatchesAppliedInAllReadTasks, "Total number of applied patch parts among all read tasks", ValueType::Number) \
141+
M(PatchesMergeAppliedInAllReadTasks, "Total number of applied patch parts with Merge mode among all read tasks", ValueType::Number) \
142+
M(PatchesJoinAppliedInAllReadTasks, "Total number of applied patch parts with Join mode among all read tasks", ValueType::Number) \
143+
M(ApplyPatchesMicroseconds, "Total time spent applying patch parts", ValueType::Number) \
144+
M(ApplyPatchesMergeMicroseconds, "Total time spent applying patch parts with Merge mode", ValueType::Number) \
145+
M(ApplyPatchesJoinMicroseconds, "Total time spent applying patch parts with Join mode", ValueType::Number) \
146+
M(AnalyzePatchRangesMicroseconds, "Total time spent analyzing index of patch parts", ValueType::Number) \
147+
M(ReadTasksWithAppliedMutationsOnFly, "Total number of read tasks for which there was any mutation applied on fly", ValueType::Number) \
148+
M(MutationsAppliedOnFlyInAllReadTasks, "Total number of applied mutations on-fly among all read tasks", ValueType::Number) \
141149
\
142150
M(SchedulerIOReadRequests, "Resource requests passed through scheduler for IO reads.", ValueType::Number) \
143151
M(SchedulerIOReadBytes, "Bytes passed through scheduler for IO reads.", ValueType::Bytes) \
@@ -1135,6 +1143,8 @@ Event end() { return END; }
11351143

11361144
bool checkCPUOverload(Int64 os_cpu_busy_time_threshold, double min_ratio, double max_ratio, bool should_throw)
11371145
{
1146+
if ((max_ratio <= 0.0) || (max_ratio <= min_ratio))
1147+
return false;
11381148
double cpu_load = global_counters.getCPUOverload(os_cpu_busy_time_threshold);
11391149

11401150
if (cpu_load > DBL_EPSILON)

src/Compression/CompressedReadBufferBase.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "CompressedReadBufferBase.h"
1+
#include <Compression/CompressedReadBufferBase.h>
22

33
#include <bit>
44
#include <cstring>
@@ -179,8 +179,8 @@ size_t CompressedReadBufferBase::readCompressedData(size_t & size_decompressed,
179179

180180
UInt8 header_size = ICompressionCodec::getHeaderSize();
181181
own_compressed_buffer.resize(header_size + sizeof(Checksum));
182-
183182
compressed_in->readStrict(own_compressed_buffer.data(), sizeof(Checksum) + header_size);
183+
own_compressed_buffer_header_init = true;
184184

185185
readHeaderAndGetCodecAndSize(
186186
own_compressed_buffer.data() + sizeof(Checksum),
@@ -233,6 +233,7 @@ size_t CompressedReadBufferBase::readCompressedDataBlockForAsynchronous(size_t &
233233

234234
own_compressed_buffer.resize(header_size + sizeof(Checksum));
235235
compressed_in->readStrict(own_compressed_buffer.data(), sizeof(Checksum) + header_size);
236+
own_compressed_buffer_header_init = true;
236237

237238
readHeaderAndGetCodecAndSize(
238239
own_compressed_buffer.data() + sizeof(Checksum),
@@ -337,7 +338,9 @@ void CompressedReadBufferBase::addDiagnostics(Exception & e) const
337338
if (auto * seekable_in = dynamic_cast<SeekableReadBuffer *>(compressed_in))
338339
current_pos = seekable_in->tryGetPosition();
339340
UInt8 header_size = ICompressionCodec::getHeaderSize();
340-
String header_hex = hexString(own_compressed_buffer.data(), std::min(own_compressed_buffer.size(), sizeof(Checksum) + header_size));
341+
String header_hex = own_compressed_buffer_header_init ?
342+
hexString(own_compressed_buffer.data(), std::min(own_compressed_buffer.size(), sizeof(Checksum) + header_size)) :
343+
String("<uninitialized>"); // We do not print uninitialized memory because it's a security vulnerability and triggers msan
341344

342345
e.addMessage("While reading or decompressing {} (position: {}, typename: {}, compressed data header: {})",
343346
getFileNameFromReadBuffer(*compressed_in),

src/Compression/CompressedReadBufferBase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class CompressedReadBufferBase
2222

2323
/// If 'compressed_in' buffer has whole compressed block - then use it. Otherwise copy parts of data to 'own_compressed_buffer'.
2424
PODArray<char> own_compressed_buffer;
25+
bool own_compressed_buffer_header_init = false; // true if own_compressed_buffer header was initialized
2526
/// Points to memory, holding compressed block.
2627
char * compressed_buffer = nullptr;
2728

src/Core/ServerSettings.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,6 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
898898
)", 0) \
899899
DECLARE(UInt32, max_database_replicated_create_table_thread_pool_size, 1, R"(The number of threads to create tables during replica recovery in DatabaseReplicated. Zero means number of threads equal number of cores.)", 0) \
900900
DECLARE(Bool, database_replicated_allow_detach_permanently, true, R"(Allow detaching tables permanently in Replicated databases)", 0) \
901-
DECLARE(Bool, format_alter_operations_with_parentheses, true, R"(If set to `true`, then alter operations will be surrounded by parentheses in formatted queries. This makes the parsing of formatted alter queries less ambiguous.)", 0) \
902901
DECLARE(String, default_replica_path, "/clickhouse/tables/{uuid}/{shard}", R"(
903902
The path to the table in ZooKeeper.
904903

0 commit comments

Comments
 (0)