diff options
author | vvvv <vvvv@yandex-team.com> | 2024-12-28 18:52:49 +0300 |
---|---|---|
committer | vvvv <vvvv@yandex-team.com> | 2024-12-28 19:08:05 +0300 |
commit | 8edc031b752662cb60f411a2d7d3d6c162d801cf (patch) | |
tree | c78646d3f4c02c56d8e5659af94aa338df9e5447 /yt/yql/tests/sql/suites/coalesce | |
parent | 4e51cb9d47a86fee833396ad0cdfb8e84ec8166c (diff) | |
download | ydb-8edc031b752662cb60f411a2d7d3d6c162d801cf.tar.gz |
Change "devtools/contrib/piglet/projects/ydblib/config.yaml"
commit_hash:bf8be6eaf53bc3065d37ec3eeb7b664ca9d6b76d
Diffstat (limited to 'yt/yql/tests/sql/suites/coalesce')
8 files changed, 136 insertions, 0 deletions
diff --git a/yt/yql/tests/sql/suites/coalesce/coalesce.cfg b/yt/yql/tests/sql/suites/coalesce/coalesce.cfg new file mode 100644 index 0000000000..5640285809 --- /dev/null +++ b/yt/yql/tests/sql/suites/coalesce/coalesce.cfg @@ -0,0 +1 @@ +in Input input_coalesce.txt diff --git a/yt/yql/tests/sql/suites/coalesce/coalesce.sql b/yt/yql/tests/sql/suites/coalesce/coalesce.sql new file mode 100644 index 0000000000..92c4778505 --- /dev/null +++ b/yt/yql/tests/sql/suites/coalesce/coalesce.sql @@ -0,0 +1 @@ +select coalesce(cast(value as int), 999) from plato.Input;
\ No newline at end of file diff --git a/yt/yql/tests/sql/suites/coalesce/coalesce_few_opt.cfg b/yt/yql/tests/sql/suites/coalesce/coalesce_few_opt.cfg new file mode 100644 index 0000000000..64b3f61710 --- /dev/null +++ b/yt/yql/tests/sql/suites/coalesce/coalesce_few_opt.cfg @@ -0,0 +1 @@ +in Input optional.txt diff --git a/yt/yql/tests/sql/suites/coalesce/coalesce_few_opt.sql b/yt/yql/tests/sql/suites/coalesce/coalesce_few_opt.sql new file mode 100644 index 0000000000..1e2d541f60 --- /dev/null +++ b/yt/yql/tests/sql/suites/coalesce/coalesce_few_opt.sql @@ -0,0 +1,24 @@ +select + 'first', + coalesce(first_null, 22), + coalesce(first_num, 33), + coalesce(coalesce(first_null, 122), 42), + coalesce(coalesce(first_num, 133), 43), + coalesce(coalesce(coalesce(first_null, 222), 442), 100500), + coalesce(coalesce(coalesce(first_num, 233), 443), 100501), + 'second', + coalesce(second_null, 22), + coalesce(second_num, 33), + coalesce(coalesce(second_null, 122), 42), + coalesce(coalesce(second_num, 133), 43), + coalesce(coalesce(coalesce(second_null, 222), 442), 100500), + coalesce(coalesce(coalesce(second_num, 233), 443), 100501), + 'third', + coalesce(third_null, 22), + coalesce(third_num, 33), + coalesce(coalesce(third_null, 122), 42), + coalesce(coalesce(third_num, 133), 43), + coalesce(coalesce(coalesce(third_null, 222), 442), 100500), + coalesce(coalesce(coalesce(third_num, 233), 443), 100501), + 'end' +from plato.Input; diff --git a/yt/yql/tests/sql/suites/coalesce/coalesce_few_real.sql b/yt/yql/tests/sql/suites/coalesce/coalesce_few_real.sql new file mode 100644 index 0000000000..0eebc69cc2 --- /dev/null +++ b/yt/yql/tests/sql/suites/coalesce/coalesce_few_real.sql @@ -0,0 +1,17 @@ +/* postgres can not */ +$optDuoFloat=Just(Just(cast(2.71 as float))); +$optDuoDouble=Just(Just(cast(3.14 as double))); +$optDuoFloatN=Just(Just(cast(null as float))); +$optDuoDoubleN=Just(Just(cast(null as double))); + +select + ($optDuoFloat ?? 0) ?? 1, + ($optDuoDouble ?? 41) ?? 42, + ($optDuoFloatN ?? 0) ?? 1., + ($optDuoDoubleN ?? 41.) ?? 42, + ($optDuoFloatN ?? cast(40.1 as float)) ?? cast(40.2 as float), + ($optDuoDoubleN ?? cast(40.1 as float)) ?? cast(40.2 as float), + (($optDuoFloatN ?? 0) ?? 1.) ?? 3, + (($optDuoDoubleN ?? 41) ?? 42) ?? 4, + 'end' +from plato.Input; diff --git a/yt/yql/tests/sql/suites/coalesce/coalesce_sugar.sql b/yt/yql/tests/sql/suites/coalesce/coalesce_sugar.sql new file mode 100644 index 0000000000..c9d2442ee8 --- /dev/null +++ b/yt/yql/tests/sql/suites/coalesce/coalesce_sugar.sql @@ -0,0 +1,3 @@ +/* postgres can not */ +$data = (select key, cast(key as Int64)/100 as eval from plato.Input); +select case when eval < 5 then eval else cast(Null as Int64) end ?? -1, key from $data; diff --git a/yt/yql/tests/sql/suites/coalesce/default.cfg b/yt/yql/tests/sql/suites/coalesce/default.cfg new file mode 100644 index 0000000000..a1f7a5a9b7 --- /dev/null +++ b/yt/yql/tests/sql/suites/coalesce/default.cfg @@ -0,0 +1,4 @@ +in Input input.txt +in Input2 input2.txt +in Input3 input3.txt +in Input4 input4.txt diff --git a/yt/yql/tests/sql/suites/coalesce/optional.txt.attr b/yt/yql/tests/sql/suites/coalesce/optional.txt.attr new file mode 100644 index 0000000000..7962199d3e --- /dev/null +++ b/yt/yql/tests/sql/suites/coalesce/optional.txt.attr @@ -0,0 +1,85 @@ +{ + "_yql_row_spec" = {"Type" = [ + "StructType"; + [ + [ + "first_null"; + [ + "OptionalType"; + [ + "DataType"; + "Uint32" + ] + ] + ]; + [ + "first_num"; + [ + "OptionalType"; + [ + "DataType"; + "Uint32" + ] + ] + ]; + [ + "second_null"; + [ + "OptionalType"; + [ + "OptionalType"; + [ + "DataType"; + "Uint32" + ] + ] + ] + ]; + [ + "second_num"; + [ + "OptionalType"; + [ + "OptionalType"; + [ + "DataType"; + "Uint32" + ] + ] + ] + ]; + [ + "third_null"; + [ + "OptionalType"; + [ + "OptionalType"; + [ + "OptionalType"; + [ + "DataType"; + "Uint32" + ] + ] + ] + ] + ]; + [ + "third_num"; + [ + "OptionalType"; + [ + "OptionalType"; + [ + "OptionalType"; + [ + "DataType"; + "Uint32" + ] + ] + ] + ] + ] + ] + ]}; +} |