diff options
author | hcpp <hcpp@ydb.tech> | 2023-01-31 13:33:35 +0300 |
---|---|---|
committer | hcpp <hcpp@ydb.tech> | 2023-01-31 13:33:35 +0300 |
commit | 26ab79cc7f4d417ffdfb3a33b524b9a5c56842bb (patch) | |
tree | 8bf47ae215269c88cb1cc3366ec1316a2d04a904 | |
parent | acd2a0b3e8301150a590339ebf6754ec7eea2a62 (diff) | |
download | ydb-26ab79cc7f4d417ffdfb3a33b524b9a5c56842bb.tar.gz |
Validation has been added for an empty set of paths
-rw-r--r-- | ydb/library/yql/providers/s3/path_generator/ut/yql_generate_partitioning_rules_ut.cpp | 17 | ||||
-rw-r--r-- | ydb/library/yql/providers/s3/path_generator/yql_s3_path_generator.cpp | 4 |
2 files changed, 20 insertions, 1 deletions
diff --git a/ydb/library/yql/providers/s3/path_generator/ut/yql_generate_partitioning_rules_ut.cpp b/ydb/library/yql/providers/s3/path_generator/ut/yql_generate_partitioning_rules_ut.cpp index 8ac90b13bc0..854794233fa 100644 --- a/ydb/library/yql/providers/s3/path_generator/ut/yql_generate_partitioning_rules_ut.cpp +++ b/ydb/library/yql/providers/s3/path_generator/ut/yql_generate_partitioning_rules_ut.cpp @@ -293,7 +293,22 @@ Y_UNIT_TEST_SUITE(TGenerateTests) { "projection.dt.unit" : "YEARS", "storage.location.template" : "yellow_tripdata_${dt}-01/" } - )", {"dt"}), yexception, "error in datetime parsing. Input data: 1980-1-1");; + )", {"dt"}), yexception, "error in datetime parsing. Input data: 1980-1-1"); + } + + Y_UNIT_TEST(EmptyOutput) { + UNIT_ASSERT_EXCEPTION_CONTAINS(CreatePathGenerator(R"( + { + "projection.enabled" : true, + "projection.dt.type" : "date", + "projection.dt.min" : "2012-01-01", + "projection.dt.max" : "2011-02-01", + "projection.dt.interval" : "1", + "projection.dt.format" : "asdf asdf 444", + "projection.dt.unit" : "YEARS", + "storage.location.template" : "/yellow_tripdata_${dt}-01/" + } + )", {"dt"}), yexception, "The projection contains an empty set of paths"); } Y_UNIT_TEST(LocationPathCollision) { diff --git a/ydb/library/yql/providers/s3/path_generator/yql_s3_path_generator.cpp b/ydb/library/yql/providers/s3/path_generator/yql_s3_path_generator.cpp index ac2414a2643..c4969a2f3f1 100644 --- a/ydb/library/yql/providers/s3/path_generator/yql_s3_path_generator.cpp +++ b/ydb/library/yql/providers/s3/path_generator/yql_s3_path_generator.cpp @@ -580,6 +580,10 @@ private: for (const auto& p: result) { Rules.push_back(TExpandedPartitioningRule{.Path=p.first, .ColumnValues=p.second}); } + + if (Rules.empty()) { + ythrow yexception() << "The projection contains an empty set of paths"; + } } void DoGenerateDate(const std::vector<TColumnPartitioningConfig>& rules, |