Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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
^
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,35 @@
}
]
};
{
"Write" = [
{
"Type" = [
"ListType";
[
"StructType";
[
[
"column0";
[
"OptionalType";
[
"DataType";
"Uint64"
]
]
]
]
]
];
"Data" = [
[
#
]
]
}
]
};
{
"Write" = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
xfail

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT
Unicode::ToUint64("0",1);

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ SELECT
SELECT
Unicode::TryToUint64("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", 16);

SELECT
Unicode::TryToUint64("0", 1);

SELECT
Unicode::TryToUint64("0x1234abcd", 16),
Unicode::TryToUint64("0X4", 16),
Expand Down
Loading