Skip to content

Commit d9f8a8d

Browse files
authored
Merge branch 'antalya-25.6.5' into bugfix/antalya-25.6.5/lock_object_storage_task_distribution_ms_lost_host
2 parents d36f86b + a1c4e5e commit d9f8a8d

33 files changed

+1093
-89
lines changed

programs/server/config.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,9 +1701,9 @@
17011701
<!-- the ClickHouse core developers team. -->
17021702
<!-- Doing so at least in pre-production environments is highly appreciated -->
17031703
<!-- The reports are anonymized -->
1704-
<enabled>true</enabled>
1705-
<send_logical_errors>true</send_logical_errors>
1706-
<endpoint>https://crash.clickhouse.com/</endpoint>
1704+
<enabled>false</enabled>
1705+
<send_logical_errors>false</send_logical_errors>
1706+
<endpoint></endpoint>
17071707
</send_crash_reports>
17081708

17091709
<!-- Uncomment to disable ClickHouse internal DNS caching. -->

src/Core/Range.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
#include <Core/Range.h>
33
#include <IO/Operators.h>
44
#include <IO/WriteBufferFromString.h>
5+
#include <IO/ReadBufferFromString.h>
56
#include <Common/FieldVisitorToString.h>
67
#include <Common/FieldAccurateComparison.h>
78

89

910
namespace DB
1011
{
1112

13+
namespace ErrorCodes
14+
{
15+
extern const int INCORRECT_DATA;
16+
};
17+
18+
1219
FieldRef::FieldRef(ColumnsWithTypeAndName * columns_, size_t row_idx_, size_t column_idx_)
1320
: Field((*(*columns_)[column_idx_].column)[row_idx_]), columns(columns_), row_idx(row_idx_), column_idx(column_idx_)
1421
{
@@ -151,6 +158,13 @@ bool Range::isInfinite() const
151158
return left.isNegativeInfinity() && right.isPositiveInfinity();
152159
}
153160

161+
/// [x, x]
162+
bool Range::isPoint() const
163+
{
164+
return fullBounded() && left_included && right_included && equals(left, right)
165+
&& !left.isNegativeInfinity() && !left.isPositiveInfinity();
166+
}
167+
154168
bool Range::intersectsRange(const Range & r) const
155169
{
156170
/// r to the left of me.
@@ -332,6 +346,29 @@ String Range::toString() const
332346
return str.str();
333347
}
334348

349+
String Range::serialize() const
350+
{
351+
WriteBufferFromOwnString str;
352+
353+
str << left_included << right_included;
354+
writeFieldBinary(left, str);
355+
writeFieldBinary(right, str);
356+
357+
return str.str();
358+
}
359+
360+
void Range::deserialize(const String & range)
361+
{
362+
if (range.empty())
363+
throw Exception(ErrorCodes::INCORRECT_DATA, "Empty range dump");
364+
365+
ReadBufferFromOwnString str(range);
366+
367+
str >> left_included >> right_included;
368+
left = readFieldBinary(str);
369+
right = readFieldBinary(str);
370+
}
371+
335372
Hyperrectangle intersect(const Hyperrectangle & a, const Hyperrectangle & b)
336373
{
337374
size_t result_size = std::min(a.size(), b.size());

src/Core/Range.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ struct Range
9494

9595
bool isBlank() const;
9696

97+
bool isPoint() const;
98+
9799
bool intersectsRange(const Range & r) const;
98100

99101
bool containsRange(const Range & r) const;
@@ -114,6 +116,9 @@ struct Range
114116
bool nearByWith(const Range & r) const;
115117

116118
String toString() const;
119+
120+
String serialize() const;
121+
void deserialize(const String & range);
117122
};
118123

119124
Range intersect(const Range & a, const Range & b);

src/Core/Settings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6918,6 +6918,9 @@ Allow retries in cluster request, when one node goes offline
69186918
)", EXPERIMENTAL) \
69196919
DECLARE(Bool, object_storage_remote_initiator, false, R"(
69206920
Execute request to object storage as remote on one of object_storage_cluster nodes.
6921+
)", EXPERIMENTAL) \
6922+
DECLARE(Bool, allow_experimental_iceberg_read_optimization, true, R"(
6923+
Allow Iceberg read optimization based on Iceberg metadata.
69216924
)", EXPERIMENTAL) \
69226925
\
69236926
/** Experimental timeSeries* aggregate functions. */ \

