aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs
diff options
context:
space:
mode:
authoraneporada <aneporada@yandex-team.com>2024-11-12 20:02:10 +0300
committerMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-11-12 22:40:29 +0300
commit06791fb116406f98a10593436968aabe51d1a856 (patch)
tree3a4c8f662423b3602767da02508ce5df0f54a2f2 /yql/essentials/udfs
parent4e4600bae44c02ba4a94c8f7a397a2c63c3cc235 (diff)
downloadydb-06791fb116406f98a10593436968aabe51d1a856.tar.gz
Merge PR #10831, #11068, #11075, #11152
#11152 - Allow to choose normal or aggreation PG function #11075 - Handle invalid base #11068 - Allow more postgis functions #10831 - Views: if exists / if not exists for DDL commit_hash:0ebf35e45ac6de147c9000440ca25237db061d2e
Diffstat (limited to 'yql/essentials/udfs')
-rw-r--r--yql/essentials/udfs/common/unicode_base/lib/unicode_base_udf.h8
-rw-r--r--yql/essentials/udfs/common/unicode_base/test/canondata/result.json5
-rw-r--r--yql/essentials/udfs/common/unicode_base/test/canondata/test.test_ToUint64F3_/extracted8
-rw-r--r--yql/essentials/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt29
-rw-r--r--yql/essentials/udfs/common/unicode_base/test/cases/ToUint64F3.cfg2
-rw-r--r--yql/essentials/udfs/common/unicode_base/test/cases/ToUint64F3.sql3
-rw-r--r--yql/essentials/udfs/common/unicode_base/test/cases/TryToUint64.sql3
7 files changed, 58 insertions, 0 deletions
diff --git a/yql/essentials/udfs/common/unicode_base/lib/unicode_base_udf.h b/yql/essentials/udfs/common/unicode_base/lib/unicode_base_udf.h
index 6cbf4b493a..2155a2d626 100644
--- a/yql/essentials/udfs/common/unicode_base/lib/unicode_base_udf.h
+++ b/yql/essentials/udfs/common/unicode_base/lib/unicode_base_udf.h
@@ -107,6 +107,10 @@ namespace {
const int base = static_cast<int>(args[1].GetOrDefault<ui16>(0));
char* pos = nullptr;
unsigned long long res = std::strtoull(input, &pos, base);
+ if (!res && errno == EINVAL) {
+ UdfTerminate("Incorrect base");
+ }
+
ui64 ret = static_cast<ui64>(res);
if (!res && pos == input) {
UdfTerminate("Input string is not a number");
@@ -125,6 +129,10 @@ namespace {
const int base = static_cast<int>(args[1].GetOrDefault<ui16>(0));
char* pos = nullptr;
unsigned long long res = std::strtoull(input, &pos, base);
+ if (!res && errno == EINVAL) {
+ return TUnboxedValuePod();
+ }
+
ui64 ret = static_cast<ui64>(res);
if (!res && pos == input) {
return TUnboxedValuePod();
diff --git a/yql/essentials/udfs/common/unicode_base/test/canondata/result.json b/yql/essentials/udfs/common/unicode_base/test/canondata/result.json
index 0b47a67444..c9012f2333 100644
--- a/yql/essentials/udfs/common/unicode_base/test/canondata/result.json
+++ b/yql/essentials/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/yql/essentials/udfs/common/unicode_base/test/canondata/test.test_ToUint64F3_/extracted b/yql/essentials/udfs/common/unicode_base/test/canondata/test.test_ToUint64F3_/extracted
new file mode 100644
index 0000000000..23c6342305
--- /dev/null
+++ b/yql/essentials/udfs/common/unicode_base/test/canondata/test.test_ToUint64F3_/extracted
@@ -0,0 +1,8 @@
+<tmp_path>/program.sql:<main>: Fatal: Execution
+
+ <tmp_path>/program.sql:<main>:2:1: Fatal: Execution of node: Result
+ SELECT
+ ^
+ <tmp_path>/program.sql:<main>:2:1: Fatal: Incorrect base
+ SELECT
+ ^ \ No newline at end of file
diff --git a/yql/essentials/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt b/yql/essentials/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt
index 594ac1486c..b2afcec500 100644
--- a/yql/essentials/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt
+++ b/yql/essentials/udfs/common/unicode_base/test/canondata/test.test_TryToUint64_/results.txt
@@ -103,6 +103,35 @@
"Uint64"
]
]
+ ]
+ ]
+ ]
+ ];
+ "Data" = [
+ [
+ #
+ ]
+ ]
+ }
+ ]
+ };
+ {
+ "Write" = [
+ {
+ "Type" = [
+ "ListType";
+ [
+ "StructType";
+ [
+ [
+ "column0";
+ [
+ "OptionalType";
+ [
+ "DataType";
+ "Uint64"
+ ]
+ ]
];
[
"column1";
diff --git a/yql/essentials/udfs/common/unicode_base/test/cases/ToUint64F3.cfg b/yql/essentials/udfs/common/unicode_base/test/cases/ToUint64F3.cfg
new file mode 100644
index 0000000000..83cfd96179
--- /dev/null
+++ b/yql/essentials/udfs/common/unicode_base/test/cases/ToUint64F3.cfg
@@ -0,0 +1,2 @@
+xfail
+
diff --git a/yql/essentials/udfs/common/unicode_base/test/cases/ToUint64F3.sql b/yql/essentials/udfs/common/unicode_base/test/cases/ToUint64F3.sql
new file mode 100644
index 0000000000..527fb1da1b
--- /dev/null
+++ b/yql/essentials/udfs/common/unicode_base/test/cases/ToUint64F3.sql
@@ -0,0 +1,3 @@
+SELECT
+ Unicode::ToUint64("0",1);
+
diff --git a/yql/essentials/udfs/common/unicode_base/test/cases/TryToUint64.sql b/yql/essentials/udfs/common/unicode_base/test/cases/TryToUint64.sql
index b2f4fa850a..c4b0aa609f 100644
--- a/yql/essentials/udfs/common/unicode_base/test/cases/TryToUint64.sql
+++ b/yql/essentials/udfs/common/unicode_base/test/cases/TryToUint64.sql
@@ -8,6 +8,9 @@ SELECT
Unicode::TryToUint64("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", 16);
SELECT
+ Unicode::TryToUint64("0", 1);
+
+SELECT
Unicode::TryToUint64("0x1234abcd", 16),
Unicode::TryToUint64("0X4", 16),
Unicode::TryToUint64("0644", 8),