diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-11-20 17:37:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 17:37:57 +0000 |
commit | f76323e9b295c15751e51e3443aa47a36bee8023 (patch) | |
tree | 4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/sql/suites/action | |
parent | 753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff) | |
parent | a7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff) | |
download | ydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz |
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'yql/essentials/tests/sql/suites/action')
159 files changed, 1604 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_and_table.sql b/yql/essentials/tests/sql/suites/action/action_eval_cluster_and_table.sql new file mode 100644 index 0000000000..414f54ac9d --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_and_table.sql @@ -0,0 +1,8 @@ +/* syntax version 1 */ +/* postgres can not */ +$cluster = "pla" || "to"; +$name = "In" || "put"; + +SELECT + count(*) +FROM yt:$cluster.$name; diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_table.cfg b/yql/essentials/tests/sql/suites/action/action_eval_cluster_table.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_table.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_table.sql b/yql/essentials/tests/sql/suites/action/action_eval_cluster_table.sql new file mode 100644 index 0000000000..67e2af6063 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_table.sql @@ -0,0 +1,9 @@ +/* syntax version 1 */ +/* postgres can not */ +$foo = CAST(Unicode::ToLower("PLATO"u) AS String); + +insert into yt:$foo.Output +select * +from yt:$foo.Input +where key < "100" +order by key; diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_table_for.cfg b/yql/essentials/tests/sql/suites/action/action_eval_cluster_table_for.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_table_for.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_table_for.sql b/yql/essentials/tests/sql/suites/action/action_eval_cluster_table_for.sql new file mode 100644 index 0000000000..56554226fe --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_table_for.sql @@ -0,0 +1,14 @@ +/* syntax version 1 */ +/* postgres can not */ +define action $a($x) as + $foo = CAST(Unicode::ToLower($x) AS String); + + insert into yt:$foo.Output + select * + from yt:$foo.Input + where key < "100" + order by key; + +end define; + +evaluate for $i in AsList("PLATO"u) do $a($i); diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_use.cfg b/yql/essentials/tests/sql/suites/action/action_eval_cluster_use.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_use.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_use.sql b/yql/essentials/tests/sql/suites/action/action_eval_cluster_use.sql new file mode 100644 index 0000000000..7635ba2d17 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_use.sql @@ -0,0 +1,10 @@ +/* syntax version 1 */ +/* postgres can not */ +$foo = CAST(Unicode::ToLower("PLATO"u) AS String); +use yt:$foo; + +insert into Output +select * +from Input +where key < "100" +order by key; diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_use_compact_named_exprs.cfg b/yql/essentials/tests/sql/suites/action/action_eval_cluster_use_compact_named_exprs.cfg new file mode 100644 index 0000000000..fccca71d35 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_use_compact_named_exprs.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +providers yt diff --git a/yql/essentials/tests/sql/suites/action/action_eval_cluster_use_compact_named_exprs.sql b/yql/essentials/tests/sql/suites/action/action_eval_cluster_use_compact_named_exprs.sql new file mode 100644 index 0000000000..08994c5615 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_eval_cluster_use_compact_named_exprs.sql @@ -0,0 +1,20 @@ +/* yt can not */ +pragma CompactNamedExprs; +$foo = CAST(Unicode::ToLower("PLATO"u) AS String); + +insert into yt:$foo.Output +select * +from yt:$foo.Input +where key < "100" +order by key; + +define action $bar() as + $x = CAST(Unicode::ToLower("PLaTO"u) AS String); + insert into yt:$x.Output + select * + from yt:$foo.Input + where key < "100" + order by key; +end define; + +do $bar(); diff --git a/yql/essentials/tests/sql/suites/action/action_nested_query.sql b/yql/essentials/tests/sql/suites/action/action_nested_query.sql new file mode 100644 index 0000000000..0d6e87d794 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_nested_query.sql @@ -0,0 +1,10 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +define action $action() as + $sub = (select * from Input); + select * from $sub order by key; +end define; + +do $action(); diff --git a/yql/essentials/tests/sql/suites/action/action_opt_args.sql b/yql/essentials/tests/sql/suites/action/action_opt_args.sql new file mode 100644 index 0000000000..b577b12a5d --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_opt_args.sql @@ -0,0 +1,8 @@ +/* syntax version 1 */ +/* postgres can not */ +define action $action($a,$b?) as + select $a + ($b ?? 0); +end define; + +do $action(1); +do $action(2, 3); diff --git a/yql/essentials/tests/sql/suites/action/action_udf_args.cfg b/yql/essentials/tests/sql/suites/action/action_udf_args.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_udf_args.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/action_udf_args.sql b/yql/essentials/tests/sql/suites/action/action_udf_args.sql new file mode 100644 index 0000000000..16f7eefcaf --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/action_udf_args.sql @@ -0,0 +1,8 @@ +/* syntax version 1 */ +/* postgres can not */ +define action $f($x) as + select $x; +end define; + +$x = CAST(Unicode::ToUpper("abc"u) AS String); +do $f($x); diff --git a/yql/essentials/tests/sql/suites/action/closure_action.sql b/yql/essentials/tests/sql/suites/action/closure_action.sql new file mode 100644 index 0000000000..3008cf3a1c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/closure_action.sql @@ -0,0 +1,14 @@ +/* syntax version 1 */ +/* postgres can not */ +define action $action($b,$c) as + $d = $b + $c; + select $b; + select $c; + select $d; +end define; + +define action $closure_action($a) as + do $a(3,4); +end define; + +do $closure_action($action); diff --git a/yql/essentials/tests/sql/suites/action/combine_subqueries_with_table_param.sql b/yql/essentials/tests/sql/suites/action/combine_subqueries_with_table_param.sql new file mode 100644 index 0000000000..542493b3af --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/combine_subqueries_with_table_param.sql @@ -0,0 +1,22 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +$combineQueries = ($query, $list) -> { + RETURN EvaluateCode(LambdaCode(($world) -> { + $queries = ListMap($list, ($arg)->{ + RETURN FuncCode("Apply", QuoteCode($query), $world, ReprCode($arg)) + }); + + RETURN FuncCode("UnionAll", $queries); + })); +}; + +DEFINE SUBQUERY $calc($table) AS + SELECT * + FROM $table; +END DEFINE; + +$fullQuery = $combineQueries($calc, AsList("Input", "Input")); + +SELECT count(*) FROM $fullQuery(); diff --git a/yql/essentials/tests/sql/suites/action/default.cfg b/yql/essentials/tests/sql/suites/action/default.cfg new file mode 100644 index 0000000000..ad52c79527 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/default.cfg @@ -0,0 +1,2 @@ +in Input input.txt +out Output output.txt diff --git a/yql/essentials/tests/sql/suites/action/define_simple_action.sql b/yql/essentials/tests/sql/suites/action/define_simple_action.sql new file mode 100644 index 0000000000..60244b3b48 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/define_simple_action.sql @@ -0,0 +1,10 @@ +/* syntax version 1 */ +/* postgres can not */ +define action $action($b,$c) as + $d = $b + $c; + select $b; + select $c; + select $d; +end define; + +do $action(1,2); diff --git a/yql/essentials/tests/sql/suites/action/dep_world_action_quote.sql b/yql/essentials/tests/sql/suites/action/dep_world_action_quote.sql new file mode 100644 index 0000000000..6375e06aee --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/dep_world_action_quote.sql @@ -0,0 +1,20 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +DEFINE ACTION $aaa($z) as + +$table = $z.0; +$k = (select min(key || $z.1) from $table); + +DEFINE ACTION $bbb($n) AS + SELECT $n || $k FROM $table; +END DEFINE; + +$ccc = EvaluateCode(QuoteCode($bbb)); +DO $ccc("1"); + +END DEFINE; + +EVALUATE FOR $z IN AsList(AsTuple("Input","foo"),AsTuple("Input","bar")) + DO $aaa($z); diff --git a/yql/essentials/tests/sql/suites/action/dep_world_quote_code.sql b/yql/essentials/tests/sql/suites/action/dep_world_quote_code.sql new file mode 100644 index 0000000000..6188630666 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/dep_world_quote_code.sql @@ -0,0 +1,31 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +$combineQueries = ($query, $list) -> { + RETURN EvaluateCode(LambdaCode(($world) -> { + $queries = ListMap($list, ($arg) -> { + RETURN FuncCode("Apply", QuoteCode($query), $world, ReprCode($arg)) + }); + + RETURN FuncCode("Extend", $queries); + })); +}; + +DEFINE ACTION $aaa($z) as + +$k = (select count(*) from $z); + +DEFINE SUBQUERY $sub($n) AS + SELECT $n + $k FROM $z; +END DEFINE; + +$fullQuery = $combineQueries($sub, ListFromRange(0, 10)); +SELECT * FROM $fullQuery(); + +END DEFINE; + +EVALUATE FOR $z IN AsList("Input") + DO $aaa($z); + +DO $aaa("Input"); diff --git a/yql/essentials/tests/sql/suites/action/discard.sql b/yql/essentials/tests/sql/suites/action/discard.sql new file mode 100644 index 0000000000..ccdac00de8 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/discard.sql @@ -0,0 +1,32 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $a() as +$_x = select 1; +discard +select ensure(1, true); +select 2; +$_y = select 2; +end define; + +process $a(); + + +define subquery $b() as +$f1 = ($row)->(<|a:1,b:$row.value|>); +$f2 = ($row)->(<|a:2,b:$row.value|>); +discard +process plato.Input using $f1(TableRow()); +process plato.Input using $f2(TableRow()); +end define; + +select * from $b() order by b limit 1; + +define subquery $c() as +$f1 = ($key,$_)->(<|a:1,b:$key|>); +$f2 = ($key,$_)->(<|a:2,b:$key|>); +discard +reduce plato.Input on key using $f1(TableRow()); +reduce plato.Input on key using $f2(TableRow()); +end define; + +select * from $c() order by b limit 1; diff --git a/yql/essentials/tests/sql/suites/action/empty_do.sql b/yql/essentials/tests/sql/suites/action/empty_do.sql new file mode 100644 index 0000000000..3b30a5803c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/empty_do.sql @@ -0,0 +1,13 @@ +/* syntax version 1 */ +/* postgres can not */ +do empty_action(); + +$action1 = empty_action; + +do $action1(); + +$action2 = ($a,$_b)->{ + return $a; +}; + +do $action2(12); diff --git a/yql/essentials/tests/sql/suites/action/eval_anon_table.cfg b/yql/essentials/tests/sql/suites/action/eval_anon_table.cfg new file mode 100644 index 0000000000..ad52c79527 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_anon_table.cfg @@ -0,0 +1,2 @@ +in Input input.txt +out Output output.txt diff --git a/yql/essentials/tests/sql/suites/action/eval_anon_table.sql b/yql/essentials/tests/sql/suites/action/eval_anon_table.sql new file mode 100644 index 0000000000..449fbd3b83 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_anon_table.sql @@ -0,0 +1,13 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$a = CAST(Unicode::ToUpper("T"u) AS String) || "able"; +$b = CAST(Unicode::ToUpper("T"u) AS String) || "able"; + +insert into @$a +select 1 as x; + +commit; + +select * from @$b; diff --git a/yql/essentials/tests/sql/suites/action/eval_asatom.sql b/yql/essentials/tests/sql/suites/action/eval_asatom.sql new file mode 100644 index 0000000000..ca169899ed --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_asatom.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +/* postgres can not */ +SELECT Yql::String(AsAtom("a" || CAST(Unicode::ToUpper("b"u) AS String))); diff --git a/yql/essentials/tests/sql/suites/action/eval_astagged.sql b/yql/essentials/tests/sql/suites/action/eval_astagged.sql new file mode 100644 index 0000000000..89c4b9bcab --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_astagged.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +/* postgres can not */ +SELECT AsTagged(0, CAST(Unicode::ToUpper("t"u) AS String) || "ag"); diff --git a/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_expr.cfg b/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_expr.cfg new file mode 100644 index 0000000000..bc27f4ed21 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_expr.cfg @@ -0,0 +1,3 @@ +xfail +providers yt + diff --git a/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_expr.sql b/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_expr.sql new file mode 100644 index 0000000000..9e8a2a8c6e --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_expr.sql @@ -0,0 +1,7 @@ +/* yt can not */ +use plato; + +$n = ["foo"]; + +select * from $n; + diff --git a/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_param.cfg b/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_param.cfg new file mode 100644 index 0000000000..bc27f4ed21 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_param.cfg @@ -0,0 +1,3 @@ +xfail +providers yt + diff --git a/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_param.sql b/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_param.sql new file mode 100644 index 0000000000..7de917ef03 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_atom_wrong_type_param.sql @@ -0,0 +1,7 @@ +/* yt can not */ +use plato; + +declare $n as List<String>?; + +select * from $n; + diff --git a/yql/essentials/tests/sql/suites/action/eval_capture.cfg b/yql/essentials/tests/sql/suites/action/eval_capture.cfg new file mode 100644 index 0000000000..c6a659f7de --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_capture.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf re2_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_capture.sql b/yql/essentials/tests/sql/suites/action/eval_capture.sql new file mode 100644 index 0000000000..b60a8c4a2a --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_capture.sql @@ -0,0 +1,4 @@ +/* syntax version 1 */ +/* postgres can not */ +$capture = Re2::Capture(".*" || CAST(Unicode::ToLower("(\\D+)"u) AS String) || ".*"); +SELECT $capture(" 123 "); diff --git a/yql/essentials/tests/sql/suites/action/eval_code.sql b/yql/essentials/tests/sql/suites/action/eval_code.sql new file mode 100644 index 0000000000..10d0360aea --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_code.sql @@ -0,0 +1,22 @@ +/* syntax version 1 */ +/* postgres can not */ +select EvaluateCode(FuncCode("Int32",AtomCode("1"))); + +$inc = EvaluateCode(LambdaCode(($x)->{return + FuncCode("+", $x, FuncCode("Int32", AtomCode("1")))})); +select $inc(1); + +$addPrefixForMembers = ($strValue)->{ + $code = EvaluateCode(LambdaCode(($str)->{ + $members = StructTypeComponents(TypeHandle(TypeOf($strValue))); + $list = ListMap($members, ($x)->{ + return ListCode(AtomCode("prefix" || $x.Name),FuncCode("Member", $str, AtomCode($x.Name))); + }); + + return FuncCode("AsStruct",$list); + })); + return $code($strValue); +}; + +select $addPrefixForMembers(AsStruct(1 as foo, "2" as bar)); + diff --git a/yql/essentials/tests/sql/suites/action/eval_code_nested.sql b/yql/essentials/tests/sql/suites/action/eval_code_nested.sql new file mode 100644 index 0000000000..e730cf7d71 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_code_nested.sql @@ -0,0 +1,18 @@ +/* syntax version 1 */ +/* postgres can not */ +select EvaluateCode( + ReprCode(1)); + +select EvaluateCode( + FuncCode("EvaluateCode", + FuncCode("ReprCode", ReprCode(1)))); + +select EvaluateCode( + FuncCode("EvaluateCode", + FuncCode("ReprCode", + FuncCode("EvaluateCode", + FuncCode("ReprCode", ReprCode(1)))))); + +select EvaluateCode( + FuncCode("EvaluateExpr", + QuoteCode(1 + 2))); diff --git a/yql/essentials/tests/sql/suites/action/eval_column.cfg b/yql/essentials/tests/sql/suites/action/eval_column.cfg new file mode 100644 index 0000000000..c6596e362c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_column.cfg @@ -0,0 +1,2 @@ +in Input input.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_column.sql b/yql/essentials/tests/sql/suites/action/eval_column.sql new file mode 100644 index 0000000000..98838fb5fe --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_column.sql @@ -0,0 +1,34 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +$x = CAST(Unicode::ToLower("foo"u) AS String); +select AsStruct("1" as foo, 2 as bar).$x; + +$x = CAST(Unicode::ToLower("value"u) AS String); +select key, t.$x from Input as t order by key; + +$x = CAST(Unicode::ToLower("value"u) AS String); +select key, TableRow().$x from Input order by key; + + +$x = CAST(Unicode::ToLower("value"u) AS String); +select * from Input as t order by t.$x; + +$x = CAST(Unicode::ToLower("value"u) AS String); +$y = CAST(Unicode::ToLower("key"u) AS String); + +select x,count(*) from Input as t group by t.$x as x +having min(t.$y) != "" +order by x; + +select a.$x as x,b.$y as y from Input as a join Input as b on (a.$x = b.$x) +order by x; + +select a.$x as x,b.$y as y from Input as a join Input as b using ($x) +order by x; + +select p, value, lag(value) over w as lag +from Input +window w as (partition by TableRow().$y as p order by TableRow().$x) +order by p, value; diff --git a/yql/essentials/tests/sql/suites/action/eval_drop.cfg b/yql/essentials/tests/sql/suites/action/eval_drop.cfg new file mode 100644 index 0000000000..58878f8945 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_drop.cfg @@ -0,0 +1 @@ +in Input input.txt diff --git a/yql/essentials/tests/sql/suites/action/eval_drop.sql b/yql/essentials/tests/sql/suites/action/eval_drop.sql new file mode 100644 index 0000000000..c5275e2801 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_drop.sql @@ -0,0 +1,7 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +$path = (select min(Path) from folder("")); + +drop table $path;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/eval_each_input_table.sql b/yql/essentials/tests/sql/suites/action/eval_each_input_table.sql new file mode 100644 index 0000000000..45514cb512 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_each_input_table.sql @@ -0,0 +1,9 @@ +/* postgres can not */ +/* syntax version 1 */ +use plato; + +$a = ListMap(ListFromRange(0,2), ($_x)->(CAST(Unicode::ToUpper("i"u) AS String) || "nput")); +select count(*) FROM each($a view raw); + +$a = ListMap(ListFromRange(0,1), ($_x)->(CAST(Unicode::ToUpper("i"u) AS String) || "nput")); +select count(*) FROM each_strict($a); diff --git a/yql/essentials/tests/sql/suites/action/eval_ensuretype.sql b/yql/essentials/tests/sql/suites/action/eval_ensuretype.sql new file mode 100644 index 0000000000..7a21c20868 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_ensuretype.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +/* postgres can not */ +SELECT EnsureType("a", String, CAST(Unicode::ToUpper("me"u) AS String) || "ssage"); diff --git a/yql/essentials/tests/sql/suites/action/eval_extract.sql b/yql/essentials/tests/sql/suites/action/eval_extract.sql new file mode 100644 index 0000000000..fd9ab0db2e --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_extract.sql @@ -0,0 +1,4 @@ +/* syntax version 1 */ +/* postgres can not */ +$list = AsList(AsStruct(1 as One, "2" as Two), AsStruct(3 as One, "4" as Two)); +SELECT ListExtract($list, CAST(Unicode::ToUpper("o"u) AS String) || "ne"); diff --git a/yql/essentials/tests/sql/suites/action/eval_filter.cfg b/yql/essentials/tests/sql/suites/action/eval_filter.cfg new file mode 100644 index 0000000000..c6596e362c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_filter.cfg @@ -0,0 +1,2 @@ +in Input input.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_filter.sql b/yql/essentials/tests/sql/suites/action/eval_filter.sql new file mode 100644 index 0000000000..7fb11ebe59 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_filter.sql @@ -0,0 +1,12 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$arg1 = "" || ""; +$arg2 = ($_item)->{return true}; +$arg3 = "" || ""; +$arg4 = "" || "raw"; + +SELECT + count(*) +FROM FILTER($arg1,$arg2,$arg3,$arg4); diff --git a/yql/essentials/tests/sql/suites/action/eval_folder.cfg b/yql/essentials/tests/sql/suites/action/eval_folder.cfg new file mode 100644 index 0000000000..9d0a494107 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_folder.cfg @@ -0,0 +1 @@ +in Input input_attrs.txt diff --git a/yql/essentials/tests/sql/suites/action/eval_folder.sql b/yql/essentials/tests/sql/suites/action/eval_folder.sql new file mode 100644 index 0000000000..fbe663bcac --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_folder.sql @@ -0,0 +1,5 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +SELECT * FROM Folder(``,"foo;bar"); diff --git a/yql/essentials/tests/sql/suites/action/eval_folder_via_file.cfg b/yql/essentials/tests/sql/suites/action/eval_folder_via_file.cfg new file mode 100644 index 0000000000..58878f8945 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_folder_via_file.cfg @@ -0,0 +1 @@ +in Input input.txt diff --git a/yql/essentials/tests/sql/suites/action/eval_folder_via_file.sql b/yql/essentials/tests/sql/suites/action/eval_folder_via_file.sql new file mode 100644 index 0000000000..2121ea69c2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_folder_via_file.sql @@ -0,0 +1,18 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +pragma yt.FolderInlineItemsLimit="0"; + +$list = ( + select aggregate_list(Path) from ( + select Path from folder("") + where Type = "table" + limit 30 + ) +); + +select + count(*) +from + each($list) diff --git a/yql/essentials/tests/sql/suites/action/eval_folder_via_file_in_job.cfg b/yql/essentials/tests/sql/suites/action/eval_folder_via_file_in_job.cfg new file mode 100644 index 0000000000..289c4251bb --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_folder_via_file_in_job.cfg @@ -0,0 +1,2 @@ +in Input input.txt +udf python3_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_folder_via_file_in_job.sql b/yql/essentials/tests/sql/suites/action/eval_folder_via_file_in_job.sql new file mode 100644 index 0000000000..10ed2ec09c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_folder_via_file_in_job.sql @@ -0,0 +1,25 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +pragma yt.FolderInlineItemsLimit="0"; + +$script = @@ +def f(s): + return True +@@; + +$callable = Python3::f(Callable<(String)->Bool>,$script); + +$list = ( + select aggregate_list(Path) from ( + select Path from folder("") + where Type = "table" and $callable(Path) + limit 30 + ) +); + +select + count(*) +from + each($list) diff --git a/yql/essentials/tests/sql/suites/action/eval_for.sql b/yql/essentials/tests/sql/suites/action/eval_for.sql new file mode 100644 index 0000000000..71427f2fde --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_for.sql @@ -0,0 +1,21 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +define action $action1($x) as + select $x; +end define; + +$f = ($i)->{ + return CAST(Unicode::ToUpper(cast($i as Utf8)) AS String); +}; + +evaluate for $i in ListMap(ListFromRange(0,3),$f) do $action1($i); + +evaluate for $i in ListMap(ListFromRange(0,0),$f) do $action1($i) else do $action1(100); + +evaluate for $i in ListMap(ListFromRange(0,0),$f) do $action1($i); + +evaluate for $i in Yql::Map(1/1,($x)->{return AsList($x)}) do $action1($i); + +evaluate for $i in Yql::Map(1/0,($x)->{return AsList($x)}) do $action1($i); diff --git a/yql/essentials/tests/sql/suites/action/eval_for_over_subquery.sql b/yql/essentials/tests/sql/suites/action/eval_for_over_subquery.sql new file mode 100644 index 0000000000..198b80b9a5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_for_over_subquery.sql @@ -0,0 +1,13 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +$list = ( + select aggregate_list(key) from Input +); + +define action $echo($x) as + select $x; +end define; + +evaluate for $a in $list do $echo($a); diff --git a/yql/essentials/tests/sql/suites/action/eval_if.sql b/yql/essentials/tests/sql/suites/action/eval_if.sql new file mode 100644 index 0000000000..f64665fd69 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_if.sql @@ -0,0 +1,18 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +define action $action1($x) as + select $x; +end define; + +evaluate if CAST(Unicode::ToUpper("i"u) AS String) == "I" + do $action1(1) +else + do $action1(2); + +evaluate if CAST(Unicode::ToUpper("i"u) AS String) != "I" + do $action1(3); + +evaluate if CAST(Unicode::ToUpper("i"u) AS String) == "I" + do $action1(4); diff --git a/yql/essentials/tests/sql/suites/action/eval_if_guard.sql b/yql/essentials/tests/sql/suites/action/eval_if_guard.sql new file mode 100644 index 0000000000..4a11e6933e --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_if_guard.sql @@ -0,0 +1,10 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +$list = ListTake(AsList("Input"),0); +define action $process() as + select count(*) FROM each($list); +end define; + +evaluate if ListLength($list)>0 do $process(); diff --git a/yql/essentials/tests/sql/suites/action/eval_input_output_table.cfg b/yql/essentials/tests/sql/suites/action/eval_input_output_table.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_input_output_table.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_input_output_table.sql b/yql/essentials/tests/sql/suites/action/eval_input_output_table.sql new file mode 100644 index 0000000000..e8bbd374f9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_input_output_table.sql @@ -0,0 +1,14 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$a = CAST(Unicode::ToUpper("o"u) AS String) || "utput"; +$b = CAST(Unicode::ToUpper("i"u) AS String) || "nput"; +INSERT INTO $a +SELECT + key as key, + "" as subkey, + "value:" || value as value +FROM $b +WHERE key < "100" +ORDER BY key; diff --git a/yql/essentials/tests/sql/suites/action/eval_input_output_table_subquery.cfg b/yql/essentials/tests/sql/suites/action/eval_input_output_table_subquery.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_input_output_table_subquery.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_input_output_table_subquery.sql b/yql/essentials/tests/sql/suites/action/eval_input_output_table_subquery.sql new file mode 100644 index 0000000000..429b27f11c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_input_output_table_subquery.sql @@ -0,0 +1,16 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$a = (SELECT CAST(Unicode::ToUpper("o"u) AS String) || "utpu"); +$b = (SELECT CAST(Unicode::ToUpper("i"u) AS String) || "npu"); +$a = $a || CAST(Unicode::ToLower("T"u) AS String); +$b = $b || CAST(Unicode::ToLower("T"u) AS String); +INSERT INTO $a +SELECT + key as key, + "" as subkey, + "value:" || value as value +FROM $b +WHERE key < "100" +ORDER BY key; diff --git a/yql/essentials/tests/sql/suites/action/eval_like.cfg b/yql/essentials/tests/sql/suites/action/eval_like.cfg new file mode 100644 index 0000000000..c6596e362c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_like.cfg @@ -0,0 +1,2 @@ +in Input input.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_like.sql b/yql/essentials/tests/sql/suites/action/eval_like.sql new file mode 100644 index 0000000000..24132ebd39 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_like.sql @@ -0,0 +1,12 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$arg1 = "" || ""; +$arg2 = CAST(Unicode::ToUpper("i"u) AS String) || "npu_"; +$arg3 = "" || ""; +$arg4 = "" || "raw"; + +SELECT + count(*) +FROM LIKE($arg1,$arg2,$arg3,$arg4); diff --git a/yql/essentials/tests/sql/suites/action/eval_on_modif_table_fail.cfg b/yql/essentials/tests/sql/suites/action/eval_on_modif_table_fail.cfg new file mode 100644 index 0000000000..a26fadcaa7 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_on_modif_table_fail.cfg @@ -0,0 +1,3 @@ +xfail +in Input input.txt +out Output output.txt diff --git a/yql/essentials/tests/sql/suites/action/eval_on_modif_table_fail.sql b/yql/essentials/tests/sql/suites/action/eval_on_modif_table_fail.sql new file mode 100644 index 0000000000..67ec4878f3 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_on_modif_table_fail.sql @@ -0,0 +1,15 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +insert into Output +select "key" as field +union all +select "subkey" as field; + +commit; + +$whitelist = select aggregate_list(field) +from Output; + +select ForceSpreadMembers([("key", key)],Unwrap($whitelist)) from Input; diff --git a/yql/essentials/tests/sql/suites/action/eval_percentile.sql b/yql/essentials/tests/sql/suites/action/eval_percentile.sql new file mode 100644 index 0000000000..64905c1872 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_percentile.sql @@ -0,0 +1,7 @@ +/* syntax version 1 */ +/* postgres can not */ +$x = 1.0/length(CAST(Unicode::ToUpper("ab"u) AS String)); +select Percentile(key,$x) from ( +select 1 as key +union all +select 2 as key) diff --git a/yql/essentials/tests/sql/suites/action/eval_pragma.cfg b/yql/essentials/tests/sql/suites/action/eval_pragma.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_pragma.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_pragma.sql b/yql/essentials/tests/sql/suites/action/eval_pragma.sql new file mode 100644 index 0000000000..87f4fb3b4a --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_pragma.sql @@ -0,0 +1,4 @@ +/* syntax version 1 */ +/* postgres can not */ +$a = "1" || CAST(Unicode::ToUpper("m") AS String); +pragma yt.DataSizePerJob=$a; diff --git a/yql/essentials/tests/sql/suites/action/eval_python3_ann.cfg b/yql/essentials/tests/sql/suites/action/eval_python3_ann.cfg new file mode 100644 index 0000000000..5fee00e994 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_python3_ann.cfg @@ -0,0 +1 @@ +udf python3_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_python3_ann.sql b/yql/essentials/tests/sql/suites/action/eval_python3_ann.sql new file mode 100644 index 0000000000..952c11cbd6 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_python3_ann.sql @@ -0,0 +1,16 @@ +/* syntax version 1 */ +/* postgres can not */ +$script = @@ +from yql.typing import * + +def f(x:Int32, y:Int32)->Int32: + """ + a simple sum UDF + """ + return x + y +@@; + +--$f = Python3::f(EvaluateType(ParseTypeHandle(Core::PythonFuncSignature(AsAtom("Python3"), $script, "f"))), $script); +$f = Python3::f($script); + +select $f(1, 2); diff --git a/yql/essentials/tests/sql/suites/action/eval_python3_signature.cfg b/yql/essentials/tests/sql/suites/action/eval_python3_signature.cfg new file mode 100644 index 0000000000..5fee00e994 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_python3_signature.cfg @@ -0,0 +1 @@ +udf python3_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_python3_signature.sql b/yql/essentials/tests/sql/suites/action/eval_python3_signature.sql new file mode 100644 index 0000000000..1b3d12a6d5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_python3_signature.sql @@ -0,0 +1,17 @@ +/* syntax version 1 */ +/* postgres can not */ +$script = @@ +def f(x, y): + """ + (Int32, Int32) + ->Int32 + + a simple sum UDF + """ + return x + y +@@; + +--$f = Python3::f(EvaluateType(ParseTypeHandle(Core::PythonFuncSignature(AsAtom("Python3"), $script, "f"))), $script); +$f = Python3::f($script); + +select $f(1, 2); diff --git a/yql/essentials/tests/sql/suites/action/eval_python_signature.cfg b/yql/essentials/tests/sql/suites/action/eval_python_signature.cfg new file mode 100644 index 0000000000..a7ca79e497 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_python_signature.cfg @@ -0,0 +1,2 @@ +udf python2_udf +providers yt diff --git a/yql/essentials/tests/sql/suites/action/eval_python_signature.sql b/yql/essentials/tests/sql/suites/action/eval_python_signature.sql new file mode 100644 index 0000000000..98ccfb12f0 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_python_signature.sql @@ -0,0 +1,17 @@ +/* syntax version 1 */ +/* postgres can not */ +$script = @@ +def f(x, y): + """ + (Int32, Int32) + ->Int32 + + a simple sum UDF + """ + return x + y +@@; + +--$f = Python::f(EvaluateType(ParseTypeHandle(Core::PythonFuncSignature(AsAtom("Python"), $script, "f"))), $script); +$f = Python::f($script); + +select $f(1, 2); diff --git a/yql/essentials/tests/sql/suites/action/eval_range.cfg b/yql/essentials/tests/sql/suites/action/eval_range.cfg new file mode 100644 index 0000000000..c6596e362c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_range.cfg @@ -0,0 +1,2 @@ +in Input input.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_range.sql b/yql/essentials/tests/sql/suites/action/eval_range.sql new file mode 100644 index 0000000000..9ab6494943 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_range.sql @@ -0,0 +1,13 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$arg1 = "" || ""; +$arg2 = CAST(Unicode::ToUpper("i"u) AS String) || "nput"; +$arg3 = CAST(Unicode::ToUpper("i"u) AS String) || "nput"; +$arg4 = "" || ""; +$arg5 = "" || "raw"; + +SELECT + count(*) +FROM RANGE($arg1,$arg2,$arg3,$arg4,$arg5); diff --git a/yql/essentials/tests/sql/suites/action/eval_regexp.cfg b/yql/essentials/tests/sql/suites/action/eval_regexp.cfg new file mode 100644 index 0000000000..c6596e362c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_regexp.cfg @@ -0,0 +1,2 @@ +in Input input.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_regexp.sql b/yql/essentials/tests/sql/suites/action/eval_regexp.sql new file mode 100644 index 0000000000..6e3fcf0ad6 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_regexp.sql @@ -0,0 +1,11 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; +$arg1 = "" || ""; +$arg2 = (Unicode::ToUpper("i") ?? "") || "npu."; +$arg3 = "" || ""; +$arg4 = "" || "raw"; + +SELECT + count(*) +FROM REGEXP($arg1,$arg2,$arg3,$arg4); diff --git a/yql/essentials/tests/sql/suites/action/eval_resourcetype.sql b/yql/essentials/tests/sql/suites/action/eval_resourcetype.sql new file mode 100644 index 0000000000..55bb20227f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_resourcetype.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +/* postgres can not */ +SELECT FormatType(ResourceType(CAST(Unicode::ToUpper("r"u) AS String) || "es")); diff --git a/yql/essentials/tests/sql/suites/action/eval_result_label.cfg b/yql/essentials/tests/sql/suites/action/eval_result_label.cfg new file mode 100644 index 0000000000..5c248bff3d --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_result_label.cfg @@ -0,0 +1 @@ +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_result_label.sql b/yql/essentials/tests/sql/suites/action/eval_result_label.sql new file mode 100644 index 0000000000..1f9e67d195 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_result_label.sql @@ -0,0 +1,4 @@ +/* syntax version 1 */ +/* postgres can not */ +$x = CAST(Unicode::ToUpper("foo"u) AS String); +select 1 into result $x; diff --git a/yql/essentials/tests/sql/suites/action/eval_sample.cfg b/yql/essentials/tests/sql/suites/action/eval_sample.cfg new file mode 100644 index 0000000000..a654f9117d --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_sample.cfg @@ -0,0 +1 @@ +in Input input1.txt diff --git a/yql/essentials/tests/sql/suites/action/eval_sample.sql b/yql/essentials/tests/sql/suites/action/eval_sample.sql new file mode 100644 index 0000000000..3b84c6e5c1 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_sample.sql @@ -0,0 +1,7 @@ +/* syntax version 1 */ +/* postgres can not */ +/* custom check: len(yt_res_yson[0]['Write'][0]['Data']) < 10 */ +$x = 1.0 / 3; +SELECT * +FROM plato.Input +SAMPLE $x;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/eval_skip_take.cfg b/yql/essentials/tests/sql/suites/action/eval_skip_take.cfg new file mode 100644 index 0000000000..c6596e362c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_skip_take.cfg @@ -0,0 +1,2 @@ +in Input input.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_skip_take.sql b/yql/essentials/tests/sql/suites/action/eval_skip_take.sql new file mode 100644 index 0000000000..06d56e5b25 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_skip_take.sql @@ -0,0 +1,8 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +select * from Input +order by key +limit length(CAST(Unicode::ToUpper("a"u) AS String)) +offset length(CAST(Unicode::ToUpper("bc"u) AS String)); diff --git a/yql/essentials/tests/sql/suites/action/eval_table_with_view.sql b/yql/essentials/tests/sql/suites/action/eval_table_with_view.sql new file mode 100644 index 0000000000..2c27b55d58 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_table_with_view.sql @@ -0,0 +1,6 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; +$x = "Input"; +SELECT * +FROM $x VIEW raw LIMIT 1;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/eval_taggedtype.sql b/yql/essentials/tests/sql/suites/action/eval_taggedtype.sql new file mode 100644 index 0000000000..f84bd85c8d --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_taggedtype.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +/* postgres can not */ +SELECT FormatType(TaggedType(DataType("Int32"), CAST(Unicode::ToUpper("r"u) AS String) || "es")); diff --git a/yql/essentials/tests/sql/suites/action/eval_type.sql b/yql/essentials/tests/sql/suites/action/eval_type.sql new file mode 100644 index 0000000000..397798867f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_type.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +/* postgres can not */ +select FormatType(EvaluateType(ParseTypeHandle("Int32" || "?"))); diff --git a/yql/essentials/tests/sql/suites/action/eval_typeof_output_table.cfg b/yql/essentials/tests/sql/suites/action/eval_typeof_output_table.cfg new file mode 100644 index 0000000000..1d0f17aef1 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_typeof_output_table.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +xfail diff --git a/yql/essentials/tests/sql/suites/action/eval_typeof_output_table.sql b/yql/essentials/tests/sql/suites/action/eval_typeof_output_table.sql new file mode 100644 index 0000000000..88b43b3736 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_typeof_output_table.sql @@ -0,0 +1,25 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +INSERT INTO Output +SELECT + key || "foo" as key2 +FROM Input; + +COMMIT; + +$input = PROCESS Output; +$c = EvaluateCode(ReprCode(FormatType(TypeOf($input)))); +select $c; + +INSERT INTO Output WITH TRUNCATE +SELECT + key || "foo" as key3 +FROM Input; + +COMMIT; + +$input = PROCESS Output; +$c = EvaluateCode(ReprCode(FormatType(TypeOf($input)))); +select $c; diff --git a/yql/essentials/tests/sql/suites/action/eval_unresolved_type_arg.sql b/yql/essentials/tests/sql/suites/action/eval_unresolved_type_arg.sql new file mode 100644 index 0000000000..1ebfe07d30 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_unresolved_type_arg.sql @@ -0,0 +1,25 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$myAddSuffix = ($row, $value) -> { + $type = TypeOf($row); + --$type=Struct<key:String,subkey:String,value:String>; + $lambda = EvaluateCode(LambdaCode(($r)->{ + return FuncCode("AsStruct", + ListMap(StructTypeComponents(TypeHandle($type)), + ($i)->{ return ListCode( + AtomCode($i.Name), + FuncCode("Concat", + FuncCode("Member",$r,AtomCode($i.Name)), + ReprCode($value) + )) })); + + })); + + return $lambda($row); +}; + +SELECT + $myAddSuffix(TableRow(), "*") +FROM Input; diff --git a/yql/essentials/tests/sql/suites/action/eval_values_output_table_subquery.cfg b/yql/essentials/tests/sql/suites/action/eval_values_output_table_subquery.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_values_output_table_subquery.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/eval_values_output_table_subquery.sql b/yql/essentials/tests/sql/suites/action/eval_values_output_table_subquery.sql new file mode 100644 index 0000000000..240f4d2263 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_values_output_table_subquery.sql @@ -0,0 +1,8 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$a = (SELECT CAST(Unicode::ToUpper("o"u) AS String) || "utpu"); +$a = $a || CAST(Unicode::ToLower("T"u) AS String); +INSERT INTO $a (key, subkey, value) +VALUES (1, "foo", false); diff --git a/yql/essentials/tests/sql/suites/action/eval_variant.sql b/yql/essentials/tests/sql/suites/action/eval_variant.sql new file mode 100644 index 0000000000..e4555ffd6f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/eval_variant.sql @@ -0,0 +1,4 @@ +/* syntax version 1 */ +/* postgres can not */ +$vt = ParseType("Variant<One:Int32,Two:String>"); +SELECT Variant(12, CAST(Unicode::ToUpper("o"u) AS String) || "ne", $vt); diff --git a/yql/essentials/tests/sql/suites/action/evaluate_match_type.sql b/yql/essentials/tests/sql/suites/action/evaluate_match_type.sql new file mode 100644 index 0000000000..bca34d037a --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/evaluate_match_type.sql @@ -0,0 +1,12 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +$keep_only_last = ($row) -> { + $members = ListFilter(StructMembers($row), ($x) -> (FIND($x, "key") IS NOT NULL)); + return ChooseMembers($row, $members) +}; + + +select * from +(select $keep_only_last(TableRow()) from Input)
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/evaluate_pure.cfg b/yql/essentials/tests/sql/suites/action/evaluate_pure.cfg new file mode 100644 index 0000000000..72eff595f4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/evaluate_pure.cfg @@ -0,0 +1,2 @@ +in Input input.txt +udf datetime_udf diff --git a/yql/essentials/tests/sql/suites/action/evaluate_pure.sql b/yql/essentials/tests/sql/suites/action/evaluate_pure.sql new file mode 100644 index 0000000000..b89afe26bc --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/evaluate_pure.sql @@ -0,0 +1,13 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +select EvaluateExpr(YQL::RandomNumber()), YQL::RandomNumber(); +select key, EvaluateExpr(cast(CurrentUtcDate() as string)) as `date` from Input; +select YQL::String(EvaluateAtom("foo" || "bar")); +select EvaluateExpr(CurrentUtcTimestamp()), CurrentUtcTimestamp(); +$y = Yson("{a=7u;c=[<d=%true>1;#;\"привет\";-3.4]}"); +select Yson::Equals(EvaluateExpr($y), $y); +select EvaluateExpr(TzDate("2000-01-01,Europe/Moscow")); +select EvaluateExpr(TzDatetime("2000-01-01T01:02:03,Europe/Moscow")); +select EvaluateExpr(TzTimestamp("2000-01-01T01:02:03.456789,Europe/Moscow")); diff --git a/yql/essentials/tests/sql/suites/action/evaluate_queries.cfg b/yql/essentials/tests/sql/suites/action/evaluate_queries.cfg new file mode 100644 index 0000000000..ad52c79527 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/evaluate_queries.cfg @@ -0,0 +1,2 @@ +in Input input.txt +out Output output.txt diff --git a/yql/essentials/tests/sql/suites/action/evaluate_queries.sql b/yql/essentials/tests/sql/suites/action/evaluate_queries.sql new file mode 100644 index 0000000000..8671f14def --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/evaluate_queries.sql @@ -0,0 +1,28 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +$s = (select count(*) from Input); +select EvaluateExpr($s); +/* +$s = (select key from Input); +select EvaluateExpr($s); + +$s = (select key || "foo" from Input); +select EvaluateExpr($s); + +$s = (select aggregate_list(key) from Input); +select EvaluateExpr($s); + +$s = (select v from (select key,min(value) as v from Input group by key order by key limit 1)); +select EvaluateExpr($s); + +$s = (select key from Input order by key limit 1); +select EvaluateExpr($s); + +$s = (select lag(key) over w from Input window w as ()); +select EvaluateExpr($s); + +$s = (select a.key from Input as a join Input as b using(key)); +select EvaluateExpr($s); +*/ diff --git a/yql/essentials/tests/sql/suites/action/export_action.cfg b/yql/essentials/tests/sql/suites/action/export_action.cfg new file mode 100644 index 0000000000..d8349c7037 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/export_action.cfg @@ -0,0 +1,2 @@ +in Input input.txt +file lib1.sql lib1.sql.txt diff --git a/yql/essentials/tests/sql/suites/action/export_action.sql b/yql/essentials/tests/sql/suites/action/export_action.sql new file mode 100644 index 0000000000..59ecc86d5b --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/export_action.sql @@ -0,0 +1,6 @@ +/* syntax version 1 */ +/* postgres can not */ +/* kikimr can not - range not supported */ +pragma library("lib1.sql"); +import lib1 symbols $action; +do $action("Input"); diff --git a/yql/essentials/tests/sql/suites/action/inline_action.sql b/yql/essentials/tests/sql/suites/action/inline_action.sql new file mode 100644 index 0000000000..44586e32e3 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/inline_action.sql @@ -0,0 +1,16 @@ +/* syntax version 1 */ +/* postgres can not */ +do begin + select 1; +end do; + +evaluate if true do begin + select 1; +end do +else do begin + select 2; +end do; + +evaluate for $i in AsList(1,2,3) do begin + select $i; +end do; diff --git a/yql/essentials/tests/sql/suites/action/input.txt b/yql/essentials/tests/sql/suites/action/input.txt new file mode 100644 index 0000000000..65949ea745 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/input.txt @@ -0,0 +1,4 @@ +{"key"="075";"subkey"="1";"value"="abc"}; +{"key"="800";"subkey"="2";"value"="ddd"}; +{"key"="020";"subkey"="3";"value"="q"}; +{"key"="150";"subkey"="4";"value"="qzz"}; diff --git a/yql/essentials/tests/sql/suites/action/input1.txt b/yql/essentials/tests/sql/suites/action/input1.txt new file mode 100644 index 0000000000..9e2c7c8718 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/input1.txt @@ -0,0 +1,10 @@ +{"key"="023";"subkey"="3";"value"="aaa"}; +{"key"="037";"subkey"="5";"value"="ddd"}; +{"key"="075";"subkey"="1";"value"="abc"}; +{"key"="150";"subkey"="1";"value"="aaa"}; +{"key"="160";"subkey"="3";"value"="iii"}; +{"key"="170";"subkey"="8";"value"="zzz"}; +{"key"="200";"subkey"="7";"value"="qqq"}; +{"key"="527";"subkey"="4";"value"="bbb"}; +{"key"="761";"subkey"="6";"value"="ccc"}; +{"key"="911";"subkey"="2";"value"="kkk"}; diff --git a/yql/essentials/tests/sql/suites/action/input_attrs.txt b/yql/essentials/tests/sql/suites/action/input_attrs.txt new file mode 100644 index 0000000000..65949ea745 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/input_attrs.txt @@ -0,0 +1,4 @@ +{"key"="075";"subkey"="1";"value"="abc"}; +{"key"="800";"subkey"="2";"value"="ddd"}; +{"key"="020";"subkey"="3";"value"="q"}; +{"key"="150";"subkey"="4";"value"="qzz"}; diff --git a/yql/essentials/tests/sql/suites/action/input_attrs.txt.attr b/yql/essentials/tests/sql/suites/action/input_attrs.txt.attr new file mode 100644 index 0000000000..d2659911d1 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/input_attrs.txt.attr @@ -0,0 +1,32 @@ +{ + "_yql_row_spec" = { + "Type" = [ + "StructType"; + [ + [ + "key"; + [ + "DataType"; + "String" + ] + ]; + [ + "subkey"; + [ + "DataType"; + "String" + ] + ]; + [ + "value"; + [ + "DataType"; + "String" + ] + ] + ] + ] + }; + "foo" = 1; + "bar" = "text"; +} diff --git a/yql/essentials/tests/sql/suites/action/insert_after_eval.cfg b/yql/essentials/tests/sql/suites/action/insert_after_eval.cfg new file mode 100644 index 0000000000..b1f9d81471 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/insert_after_eval.cfg @@ -0,0 +1 @@ +out Output modify.txt diff --git a/yql/essentials/tests/sql/suites/action/insert_after_eval.sql b/yql/essentials/tests/sql/suites/action/insert_after_eval.sql new file mode 100644 index 0000000000..60ab74c109 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/insert_after_eval.sql @@ -0,0 +1,9 @@ +/* syntax version 1 */ +/* postgres can not */ +/* multirun can not */ +USE plato; + +$s1 = (select count(*) from Output); +$s2 = (select max(key) from Output); +insert into Output with truncate +select EvaluateExpr($s1) as a, EvaluateExpr($s2) as b; diff --git a/yql/essentials/tests/sql/suites/action/insert_after_eval_xlock.cfg b/yql/essentials/tests/sql/suites/action/insert_after_eval_xlock.cfg new file mode 100644 index 0000000000..b1f9d81471 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/insert_after_eval_xlock.cfg @@ -0,0 +1 @@ +out Output modify.txt diff --git a/yql/essentials/tests/sql/suites/action/insert_after_eval_xlock.sql b/yql/essentials/tests/sql/suites/action/insert_after_eval_xlock.sql new file mode 100644 index 0000000000..c31b9e04eb --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/insert_after_eval_xlock.sql @@ -0,0 +1,9 @@ +/* syntax version 1 */ +/* postgres can not */ +/* multirun can not */ +USE plato; + +$s1 = (select count(*) from Output with xlock); +$s2 = (select max(key) from Output with xlock); +insert into Output with truncate +select EvaluateExpr($s1) as a, EvaluateExpr($s2) as b; diff --git a/yql/essentials/tests/sql/suites/action/insert_each_from_folder.cfg b/yql/essentials/tests/sql/suites/action/insert_each_from_folder.cfg new file mode 100644 index 0000000000..ad52c79527 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/insert_each_from_folder.cfg @@ -0,0 +1,2 @@ +in Input input.txt +out Output output.txt diff --git a/yql/essentials/tests/sql/suites/action/insert_each_from_folder.sql b/yql/essentials/tests/sql/suites/action/insert_each_from_folder.sql new file mode 100644 index 0000000000..dc06200679 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/insert_each_from_folder.sql @@ -0,0 +1,19 @@ +/* syntax version 1 */ +/* postgres can not */ +/* multirun can not */ +use plato; + +$list = ( + select aggregate_list(Path) from ( + select Path from folder("") + where Type = "table" and Path like "Input%" + order by Path desc + limit 30 + ) +); + +insert into Output with truncate +select + count(*) +from + each($list) diff --git a/yql/essentials/tests/sql/suites/action/lambda_arg_count.sql b/yql/essentials/tests/sql/suites/action/lambda_arg_count.sql new file mode 100644 index 0000000000..37854ea7b8 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/lambda_arg_count.sql @@ -0,0 +1,14 @@ +/* syntax version 1 */ +/* postgres can not */ +SELECT + LambdaArgumentsCount(()->(1)), + LambdaArgumentsCount(($x)->($x+1)), + LambdaArgumentsCount(($x, $y)->($x+$y)), + LambdaArgumentsCount(($x?)->($x+1)), + LambdaArgumentsCount(($x, $y?)->($x+$y)), + + LambdaOptionalArgumentsCount(()->(1)), + LambdaOptionalArgumentsCount(($x)->($x+1)), + LambdaOptionalArgumentsCount(($x, $y)->($x+$y)), + LambdaOptionalArgumentsCount(($x?)->($x+1)), + LambdaOptionalArgumentsCount(($x, $y?)->($x+$y)); diff --git a/yql/essentials/tests/sql/suites/action/large_evaluate_for_fail.cfg b/yql/essentials/tests/sql/suites/action/large_evaluate_for_fail.cfg new file mode 100644 index 0000000000..5dae597903 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/large_evaluate_for_fail.cfg @@ -0,0 +1 @@ +xfail diff --git a/yql/essentials/tests/sql/suites/action/large_evaluate_for_fail.sql b/yql/essentials/tests/sql/suites/action/large_evaluate_for_fail.sql new file mode 100644 index 0000000000..74a9ac9790 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/large_evaluate_for_fail.sql @@ -0,0 +1,5 @@ +/* syntax version 1 */ +/* postgres can not */ +pragma config.flags("EvaluateForLimit", "3"); + +evaluate for $_i in ListFromRange(0, 10) do empty_action(); diff --git a/yql/essentials/tests/sql/suites/action/lib1.sql.txt b/yql/essentials/tests/sql/suites/action/lib1.sql.txt new file mode 100644 index 0000000000..78edb4e064 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/lib1.sql.txt @@ -0,0 +1,7 @@ +use plato; + +define action $action($table) as + select key,count(*) as cnt from $table group by key order by key; +end define; + +export $action; diff --git a/yql/essentials/tests/sql/suites/action/mixed_eval_typeof_world1.cfg b/yql/essentials/tests/sql/suites/action/mixed_eval_typeof_world1.cfg new file mode 100644 index 0000000000..dbda958ebd --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/mixed_eval_typeof_world1.cfg @@ -0,0 +1,6 @@ +xfail +in Input input.txt +out Output1 output1.txt +out Output2 output2.txt +out Output3 output3.txt + diff --git a/yql/essentials/tests/sql/suites/action/mixed_eval_typeof_world1.sql b/yql/essentials/tests/sql/suites/action/mixed_eval_typeof_world1.sql new file mode 100644 index 0000000000..54de5b2950 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/mixed_eval_typeof_world1.sql @@ -0,0 +1,45 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +$force_remove_members = ($struct, $to_remove) -> { + $remover = EvaluateCode(LambdaCode(($st) -> { + $to_keep = ListFlatMap(StructTypeComponents(TypeHandle(TypeOf($struct))), ($x) -> {return IF($x.Name not in $to_remove, $x.Name)}); + return FuncCode( + "AsStruct", + ListMap( + $to_keep, + ($x) -> {return ListCode(AtomCode($x), FuncCode("Member", $st, AtomCode($x)))} + ) + ) + })); + return $remover($struct) +}; + +define action $func($input, $output) as + $jname = $output; + insert into @$jname + with truncate + select + * + from $input as input; + commit; + insert into $output + with truncate + select + AGG_LIST( + $force_remove_members( + TableRow(), + [''] + ) + ) + from @$jname; + commit; +end define; + +$exps = [('Input','Output1'),('Input','Output2'),('Input','Output3')]; +evaluate for $exp_name in $exps do begin + $input = $exp_name.0; + $output = $exp_name.1; + do $func($input, $output); +end do; diff --git a/yql/essentials/tests/sql/suites/action/modify.txt b/yql/essentials/tests/sql/suites/action/modify.txt new file mode 100644 index 0000000000..15f63a38a7 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/modify.txt @@ -0,0 +1,2 @@ +{"key"="023";"subkey"="3";"value"="aaa"}; +{"key"="037";"subkey"="5";"value"="ddd"}; diff --git a/yql/essentials/tests/sql/suites/action/modify.txt.attr b/yql/essentials/tests/sql/suites/action/modify.txt.attr new file mode 100644 index 0000000000..36b3c00c90 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/modify.txt.attr @@ -0,0 +1,5 @@ +{ + "_yql_row_spec"={ + "Type"=["StructType";[["key";["DataType";"String";];];["subkey";["DataType";"String";];];["value";["DataType";"String";];];];]; + } +} diff --git a/yql/essentials/tests/sql/suites/action/nested_action.sql b/yql/essentials/tests/sql/suites/action/nested_action.sql new file mode 100644 index 0000000000..4beb520d5a --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/nested_action.sql @@ -0,0 +1,14 @@ +/* syntax version 1 */ +/* postgres can not */ +define action $action($b,$c) as + define action $aaa() as + select $b; + end define; + define action $bbb() as + select $c; + end define; + do $aaa(); + do $bbb(); +end define; + +do $action(1,2); diff --git a/yql/essentials/tests/sql/suites/action/nested_eval.sql b/yql/essentials/tests/sql/suites/action/nested_eval.sql new file mode 100644 index 0000000000..0960c6da74 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/nested_eval.sql @@ -0,0 +1,25 @@ +/* syntax version 1 */ +/* postgres can not */ +$make_struct = Callable( + Callable<(String) -> Struct<lel : Int32>>, + ($_string) -> { return AsStruct(5 as lel); } +); + +$kekify_struct = ($struct) -> { + return EvaluateCode(FuncCode("AsStruct", + ListMap( + StructTypeComponents(TypeHandle(TypeOf($struct))), + ($_component) -> { return ListCode(AtomCode("kek"), ReprCode(42)); } + ) + )); +}; + +$struct = AsStruct( + Callable( + Callable<(String)->Struct<kek : Int32>>, + ($string) -> { return $kekify_struct($make_struct($string)); } + ) as KekFromString, + TypeHandle(Int32) as IntHandle +); + +select FormatType(EvaluateType($struct.IntHandle)); diff --git a/yql/essentials/tests/sql/suites/action/nested_rewrite_io.sql b/yql/essentials/tests/sql/suites/action/nested_rewrite_io.sql new file mode 100644 index 0000000000..4150bc7e3f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/nested_rewrite_io.sql @@ -0,0 +1,22 @@ +use plato; +$input = select * from AS_TABLE([<|a:"foo",b:"123"|>]); + +$mapping = select {"a":"String", "b":"Int32"} from Input limit 1; + +$transformer = ($type)->{ + $t = EvaluateType(ParseTypeHandle($type)); + return ($value)->{ return cast($value as $t); }; +}; + +$converter = ($row)->{ + return EvaluateCode(LambdaCode(($rowCode)->{ + return FuncCode("AsStruct", ListMap(StructMembers($row), ($name)->{ + return ListCode( + AtomCode($name), + FuncCode("Apply", QuoteCode($transformer(Unwrap($mapping[$name]))), FuncCode("Member", $rowCode, AtomCode($name))) + ); + })); + }))($row); +}; + +select * from (select $converter(TableRow()) from $input) flatten columns; diff --git a/yql/essentials/tests/sql/suites/action/nested_subquery.cfg b/yql/essentials/tests/sql/suites/action/nested_subquery.cfg new file mode 100644 index 0000000000..386ab9ac7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/nested_subquery.cfg @@ -0,0 +1,3 @@ +in Input input.txt +out Output output.txt +udf string_udf diff --git a/yql/essentials/tests/sql/suites/action/nested_subquery.sql b/yql/essentials/tests/sql/suites/action/nested_subquery.sql new file mode 100644 index 0000000000..375dee1116 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/nested_subquery.sql @@ -0,0 +1,13 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +define subquery $q($name) as + define subquery $nested() as + select $name; + end define; + + process $nested(); +end define; + +process $q(CAST(Unicode::ToUpper("foo"u) AS String)); diff --git a/yql/essentials/tests/sql/suites/action/no_columns_in_do.sqlx b/yql/essentials/tests/sql/suites/action/no_columns_in_do.sqlx new file mode 100644 index 0000000000..b51e642f16 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/no_columns_in_do.sqlx @@ -0,0 +1,8 @@ +/* postgres can not */ +$a = `aaa`; + +define action $action($s) as + select $s; +end define; + +do $action($a); diff --git a/yql/essentials/tests/sql/suites/action/parallel_for.sql b/yql/essentials/tests/sql/suites/action/parallel_for.sql new file mode 100644 index 0000000000..d9bfcfcedb --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/parallel_for.sql @@ -0,0 +1,11 @@ +/* yt can not */ +use plato; + +evaluate parallel for $i in [1,2,1,2,1] do begin +insert into Output +select $i as a; +end do; + +commit; +insert into Output with truncate +select a from Output order by a; diff --git a/yql/essentials/tests/sql/suites/action/parallel_for_commit.sqlx b/yql/essentials/tests/sql/suites/action/parallel_for_commit.sqlx new file mode 100644 index 0000000000..44ea0ff126 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/parallel_for_commit.sqlx @@ -0,0 +1,4 @@ +evaluate parallel for $i in [1,2,3] do begin +commit; +end do; + diff --git a/yql/essentials/tests/sql/suites/action/parallel_for_select.sqlx b/yql/essentials/tests/sql/suites/action/parallel_for_select.sqlx new file mode 100644 index 0000000000..4b190b2c56 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/parallel_for_select.sqlx @@ -0,0 +1,4 @@ +evaluate parallel for $i in [1,2,3] do begin +select $i; +end do; + diff --git a/yql/essentials/tests/sql/suites/action/parallel_for_values.sqlx b/yql/essentials/tests/sql/suites/action/parallel_for_values.sqlx new file mode 100644 index 0000000000..80891830a9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/parallel_for_values.sqlx @@ -0,0 +1,4 @@ +evaluate parallel for $i in [1,2,3] do begin +values ($i); +end do; + diff --git a/yql/essentials/tests/sql/suites/action/pass_action_as_param.sql b/yql/essentials/tests/sql/suites/action/pass_action_as_param.sql new file mode 100644 index 0000000000..e5ab80b264 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/pass_action_as_param.sql @@ -0,0 +1,14 @@ +/* syntax version 1 */ +/* postgres can not */ +define action $dup($x) as + do $x(); + do $x(); +end define; + +do $dup(empty_action); + +define action $sel_foo() as + select "foo"; +end define; + +do $dup($sel_foo); diff --git a/yql/essentials/tests/sql/suites/action/pass_subquery_as_param.sql b/yql/essentials/tests/sql/suites/action/pass_subquery_as_param.sql new file mode 100644 index 0000000000..23e1af9551 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/pass_subquery_as_param.sql @@ -0,0 +1,13 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $dup($x) as + select * from $x(1) + union all + select * from $x(2); +end define; + +define subquery $sub($n) as + select $n * 10; +end define; + +select * from $dup($sub); diff --git a/yql/essentials/tests/sql/suites/action/pending_arg_fail.cfg b/yql/essentials/tests/sql/suites/action/pending_arg_fail.cfg new file mode 100644 index 0000000000..eb2e5315d1 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/pending_arg_fail.cfg @@ -0,0 +1 @@ +xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/pending_arg_fail.sql b/yql/essentials/tests/sql/suites/action/pending_arg_fail.sql new file mode 100644 index 0000000000..5c09ceb11c --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/pending_arg_fail.sql @@ -0,0 +1,4 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; +select ListExtract(value,key) from Input;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/process_from_subquery_with_orderby.sql b/yql/essentials/tests/sql/suites/action/process_from_subquery_with_orderby.sql new file mode 100644 index 0000000000..24ad5b76f9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/process_from_subquery_with_orderby.sql @@ -0,0 +1,5 @@ +/* postgres can not */ +define subquery $src() as + select * from plato.Input order by key; +end define; +process $src(); diff --git a/yql/essentials/tests/sql/suites/action/runtime_apply_quoted_code.sql b/yql/essentials/tests/sql/suites/action/runtime_apply_quoted_code.sql new file mode 100644 index 0000000000..8a4a92b353 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_apply_quoted_code.sql @@ -0,0 +1,21 @@ +/* syntax version 1 */ +/* postgres can not */ +$func = ($x)->{ + return $x == 1; +}; + +$structApply = ($strValue, $f)->{ + $code = EvaluateCode(LambdaCode(($strCode)->{ + $members = StructTypeComponents(TypeHandle(TypeOf($strValue))); + + return Yql::Fold($members, ReprCode(false), ($item, $state)->{ + $member = FuncCode("Member", $strCode, AtomCode($item.Name)); + $apply = FuncCode("Apply", QuoteCode($f), $member); + return FuncCode("Or", $state, $apply); + }); + })); + return $code($strValue); +}; + +select $structApply(AsStruct(1 as a,2 as b,3 as c), $func); +select $structApply(AsStruct(4 as a,2 as b,3 as c), $func); diff --git a/yql/essentials/tests/sql/suites/action/runtime_for_select.sql b/yql/essentials/tests/sql/suites/action/runtime_for_select.sql new file mode 100644 index 0000000000..5e9ad5d10f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_for_select.sql @@ -0,0 +1,44 @@ +/* syntax version 1 */ +/* postgres can not */ +for $i in Just(AsList(1,2,3)) do begin + select $i; +end do +else do begin + select 10; +end do; + +for $i in Just(ListCreate(Int32)) do begin + select $i; +end do +else do begin + select 11; +end do; + +for $i in null do begin + select $i; +end do +else do begin + select 12; +end do; + +for $i in AsList(4) do begin + select $i; +end do +else do begin + select 13; +end do; + +for $i in ListCreate(String) do begin + select $i; +end do +else do begin + select 14; +end do; + +for $i in AsList(5) do begin + select $i; +end do; + +for $i in ListCreate(Bool) do begin + select $i; +end do diff --git a/yql/essentials/tests/sql/suites/action/runtime_format_free_args_code.sql b/yql/essentials/tests/sql/suites/action/runtime_format_free_args_code.sql new file mode 100644 index 0000000000..4d037fc4ca --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_format_free_args_code.sql @@ -0,0 +1,6 @@ +$x = EvaluateCode(LambdaCode(($arg1, $arg2)->{ + $f = FuncCode("Concat", $arg1, $arg2); + return ReprCode(FormatCode($f)); +})); + +select $x(1,2); diff --git a/yql/essentials/tests/sql/suites/action/runtime_format_type.sql b/yql/essentials/tests/sql/suites/action/runtime_format_type.sql new file mode 100644 index 0000000000..d08b6faf40 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_format_type.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +/* postgres can not */ +select FormatType(TypeHandle(TypeOf(1))); diff --git a/yql/essentials/tests/sql/suites/action/runtime_if_select.sql b/yql/essentials/tests/sql/suites/action/runtime_if_select.sql new file mode 100644 index 0000000000..c81f207ae9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_if_select.sql @@ -0,0 +1,29 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +insert into @foo +select count(*) as count from Input; +commit; +$n = (select count from @foo); +$predicate = $n > 1; + +if $predicate do begin + select 1; +end do; + +if not $predicate do begin + select 2; +end do; + +if $predicate do begin + select 3; +end do else do begin + select 4; +end do; + +if not $predicate do begin + select 5; +end do else do begin + select 6; +end do; diff --git a/yql/essentials/tests/sql/suites/action/runtime_make_code.sql b/yql/essentials/tests/sql/suites/action/runtime_make_code.sql new file mode 100644 index 0000000000..c340ce6fda --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_make_code.sql @@ -0,0 +1,15 @@ +/* postgres can not */ +/* syntax version 1 */ +select FormatCode( + ListCode( + AtomCode("1"), + AsList(AtomCode("2"),AtomCode("3")), + FuncCode("Func", + AtomCode("4"), + AsList(AtomCode("5"),AtomCode("6"))), + LambdaCode(()->{ return AtomCode("7") }), + LambdaCode(($x)->{ return FuncCode("-",$x) }), + LambdaCode(($x,$y)->{ return FuncCode("*",$x,$y) }), + LambdaCode(2, ($args)->{ return FuncCode("+",Unwrap($args[0]),Unwrap($args[1])) }), + ) +); diff --git a/yql/essentials/tests/sql/suites/action/runtime_parse_type.sql b/yql/essentials/tests/sql/suites/action/runtime_parse_type.sql new file mode 100644 index 0000000000..a6396ecbbd --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_parse_type.sql @@ -0,0 +1,3 @@ +/* postgres can not */ +/* syntax version 1 */ +select FormatType(ParseTypeHandle("Int32" || "?")); diff --git a/yql/essentials/tests/sql/suites/action/runtime_quote_code.sql b/yql/essentials/tests/sql/suites/action/runtime_quote_code.sql new file mode 100644 index 0000000000..f13eea773d --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_quote_code.sql @@ -0,0 +1,13 @@ +/* postgres can not */ +/* syntax version 1 */ +select + FormatCode(QuoteCode(AsAtom("foo"))), + FormatCode(QuoteCode(AsTuple())), + FormatCode(QuoteCode(AsTuple(AsAtom("foo"),AsAtom("bar")))), + FormatCode(QuoteCode(1)), + FormatCode(QuoteCode(($x,$y)->{ return $x+$y })), + ListMap(ListFromRange(1,4), ($x)->{ + return FormatCode(QuoteCode( + ($y)->{ return $x+$y } + )) + }); diff --git a/yql/essentials/tests/sql/suites/action/runtime_repr_code.sql b/yql/essentials/tests/sql/suites/action/runtime_repr_code.sql new file mode 100644 index 0000000000..da17985da4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_repr_code.sql @@ -0,0 +1,12 @@ +/* syntax version 1 */ +/* postgres can not */ +$fact = EvaluateCode( + Yql::Fold( + ListFromRange(1,11), + ReprCode(1), + ($item, $state)->{ + return FuncCode("*", $state, ReprCode($item)) + }) +); + +select $fact; diff --git a/yql/essentials/tests/sql/suites/action/runtime_serialize_type.sql b/yql/essentials/tests/sql/suites/action/runtime_serialize_type.sql new file mode 100644 index 0000000000..ffb1dd0450 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_serialize_type.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +/* postgres can not */ +select Yql::SerializeTypeHandle(TypeHandle(TypeOf(1))); diff --git a/yql/essentials/tests/sql/suites/action/runtime_type_kind.sql b/yql/essentials/tests/sql/suites/action/runtime_type_kind.sql new file mode 100644 index 0000000000..c14ee1753b --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_type_kind.sql @@ -0,0 +1,8 @@ +/* syntax version 1 */ +/* postgres can not */ +select + TypeKind(TypeHandle(TypeOf(1))), + TypeKind(TypeHandle(TypeOf(AsList(1)))), + TypeKind(TypeHandle(TypeOf(NULL))), + TypeKind(TypeHandle(TypeOf(TypeOf(1)))), + TypeKind(TypeHandle(TypeOf(AsAtom("1")))); diff --git a/yql/essentials/tests/sql/suites/action/runtime_type_splitmake.sql b/yql/essentials/tests/sql/suites/action/runtime_type_splitmake.sql new file mode 100644 index 0000000000..40cd8abeb0 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/runtime_type_splitmake.sql @@ -0,0 +1,54 @@ +/* syntax version 1 */ +/* postgres can not */ +$formatTagged = ($x)->{return AsStruct(FormatType($x.Base) as Base, $x.Tag as Tag)}; +$formatArgument = ($x)->{return AsStruct(FormatType($x.Type) as Type, $x.Name as Name, $x.Flags as Flags)}; +$formatCallable = ($x)->{return AsStruct( + $x.OptionalArgumentsCount as OptionalArgumentsCount, + $x.Payload as Payload, + FormatType($x.Result) as Result, + ListMap($x.Arguments, $formatArgument) as Arguments +)}; + +select + DataTypeComponents(ParseTypeHandle("Int32")), + DataTypeComponents(ParseTypeHandle("Decimal(4,1)")), + FormatType(DataTypeHandle(AsList("Int32"))), + FormatType(DataTypeHandle(AsList("Decimal","4","1"))), + FormatType(OptionalItemType(ParseTypeHandle("Int32?"))), + FormatType(OptionalTypeHandle(ParseTypeHandle("Int32"))), + FormatType(ListItemType(ParseTypeHandle("List<Int32>"))), + FormatType(ListTypeHandle(ParseTypeHandle("Int32"))), + FormatType(StreamItemType(ParseTypeHandle("Stream<Int32>"))), + FormatType(StreamTypeHandle(ParseTypeHandle("Int32"))), + ListMap( + TupleTypeComponents(ParseTypeHandle("Tuple<Int32,String>")), + ($x)->{return FormatType($x)}), + FormatType(TupleTypeHandle(ListMap( + AsList("Int32","String"), ($x)->{return ParseTypeHandle($x)}))), + ListMap( + StructTypeComponents(ParseTypeHandle("Struct<foo:Int32,bar:String>")), + ($x)->{return AsTuple($x.Name, FormatType($x.Type))}), + FormatType(StructTypeHandle(ListMap( + AsList(AsTuple("foo", "Int32"),AsTuple("bar", "String")), + ($x)->{return AsStruct($x.0 as Name,ParseTypeHandle($x.1) as Type)}))), + StaticMap(DictTypeComponents(ParseTypeHandle("Dict<String,Int32>")), + ($x)->{return FormatType($x)}), + FormatType(DictTypeHandle(ParseTypeHandle("String"),ParseTypeHandle("Int32"))), + ResourceTypeTag(ParseTypeHandle("Resource<foo>")), + FormatType(ResourceTypeHandle("foo")), + $formatTagged(TaggedTypeComponents(ParseTypeHandle("Tagged<String,foo>"))), + FormatType(TaggedTypeHandle(ParseTypeHandle("String"),"foo")), + FormatType(VariantUnderlyingType(ParseTypeHandle("Variant<Int32,String>"))), + FormatType(VariantTypeHandle(ParseTypeHandle("Tuple<Int32,String>"))), + FormatType(VariantUnderlyingType(ParseTypeHandle("Variant<a:Int32,b:String>"))), + FormatType(VariantTypeHandle(ParseTypeHandle("Struct<a:Int32,b:String>"))), + FormatType(VoidTypeHandle()), + FormatType(NullTypeHandle()), + $formatCallable(CallableTypeComponents(ParseTypeHandle("(Int32,[bar:Double?{Flags:AutoMap}])->String{Payload:foo}"))), + FormatType(CallableTypeHandle(ParseTypeHandle("String"),AsList( + CallableArgument(ParseTypeHandle("Int32")), + CallableArgument(ParseTypeHandle("Double?"), "bar", AsList("AutoMap"))))), + FormatType(CallableTypeHandle(ParseTypeHandle("String"),AsList( + CallableArgument(ParseTypeHandle("Int32")), + CallableArgument(ParseTypeHandle("Double?"), "bar", AsList("AutoMap"))), + 1, "foo")); diff --git a/yql/essentials/tests/sql/suites/action/select_from_subquery_with_orderby.sql b/yql/essentials/tests/sql/suites/action/select_from_subquery_with_orderby.sql new file mode 100644 index 0000000000..fbc0f689d8 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/select_from_subquery_with_orderby.sql @@ -0,0 +1,12 @@ +/* postgres can not */ +/* syntax version 1 */ +define subquery $src() as + select * from plato.Input order by subkey; +end define; + +define subquery $src_non_yt() as + select * from as_table([<|key:1, subkey:1|>, <|key:2, subkey:2|>]) order by subkey; +end define; + +select * from $src() order by key; +select * from $src_non_yt() order by key; diff --git a/yql/essentials/tests/sql/suites/action/subquery.sql b/yql/essentials/tests/sql/suites/action/subquery.sql new file mode 100644 index 0000000000..60df127bd5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery.sql @@ -0,0 +1,21 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +define subquery $q($name, $a) as + $i = (select * from $name); + $b = "_foo"; + select key || $a || $b as key from $i; +end define; + +$z = (select key from $q("Input", "_bar")); + +select $z; + +select key from $q("Input", "_baz") order by key; + +define subquery $e() as + select "hello"; +end define; + +process $e(); diff --git a/yql/essentials/tests/sql/suites/action/subquery_accessnode.sql b/yql/essentials/tests/sql/suites/action/subquery_accessnode.sql new file mode 100644 index 0000000000..5cd354945e --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_accessnode.sql @@ -0,0 +1,8 @@ +/* syntax version 1 */ +/* postgres can not */ + +define subquery $foo() as + select <|a: 1, b: 2|> as s; +end define; + +select s.a as a, s.b as b from $foo(); diff --git a/yql/essentials/tests/sql/suites/action/subquery_assumeorderby.sql b/yql/essentials/tests/sql/suites/action/subquery_assumeorderby.sql new file mode 100644 index 0000000000..08c1779801 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_assumeorderby.sql @@ -0,0 +1,9 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $sub() as + select * from (values (1),(2),(3)) as a(x); +end define; + +$sub2 = SubqueryAssumeOrderBy($sub, [("x",true)]); + +process $sub2();
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/subquery_extend_over_extend_for.sql b/yql/essentials/tests/sql/suites/action/subquery_extend_over_extend_for.sql new file mode 100644 index 0000000000..08951c5c36 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_extend_over_extend_for.sql @@ -0,0 +1,11 @@ +/* syntax version 1 */ +/* postgres can not */ +DEFINE SUBQUERY $sub($i) as + SELECT $i as x; +END DEFINE; + +$s = SubqueryExtendFor([1,2,3],$sub); +$s2 = SubqueryExtendFor([1,2,3],$sub); + +$s3 = SubqueryExtend($s, $s2); +PROCESS $s3(); diff --git a/yql/essentials/tests/sql/suites/action/subquery_merge1.sql b/yql/essentials/tests/sql/suites/action/subquery_merge1.sql new file mode 100644 index 0000000000..ae6d563701 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_merge1.sql @@ -0,0 +1,25 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $sub1() as + select 1 as x; +end define; + +define subquery $sub2() as + select 2 as x; +end define; + +define subquery $sub3() as + select 3 as y; +end define; + +$s = SubqueryExtend($sub1,$sub2); +process $s(); + +$s = SubqueryUnionAll($sub1,$sub3); +process $s(); + +$s = SubqueryMerge($sub1,$sub2); +process $s(); + +$s = SubqueryUnionMerge($sub1,$sub3); +process $s(); diff --git a/yql/essentials/tests/sql/suites/action/subquery_merge2.sql b/yql/essentials/tests/sql/suites/action/subquery_merge2.sql new file mode 100644 index 0000000000..f8d4918c83 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_merge2.sql @@ -0,0 +1,17 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $sub($i) as + select $i as x; +end define; + +$s = SubqueryExtendFor([1,2,3],$sub); +process $s(); + +$s = SubqueryUnionAllFor([1,2,3],$sub); +process $s(); + +$s = SubqueryMergeFor([1,2,3],$sub); +process $s(); + +$s = SubqueryUnionMergeFor([1,2,3],$sub); +process $s(); diff --git a/yql/essentials/tests/sql/suites/action/subquery_merge_evaluate.sql b/yql/essentials/tests/sql/suites/action/subquery_merge_evaluate.sql new file mode 100644 index 0000000000..25c3a000fa --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_merge_evaluate.sql @@ -0,0 +1,16 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +define subquery $sub1($i,$j?) as + select $i - 1,$j; +end define; + +define subquery $sub2($i,$j?) as + select $i + 1,$j; +end define; + +$sub = EvaluateCode(If(1>2,QuoteCode($sub1),QuoteCode($sub2))); + +$s = SubqueryExtendFor([1,2,3],$sub); +process $s(); diff --git a/yql/essentials/tests/sql/suites/action/subquery_merge_nested_subquery.cfg b/yql/essentials/tests/sql/suites/action/subquery_merge_nested_subquery.cfg new file mode 100644 index 0000000000..58878f8945 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_merge_nested_subquery.cfg @@ -0,0 +1 @@ +in Input input.txt diff --git a/yql/essentials/tests/sql/suites/action/subquery_merge_nested_subquery.sql b/yql/essentials/tests/sql/suites/action/subquery_merge_nested_subquery.sql new file mode 100644 index 0000000000..47317a548e --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_merge_nested_subquery.sql @@ -0,0 +1,16 @@ +/* syntax version 1 */ +/* postgres can not */ +USE plato; + +DEFINE SUBQUERY $get_tables_list($dir) AS + SELECT + Unwrap($dir || "/" || CAST(TableName(Path, "yt") AS String)) AS Path, + FROM FOLDER($dir) +END DEFINE; + +DEFINE SUBQUERY $get_all_tables_list($dirs) AS + $get_src_tables = SubqueryExtendFor(UNWRAP(ListUniq($dirs)), $get_tables_list); + select * from $get_src_tables(); +END DEFINE; + +process $get_all_tables_list([""]); diff --git a/yql/essentials/tests/sql/suites/action/subquery_merge_nested_world.sql b/yql/essentials/tests/sql/suites/action/subquery_merge_nested_world.sql new file mode 100644 index 0000000000..67f0683145 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_merge_nested_world.sql @@ -0,0 +1,15 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +DEFINE SUBQUERY $s($_i) AS + $t = SELECT AGGREGATE_LIST(Path) FROM FOLDER('') WHERE Path LIKE "Input%"; + SELECT + * + FROM EACH($t); +END DEFINE; + +$extractor = SubqueryMergeFor([1], $s); + +SELECT * +FROM $extractor(); diff --git a/yql/essentials/tests/sql/suites/action/subquery_opt_args.sql b/yql/essentials/tests/sql/suites/action/subquery_opt_args.sql new file mode 100644 index 0000000000..b3c1c8a757 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_opt_args.sql @@ -0,0 +1,8 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $sub($a,$b?) as + select $a + ($b ?? 0); +end define; + +process $sub(1); +process $sub(2, 3); diff --git a/yql/essentials/tests/sql/suites/action/subquery_orderby0.sql b/yql/essentials/tests/sql/suites/action/subquery_orderby0.sql new file mode 100644 index 0000000000..e281e537cc --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_orderby0.sql @@ -0,0 +1,13 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $sub() as + select * from (values (1,'c'),(1,'a'),(3,'b')) as a(x,y); +end define; + +$sub2 = SubqueryOrderBy($sub, []); + +process $sub2(); + +$sub3 = SubqueryOrderBy($sub, ListCreate(Tuple<String,Bool>)); + +process $sub3();
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/subquery_orderby1.sql b/yql/essentials/tests/sql/suites/action/subquery_orderby1.sql new file mode 100644 index 0000000000..7070defdb5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_orderby1.sql @@ -0,0 +1,9 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $sub() as + select * from (values (1),(2),(3)) as a(x); +end define; + +$sub2 = SubqueryOrderBy($sub, [("x",false)]); + +process $sub2();
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/subquery_orderby2.sql b/yql/essentials/tests/sql/suites/action/subquery_orderby2.sql new file mode 100644 index 0000000000..7dbbe3ad0f --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/subquery_orderby2.sql @@ -0,0 +1,9 @@ +/* syntax version 1 */ +/* postgres can not */ +define subquery $sub() as + select * from (values (1,'c'),(1,'a'),(3,'b')) as a(x,y); +end define; + +$sub2 = SubqueryOrderBy($sub, [("x",false), ("y",true)]); + +process $sub2();
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/action/table_content_before_from_folder.cfg b/yql/essentials/tests/sql/suites/action/table_content_before_from_folder.cfg new file mode 100644 index 0000000000..ad52c79527 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/table_content_before_from_folder.cfg @@ -0,0 +1,2 @@ +in Input input.txt +out Output output.txt diff --git a/yql/essentials/tests/sql/suites/action/table_content_before_from_folder.sql b/yql/essentials/tests/sql/suites/action/table_content_before_from_folder.sql new file mode 100644 index 0000000000..bd6ee020d4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/action/table_content_before_from_folder.sql @@ -0,0 +1,7 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; +pragma yt.EvaluationTableSizeLimit="1"; +select * from Input limit 1; +$tables = (select aggregate_list(Path) as dates from folder("") where Path like "Input%"); +select count(*) from each($tables); |