aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzverevgeny <zverevgeny@ydb.tech>2023-08-29 07:43:04 +0300
committerzverevgeny <zverevgeny@ydb.tech>2023-08-29 08:13:07 +0300
commit700daca8b71c578d994301fde50b8c16ce5605a5 (patch)
treeff37b7975fb3e953453f52fa6f34399d4bac00ae
parentf8da9cde4d191efbaa2ebb2eaf364dac43121702 (diff)
downloadydb-700daca8b71c578d994301fde50b8c16ce5605a5.tar.gz
YQL-16186 ut on rows per match
-rw-r--r--ydb/library/yql/sql/v1/sql_match_recognize_ut.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/ydb/library/yql/sql/v1/sql_match_recognize_ut.cpp b/ydb/library/yql/sql/v1/sql_match_recognize_ut.cpp
index f54530f718..07bf8f2867 100644
--- a/ydb/library/yql/sql/v1/sql_match_recognize_ut.cpp
+++ b/ydb/library/yql/sql/v1/sql_match_recognize_ut.cpp
@@ -127,7 +127,49 @@ FROM Input MATCH_RECOGNIZE(
//TODO https://st.yandex-team.ru/YQL-16186
}
Y_UNIT_TEST(RowsPerMatch) {
- //TODO https://st.yandex-team.ru/YQL-16186
+ {
+ const auto stmt = R"(
+USE plato;
+SELECT *
+FROM Input MATCH_RECOGNIZE(
+ ONE ROW PER MATCH
+ PATTERN (A)
+ DEFINE A as A
+)
+)";
+ auto r = MatchRecognizeSqlToYql(stmt);
+ UNIT_ASSERT(r.IsOk());
+ auto rowsPerMatch = FindMatchRecognizeParam(r.Root, "rowsPerMatch");
+ UNIT_ASSERT_VALUES_EQUAL("RowsPerMatch_OneRow", rowsPerMatch->GetChild(1)->GetContent());
+ }
+ {
+ const auto stmt = R"(
+USE plato;
+SELECT *
+FROM Input MATCH_RECOGNIZE(
+ ALL ROWS PER MATCH
+ PATTERN (A)
+ DEFINE A as A
+)
+)";
+ auto r = MatchRecognizeSqlToYql(stmt);
+ UNIT_ASSERT(not r.IsOk()); ///https://st.yandex-team.ru/YQL-16213
+ }
+ { //default
+ const auto stmt = R"(
+USE plato;
+SELECT *
+FROM Input MATCH_RECOGNIZE(
+ PATTERN (A)
+ DEFINE A as A
+)
+)";
+ auto r = MatchRecognizeSqlToYql(stmt);
+ UNIT_ASSERT(r.IsOk());
+ auto rowsPerMatch = FindMatchRecognizeParam(r.Root, "rowsPerMatch");
+ UNIT_ASSERT_VALUES_EQUAL("RowsPerMatch_OneRow", rowsPerMatch->GetChild(1)->GetContent());
+ }
+
}
Y_UNIT_TEST(SkipAfterMatch) {
{