Skip to content

Commit b7ca3e6

Browse files
committed
fix
1 parent d3c86f5 commit b7ca3e6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/query/expression/src/type_check.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,18 @@ pub fn common_super_type(
596596
let ty = DecimalDataType::binary_result_type(&a, &b, false, false, true).ok();
597597
ty.map(DataType::Decimal)
598598
}
599-
(DataType::Number(num_ty), decimal_ty @ DataType::Decimal(_))
600-
| (decimal_ty @ DataType::Decimal(_), DataType::Number(num_ty))
599+
(DataType::Number(num_ty), DataType::Decimal(decimal_ty))
600+
| (DataType::Decimal(decimal_ty), DataType::Number(num_ty))
601601
if !num_ty.is_float() =>
602602
{
603-
Some(decimal_ty)
603+
let max_precision = decimal_ty.max_precision();
604+
let scale = decimal_ty.scale();
605+
DecimalDataType::from_size(DecimalSize {
606+
precision: max_precision,
607+
scale,
608+
})
609+
.ok()
610+
.map(DataType::Decimal)
604611
}
605612
(DataType::Number(num_ty), DataType::Decimal(_))
606613
| (DataType::Decimal(_), DataType::Number(num_ty))

0 commit comments

Comments
 (0)