src/Core/SettingsChangesHistory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const VersionToSettingsChangesMap & getSettingsChangesHistory()
8383
{"object_storage_cluster_join_mode", "allow", "allow", "New setting"},
8484
{"object_storage_remote_initiator", false, false, "New setting."},
8585
{"allow_experimental_export_merge_tree_part", false, false, "New setting."},
86+
{"allow_experimental_iceberg_read_optimization", true, true, "New setting."},
8687
{"export_merge_tree_part_overwrite_file_if_exists", false, false, "New setting."},
8788
});
8889
addSettingsChanges(settings_changes_history, "25.6",

src/Disks/ObjectStorages/IObjectStorage.cpp

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include <Common/Exception.h>
99
#include <Common/ObjectStorageKeyGenerator.h>
1010

11+
/// TODO: move DataFileInfo into separate file
12+
#include <Storages/ObjectStorage/DataLakes/IDataLakeMetadata.h>
13+
1114
#include <Poco/JSON/Object.h>
1215
#include <Poco/JSON/Parser.h>
1316
#include <Poco/JSON/JSONException.h>
@@ -101,6 +104,28 @@ WriteSettings IObjectStorage::patchSettings(const WriteSettings & write_settings
101104
return write_settings;
102105
}
103106

107+
RelativePathWithMetadata::RelativePathWithMetadata(const String & task_string, std::optional<ObjectMetadata> metadata_)
108+
: metadata(std::move(metadata_))
109+
, command(task_string)
110+
{
111+
if (!command.isParsed())
112+
relative_path = task_string;
113+
else
114+
{
115+
auto file_path = command.getFilePath();
116+
if (file_path.has_value())
117+
relative_path = file_path.value();
118+
file_meta_info = command.getFileMetaInfo();
119+
}
120+
}
121+
122+
RelativePathWithMetadata::RelativePathWithMetadata(const DataFileInfo & info, std::optional<ObjectMetadata> metadata_)
123+
: metadata(std::move(metadata_))
124+
{
125+
relative_path = info.file_path;
126+
file_meta_info = info.file_meta_info;
127+
}
128+
104129
void RelativePathWithMetadata::loadMetadata(ObjectStoragePtr object_storage, bool ignore_non_existent_file)
105130
{
106131
if (!metadata)
@@ -129,20 +154,29 @@ RelativePathWithMetadata::CommandInTaskResponse::CommandInTaskResponse(const std
129154

130155
successfully_parsed = true;
131156

157+
if (json->has("file_path"))
158+
file_path = json->getValue<std::string>("file_path");
132159
if (json->has("retry_after_us"))
133160
retry_after_us = json->getValue<size_t>("retry_after_us");
161+
if (json->has("meta_info"))
162+
file_meta_info = std::make_shared<DataFileMetaInfo>(json->getObject("meta_info"));
134163
}
135164
catch (const Poco::JSON::JSONException &)
136165
{ /// Not a JSON
137166
return;
138167
}
139168
}
140169

141-
std::string RelativePathWithMetadata::CommandInTaskResponse::to_string() const
170+
std::string RelativePathWithMetadata::CommandInTaskResponse::toString() const
142171
{
143172
Poco::JSON::Object json;
173+
174+
if (file_path.has_value())
175+
json.set("file_path", file_path.value());
144176
if (retry_after_us.has_value())
145177
json.set("retry_after_us", retry_after_us.value());
178+
if (file_meta_info.has_value())
179+
json.set("meta_info", file_meta_info.value()->toJson());
146180

147181
std::ostringstream oss;
148182
oss.exceptions(std::ios::failbit);

src/Disks/ObjectStorages/IObjectStorage.h

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <Poco/Timestamp.h>
1111
#include <Poco/Util/AbstractConfiguration.h>
12+
#include <Poco/JSON/Object.h>
1213
#include <Core/Defines.h>
1314
#include <IO/ReadSettings.h>
1415
#include <IO/WriteSettings.h>
@@ -101,6 +102,10 @@ struct ObjectMetadata
101102
ObjectAttributes attributes;
102103
};
103104

105+
struct DataFileInfo;
106+
class DataFileMetaInfo;
107+
using DataFileMetaInfoPtr = std::shared_ptr<DataFileMetaInfo>;
108+
104109
struct RelativePathWithMetadata
105110
{
106111
class CommandInTaskResponse
@@ -109,31 +114,35 @@ struct RelativePathWithMetadata
109114
CommandInTaskResponse() = default;
110115
explicit CommandInTaskResponse(const std::string & task);
111116

112-
bool is_parsed() const { return successfully_parsed; }
113-
void set_retry_after_us(Poco::Timestamp::TimeDiff time_us) { retry_after_us = time_us; }
117+
bool isParsed() const { return successfully_parsed; }
118+
void setFilePath(const std::string & file_path_ ) { file_path = file_path_; }
119+
void setRetryAfterUs(Poco::Timestamp::TimeDiff time_us) { retry_after_us = time_us; }
120+
void setFileMetaInfo(DataFileMetaInfoPtr file_meta_info_ ) { file_meta_info = file_meta_info_; }
121+
122+
std::string toString() const;
123+
124+
std::optional<std::string> getFilePath() const { return file_path; }
114125

115-
std::string to_string() const;
126+
std::optional<Poco::Timestamp::TimeDiff> getRetryAfterUs() const { return retry_after_us; }
116127

117-
std::optional<Poco::Timestamp::TimeDiff> get_retry_after_us() const { return retry_after_us; }
128+
std::optional<DataFileMetaInfoPtr> getFileMetaInfo() const { return file_meta_info; }
118129

119130
private:
120131
bool successfully_parsed = false;
132+
std::optional<std::string> file_path;
121133
std::optional<Poco::Timestamp::TimeDiff> retry_after_us;
134+
std::optional<DataFileMetaInfoPtr> file_meta_info;
122135
};
123136

124137
String relative_path;
125138
std::optional<ObjectMetadata> metadata;
126139
CommandInTaskResponse command;
140+
std::optional<DataFileMetaInfoPtr> file_meta_info;
127141

128142
RelativePathWithMetadata() = default;
129143

130-
explicit RelativePathWithMetadata(const String & task_string, std::optional<ObjectMetadata> metadata_ = std::nullopt)
131-
: metadata(std::move(metadata_))
132-
, command(task_string)
133-
{
134-
if (!command.is_parsed())
135-
relative_path = task_string;
136-
}
144+
explicit RelativePathWithMetadata(const String & task_string, std::optional<ObjectMetadata> metadata_ = std::nullopt);
145+
explicit RelativePathWithMetadata(const DataFileInfo & info, std::optional<ObjectMetadata> metadata_ = std::nullopt);
137146

138147
virtual ~RelativePathWithMetadata() = default;
139148

@@ -145,6 +154,10 @@ struct RelativePathWithMetadata
145154
virtual std::string getPathToArchive() const { throw Exception(ErrorCodes::LOGICAL_ERROR, "Not an archive"); }
146155
virtual size_t fileSizeInArchive() const { throw Exception(ErrorCodes::LOGICAL_ERROR, "Not an archive"); }
147156

157+
void setFileMetaInfo(DataFileMetaInfoPtr file_meta_info_ ) { file_meta_info = file_meta_info_; }
158+
void setFileMetaInfo(std::optional<DataFileMetaInfoPtr> file_meta_info_ ) { file_meta_info = file_meta_info_; }
159+
std::optional<DataFileMetaInfoPtr> getFileMetaInfo() const { return file_meta_info; }
160+
148161
void loadMetadata(ObjectStoragePtr object_storage, bool ignore_non_existent_file);
149162
const CommandInTaskResponse & getCommand() const { return command; }
150163
};

