diff --git a/src/Storages/StorageS3.cpp b/src/Storages/StorageS3.cpp index 67849c11e28..103a579c926 100644 --- a/src/Storages/StorageS3.cpp +++ b/src/Storages/StorageS3.cpp @@ -4,18 +4,22 @@ #include +#include + #include -#include -#include -#include #include #include #include #include -#include +#include #include +#include + +#include +#include +#include #include #include @@ -365,10 +369,12 @@ public: , max_single_part_upload_size(max_single_part_upload_size_) { - ASTPtr query = partition_by; - auto syntax_result = TreeRewriter(context).analyze(query, sample_block.getNamesAndTypesList()); - partition_by_expr = ExpressionAnalyzer(query, syntax_result, context).getActions(false); - partition_by_column_name = partition_by->getColumnName(); + std::vector arguments(1, partition_by); + ASTPtr partition_by_string = makeASTFunction(FunctionToString::name, std::move(arguments)); + + auto syntax_result = TreeRewriter(context).analyze(partition_by_string, sample_block.getNamesAndTypesList()); + partition_by_expr = ExpressionAnalyzer(partition_by_string, syntax_result, context).getActions(false); + partition_by_column_name = partition_by_string->getColumnName(); } String getName() const override { return "PartitionedStorageS3Sink"; } diff --git a/tests/integration/test_storage_s3/test.py b/tests/integration/test_storage_s3/test.py index 85873c746fa..2b99222a270 100644 --- a/tests/integration/test_storage_s3/test.py +++ b/tests/integration/test_storage_s3/test.py @@ -154,7 +154,7 @@ def test_distributed_put(cluster): values_csv = "1,2,3\n3,2,1\n78,43,45\n" filename = "test_{_partition_id}.csv" put_query = f"""insert into table function s3('http://{cluster.minio_host}:{cluster.minio_port}/{bucket}/{filename}', - 'CSV', '{table_format}') PARTITION BY toString(column3) values {values}""" + 'CSV', '{table_format}') PARTITION BY column3 values {values}""" run_query(instance, put_query)