Skip to content

Commit 57ca34c

Browse files
committed
preserve max_bytes and max_rows settings
1 parent c6eee2c commit 57ca34c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/Storages/ExportReplicatedMergeTreePartitionManifest.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ struct ExportReplicatedMergeTreePartitionManifest
112112
size_t max_threads;
113113
bool parallel_formatting;
114114
bool parquet_parallel_encoding;
115+
size_t max_bytes_per_file;
116+
size_t max_rows_per_file;
115117
MergeTreePartExportManifest::FileAlreadyExistsPolicy file_already_exists_policy;
116118

117119
std::string toJsonString() const
@@ -131,6 +133,8 @@ struct ExportReplicatedMergeTreePartitionManifest
131133
json.set("parallel_formatting", parallel_formatting);
132134
json.set("max_threads", max_threads);
133135
json.set("parquet_parallel_encoding", parquet_parallel_encoding);
136+
json.set("max_bytes_per_file", max_bytes_per_file);
137+
json.set("max_rows_per_file", max_rows_per_file);
134138
json.set("file_already_exists_policy", String(magic_enum::enum_name(file_already_exists_policy)));
135139
json.set("create_time", create_time);
136140
json.set("max_retries", max_retries);
@@ -164,7 +168,8 @@ struct ExportReplicatedMergeTreePartitionManifest
164168
manifest.max_threads = json->getValue<size_t>("max_threads");
165169
manifest.parallel_formatting = json->getValue<bool>("parallel_formatting");
166170
manifest.parquet_parallel_encoding = json->getValue<bool>("parquet_parallel_encoding");
167-
171+
manifest.max_bytes_per_file = json->getValue<size_t>("max_bytes_per_file");
172+
manifest.max_rows_per_file = json->getValue<size_t>("max_rows_per_file");
168173
if (json->has("file_already_exists_policy"))
169174
{
170175
const auto file_already_exists_policy = magic_enum::enum_cast<MergeTreePartExportManifest::FileAlreadyExistsPolicy>(json->getValue<String>("file_already_exists_policy"));

src/Storages/MergeTree/ExportPartitionTaskScheduler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ namespace
2828
context_copy->setSetting("output_format_parquet_parallel_encoding", manifest.parquet_parallel_encoding);
2929
context_copy->setSetting("max_threads", manifest.max_threads);
3030
context_copy->setSetting("export_merge_tree_part_file_already_exists_policy", String(magic_enum::enum_name(manifest.file_already_exists_policy)));
31+
context_copy->setSetting("export_merge_tree_part_max_bytes_per_file", manifest.max_bytes_per_file);
32+
context_copy->setSetting("export_merge_tree_part_max_rows_per_file", manifest.max_rows_per_file);
3133
return context_copy;
3234
}
3335
}

src/Storages/StorageReplicatedMergeTree.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ namespace Setting
200200
extern const SettingsBool output_format_parquet_parallel_encoding;
201201
extern const SettingsMaxThreads max_threads;
202202
extern const SettingsMergeTreePartExportFileAlreadyExistsPolicy export_merge_tree_part_file_already_exists_policy;
203+
extern const SettingsUInt64 export_merge_tree_part_max_bytes_per_file;
204+
extern const SettingsUInt64 export_merge_tree_part_max_rows_per_file;
203205
}
204206

205207
namespace MergeTreeSetting
@@ -8222,6 +8224,8 @@ void StorageReplicatedMergeTree::exportPartitionToTable(const PartitionCommand &
82228224
manifest.max_threads = query_context->getSettingsRef()[Setting::max_threads];
82238225
manifest.parallel_formatting = query_context->getSettingsRef()[Setting::output_format_parallel_formatting];
82248226
manifest.parquet_parallel_encoding = query_context->getSettingsRef()[Setting::output_format_parquet_parallel_encoding];
8227+
manifest.max_bytes_per_file = query_context->getSettingsRef()[Setting::export_merge_tree_part_max_bytes_per_file];
8228+
manifest.max_rows_per_file = query_context->getSettingsRef()[Setting::export_merge_tree_part_max_rows_per_file];
82258229

82268230
manifest.file_already_exists_policy = query_context->getSettingsRef()[Setting::export_merge_tree_part_file_already_exists_policy].value;
82278231

0 commit comments

Comments
 (0)