src/Parsers/FunctionSecretArgumentsFinder.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class FunctionSecretArgumentsFinder
241241
break;
242242
if (f->name() == "headers")
243243
result.nested_maps.push_back(f->name());
244-
else if (f->name() != "extra_credentials")
244+
else if (f->name() != "extra_credentials" && f->name() != "equals")
245245
break;
246246
count -= 1;
247247
}
@@ -266,6 +266,8 @@ class FunctionSecretArgumentsFinder
266266
return;
267267
}
268268

269+
findSecretNamedArgument("secret_access_key", url_arg_idx);
270+
269271
/// We should check other arguments first because we don't need to do any replacement in case of
270272
/// s3('url', NOSIGN, 'format' [, 'compression'] [, extra_credentials(..)] [, headers(..)])
271273
/// s3('url', 'format', 'structure' [, 'compression'] [, extra_credentials(..)] [, headers(..)])
@@ -625,6 +627,8 @@ class FunctionSecretArgumentsFinder
625627
return;
626628
}
627629

630+
findSecretNamedArgument("secret_access_key", 0);
631+
628632
/// We should check other arguments first because we don't need to do any replacement in case of
629633
/// S3('url', NOSIGN, 'format' [, 'compression'] [, extra_credentials(..)] [, headers(..)])
630634
/// S3('url', 'format', 'compression' [, extra_credentials(..)] [, headers(..)])

src/Processors/Chunk.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ void Chunk::addColumn(ColumnPtr column)
108108

109109
void Chunk::addColumn(size_t position, ColumnPtr column)
110110
{
111-
if (position >= columns.size())
111+
if (position == columns.size())
112+
{
113+
addColumn(column);
114+
return;
115+
}
116+
if (position > columns.size())
112117
throw Exception(ErrorCodes::POSITION_OUT_OF_BOUND,
113118
"Position {} out of bound in Chunk::addColumn(), max position = {}",
114119
position, !columns.empty() ? columns.size() - 1 : 0);

src/Storages/HivePartitioningUtils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <Formats/EscapingRuleUtils.h>
1010
#include <Formats/FormatFactory.h>
1111
#include <Processors/Chunk.h>
12+
#include <DataTypes/IDataType.h>
1213

1314
namespace DB
1415
{
@@ -85,7 +86,7 @@ NamesAndTypesList extractHivePartitionColumnsFromPath(
8586
{
8687
if (const auto type = tryInferDataTypeByEscapingRule(value, format_settings ? *format_settings : getFormatSettings(context), FormatSettings::EscapingRule::Raw))
8788
{
88-
if (type->canBeInsideLowCardinality())
89+
if (type->canBeInsideLowCardinality() && isStringOrFixedString(type))
8990
{
9091
hive_partition_columns_to_read_from_file_path.emplace_back(key, std::make_shared<DataTypeLowCardinality>(type));
9192
}

0 commit comments

Comments
 (0)