aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhcpp <hcpp@ydb.tech>2022-08-23 16:28:09 +0300
committerhcpp <hcpp@ydb.tech>2022-08-23 16:28:09 +0300
commitc5bd5def82301cb3fdd8cc3687df617e2a9ff7f9 (patch)
tree5495a692e6bf841854b9c6ca2866341b13e057be
parenta3069b94849161bcc18b5d63a6be2d0aaec4fa23 (diff)
downloadydb-c5bd5def82301cb3fdd8cc3687df617e2a9ff7f9.tar.gz
projection tests has been added
-rw-r--r--ydb/library/yql/providers/s3/path_generator/ut/yql_generate_partitioning_rules_ut.cpp40
1 files changed, 40 insertions, 0 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 213b13c86a..413110a590 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
@@ -198,7 +198,47 @@ Y_UNIT_TEST_SUITE(TGenerateTests) {
UNIT_ASSERT_VALUES_EQUAL(rules[1].ColumnValues.size(), 2);
}
+ Y_UNIT_TEST(ProjectionFormatWithEmptySubstitution) {
+ auto generator = CreatePathGenerator(R"(
+ {
+ "projection.enabled" : true,
+ "projection.dt.type" : "date",
+ "projection.dt.min" : "2012-01-01",
+ "projection.dt.max" : "2012-02-01",
+ "projection.dt.interval" : "1",
+ "projection.dt.format" : "asdf asdf 444",
+ "projection.dt.unit" : "YEARS",
+ "storage.location.template" : "yellow_tripdata_${dt}-01.csv"
+ }
+ )", {"dt"});
+
+ auto rules = generator->GetRules();
+ UNIT_ASSERT_VALUES_EQUAL(rules.size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(rules[0].Path, "yellow_tripdata_asdf asdf 444-01.csv");
+ UNIT_ASSERT_VALUES_EQUAL(rules[0].ColumnValues.size(), 1);
+ }
+ Y_UNIT_TEST(ProjectionFormatWithStrangeSubstitution) {
+ auto generator = CreatePathGenerator(R"(
+ {
+ "projection.enabled" : true,
+ "projection.dt.type" : "date",
+ "projection.dt.min" : "2012-01-01",
+ "projection.dt.max" : "2014-01-01",
+ "projection.dt.interval" : "1",
+ "projection.dt.format" : "asdf%0 asdf%Y%0 444",
+ "projection.dt.unit" : "YEARS",
+ "storage.location.template" : "yellow_tripdata_${dt}-01.csv"
+ }
+ )", {"dt"});
+
+ auto rules = generator->GetRules();
+ UNIT_ASSERT_VALUES_EQUAL(rules.size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(rules[0].Path, "yellow_tripdata_asdf%0 asdf2012%0 444-01.csv");
+ UNIT_ASSERT_VALUES_EQUAL(rules[0].ColumnValues.size(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(rules[1].Path, "yellow_tripdata_asdf%0 asdf2013%0 444-01.csv");
+ UNIT_ASSERT_VALUES_EQUAL(rules[1].ColumnValues.size(), 1);
+ }
}
}