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/params | |
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/params')
59 files changed, 306 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/params/complex_yson.cfg b/yql/essentials/tests/sql/suites/params/complex_yson.cfg new file mode 100644 index 0000000000..bee766d276 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/complex_yson.cfg @@ -0,0 +1 @@ +param $x p_yson2.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/complex_yson.sql b/yql/essentials/tests/sql/suites/params/complex_yson.sql new file mode 100644 index 0000000000..31c65f574e --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/complex_yson.sql @@ -0,0 +1,4 @@ +pragma yson.Strict; + +declare $x as Yson; +select ToBytes(Yson::SerializePretty($x)); diff --git a/yql/essentials/tests/sql/suites/params/default.cfg b/yql/essentials/tests/sql/suites/params/default.cfg new file mode 100644 index 0000000000..e68191f82c --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/default.cfg @@ -0,0 +1 @@ +in Input input.txt
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/dict.cfg b/yql/essentials/tests/sql/suites/params/dict.cfg new file mode 100644 index 0000000000..ecab95188f --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/dict.cfg @@ -0,0 +1,2 @@ +param $x p_dict.json +param $x2 p_dict2.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/dict.sql b/yql/essentials/tests/sql/suites/params/dict.sql new file mode 100644 index 0000000000..0af2b27d2c --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/dict.sql @@ -0,0 +1,4 @@ +/* syntax version 1 */ +declare $x as Dict<String, Int64?>; +declare $x2 as Dict<Utf8, Int64?>; +select $x["a1"], $x["a2"], $x["a3"], $x2["a1"], $x2["a2"], $x2["a3"] diff --git a/yql/essentials/tests/sql/suites/params/input.txt b/yql/essentials/tests/sql/suites/params/input.txt new file mode 100644 index 0000000000..96d1fdd0ab --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/input.txt @@ -0,0 +1,3 @@ +{"key"="foo";"subkey"="bar";"value"="wat"}; +{"key"="bar";"subkey"="wat";"value"="wtf"}; +{"key"="wtf";"subkey"="foo";"value"="bar"}; diff --git a/yql/essentials/tests/sql/suites/params/list.cfg b/yql/essentials/tests/sql/suites/params/list.cfg new file mode 100644 index 0000000000..b50f6435a6 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/list.cfg @@ -0,0 +1 @@ +param $x p_list.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/list.sql b/yql/essentials/tests/sql/suites/params/list.sql new file mode 100644 index 0000000000..af4a6f4023 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/list.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +declare $x as List<String?>; +select ListLength($x), $x[0], $x[1], $x[2], $x[3]; diff --git a/yql/essentials/tests/sql/suites/params/missing_param_fail.cfg b/yql/essentials/tests/sql/suites/params/missing_param_fail.cfg new file mode 100644 index 0000000000..6fdcfa62be --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/missing_param_fail.cfg @@ -0,0 +1,2 @@ +xfail +param $x p_int64.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/missing_param_fail.sql b/yql/essentials/tests/sql/suites/params/missing_param_fail.sql new file mode 100644 index 0000000000..65aa3ded37 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/missing_param_fail.sql @@ -0,0 +1,3 @@ +declare $x as int; +declare $y as int; +select $x + $y; diff --git a/yql/essentials/tests/sql/suites/params/no_optional_param.sql b/yql/essentials/tests/sql/suites/params/no_optional_param.sql new file mode 100644 index 0000000000..db481d0094 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/no_optional_param.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +declare $x as Uint32?; +select 2 * coalesce($x, 33); diff --git a/yql/essentials/tests/sql/suites/params/no_params_fail.cfg b/yql/essentials/tests/sql/suites/params/no_params_fail.cfg new file mode 100644 index 0000000000..eb2e5315d1 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/no_params_fail.cfg @@ -0,0 +1 @@ +xfail
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/no_params_fail.sql b/yql/essentials/tests/sql/suites/params/no_params_fail.sql new file mode 100644 index 0000000000..9144f91e92 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/no_params_fail.sql @@ -0,0 +1,2 @@ +declare $x as int; +select 2 * $x;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_bool.json b/yql/essentials/tests/sql/suites/params/p_bool.json new file mode 100644 index 0000000000..f32a5804e2 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_bool.json @@ -0,0 +1 @@ +true
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_date.json b/yql/essentials/tests/sql/suites/params/p_date.json new file mode 100644 index 0000000000..00877b0f5d --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_date.json @@ -0,0 +1 @@ +"17563"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_datetime.json b/yql/essentials/tests/sql/suites/params/p_datetime.json new file mode 100644 index 0000000000..38a1f5ac22 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_datetime.json @@ -0,0 +1 @@ +"1517498177"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_decimal.json b/yql/essentials/tests/sql/suites/params/p_decimal.json new file mode 100644 index 0000000000..8640e06c7f --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_decimal.json @@ -0,0 +1 @@ +"-9876.12345"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_dict.json b/yql/essentials/tests/sql/suites/params/p_dict.json new file mode 100644 index 0000000000..524df1fc93 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_dict.json @@ -0,0 +1 @@ +[["a1", "765"], ["a2", null]]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_dict2.json b/yql/essentials/tests/sql/suites/params/p_dict2.json new file mode 100644 index 0000000000..2545ff38f6 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_dict2.json @@ -0,0 +1 @@ +{"a1": "765", "a2": null}
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_double.json b/yql/essentials/tests/sql/suites/params/p_double.json new file mode 100644 index 0000000000..d37de39b8f --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_double.json @@ -0,0 +1 @@ +"-567.1234"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_int64.json b/yql/essentials/tests/sql/suites/params/p_int64.json new file mode 100644 index 0000000000..45239526ac --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_int64.json @@ -0,0 +1 @@ +"-21"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_interval.json b/yql/essentials/tests/sql/suites/params/p_interval.json new file mode 100644 index 0000000000..80444e5c5b --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_interval.json @@ -0,0 +1 @@ +"-2509261088556"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_json.json b/yql/essentials/tests/sql/suites/params/p_json.json new file mode 100644 index 0000000000..b77a55d7d7 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_json.json @@ -0,0 +1 @@ +"{\"b\": 321}"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_list.json b/yql/essentials/tests/sql/suites/params/p_list.json new file mode 100644 index 0000000000..966d2f232e --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_list.json @@ -0,0 +1 @@ +["a1", null, "a2"]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_null.json b/yql/essentials/tests/sql/suites/params/p_null.json new file mode 100644 index 0000000000..ec747fa47d --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_null.json @@ -0,0 +1 @@ +null
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_number_list.json b/yql/essentials/tests/sql/suites/params/p_number_list.json new file mode 100644 index 0000000000..fc4de450de --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_number_list.json @@ -0,0 +1 @@ +["1", "2", "3"] diff --git a/yql/essentials/tests/sql/suites/params/p_string.json b/yql/essentials/tests/sql/suites/params/p_string.json new file mode 100644 index 0000000000..0f53da34fe --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_string.json @@ -0,0 +1 @@ +"Moscow!"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_string_bin.json b/yql/essentials/tests/sql/suites/params/p_string_bin.json new file mode 100644 index 0000000000..bcd48de1af --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_string_bin.json @@ -0,0 +1 @@ +["AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w=="]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_string_ru.json b/yql/essentials/tests/sql/suites/params/p_string_ru.json new file mode 100644 index 0000000000..4cc3538906 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_string_ru.json @@ -0,0 +1 @@ +"Moscow Привет!"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_struct.json b/yql/essentials/tests/sql/suites/params/p_struct.json new file mode 100644 index 0000000000..f4670c9c63 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_struct.json @@ -0,0 +1 @@ +{"a": "42", "b": "\u043f\u0438\u0443-\u043f\u0438\u0443"}
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_timestamp.json b/yql/essentials/tests/sql/suites/params/p_timestamp.json new file mode 100644 index 0000000000..f9655df825 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_timestamp.json @@ -0,0 +1 @@ +"1517498177034567"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_tuple1.json b/yql/essentials/tests/sql/suites/params/p_tuple1.json new file mode 100644 index 0000000000..6da1e94df1 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_tuple1.json @@ -0,0 +1 @@ +["a1", "765"]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_tuple2.json b/yql/essentials/tests/sql/suites/params/p_tuple2.json new file mode 100644 index 0000000000..cbca0f6c6d --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_tuple2.json @@ -0,0 +1 @@ +["a2", null]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_tzdate.json b/yql/essentials/tests/sql/suites/params/p_tzdate.json new file mode 100644 index 0000000000..2754f54f59 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_tzdate.json @@ -0,0 +1 @@ +"2018-02-01,America/Los_Angeles"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_tzdatetime.json b/yql/essentials/tests/sql/suites/params/p_tzdatetime.json new file mode 100644 index 0000000000..cd6da4aab5 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_tzdatetime.json @@ -0,0 +1 @@ +"2018-02-01T15:16:17,Europe/Moscow"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_tztimestamp.json b/yql/essentials/tests/sql/suites/params/p_tztimestamp.json new file mode 100644 index 0000000000..da2fb8656c --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_tztimestamp.json @@ -0,0 +1 @@ +"2018-02-01T15:16:17.034567,GMT"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_uint64.json b/yql/essentials/tests/sql/suites/params/p_uint64.json new file mode 100644 index 0000000000..3e71fa1475 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_uint64.json @@ -0,0 +1 @@ +"21"
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_uuid.json b/yql/essentials/tests/sql/suites/params/p_uuid.json new file mode 100644 index 0000000000..505d02b045 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_uuid.json @@ -0,0 +1 @@ +["AIQOVZvi1EGnFkRmVUQAAA=="]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_variant1.json b/yql/essentials/tests/sql/suites/params/p_variant1.json new file mode 100644 index 0000000000..7c32328715 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_variant1.json @@ -0,0 +1 @@ +["0", "abc"]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_variant2.json b/yql/essentials/tests/sql/suites/params/p_variant2.json new file mode 100644 index 0000000000..8d709a2855 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_variant2.json @@ -0,0 +1 @@ +["1", "789"]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_variant3.json b/yql/essentials/tests/sql/suites/params/p_variant3.json new file mode 100644 index 0000000000..1240fbbeb4 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_variant3.json @@ -0,0 +1 @@ +["0", "hehe"]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_variant4.json b/yql/essentials/tests/sql/suites/params/p_variant4.json new file mode 100644 index 0000000000..b614005aa3 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_variant4.json @@ -0,0 +1 @@ +["1", "119"]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_variant5.json b/yql/essentials/tests/sql/suites/params/p_variant5.json new file mode 100644 index 0000000000..73a83a951a --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_variant5.json @@ -0,0 +1 @@ +[["a"], "foo"]
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_yson.json b/yql/essentials/tests/sql/suites/params/p_yson.json new file mode 100644 index 0000000000..2f5ffff984 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_yson.json @@ -0,0 +1 @@ +{"a": 123}
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/p_yson2.json b/yql/essentials/tests/sql/suites/params/p_yson2.json new file mode 100644 index 0000000000..6239a99bac --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/p_yson2.json @@ -0,0 +1,101 @@ +# import yt.yson as yson +# bin_str = ''.join(map(chr, xrange(0, 255))) +# s = yson.YsonString(bin_str) +# s.attributes = yson.YsonMap({ +# 'a1': yson.YsonString('oops'), +# 'a2': yson.YsonList([yson.YsonUint64(876), yson.YsonString('boom')]) +# }) +# +# y = yson.YsonMap( +# { +# 'a': yson.YsonBoolean(True), +# 'b': yson.YsonBoolean(False), +# 'c': yson.YsonString('hello Ìîñêâà'), +# 'd': s, +# 'x': yson.YsonDouble(-1.34), +# 'y': yson.YsonDouble(float('nan')), +# 'v': yson.YsonEntity(), +# '$z': yson.YsonDouble(float('-inf')), +# '$t': yson.YsonDouble(float('inf')), +# '$$$e': yson.YsonMap( +# { +# '$f': yson.YsonString('hehe'), +# '$$g': yson.YsonList([yson.YsonEntity(), yson.YsonInt64(-12345), yson.YsonUint64(9876)]) +# } +# ) +# } +# ) +# +# x = YqlParameterValueBuilder.make_yson(y) +# t = json.dumps(x.to_json(), sort_keys=True, indent=4) +# import sys +# sys.stderr.write(t) + +{ + "$$$$e": { + "$$$g": [ + null, + { + "$type": "int64", + "$value": "-12345" + }, + { + "$type": "uint64", + "$value": "9876" + } + ], + "$$f": { + "$type": "string", + "$value": "hehe" + } + }, + "$$t": { + "$type": "double", + "$value": "inf" + }, + "$$z": { + "$type": "double", + "$value": "-inf" + }, + "a": { + "$type": "boolean", + "$value": "true" + }, + "b": { + "$type": "boolean", + "$value": "false" + }, + "c": { + "$type": "string", + "$value": "hello \u00d0\u009c\u00d0\u00be\u00d1\u0081\u00d0\u00ba\u00d0\u00b2\u00d0\u00b0" + }, + "d": { + "$attributes": { + "a1": { + "$type": "string", + "$value": "oops" + }, + "a2": [ + { + "$type": "uint64", + "$value": "876" + }, + { + "$type": "string", + "$value": "boom" + } + ] + }, + "$type": "string", + "$value": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u007f\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe" + }, + "v": null, + "x": { + "$type": "double", + "$value": "-1.34" + }, + "y": { + "$type": "double", + "$value": "nan" + } +}
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/param_in_in_predicate.cfg b/yql/essentials/tests/sql/suites/params/param_in_in_predicate.cfg new file mode 100644 index 0000000000..0fd5347027 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/param_in_in_predicate.cfg @@ -0,0 +1 @@ +param $foo p_number_list.json diff --git a/yql/essentials/tests/sql/suites/params/param_in_in_predicate.sql b/yql/essentials/tests/sql/suites/params/param_in_in_predicate.sql new file mode 100644 index 0000000000..ced6a53818 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/param_in_in_predicate.sql @@ -0,0 +1,5 @@ +/* syntax version 1 */ +declare $foo as List<Int32>; + +select 1 in $foo, 100 in $foo; + diff --git a/yql/essentials/tests/sql/suites/params/param_in_json_api.cfg b/yql/essentials/tests/sql/suites/params/param_in_json_api.cfg new file mode 100644 index 0000000000..935a7bf243 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/param_in_json_api.cfg @@ -0,0 +1,6 @@ +param $input_json p_json.json +param $int64_param p_int64.json +param $double_param p_double.json +param $bool_param p_bool.json +param $string_param p_string_ru.json +param $json_param p_json.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/param_in_json_api.sql b/yql/essentials/tests/sql/suites/params/param_in_json_api.sql new file mode 100644 index 0000000000..714240ad4c --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/param_in_json_api.sql @@ -0,0 +1,45 @@ +/* syntax version 1 */ +/* postgres can not */ + +DECLARE $input_json as Json; +DECLARE $int64_param as Int64; +DECLARE $double_param as Double; +DECLARE $bool_param as Bool; +DECLARE $string_param as Utf8; +DECLARE $json_param as Json; + +SELECT + JSON_VALUE( + $input_json, + "strict $var" + PASSING + $int64_param as var + RETURNING Int64 + ), + JSON_VALUE( + $input_json, + "strict $var" + PASSING + $double_param as var + RETURNING Double + ), + JSON_VALUE( + $input_json, + "strict $var" + PASSING + $bool_param as var + RETURNING Bool + ), + JSON_VALUE( + $input_json, + "strict $var" + PASSING + $string_param as var + RETURNING String + ), + JSON_QUERY( + $input_json, + "strict $var" + PASSING + $json_param as var + );
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/param_type_mismatch_fail.cfg b/yql/essentials/tests/sql/suites/params/param_type_mismatch_fail.cfg new file mode 100644 index 0000000000..6fdcfa62be --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/param_type_mismatch_fail.cfg @@ -0,0 +1,2 @@ +xfail +param $x p_int64.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/param_type_mismatch_fail.sql b/yql/essentials/tests/sql/suites/params/param_type_mismatch_fail.sql new file mode 100644 index 0000000000..ea6e631d35 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/param_type_mismatch_fail.sql @@ -0,0 +1,2 @@ +declare $x as UInt32; +select 2 * $x;
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/primitives.cfg b/yql/essentials/tests/sql/suites/params/primitives.cfg new file mode 100644 index 0000000000..a6f7786da7 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/primitives.cfg @@ -0,0 +1,24 @@ +param $x1 p_int64.json +param $x2 p_double.json +param $x3 p_bool.json +param $x4 p_double.json +param $x5 p_string_ru.json +param $x6 p_int64.json +param $x7 p_uint64.json +param $x8 p_string_bin.json +param $x9 p_string_ru.json +param $x10 p_uuid.json +param $x11 p_null.json +param $x12 p_string.json +param $x13 p_yson.json +param $x14 p_json.json +param $x15 p_datetime.json +param $x16 p_date.json +param $x17 p_timestamp.json +param $x18 p_interval.json +param $x19 p_tzdatetime.json +param $x20 p_tztimestamp.json +param $x21 p_tzdate.json +param $x22 p_null.json +param $x23 p_decimal.json +udf unicode_udf
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/primitives.sql b/yql/essentials/tests/sql/suites/params/primitives.sql new file mode 100644 index 0000000000..42aeef5bab --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/primitives.sql @@ -0,0 +1,30 @@ +/* syntax version 1 */ +declare $x1 as int; +declare $x2 as Double; +declare $x3 as Bool; +declare $x4 as Float; +declare $x5 as String; -- unicode +declare $x6 as Int64; +declare $x7 as Uint64; +declare $x8 as String; -- binary +declare $x9 as Utf8; +declare $x10 as Uuid; +declare $x11 as String?; -- null +declare $x12 as String?; -- not null +declare $x13 as Yson; +declare $x14 as Json; +declare $x15 as datetime; +declare $x16 as date; +declare $x17 as timestamp; +declare $x18 as interval; +declare $x19 as tzdatetime; +declare $x20 as tztimestamp; +declare $x21 as tzdate; +declare $x22 as Void; +declare $x23 as Decimal(21,8); +select 2 * $x1, -$x2 * 10, not $x3, -$x4, $x5 || "2018", -$x6, $x7 + 1, Length($x8), + Unicode::GetLength($x9), cast($x10 as string), coalesce($x11, "XYZ"), coalesce($x12, "XYZ"), + Yson::LookupInt64($x13, 'a'), Yson::ConvertToInt64($x14.b), + cast($x15 as string), cast($x16 as string), cast($x17 as string), cast($x18 as string), + cast($x19 as string), cast($x20 as string), cast($x21 as string), + $x22, cast($x23 as string); diff --git a/yql/essentials/tests/sql/suites/params/struct.cfg b/yql/essentials/tests/sql/suites/params/struct.cfg new file mode 100644 index 0000000000..598bded49e --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/struct.cfg @@ -0,0 +1 @@ +param $x p_struct.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/struct.sql b/yql/essentials/tests/sql/suites/params/struct.sql new file mode 100644 index 0000000000..01b450ece3 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/struct.sql @@ -0,0 +1,3 @@ +/* syntax version 1 */ +declare $x as Struct<a:Int64, b:String?>; +select cast($x.a as String) || coalesce($x.b, "zzz"); diff --git a/yql/essentials/tests/sql/suites/params/tuple.cfg b/yql/essentials/tests/sql/suites/params/tuple.cfg new file mode 100644 index 0000000000..731cd63af9 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/tuple.cfg @@ -0,0 +1,2 @@ +param $x1 p_tuple1.json +param $x2 p_tuple2.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/tuple.sql b/yql/essentials/tests/sql/suites/params/tuple.sql new file mode 100644 index 0000000000..783a7336dd --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/tuple.sql @@ -0,0 +1,6 @@ +/* syntax version 1 */ +declare $x1 as Tuple<String, Int64?>; +declare $x2 as Tuple<String, Int64?>; +$a, $b = $x1; + +select $a, $b, $x2.0, $x2.1; diff --git a/yql/essentials/tests/sql/suites/params/variant.cfg b/yql/essentials/tests/sql/suites/params/variant.cfg new file mode 100644 index 0000000000..63ac903276 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/variant.cfg @@ -0,0 +1,5 @@ +param $x1 p_variant1.json +param $x2 p_variant2.json +param $x3 p_variant3.json +param $x4 p_variant4.json +param $x5 p_variant5.json
\ No newline at end of file diff --git a/yql/essentials/tests/sql/suites/params/variant.sql b/yql/essentials/tests/sql/suites/params/variant.sql new file mode 100644 index 0000000000..cd7c477a61 --- /dev/null +++ b/yql/essentials/tests/sql/suites/params/variant.sql @@ -0,0 +1,12 @@ +/* syntax version 1 */ + +-- underlying type is tuple +declare $x1 as Variant<String, Int64>; +declare $x2 as Variant<String, Int64>; + +-- underlying type is struct +declare $x3 as Variant<a:String, b:Int64>; +declare $x4 as Variant<a:String, b:Int64>; +declare $x5 as Variant<a:String, b:Int64>; + +select $x1.0 || cast($x2.1 as String) || $x3.a || cast($x4.b as String) || $x5.a; |