diff options
author | Vitaly Isaev <vitalyisaev@ydb.tech> | 2024-12-12 15:39:00 +0000 |
---|---|---|
committer | Vitaly Isaev <vitalyisaev@ydb.tech> | 2024-12-12 15:39:00 +0000 |
commit | 827b115675004838023427572a7c69f40a86a80a (patch) | |
tree | e99c953fe494b9de8d8597a15859d77c81f118c7 /yql/essentials/tests | |
parent | 42701242eaf5be980cb935631586d0e90b82641c (diff) | |
parent | fab222fd8176d00eee5ddafc6bce8cb95a6e3ab0 (diff) | |
download | ydb-827b115675004838023427572a7c69f40a86a80a.tar.gz |
Merge branch 'rightlib' into rightlib_20241212
Diffstat (limited to 'yql/essentials/tests')
10 files changed, 57 insertions, 59 deletions
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/result.json b/yql/essentials/tests/sql/sql2yql/canondata/result.json index 47f93caece..e73aa91e9e 100644 --- a/yql/essentials/tests/sql/sql2yql/canondata/result.json +++ b/yql/essentials/tests/sql/sql2yql/canondata/result.json @@ -11180,30 +11180,30 @@ ], "test_sql2yql.test[match_recognize-alerts-streaming]": [ { - "checksum": "951e1c6d04cbba2370c2a5e5542d6afd", - "size": 10537, - "uri": "https://{canondata_backend}/1942671/e054628d5e2733e5fbc993cb8c765074de561f06/resource.tar.gz#test_sql2yql.test_match_recognize-alerts-streaming_/sql.yql" + "checksum": "931c9266d12e54a59fb0cd3570c3ccc0", + "size": 9765, + "uri": "https://{canondata_backend}/1903885/44ceadc17896d9c66a7580ce6886870c575e270b/resource.tar.gz#test_sql2yql.test_match_recognize-alerts-streaming_/sql.yql" } ], "test_sql2yql.test[match_recognize-alerts]": [ { - "checksum": "67843aad123bb76d097416bf83bbe749", - "size": 10539, - "uri": "https://{canondata_backend}/1942671/e054628d5e2733e5fbc993cb8c765074de561f06/resource.tar.gz#test_sql2yql.test_match_recognize-alerts_/sql.yql" + "checksum": "81ff4044da026f2de566bc73e499da3d", + "size": 9767, + "uri": "https://{canondata_backend}/1903885/44ceadc17896d9c66a7580ce6886870c575e270b/resource.tar.gz#test_sql2yql.test_match_recognize-alerts_/sql.yql" } ], "test_sql2yql.test[match_recognize-alerts_without_order]": [ { - "checksum": "3260928c483690ee0d3f06917cd1d5cb", - "size": 10420, - "uri": "https://{canondata_backend}/1942671/e054628d5e2733e5fbc993cb8c765074de561f06/resource.tar.gz#test_sql2yql.test_match_recognize-alerts_without_order_/sql.yql" + "checksum": "adf84392f4dd1db143484be8cbbda16c", + "size": 9648, + "uri": "https://{canondata_backend}/1903885/44ceadc17896d9c66a7580ce6886870c575e270b/resource.tar.gz#test_sql2yql.test_match_recognize-alerts_without_order_/sql.yql" } ], "test_sql2yql.test[match_recognize-greedy_quantifiers]": [ { - "checksum": "45d528f98097150c41366da075dc08c8", - "size": 4257, - "uri": "https://{canondata_backend}/1130705/7ccb4b448efbf0410ae97c635cda187d108148f4/resource.tar.gz#test_sql2yql.test_match_recognize-greedy_quantifiers_/sql.yql" + "checksum": "c6b4102b3bf241e7b309e8cc93aaf76c", + "size": 4349, + "uri": "https://{canondata_backend}/1903885/44ceadc17896d9c66a7580ce6886870c575e270b/resource.tar.gz#test_sql2yql.test_match_recognize-greedy_quantifiers_/sql.yql" } ], "test_sql2yql.test[match_recognize-permute]": [ @@ -12368,6 +12368,13 @@ "uri": "https://{canondata_backend}/1937429/434276f26b2857be3c5ad3fdbbf877d2bf775ac5/resource.tar.gz#test_sql2yql.test_pg-aggregate_scalar_minus_zero_/sql.yql" } ], + "test_sql2yql.test[pg-aliased_columns]": [ + { + "checksum": "7ca1f0f6ce1395c4d6f826660886df83", + "size": 953, + "uri": "https://{canondata_backend}/1777230/27c189b00ecc5d4153899123da0bf3c72d8cfd80/resource.tar.gz#test_sql2yql.test_pg-aliased_columns_/sql.yql" + } + ], "test_sql2yql.test[pg-all_data]": [ { "checksum": "e2e983a696817fe3cbebcbbf79264fd1", diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts-streaming_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts-streaming_/formatted.sql index e572efb76d..28d63923cf 100644 --- a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts-streaming_/formatted.sql +++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts-streaming_/formatted.sql @@ -28,13 +28,12 @@ FROM LAST(LOGIN_SUCCESS_REMOTE.user) AS remote_login_user, LAST(LOGIN_SUCCESS_REMOTE.dt) AS remote_login_dt, LAST(SUSPICIOUS_ACTION_SOON.dt) AS suspicious_action_dt, - LAST(SUSPICIOUS_ACTION_TIMEOUT.dt) AS suspicious_action_timeout_dt, FIRST(LOGIN_FAILED_SAME_USER.dt) AS brutforce_begin, FIRST(LOGIN_SUCCESS_SAME_USER.dt) AS brutforce_end, LAST(LOGIN_SUCCESS_SAME_USER.user) AS brutforce_login ONE ROW PER MATCH AFTER MATCH SKIP TO NEXT ROW - PATTERN (LOGIN_SUCCESS_REMOTE ANY_ROW1 * (SUSPICIOUS_ACTION_SOON | SUSPICIOUS_ACTION_TIMEOUT) | (LOGIN_FAILED_SAME_USER ANY_ROW2 *) {2,} LOGIN_SUCCESS_SAME_USER) + PATTERN (LOGIN_SUCCESS_REMOTE ANY_ROW1 * SUSPICIOUS_ACTION_SOON | (LOGIN_FAILED_SAME_USER ANY_ROW2 *) {2,} LOGIN_SUCCESS_SAME_USER) DEFINE LOGIN_SUCCESS_REMOTE AS LOGIN_SUCCESS_REMOTE.ev_type == "login" AND LOGIN_SUCCESS_REMOTE.ev_status == "success" @@ -44,7 +43,6 @@ FROM SUSPICIOUS_ACTION_SOON AS SUSPICIOUS_ACTION_SOON.host == LAST(LOGIN_SUCCESS_REMOTE.host) AND SUSPICIOUS_ACTION_SOON.ev_type == "delete_all" AND COALESCE(SUSPICIOUS_ACTION_SOON.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) <= 500, TRUE), - SUSPICIOUS_ACTION_TIMEOUT AS COALESCE(SUSPICIOUS_ACTION_TIMEOUT.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) > 500, TRUE), LOGIN_FAILED_SAME_USER AS LOGIN_FAILED_SAME_USER.ev_type == "login" AND LOGIN_FAILED_SAME_USER.ev_status != "success" AND ( diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts_/formatted.sql index 471b7f13ab..ea91539f37 100644 --- a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts_/formatted.sql +++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts_/formatted.sql @@ -28,13 +28,12 @@ FROM LAST(LOGIN_SUCCESS_REMOTE.user) AS remote_login_user, LAST(LOGIN_SUCCESS_REMOTE.dt) AS remote_login_dt, LAST(SUSPICIOUS_ACTION_SOON.dt) AS suspicious_action_dt, - LAST(SUSPICIOUS_ACTION_TIMEOUT.dt) AS suspicious_action_timeout_dt, FIRST(LOGIN_FAILED_SAME_USER.dt) AS brutforce_begin, FIRST(LOGIN_SUCCESS_SAME_USER.dt) AS brutforce_end, LAST(LOGIN_SUCCESS_SAME_USER.user) AS brutforce_login ONE ROW PER MATCH AFTER MATCH SKIP TO NEXT ROW - PATTERN (LOGIN_SUCCESS_REMOTE ANY_ROW1 * (SUSPICIOUS_ACTION_SOON | SUSPICIOUS_ACTION_TIMEOUT) | (LOGIN_FAILED_SAME_USER ANY_ROW2 *) {2,} LOGIN_SUCCESS_SAME_USER) + PATTERN (LOGIN_SUCCESS_REMOTE ANY_ROW1 * SUSPICIOUS_ACTION_SOON | (LOGIN_FAILED_SAME_USER ANY_ROW2 *) {2,} LOGIN_SUCCESS_SAME_USER) DEFINE LOGIN_SUCCESS_REMOTE AS LOGIN_SUCCESS_REMOTE.ev_type == "login" AND LOGIN_SUCCESS_REMOTE.ev_status == "success" @@ -44,7 +43,6 @@ FROM SUSPICIOUS_ACTION_SOON AS SUSPICIOUS_ACTION_SOON.host == LAST(LOGIN_SUCCESS_REMOTE.host) AND SUSPICIOUS_ACTION_SOON.ev_type == "delete_all" AND COALESCE(SUSPICIOUS_ACTION_SOON.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) <= 500, TRUE), - SUSPICIOUS_ACTION_TIMEOUT AS COALESCE(SUSPICIOUS_ACTION_TIMEOUT.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) > 500, TRUE), LOGIN_FAILED_SAME_USER AS LOGIN_FAILED_SAME_USER.ev_type == "login" AND LOGIN_FAILED_SAME_USER.ev_status != "success" AND ( diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts_without_order_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts_without_order_/formatted.sql index 70d4e9cc66..4d30431160 100644 --- a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts_without_order_/formatted.sql +++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-alerts_without_order_/formatted.sql @@ -26,13 +26,12 @@ FROM LAST(LOGIN_SUCCESS_REMOTE.user) AS remote_login_user, LAST(LOGIN_SUCCESS_REMOTE.dt) AS remote_login_dt, LAST(SUSPICIOUS_ACTION_SOON.dt) AS suspicious_action_dt, - LAST(SUSPICIOUS_ACTION_TIMEOUT.dt) AS suspicious_action_timeout_dt, FIRST(LOGIN_FAILED_SAME_USER.dt) AS brutforce_begin, FIRST(LOGIN_SUCCESS_SAME_USER.dt) AS brutforce_end, LAST(LOGIN_SUCCESS_SAME_USER.user) AS brutforce_login ONE ROW PER MATCH AFTER MATCH SKIP TO NEXT ROW - PATTERN (LOGIN_SUCCESS_REMOTE ANY_ROW1 * (SUSPICIOUS_ACTION_SOON | SUSPICIOUS_ACTION_TIMEOUT) | (LOGIN_FAILED_SAME_USER ANY_ROW2 *) {2,} LOGIN_SUCCESS_SAME_USER) + PATTERN (LOGIN_SUCCESS_REMOTE ANY_ROW1 * SUSPICIOUS_ACTION_SOON | (LOGIN_FAILED_SAME_USER ANY_ROW2 *) {2,} LOGIN_SUCCESS_SAME_USER) DEFINE LOGIN_SUCCESS_REMOTE AS LOGIN_SUCCESS_REMOTE.ev_type == "login" AND LOGIN_SUCCESS_REMOTE.ev_status == "success" @@ -42,7 +41,6 @@ FROM SUSPICIOUS_ACTION_SOON AS SUSPICIOUS_ACTION_SOON.host == LAST(LOGIN_SUCCESS_REMOTE.host) AND SUSPICIOUS_ACTION_SOON.ev_type == "delete_all" AND COALESCE(SUSPICIOUS_ACTION_SOON.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) <= 500, TRUE), - SUSPICIOUS_ACTION_TIMEOUT AS COALESCE(SUSPICIOUS_ACTION_TIMEOUT.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) > 500, TRUE), LOGIN_FAILED_SAME_USER AS LOGIN_FAILED_SAME_USER.ev_type == "login" AND LOGIN_FAILED_SAME_USER.ev_status != "success" AND ( diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-greedy_quantifiers_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-greedy_quantifiers_/formatted.sql index e9e70b561f..887a45e7e3 100644 --- a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-greedy_quantifiers_/formatted.sql +++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_match_recognize-greedy_quantifiers_/formatted.sql @@ -6,12 +6,15 @@ $input = * FROM AS_TABLE([ - <|time: 0, id: 1, name: 'A'|>, - <|time: 200, id: 2, name: 'B'|>, - <|time: 400, id: 3, name: 'C'|>, - <|time: 600, id: 4, name: 'B'|>, - <|time: 800, id: 5, name: 'C'|>, - <|time: 1000, id: 6, name: 'W'|>, + <|time: 0, name: 'A'|>, + <|time: 100, name: 'B'|>, + <|time: 200, name: 'C'|>, + <|time: 300, name: 'B'|>, + <|time: 400, name: 'C'|>, + <|time: 500, name: 'A'|>, + <|time: 600, name: 'B'|>, + <|time: 700, name: 'C'|>, + <|time: 800, name: 'W'|>, ]) ; @@ -22,9 +25,9 @@ FROM ORDER BY CAST(time AS Timestamp) MEASURES - FIRST(A.id) AS a_id, - LAST(B_OR_C.id) AS bc_id, - LAST(C.id) AS c_id + FIRST(A.time) AS a_time, + LAST(B_OR_C.time) AS bc_time, + LAST(C.time) AS c_time PATTERN (A B_OR_C * C) DEFINE A AS A.name == 'A', diff --git a/yql/essentials/tests/sql/suites/match_recognize/alerts-streaming.sql b/yql/essentials/tests/sql/suites/match_recognize/alerts-streaming.sql index 5a9d43a155..f8f13b5411 100644 --- a/yql/essentials/tests/sql/suites/match_recognize/alerts-streaming.sql +++ b/yql/essentials/tests/sql/suites/match_recognize/alerts-streaming.sql @@ -25,7 +25,6 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( LAST(LOGIN_SUCCESS_REMOTE.user) as remote_login_user, LAST(LOGIN_SUCCESS_REMOTE.dt) as remote_login_dt, LAST(SUSPICIOUS_ACTION_SOON.dt) as suspicious_action_dt, - LAST(SUSPICIOUS_ACTION_TIMEOUT.dt) as suspicious_action_timeout_dt, FIRST(LOGIN_FAILED_SAME_USER.dt) as brutforce_begin, FIRST(LOGIN_SUCCESS_SAME_USER.dt) as brutforce_end, LAST(LOGIN_SUCCESS_SAME_USER.user) as brutforce_login @@ -33,7 +32,7 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( ONE ROW PER MATCH AFTER MATCH SKIP TO NEXT ROW PATTERN ( - LOGIN_SUCCESS_REMOTE ANY_ROW1* (SUSPICIOUS_ACTION_SOON | SUSPICIOUS_ACTION_TIMEOUT) | + LOGIN_SUCCESS_REMOTE ANY_ROW1* SUSPICIOUS_ACTION_SOON | (LOGIN_FAILED_SAME_USER ANY_ROW2*){2,} LOGIN_SUCCESS_SAME_USER ) DEFINE @@ -48,8 +47,6 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( SUSPICIOUS_ACTION_SOON.host = LAST(LOGIN_SUCCESS_REMOTE.host) and SUSPICIOUS_ACTION_SOON.ev_type = "delete_all" and COALESCE(SUSPICIOUS_ACTION_SOON.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) <= 500, TRUE), - SUSPICIOUS_ACTION_TIMEOUT as - COALESCE(SUSPICIOUS_ACTION_TIMEOUT.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) > 500, TRUE), LOGIN_FAILED_SAME_USER as LOGIN_FAILED_SAME_USER.ev_type = "login" and LOGIN_FAILED_SAME_USER.ev_status <> "success" and diff --git a/yql/essentials/tests/sql/suites/match_recognize/alerts.sql b/yql/essentials/tests/sql/suites/match_recognize/alerts.sql index 9b408b63ed..da1aa8ddd4 100644 --- a/yql/essentials/tests/sql/suites/match_recognize/alerts.sql +++ b/yql/essentials/tests/sql/suites/match_recognize/alerts.sql @@ -25,7 +25,6 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( LAST(LOGIN_SUCCESS_REMOTE.user) as remote_login_user, LAST(LOGIN_SUCCESS_REMOTE.dt) as remote_login_dt, LAST(SUSPICIOUS_ACTION_SOON.dt) as suspicious_action_dt, - LAST(SUSPICIOUS_ACTION_TIMEOUT.dt) as suspicious_action_timeout_dt, FIRST(LOGIN_FAILED_SAME_USER.dt) as brutforce_begin, FIRST(LOGIN_SUCCESS_SAME_USER.dt) as brutforce_end, LAST(LOGIN_SUCCESS_SAME_USER.user) as brutforce_login @@ -33,7 +32,7 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( ONE ROW PER MATCH AFTER MATCH SKIP TO NEXT ROW PATTERN ( - LOGIN_SUCCESS_REMOTE ANY_ROW1* (SUSPICIOUS_ACTION_SOON | SUSPICIOUS_ACTION_TIMEOUT) | + LOGIN_SUCCESS_REMOTE ANY_ROW1* SUSPICIOUS_ACTION_SOON | (LOGIN_FAILED_SAME_USER ANY_ROW2*){2,} LOGIN_SUCCESS_SAME_USER ) DEFINE @@ -48,8 +47,6 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( SUSPICIOUS_ACTION_SOON.host = LAST(LOGIN_SUCCESS_REMOTE.host) and SUSPICIOUS_ACTION_SOON.ev_type = "delete_all" and COALESCE(SUSPICIOUS_ACTION_SOON.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) <= 500, TRUE), - SUSPICIOUS_ACTION_TIMEOUT as - COALESCE(SUSPICIOUS_ACTION_TIMEOUT.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) > 500, TRUE), LOGIN_FAILED_SAME_USER as LOGIN_FAILED_SAME_USER.ev_type = "login" and LOGIN_FAILED_SAME_USER.ev_status <> "success" and diff --git a/yql/essentials/tests/sql/suites/match_recognize/alerts_without_order.sql b/yql/essentials/tests/sql/suites/match_recognize/alerts_without_order.sql index bab465988d..006ba67e2e 100644 --- a/yql/essentials/tests/sql/suites/match_recognize/alerts_without_order.sql +++ b/yql/essentials/tests/sql/suites/match_recognize/alerts_without_order.sql @@ -24,7 +24,6 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( LAST(LOGIN_SUCCESS_REMOTE.user) as remote_login_user, LAST(LOGIN_SUCCESS_REMOTE.dt) as remote_login_dt, LAST(SUSPICIOUS_ACTION_SOON.dt) as suspicious_action_dt, - LAST(SUSPICIOUS_ACTION_TIMEOUT.dt) as suspicious_action_timeout_dt, FIRST(LOGIN_FAILED_SAME_USER.dt) as brutforce_begin, FIRST(LOGIN_SUCCESS_SAME_USER.dt) as brutforce_end, LAST(LOGIN_SUCCESS_SAME_USER.user) as brutforce_login @@ -32,7 +31,7 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( ONE ROW PER MATCH AFTER MATCH SKIP TO NEXT ROW PATTERN ( - LOGIN_SUCCESS_REMOTE ANY_ROW1* (SUSPICIOUS_ACTION_SOON | SUSPICIOUS_ACTION_TIMEOUT) | + LOGIN_SUCCESS_REMOTE ANY_ROW1* SUSPICIOUS_ACTION_SOON | (LOGIN_FAILED_SAME_USER ANY_ROW2*){2,} LOGIN_SUCCESS_SAME_USER ) DEFINE @@ -47,8 +46,6 @@ FROM AS_TABLE($osquery_data) MATCH_RECOGNIZE( SUSPICIOUS_ACTION_SOON.host = LAST(LOGIN_SUCCESS_REMOTE.host) and SUSPICIOUS_ACTION_SOON.ev_type = "delete_all" and COALESCE(SUSPICIOUS_ACTION_SOON.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) <= 500, TRUE), - SUSPICIOUS_ACTION_TIMEOUT as - COALESCE(SUSPICIOUS_ACTION_TIMEOUT.dt - FIRST(LOGIN_SUCCESS_REMOTE.dt) > 500, TRUE), LOGIN_FAILED_SAME_USER as LOGIN_FAILED_SAME_USER.ev_type = "login" and LOGIN_FAILED_SAME_USER.ev_status <> "success" and diff --git a/yql/essentials/tests/sql/suites/match_recognize/greedy_quantifiers.sql b/yql/essentials/tests/sql/suites/match_recognize/greedy_quantifiers.sql index 8645b1c5f2..96707478d6 100644 --- a/yql/essentials/tests/sql/suites/match_recognize/greedy_quantifiers.sql +++ b/yql/essentials/tests/sql/suites/match_recognize/greedy_quantifiers.sql @@ -1,26 +1,27 @@ -pragma FeatureR010="prototype"; -pragma config.flags("MatchRecognizeStream", "disable"); +PRAGMA FeatureR010="prototype"; +PRAGMA config.flags("MatchRecognizeStream", "disable"); $input = SELECT * FROM AS_TABLE([ - <|time: 0, id: 1, name: 'A'|>, - <|time: 200, id: 2, name: 'B'|>, - <|time: 400, id: 3, name: 'C'|>, - <|time: 600, id: 4, name: 'B'|>, - <|time: 800, id: 5, name: 'C'|>, - <|time: 1000, id: 6, name: 'W'|>, + <|time: 0, name: 'A'|>, + <|time: 100, name: 'B'|>, + <|time: 200, name: 'C'|>, + <|time: 300, name: 'B'|>, + <|time: 400, name: 'C'|>, + <|time: 500, name: 'A'|>, + <|time: 600, name: 'B'|>, + <|time: 700, name: 'C'|>, + <|time: 800, name: 'W'|>, ]); - SELECT * FROM $input MATCH_RECOGNIZE ( ORDER BY CAST(time AS Timestamp) MEASURES - FIRST(A.id) as a_id, - LAST(B_OR_C.id) as bc_id, - LAST(C.id) as c_id + FIRST(A.time) AS a_time, + LAST(B_OR_C.time) AS bc_time, + LAST(C.time) AS c_time PATTERN (A B_OR_C* C) DEFINE - A AS A.name ='A', - B_OR_C AS (B_OR_C.name ='B' or B_OR_C.name ='C'), - C AS C.name ='C' - ); - + A AS A.name = 'A', + B_OR_C AS (B_OR_C.name = 'B' OR B_OR_C.name = 'C'), + C AS C.name = 'C' +); diff --git a/yql/essentials/tests/sql/suites/pg/aliased_columns.sql b/yql/essentials/tests/sql/suites/pg/aliased_columns.sql new file mode 100644 index 0000000000..6ba1335386 --- /dev/null +++ b/yql/essentials/tests/sql/suites/pg/aliased_columns.sql @@ -0,0 +1,2 @@ +--!syntax_pg +select a, b, c from (select 1 as a, 2 as b, 3 as c) as "A.B" order by b |