Skip to content

Commit 2276821

Browse files
committed
change export_filename to file
1 parent e921b0c commit 2276821

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/Storages/MergeTree/IMergeTreeDataPart.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,11 @@ Block IMergeTreeDataPart::MinMaxIndex::getBlock(const MergeTreeData & data) cons
300300

301301
const auto column = data_type->createColumn();
302302

303-
const auto min_val = hyperrectangle.at(i).left;
304-
const auto max_val = hyperrectangle.at(i).right;
303+
auto range = hyperrectangle.at(i);
304+
range.shrinkToIncludedIfPossible();
305+
306+
const auto & min_val = range.left;
307+
const auto & max_val = range.right;
305308

306309
column->insert(min_val);
307310
column->insert(max_val);

src/Storages/ObjectStorage/ObjectStorageFilePathGenerator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ namespace DB
1919

2020
struct ObjectStorageWildcardFilePathGenerator : ObjectStorageFilePathGenerator
2121
{
22+
static constexpr const char * FILE_WILDCARD = "{_file}";
2223
explicit ObjectStorageWildcardFilePathGenerator(const std::string & raw_path_) : raw_path(raw_path_) {}
2324

2425
using ObjectStorageFilePathGenerator::getPathForWrite; // Bring base class overloads into scope
2526
std::string getPathForWrite(const std::string & partition_id, const std::string & file_name_override) const override
2627
{
2728
const auto partition_replaced_path = PartitionedSink::replaceWildcards(raw_path, partition_id);
28-
const auto final_path = boost::replace_all_copy(partition_replaced_path, "{_export_filename}", file_name_override);
29+
const auto final_path = boost::replace_all_copy(partition_replaced_path, FILE_WILDCARD, file_name_override);
2930
return final_path;
3031
}
3132

src/Storages/ObjectStorage/StorageObjectStorageConfiguration.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ bool StorageObjectStorageConfiguration::Path::hasPartitionWildcard() const
161161

162162
bool StorageObjectStorageConfiguration::Path::hasExportFilenameWildcard() const
163163
{
164-
static const String EXPORT_FILENAME_WILDCARD = "{_export_filename}";
165-
return path.find(EXPORT_FILENAME_WILDCARD) != String::npos;
164+
return path.find(ObjectStorageWildcardFilePathGenerator::FILE_WILDCARD) != String::npos;
166165
}
167166

168167

tests/queries/0_stateless/03572_export_merge_tree_part_to_object_storage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ query "CREATE TABLE $mt_table_roundtrip ENGINE = MergeTree() PARTITION BY year O
3838
echo "---- Data in roundtrip MergeTree table (should match s3_table)"
3939
query "SELECT * FROM $s3_table ORDER BY id"
4040

41-
query "CREATE TABLE $s3_table_wildcard (id UInt64, year UInt16) ENGINE = S3(s3_conn, filename='$s3_table_wildcard/{_partition_id}/{_export_filename}.parquet', format=Parquet, partition_strategy='wildcard') PARTITION BY year"
41+
query "CREATE TABLE $s3_table_wildcard (id UInt64, year UInt16) ENGINE = S3(s3_conn, filename='$s3_table_wildcard/{_partition_id}/{file}.parquet', format=Parquet, partition_strategy='wildcard') PARTITION BY year"
4242

4343
echo "---- Export 2020_1_1_0 and 2021_2_2_0 to wildcard table"
4444
query "ALTER TABLE $mt_table EXPORT PART '2020_1_1_0' TO TABLE $s3_table_wildcard SETTINGS allow_experimental_export_merge_tree_part = 1"
@@ -53,7 +53,7 @@ query "ALTER TABLE $mt_table EXPORT PART '2020_1_1_0' TO TABLE $s3_table_wildcar
5353
query "SELECT * FROM s3(s3_conn, filename='$s3_table_wildcard/**.parquet') ORDER BY id"
5454

5555
query "CREATE TABLE $mt_table_partition_expression_with_function (id UInt64, year UInt16) ENGINE = MergeTree() PARTITION BY toString(year) ORDER BY tuple()"
56-
query "CREATE TABLE $s3_table_wildcard_partition_expression_with_function (id UInt64, year UInt16) ENGINE = S3(s3_conn, filename='$s3_table_wildcard_partition_expression_with_function/{_partition_id}/{_export_filename}.parquet', format=Parquet, partition_strategy='wildcard') PARTITION BY toString(year)"
56+
query "CREATE TABLE $s3_table_wildcard_partition_expression_with_function (id UInt64, year UInt16) ENGINE = S3(s3_conn, filename='$s3_table_wildcard_partition_expression_with_function/{_partition_id}/{file}.parquet', format=Parquet, partition_strategy='wildcard') PARTITION BY toString(year)"
5757

5858
# insert
5959
query "INSERT INTO $mt_table_partition_expression_with_function VALUES (1, 2020), (2, 2020), (3, 2020), (4, 2021)"

0 commit comments

Comments
 (0)