From acb4504531a1d0e3df0fa49b4037cc1f81348acf Mon Sep 17 00:00:00 2001 From: Vitaly Stoyan Date: Tue, 29 Oct 2024 20:32:26 +0300 Subject: [PATCH] test --- .../unicode_base/lib/unicode_base_udf.h | 4 +++ .../unicode_base/test/canondata/result.json | 5 ++++ .../canondata/test.test_ToUint64F3_/extracted | 8 +++++ .../test.test_TryToUint64_/results.txt | 29 +++++++++++++++++++ .../unicode_base/test/cases/ToUint64F3.cfg | 2 ++ .../unicode_base/test/cases/ToUint64F3.sql | 3 ++ .../unicode_base/test/cases/TryToUint64.sql | 3 ++ 7 files changed, 54 insertions(+) create mode 100644 ydb/library/yql/udfs/common/unicode_base/test/canondata/test.test_ToUint64F3_/extracted create mode 100644 ydb/library/yql/udfs/common/unicode_base/test/cases/ToUint64F3.cfg create mode 100644 ydb/library/yql/udfs/common/unicode_base/test/cases/ToUint64F3.sql diff --git a/ydb/library/yql/udfs/common/unicode_base/lib/unicode_base_udf.h b/ydb/library/yql/udfs/common/unicode_base/lib/unicode_base_udf.h index f8e848352456..c7529c4ab073 100644 --- a/ydb/library/yql/udfs/common/unicode_base/lib/unicode_base_udf.h +++ b/ydb/library/yql/udfs/common/unicode_base/lib/unicode_base_udf.h @@ -129,6 +129,10 @@ namespace { const int base = static_cast(args[1].GetOrDefault(0)); char* pos = nullptr; unsigned long long res = std::strtoull(input, &pos, base); + if (!res && errno == EINVAL) { + return TUnboxedValuePod(); + } + ui64 ret = static_cast(res); if (!res && pos == input) { return TUnboxedValuePod(); diff --git a/ydb/library/yql/udfs/common/unicode_base/test/canondata/result.json b/ydb/library/yql/udfs/common/unicode_base/test/canondata/result.json index 0b47a674443c..c9012f2333d0 100644 --- a/ydb/library/yql/udfs/common/unicode_base/test/canondata/result.json +++ b/ydb/library/yql/udfs/common/unicode_base/test/canondata/result.json @@ -44,6 +44,11 @@ "uri": "file://test.test_ToUint64F2_/extracted" } ], + "test.test[ToUint64F3]": [ + { + "uri": "file://test.test_ToUint64F3_/extracted" + } + ], "test.test[ToUint64]": [ { "uri": "file://test.test_ToUint64_/results.txt" diff --git a/ydb/library/yql/udfs/common/unicode_base/test/canondata/test.test_ToUint64F3_/extracted b/ydb/library/yql/udfs/common/unicode_base/test/canondata/test.test_ToUint64F3_/extracted new file mode 100644 index 000000000000..23c634230537 --- /dev/null +++ b/ydb/library/yql/udfs/common/unicode_base/test/canondata/test.test_ToUint64F3_/extracted @@ -0,0 +1,8 @@ +/program.sql:
: Fatal: Execution + + /program.sql:
:2:1: Fatal: Execution of node: Result + SELECT + ^ + /program.sql:
:2:1: Fatal: Incorrect base + SELECT + ^ \ No newline at end of file diff --git a/ydb/library/yql/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt b/ydb/library/yql/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt index 594ac1486c02..b2afcec500b1 100644 --- a/ydb/library/yql/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt +++ b/ydb/library/yql/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt @@ -86,6 +86,35 @@ } ] }; + { + "Write" = [ + { + "Type" = [ + "ListType"; + [ + "StructType"; + [ + [ + "column0"; + [ + "OptionalType"; + [ + "DataType"; + "Uint64" + ] + ] + ] + ] + ] + ]; + "Data" = [ + [ + # + ] + ] + } + ] + }; { "Write" = [ { diff --git a/ydb/library/yql/udfs/common/unicode_base/test/cases/ToUint64F3.cfg b/ydb/library/yql/udfs/common/unicode_base/test/cases/ToUint64F3.cfg new file mode 100644 index 000000000000..83cfd96179ac --- /dev/null +++ b/ydb/library/yql/udfs/common/unicode_base/test/cases/ToUint64F3.cfg @@ -0,0 +1,2 @@ +xfail + diff --git a/ydb/library/yql/udfs/common/unicode_base/test/cases/ToUint64F3.sql b/ydb/library/yql/udfs/common/unicode_base/test/cases/ToUint64F3.sql new file mode 100644 index 000000000000..527fb1da1bd5 --- /dev/null +++ b/ydb/library/yql/udfs/common/unicode_base/test/cases/ToUint64F3.sql @@ -0,0 +1,3 @@ +SELECT + Unicode::ToUint64("0",1); + diff --git a/ydb/library/yql/udfs/common/unicode_base/test/cases/TryToUint64.sql b/ydb/library/yql/udfs/common/unicode_base/test/cases/TryToUint64.sql index b2f4fa850ab7..c4b0aa609f34 100644 --- a/ydb/library/yql/udfs/common/unicode_base/test/cases/TryToUint64.sql +++ b/ydb/library/yql/udfs/common/unicode_base/test/cases/TryToUint64.sql @@ -7,6 +7,9 @@ SELECT SELECT Unicode::TryToUint64("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", 16); +SELECT + Unicode::TryToUint64("0", 1); + SELECT Unicode::TryToUint64("0x1234abcd", 16), Unicode::TryToUint64("0X4", 16),