summaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql
diff options
context:
space:
mode:
authoratarasov5 <[email protected]>2025-08-28 14:59:55 +0300
committeratarasov5 <[email protected]>2025-08-28 15:45:33 +0300
commit642fe48387994c15621318e16f98eac8d11a301c (patch)
treef362d0234fe8e4e263bc5b8ad64b12788a6b7039 /yql/essentials/tests/sql
parent81d828c32c8d5477cb2f0ce5da06a1a8d9392ca3 (diff)
YQL-20340: Fix getelem comp node
commit_hash:4b93115d4e3d46770946a7a462c7413d6183282f
Diffstat (limited to 'yql/essentials/tests/sql')
-rw-r--r--yql/essentials/tests/sql/minirun/part0/canondata/result.json28
-rw-r--r--yql/essentials/tests/sql/minirun/part2/canondata/result.json14
-rw-r--r--yql/essentials/tests/sql/minirun/part3/canondata/result.json14
-rw-r--r--yql/essentials/tests/sql/minirun/part4/canondata/result.json14
-rw-r--r--yql/essentials/tests/sql/minirun/part5/canondata/result.json14
-rw-r--r--yql/essentials/tests/sql/minirun/part7/canondata/result.json28
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/result.json96
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_optional_no_tagged_/formatted.sql25
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_optional_no_tagged_no_cache_/formatted.sql45
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_tagged_/formatted.sql28
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_tagged_no_cache_/formatted.sql48
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_/formatted.sql28
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_cache_/formatted.sql48
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_optional_/formatted.sql25
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_optional_no_cache_/formatted.sql45
-rw-r--r--yql/essentials/tests/sql/suites/expr/nth_no_optional_no_tagged.yql25
-rw-r--r--yql/essentials/tests/sql/suites/expr/nth_no_optional_no_tagged_no_cache.yql45
-rw-r--r--yql/essentials/tests/sql/suites/expr/nth_no_tagged.yql28
-rw-r--r--yql/essentials/tests/sql/suites/expr/nth_no_tagged_no_cache.yql48
-rw-r--r--yql/essentials/tests/sql/suites/expr/tagged_nth.yql28
-rw-r--r--yql/essentials/tests/sql/suites/expr/tagged_nth_no_cache.yql49
-rw-r--r--yql/essentials/tests/sql/suites/expr/tagged_nth_no_optional.yql25
-rw-r--r--yql/essentials/tests/sql/suites/expr/tagged_nth_no_optional_no_cache.yql45
23 files changed, 793 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/minirun/part0/canondata/result.json b/yql/essentials/tests/sql/minirun/part0/canondata/result.json
index 65b2e9e9175..861fc286679 100644
--- a/yql/essentials/tests/sql/minirun/part0/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part0/canondata/result.json
@@ -670,6 +670,34 @@
"uri": "https://{canondata_backend}/1942525/ede9d81525f3cde3c09402fe9435fdbba85f47bc/resource.tar.gz#test.test_expr-struct_literal--Results_/results.txt"
}
],
+ "test.test[expr-tagged_nth-default.txt-Debug]": [
+ {
+ "checksum": "5cfca1323b5db6c402d15491eefdd536",
+ "size": 924,
+ "uri": "https://{canondata_backend}/1817427/71c69e0489dfa612a57e6a73d889c47617e888f9/resource.tar.gz#test.test_expr-tagged_nth-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[expr-tagged_nth-default.txt-Results]": [
+ {
+ "checksum": "12a7de262fad1f40459870da4d5d6083",
+ "size": 4332,
+ "uri": "https://{canondata_backend}/1775059/9c09d1b7ca039bad9f375e5e993bbd259f8d98bc/resource.tar.gz#test.test_expr-tagged_nth-default.txt-Results_/results.txt"
+ }
+ ],
+ "test.test[expr-tagged_nth_no_optional-default.txt-Debug]": [
+ {
+ "checksum": "c464d8859c092fdfc7ecfb7bec190d2a",
+ "size": 724,
+ "uri": "https://{canondata_backend}/1817427/71c69e0489dfa612a57e6a73d889c47617e888f9/resource.tar.gz#test.test_expr-tagged_nth_no_optional-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[expr-tagged_nth_no_optional-default.txt-Results]": [
+ {
+ "checksum": "dcf899a35be34f9dcba93487513bc819",
+ "size": 3081,
+ "uri": "https://{canondata_backend}/1775059/9c09d1b7ca039bad9f375e5e993bbd259f8d98bc/resource.tar.gz#test.test_expr-tagged_nth_no_optional-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[expr-to_hashed_dict_tuple_key-default.txt-Debug]": [
{
"checksum": "f0cf1545022f8f237a44d99aaf7b0e7c",
diff --git a/yql/essentials/tests/sql/minirun/part2/canondata/result.json b/yql/essentials/tests/sql/minirun/part2/canondata/result.json
index bcfbc3c1fdd..7ff7cd2f25d 100644
--- a/yql/essentials/tests/sql/minirun/part2/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part2/canondata/result.json
@@ -681,6 +681,20 @@
"uri": "https://{canondata_backend}/1946324/e7201814e6e6593b8222695568ac22e9db8f99bc/resource.tar.gz#test.test_expr-longint_builtins-default.txt-Results_/results.txt"
}
],
+ "test.test[expr-nth_no_tagged_no_cache-default.txt-Debug]": [
+ {
+ "checksum": "3a01e0ed4889c9e3359e70a4fbab6918",
+ "size": 1150,
+ "uri": "https://{canondata_backend}/1814674/efe8c7ac8f2ea327318cb7a3ddfef73523f9ca53/resource.tar.gz#test.test_expr-nth_no_tagged_no_cache-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[expr-nth_no_tagged_no_cache-default.txt-Results]": [
+ {
+ "checksum": "2255f4b90375f9348060f9605926c2c3",
+ "size": 4329,
+ "uri": "https://{canondata_backend}/1814674/efe8c7ac8f2ea327318cb7a3ddfef73523f9ca53/resource.tar.gz#test.test_expr-nth_no_tagged_no_cache-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[expr-partial_columns_in_mem_aggr-default.txt-Debug]": [
{
"checksum": "f6b313886299912210c39d23bbc3c44b",
diff --git a/yql/essentials/tests/sql/minirun/part3/canondata/result.json b/yql/essentials/tests/sql/minirun/part3/canondata/result.json
index 255e1ee8db5..1374b8323ee 100644
--- a/yql/essentials/tests/sql/minirun/part3/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part3/canondata/result.json
@@ -561,6 +561,20 @@
"uri": "https://{canondata_backend}/1942671/d3336f0bb6dbe9e9fd1f3cf5e74ebe4602d13132/resource.tar.gz#test.test_expr-list_from_range-default.txt-Results_/results.txt"
}
],
+ "test.test[expr-nth_no_optional_no_tagged_no_cache-default.txt-Debug]": [
+ {
+ "checksum": "1aa9af53a28b769543e515e500c6c797",
+ "size": 1036,
+ "uri": "https://{canondata_backend}/1942173/4d031afb3e8d48927da6c14d5eb6c4d18097c5f4/resource.tar.gz#test.test_expr-nth_no_optional_no_tagged_no_cache-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[expr-nth_no_optional_no_tagged_no_cache-default.txt-Results]": [
+ {
+ "checksum": "70128e5a26530fdd99dbf079173a4b35",
+ "size": 3782,
+ "uri": "https://{canondata_backend}/1942173/4d031afb3e8d48927da6c14d5eb6c4d18097c5f4/resource.tar.gz#test.test_expr-nth_no_optional_no_tagged_no_cache-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[expr-opt_list_map-default.txt-Debug]": [
{
"checksum": "5aed4a678e424baaa9f7fba738a457ff",
diff --git a/yql/essentials/tests/sql/minirun/part4/canondata/result.json b/yql/essentials/tests/sql/minirun/part4/canondata/result.json
index 860fc33ae76..de4f5eeeb08 100644
--- a/yql/essentials/tests/sql/minirun/part4/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part4/canondata/result.json
@@ -636,6 +636,20 @@
"uri": "https://{canondata_backend}/1942671/f9fe8b5ff2967f43b60e0f5b3fa5c2c4eff69207/resource.tar.gz#test.test_expr-list_top_sort-default.txt-Results_/results.txt"
}
],
+ "test.test[expr-nth_no_tagged-default.txt-Debug]": [
+ {
+ "checksum": "2c4ad1d970316f96ebc28632ab698bee",
+ "size": 754,
+ "uri": "https://{canondata_backend}/1817427/efdcc8940db1bbb79de10bdec85748b9b022445e/resource.tar.gz#test.test_expr-nth_no_tagged-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[expr-nth_no_tagged-default.txt-Results]": [
+ {
+ "checksum": "a6bb73c2dd1a49393d3b4b3e5b42f2f0",
+ "size": 2553,
+ "uri": "https://{canondata_backend}/1925842/421e1f73672cfe3018278a1db28d854870c0151d/resource.tar.gz#test.test_expr-nth_no_tagged-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[expr-table_path-default.txt-Debug]": [
{
"checksum": "390c0d1fae8cdf69553f72184fc15801",
diff --git a/yql/essentials/tests/sql/minirun/part5/canondata/result.json b/yql/essentials/tests/sql/minirun/part5/canondata/result.json
index 04dfb913bfe..011770fbbfd 100644
--- a/yql/essentials/tests/sql/minirun/part5/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part5/canondata/result.json
@@ -943,6 +943,20 @@
"uri": "file://test.test_expr-list_flat_map_deprecated_opt-default.txt-Results_/extracted"
}
],
+ "test.test[expr-nth_no_optional_no_tagged-default.txt-Debug]": [
+ {
+ "checksum": "906aa3574e44e5c27a0d9c18e7c2e1db",
+ "size": 644,
+ "uri": "https://{canondata_backend}/1817427/2dc878bbecb1d83cab619d3beae95487eda85171/resource.tar.gz#test.test_expr-nth_no_optional_no_tagged-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[expr-nth_no_optional_no_tagged-default.txt-Results]": [
+ {
+ "checksum": "295a6801944097dc841de77aafed57e1",
+ "size": 2182,
+ "uri": "https://{canondata_backend}/1775059/86ecd2107b9bc58125a7e8e8ec2bba0d1ab4dae8/resource.tar.gz#test.test_expr-nth_no_optional_no_tagged-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[expr-struct_builtins-default.txt-Debug]": [
{
"checksum": "46958300093332035cd00204e3c0d29f",
diff --git a/yql/essentials/tests/sql/minirun/part7/canondata/result.json b/yql/essentials/tests/sql/minirun/part7/canondata/result.json
index 061272da90f..9acd8da8d20 100644
--- a/yql/essentials/tests/sql/minirun/part7/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part7/canondata/result.json
@@ -569,6 +569,34 @@
"uri": "https://{canondata_backend}/1942525/5b75160303fccf854ef8bcd60aae18ec7c47ceda/resource.tar.gz#test.test_expr-struct_slice-default.txt-Results_/results.txt"
}
],
+ "test.test[expr-tagged_nth_no_cache-default.txt-Debug]": [
+ {
+ "checksum": "6a942f415a1c17abec5997d0e2bc9a1b",
+ "size": 1320,
+ "uri": "https://{canondata_backend}/1814674/0fd635549c290a101879f0575638429cb3c65923/resource.tar.gz#test.test_expr-tagged_nth_no_cache-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[expr-tagged_nth_no_cache-default.txt-Results]": [
+ {
+ "checksum": "2721519b95805a4ee69143b2629825aa",
+ "size": 6108,
+ "uri": "https://{canondata_backend}/1814674/0fd635549c290a101879f0575638429cb3c65923/resource.tar.gz#test.test_expr-tagged_nth_no_cache-default.txt-Results_/results.txt"
+ }
+ ],
+ "test.test[expr-tagged_nth_no_optional_no_cache-default.txt-Debug]": [
+ {
+ "checksum": "3658a9b32a026300586d7d70ccdb24d8",
+ "size": 1116,
+ "uri": "https://{canondata_backend}/1814674/0fd635549c290a101879f0575638429cb3c65923/resource.tar.gz#test.test_expr-tagged_nth_no_optional_no_cache-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[expr-tagged_nth_no_optional_no_cache-default.txt-Results]": [
+ {
+ "checksum": "1b04197e3e8e4296edcf805c0daa42df",
+ "size": 4681,
+ "uri": "https://{canondata_backend}/1814674/0fd635549c290a101879f0575638429cb3c65923/resource.tar.gz#test.test_expr-tagged_nth_no_optional_no_cache-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[expr-uuid-default.txt-Debug]": [
{
"checksum": "c7b5816b36ef8c082dad802bab80b466",
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/result.json b/yql/essentials/tests/sql/sql2yql/canondata/result.json
index 7710d0c54b8..e5f020fc976 100644
--- a/yql/essentials/tests/sql/sql2yql/canondata/result.json
+++ b/yql/essentials/tests/sql/sql2yql/canondata/result.json
@@ -3394,6 +3394,34 @@
"uri": "https://{canondata_backend}/1942173/99e88108149e222741552e7e6cddef041d6a2846/resource.tar.gz#test_sql2yql.test_expr-minmax_for_complex_types_/sql.yql"
}
],
+ "test_sql2yql.test[expr-nth_no_optional_no_tagged]": [
+ {
+ "checksum": "36232aa724068d894eeca9410ed12929",
+ "size": 2106,
+ "uri": "https://{canondata_backend}/1784826/00cd6cd2ba7605aef48f862f0ad2c01f28cb09a0/resource.tar.gz#test_sql2yql.test_expr-nth_no_optional_no_tagged_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[expr-nth_no_optional_no_tagged_no_cache]": [
+ {
+ "checksum": "9458795820ac9991b7a29c0b6f321332",
+ "size": 4594,
+ "uri": "https://{canondata_backend}/1880306/ceb9f028cc97a068c8b4060a3d97985d50af7310/resource.tar.gz#test_sql2yql.test_expr-nth_no_optional_no_tagged_no_cache_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[expr-nth_no_tagged]": [
+ {
+ "checksum": "2f8a7a89dfa82ce26e4cd0be03fa57f1",
+ "size": 2139,
+ "uri": "https://{canondata_backend}/1784826/00cd6cd2ba7605aef48f862f0ad2c01f28cb09a0/resource.tar.gz#test_sql2yql.test_expr-nth_no_tagged_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[expr-nth_no_tagged_no_cache]": [
+ {
+ "checksum": "bcc91b82a8c0d29fc1c832895d5a0be0",
+ "size": 4627,
+ "uri": "https://{canondata_backend}/1880306/ceb9f028cc97a068c8b4060a3d97985d50af7310/resource.tar.gz#test_sql2yql.test_expr-nth_no_tagged_no_cache_/sql.yql"
+ }
+ ],
"test_sql2yql.test[expr-opt_list_map]": [
{
"checksum": "cbe8c7680e62a2d67eaa35c727e9895e",
@@ -3534,6 +3562,34 @@
"uri": "https://{canondata_backend}/1923547/26d32eb789592629a387bffbe3c29af93fc60786/resource.tar.gz#test_sql2yql.test_expr-tablename_/sql.yql"
}
],
+ "test_sql2yql.test[expr-tagged_nth]": [
+ {
+ "checksum": "5880af1da4ebf2cf9a0bf32565bbaf41",
+ "size": 2219,
+ "uri": "https://{canondata_backend}/1784826/00cd6cd2ba7605aef48f862f0ad2c01f28cb09a0/resource.tar.gz#test_sql2yql.test_expr-tagged_nth_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[expr-tagged_nth_no_cache]": [
+ {
+ "checksum": "77bf5801970db30bf78bdae7353dc6b6",
+ "size": 4707,
+ "uri": "https://{canondata_backend}/1880306/ceb9f028cc97a068c8b4060a3d97985d50af7310/resource.tar.gz#test_sql2yql.test_expr-tagged_nth_no_cache_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[expr-tagged_nth_no_optional]": [
+ {
+ "checksum": "d6e13d2443925261e815f63f98a1816b",
+ "size": 2186,
+ "uri": "https://{canondata_backend}/1784826/00cd6cd2ba7605aef48f862f0ad2c01f28cb09a0/resource.tar.gz#test_sql2yql.test_expr-tagged_nth_no_optional_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[expr-tagged_nth_no_optional_no_cache]": [
+ {
+ "checksum": "23eca92c148f9e2f55012169bff06ab9",
+ "size": 4674,
+ "uri": "https://{canondata_backend}/1880306/ceb9f028cc97a068c8b4060a3d97985d50af7310/resource.tar.gz#test_sql2yql.test_expr-tagged_nth_no_optional_no_cache_/sql.yql"
+ }
+ ],
"test_sql2yql.test[expr-to_dict_from_nothing]": [
{
"checksum": "f8aa8ee9953a55c7169e04fca1c319c3",
@@ -10502,6 +10558,26 @@
"uri": "file://test_sql_format.test_expr-minmax_for_complex_types_/formatted.sql"
}
],
+ "test_sql_format.test[expr-nth_no_optional_no_tagged]": [
+ {
+ "uri": "file://test_sql_format.test_expr-nth_no_optional_no_tagged_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[expr-nth_no_optional_no_tagged_no_cache]": [
+ {
+ "uri": "file://test_sql_format.test_expr-nth_no_optional_no_tagged_no_cache_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[expr-nth_no_tagged]": [
+ {
+ "uri": "file://test_sql_format.test_expr-nth_no_tagged_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[expr-nth_no_tagged_no_cache]": [
+ {
+ "uri": "file://test_sql_format.test_expr-nth_no_tagged_no_cache_/formatted.sql"
+ }
+ ],
"test_sql_format.test[expr-opt_list_map]": [
{
"uri": "file://test_sql_format.test_expr-opt_list_map_/formatted.sql"
@@ -10602,6 +10678,26 @@
"uri": "file://test_sql_format.test_expr-tablename_/formatted.sql"
}
],
+ "test_sql_format.test[expr-tagged_nth]": [
+ {
+ "uri": "file://test_sql_format.test_expr-tagged_nth_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[expr-tagged_nth_no_cache]": [
+ {
+ "uri": "file://test_sql_format.test_expr-tagged_nth_no_cache_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[expr-tagged_nth_no_optional]": [
+ {
+ "uri": "file://test_sql_format.test_expr-tagged_nth_no_optional_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[expr-tagged_nth_no_optional_no_cache]": [
+ {
+ "uri": "file://test_sql_format.test_expr-tagged_nth_no_optional_no_cache_/formatted.sql"
+ }
+ ],
"test_sql_format.test[expr-to_dict_from_nothing]": [
{
"uri": "file://test_sql_format.test_expr-to_dict_from_nothing_/formatted.sql"
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_optional_no_tagged_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_optional_no_tagged_/formatted.sql
new file mode 100644
index 00000000000..a3b290439c6
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_optional_no_tagged_/formatted.sql
@@ -0,0 +1,25 @@
+/* postgres can not */
+PRAGMA EmitAggApply;
+PRAGMA EmitTableSource;
+
+$data = [
+ <|
+ x: (
+ 1,
+ just(2),
+ NULL,
+ Nothing(Int32?),
+ Nothing(pgint4)
+ )
+ |>
+];
+
+SELECT
+ x.0,
+ x.1,
+ x.2,
+ x.3,
+ x.4
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_optional_no_tagged_no_cache_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_optional_no_tagged_no_cache_/formatted.sql
new file mode 100644
index 00000000000..e490268ee27
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_optional_no_tagged_no_cache_/formatted.sql
@@ -0,0 +1,45 @@
+/* postgres can not */
+PRAGMA EmitAggApply;
+PRAGMA EmitTableSource;
+
+$data = [
+ <|
+ x: (
+ 1,
+ just(2),
+ NULL,
+ Nothing(Int32?),
+ Nothing(pgint4)
+ )
+ |>
+];
+
+SELECT
+ x.0,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.1,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.2,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.3,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.4,
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_tagged_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_tagged_/formatted.sql
new file mode 100644
index 00000000000..36e30098b80
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_tagged_/formatted.sql
@@ -0,0 +1,28 @@
+/* postgres can not */
+PRAGMA EmitAggApply;
+PRAGMA EmitTableSource;
+
+$data = [
+ <|
+ x: Just(
+ (
+ 1,
+ just(2),
+ NULL,
+ Nothing(Int32?),
+ Nothing(pgint4)
+ )
+ )
+ |>,
+ <|x: NULL|>
+];
+
+SELECT
+ x.0,
+ x.1,
+ x.2,
+ x.3,
+ x.4
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_tagged_no_cache_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_tagged_no_cache_/formatted.sql
new file mode 100644
index 00000000000..0b645e0ac77
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-nth_no_tagged_no_cache_/formatted.sql
@@ -0,0 +1,48 @@
+/* postgres can not */
+PRAGMA EmitAggApply;
+PRAGMA EmitTableSource;
+
+$data = [
+ <|
+ x: Just(
+ (
+ 1,
+ just(2),
+ NULL,
+ Nothing(Int32?),
+ Nothing(pgint4)
+ )
+ )
+ |>,
+ <|x: NULL|>
+];
+
+SELECT
+ x.0,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.1,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.2,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.3,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.4,
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_/formatted.sql
new file mode 100644
index 00000000000..8d7eebd72e4
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_/formatted.sql
@@ -0,0 +1,28 @@
+/* postgres can not */
+PRAGMA EmitAggApply;
+PRAGMA EmitTableSource;
+
+$data = [
+ <|
+ x: Just(
+ (
+ AsTagged(1, 'A'),
+ AsTagged(just(2), 'B'),
+ AsTagged(NULL, 'C'),
+ AsTagged(Nothing(Int32?), 'D'),
+ AsTagged(Nothing(pgint4), 'E')
+ )
+ )
+ |>,
+ <|x: NULL|>
+];
+
+SELECT
+ x.0,
+ x.1,
+ x.2,
+ x.3,
+ x.4
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_cache_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_cache_/formatted.sql
new file mode 100644
index 00000000000..83e9e501e47
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_cache_/formatted.sql
@@ -0,0 +1,48 @@
+/* postgres can not */
+PRAGMA EmitAggApply;
+PRAGMA EmitTableSource;
+
+$data = [
+ <|
+ x: Just(
+ (
+ AsTagged(1, 'A'),
+ AsTagged(just(2), 'B'),
+ AsTagged(NULL, 'C'),
+ AsTagged(Nothing(Int32?), 'D'),
+ AsTagged(Nothing(pgint4), 'E')
+ )
+ )
+ |>,
+ <|x: NULL|>
+];
+
+SELECT
+ x.0,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.1,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.2,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.3,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.4,
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_optional_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_optional_/formatted.sql
new file mode 100644
index 00000000000..177c0737d74
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_optional_/formatted.sql
@@ -0,0 +1,25 @@
+/* postgres can not */
+PRAGMA EmitAggApply;
+PRAGMA EmitTableSource;
+
+$data = [
+ <|
+ x: (
+ AsTagged(1, 'A'),
+ AsTagged(just(2), 'B'),
+ AsTagged(NULL, 'C'),
+ AsTagged(Nothing(Int32?), 'D'),
+ AsTagged(Nothing(pgint4), 'E')
+ )
+ |>
+];
+
+SELECT
+ x.0,
+ x.1,
+ x.2,
+ x.3,
+ x.4
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_optional_no_cache_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_optional_no_cache_/formatted.sql
new file mode 100644
index 00000000000..2fb520082de
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_expr-tagged_nth_no_optional_no_cache_/formatted.sql
@@ -0,0 +1,45 @@
+/* postgres can not */
+PRAGMA EmitAggApply;
+PRAGMA EmitTableSource;
+
+$data = [
+ <|
+ x: (
+ AsTagged(1, 'A'),
+ AsTagged(just(2), 'B'),
+ AsTagged(NULL, 'C'),
+ AsTagged(Nothing(Int32?), 'D'),
+ AsTagged(Nothing(pgint4), 'E')
+ )
+ |>
+];
+
+SELECT
+ x.0,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.1,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.2,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.3,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.4,
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/suites/expr/nth_no_optional_no_tagged.yql b/yql/essentials/tests/sql/suites/expr/nth_no_optional_no_tagged.yql
new file mode 100644
index 00000000000..a41c326b395
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/nth_no_optional_no_tagged.yql
@@ -0,0 +1,25 @@
+/* postgres can not */
+pragma EmitAggApply;
+pragma EmitTableSource;
+
+$data = [
+ <|
+ x: (
+ 1,
+ just(2),
+ NULL,
+ Nothing(Int32?),
+ Nothing(pgint4)
+ )
+ |>
+];
+
+SELECT
+ x.0,
+ x.1,
+ x.2,
+ x.3,
+ x.4
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/suites/expr/nth_no_optional_no_tagged_no_cache.yql b/yql/essentials/tests/sql/suites/expr/nth_no_optional_no_tagged_no_cache.yql
new file mode 100644
index 00000000000..6854c668c55
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/nth_no_optional_no_tagged_no_cache.yql
@@ -0,0 +1,45 @@
+/* postgres can not */
+pragma EmitAggApply;
+pragma EmitTableSource;
+
+$data = [
+ <|
+ x: (
+ 1,
+ just(2),
+ NULL,
+ Nothing(Int32?),
+ Nothing(pgint4)
+ )
+ |>
+];
+
+SELECT
+ x.0,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.1,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.2,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.3,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.4,
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/suites/expr/nth_no_tagged.yql b/yql/essentials/tests/sql/suites/expr/nth_no_tagged.yql
new file mode 100644
index 00000000000..3f3137b6f28
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/nth_no_tagged.yql
@@ -0,0 +1,28 @@
+/* postgres can not */
+pragma EmitAggApply;
+pragma EmitTableSource;
+
+$data = [
+ <|
+ x: Just(
+ (
+ 1,
+ just(2),
+ NULL,
+ Nothing(Int32?),
+ Nothing(pgint4)
+ )
+ )
+ |>,
+ <|x: NULL|>
+];
+
+SELECT
+ x.0,
+ x.1,
+ x.2,
+ x.3,
+ x.4
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/suites/expr/nth_no_tagged_no_cache.yql b/yql/essentials/tests/sql/suites/expr/nth_no_tagged_no_cache.yql
new file mode 100644
index 00000000000..ede2ce839ae
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/nth_no_tagged_no_cache.yql
@@ -0,0 +1,48 @@
+/* postgres can not */
+pragma EmitAggApply;
+pragma EmitTableSource;
+
+$data = [
+ <|
+ x: Just(
+ (
+ 1,
+ just(2),
+ NULL,
+ Nothing(Int32?),
+ Nothing(pgint4)
+ )
+ )
+ |>,
+ <|x: NULL|>
+];
+
+SELECT
+ x.0,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.1,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.2,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.3,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.4,
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/suites/expr/tagged_nth.yql b/yql/essentials/tests/sql/suites/expr/tagged_nth.yql
new file mode 100644
index 00000000000..ab05dc9b0cb
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/tagged_nth.yql
@@ -0,0 +1,28 @@
+/* postgres can not */
+pragma EmitAggApply;
+pragma EmitTableSource;
+
+$data = [
+ <|
+ x: Just(
+ (
+ AsTagged(1, 'A'),
+ AsTagged(just(2), 'B'),
+ AsTagged(NULL, 'C'),
+ AsTagged(Nothing(Int32?), 'D'),
+ AsTagged(Nothing(pgint4), 'E')
+ )
+ )
+ |>,
+ <|x: NULL|>
+];
+
+SELECT
+ x.0,
+ x.1,
+ x.2,
+ x.3,
+ x.4
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/suites/expr/tagged_nth_no_cache.yql b/yql/essentials/tests/sql/suites/expr/tagged_nth_no_cache.yql
new file mode 100644
index 00000000000..0e7b8185e5d
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/tagged_nth_no_cache.yql
@@ -0,0 +1,49 @@
+/* postgres can not */
+pragma EmitAggApply;
+pragma EmitTableSource;
+
+$data = [
+ <|
+ x: Just(
+ (
+ AsTagged(1, 'A'),
+ AsTagged(just(2), 'B'),
+ AsTagged(NULL, 'C'),
+ AsTagged(Nothing(Int32?), 'D'),
+ AsTagged(Nothing(pgint4), 'E')
+ )
+ )
+ |>,
+ <|x: NULL|>
+];
+
+SELECT
+ x.0,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.1,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.2,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.3,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.4,
+FROM
+ AS_TABLE($data)
+;
+
diff --git a/yql/essentials/tests/sql/suites/expr/tagged_nth_no_optional.yql b/yql/essentials/tests/sql/suites/expr/tagged_nth_no_optional.yql
new file mode 100644
index 00000000000..678d6b2e44f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/tagged_nth_no_optional.yql
@@ -0,0 +1,25 @@
+/* postgres can not */
+pragma EmitAggApply;
+pragma EmitTableSource;
+
+$data = [
+ <|
+ x: (
+ AsTagged(1, 'A'),
+ AsTagged(just(2), 'B'),
+ AsTagged(NULL, 'C'),
+ AsTagged(Nothing(Int32?), 'D'),
+ AsTagged(Nothing(pgint4), 'E')
+ )
+ |>
+];
+
+SELECT
+ x.0,
+ x.1,
+ x.2,
+ x.3,
+ x.4
+FROM
+ AS_TABLE($data)
+;
diff --git a/yql/essentials/tests/sql/suites/expr/tagged_nth_no_optional_no_cache.yql b/yql/essentials/tests/sql/suites/expr/tagged_nth_no_optional_no_cache.yql
new file mode 100644
index 00000000000..cb0e7470e5b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/expr/tagged_nth_no_optional_no_cache.yql
@@ -0,0 +1,45 @@
+/* postgres can not */
+pragma EmitAggApply;
+pragma EmitTableSource;
+
+$data = [
+ <|
+ x: (
+ AsTagged(1, 'A'),
+ AsTagged(just(2), 'B'),
+ AsTagged(NULL, 'C'),
+ AsTagged(Nothing(Int32?), 'D'),
+ AsTagged(Nothing(pgint4), 'E')
+ )
+ |>
+];
+
+SELECT
+ x.0,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.1,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.2,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.3,
+FROM
+ AS_TABLE($data)
+;
+
+SELECT
+ x.4,
+FROM
+ AS_TABLE($data)
+;