Skip to content

Commit

Permalink
[Bug](decimalv2) getCmpType return decimalv2 when lhs/rhs type both i…
Browse files Browse the repository at this point in the history
…s decimalv2 (apache#26705) (apache#26767)
  • Loading branch information
BiteTheDDDDt committed Nov 10, 2023
1 parent eac772c commit a63c353
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,12 @@ private Type getCmpType() throws AnalysisException {
if (t1 == PrimitiveType.BIGINT && t2 == PrimitiveType.BIGINT) {
return Type.getAssignmentCompatibleType(getChild(0).getType(), getChild(1).getType(), false);
}

if (t1 == PrimitiveType.DECIMALV2 && t2 == PrimitiveType.DECIMALV2) {
return ScalarType.getAssignmentCompatibleDecimalV2Type((ScalarType) getChild(0).getType(),
(ScalarType) getChild(1).getType());
}

if ((t1 == PrimitiveType.BIGINT && t2 == PrimitiveType.DECIMALV2)
|| (t2 == PrimitiveType.BIGINT && t1 == PrimitiveType.DECIMALV2)
|| (t1 == PrimitiveType.LARGEINT && t2 == PrimitiveType.DECIMALV2)
Expand Down
20 changes: 20 additions & 0 deletions regression-test/suites/delete_p0/test_delete.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,24 @@ PROPERTIES
"""

sql "delete from dwd_pay partitions(p202310) where pay_time = '20231002';"

sql """
ADMIN SET FRONTEND CONFIG ('disable_decimalv2' = 'false');
"""

sql "drop table if exists test"
sql """
CREATE TABLE `test`
(
col_1 int,
col_2 decimalv2(10,3)
)ENGINE=OLAP
duplicate KEY(`col_1`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`col_1`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql "DELETE FROM test WHERE col_2 = cast(123.45 as decimalv2(10,3));"
}

0 comments on commit a63c353

Please sign in to comment.