aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests
diff options
context:
space:
mode:
authoravevad <avevad@yandex-team.com>2024-12-13 14:25:35 +0300
committeravevad <avevad@yandex-team.com>2024-12-13 15:28:58 +0300
commit8970a1a0e4f5cb97926644f3f75768d860d09ef9 (patch)
tree0a90a9738b10ca9558dad1b792ca76c842df2e55 /yql/essentials/tests
parent84872c9673776978453258b23ba78fb2a6f32d85 (diff)
downloadydb-8970a1a0e4f5cb97926644f3f75768d860d09ef9.tar.gz
YQL-19163 Fix StaticFold behavior with optional args lambdas
commit_hash:bbea0c78d15d9ba627f15182d80dd2406a494b93
Diffstat (limited to 'yql/essentials/tests')
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/result.json6
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-static_fold_/formatted.sql15
-rw-r--r--yql/essentials/tests/sql/suites/expr/static_fold.sql14
3 files changed, 31 insertions, 4 deletions
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/result.json b/yql/essentials/tests/sql/sql2yql/canondata/result.json
index ab345774f4..8e339438a1 100644
--- a/yql/essentials/tests/sql/sql2yql/canondata/result.json
+++ b/yql/essentials/tests/sql/sql2yql/canondata/result.json
@@ -6693,9 +6693,9 @@
],
"test_sql2yql.test[expr-static_fold]": [
{
- "checksum": "90e676aca21d7b7a84997aa261cba619",
- "size": 3647,
- "uri": "https://{canondata_backend}/1936273/4a1b39013e1bae40e722cff8ccef8829784964e2/resource.tar.gz#test_sql2yql.test_expr-static_fold_/sql.yql"
+ "checksum": "397ed54ebb027b5d4ea51a7c577bfad0",
+ "size": 4863,
+ "uri": "https://{canondata_backend}/1900335/87071896eae3051f9f7c20c1c894d1187145cde1/resource.tar.gz#test_sql2yql.test_expr-static_fold_/sql.yql"
}
],
"test_sql2yql.test[expr-static_zip]": [
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-static_fold_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-static_fold_/formatted.sql
index edc564c1f5..428d75f9ee 100644
--- a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-static_fold_/formatted.sql
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-static_fold_/formatted.sql
@@ -25,3 +25,18 @@ SELECT
CAST(StaticFold1($st_empty, $start, $concat) AS Optional<String>),
StaticFold1($tup, $start, $concat)
;
+
+--WithOptionalArgs lambda test
+$puk = ($row_struct) -> {
+ RETURN StaticFold(
+ $row_struct,
+ 0,
+ ($item, $sum?) -> {
+ RETURN $sum + IF($item IS NULL, 0, 1)
+ }
+ )
+};
+
+SELECT
+ $puk(Unwrap(CAST(<|one: "8912", two: 42|> AS Struct<one: Int64, two: Int64>)))
+;
diff --git a/yql/essentials/tests/sql/suites/expr/static_fold.sql b/yql/essentials/tests/sql/suites/expr/static_fold.sql
index 9118da0e06..81444ea9b3 100644
--- a/yql/essentials/tests/sql/suites/expr/static_fold.sql
+++ b/yql/essentials/tests/sql/suites/expr/static_fold.sql
@@ -18,4 +18,16 @@ SELECT
StaticFold1($st_many, $start, $concat),
StaticFold1($st_single, $start, $concat),
CAST(StaticFold1($st_empty, $start, $concat) AS Optional<String>),
- StaticFold1($tup, $start, $concat); \ No newline at end of file
+ StaticFold1($tup, $start, $concat);
+
+--WithOptionalArgs lambda test
+$puk = ($row_struct) -> {
+ RETURN StaticFold(
+ $row_struct,
+ 0,
+ ($item, $sum?) -> {
+ RETURN $sum + IF($item IS NULL, 0, 1)
+ }
+ )
+};
+SELECT $puk(Unwrap(CAST(<|one:"8912", two:42|> AS Struct<one: Int64, two:Int64>))); \ No newline at end of file