Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions src/query/functions/src/scalars/decimal/src/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ pub fn register_to_decimal(registry: &mut FunctionRegistry) {
],
false,
),
(3, false, false) => (
vec![
from_type.clone(),
DataType::Number(NumberDataType::Int64),
DataType::Number(NumberDataType::Int64),
],
false,
),
(4, true, true) => (
vec![
DataType::String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,28 @@ SELECT to_decimal('12.3000', '99D9999');
----
12

query I
SELECT to_decimal(123.4567, 10, 4);
----
123.4567

query I
SELECT to_decimal(true, 5, 2), to_decimal(false, 5, 2);
----
1.00 0.00

query I
SELECT to_decimal(number, 10, 2) FROM numbers(3);
----
0.00
1.00
2.00

query I
SELECT try_to_decimal(123456, 6, 0);
----
123456

query I
SELECT TO_DECIMAL('123456789', 9);
----
Expand Down
Loading