Skip to content

Function CompareTo in PartitionKey throws cast error #721

@chenhao7253886

Description

@chenhao7253886

When we create a table, which partition key is tinyint, such as
CREATE TABLE test (
k1 tinyint(4) COMMENT "",
k2 smallint(6) COMMENT "",
k3 int(11) COMMENT "",
k4 bigint(20) COMMENT "",
k5 decimal(9, 0) COMMENT "",
k6 char(5) COMMENT "",
k10 date COMMENT "",
k11 datetime COMMENT "",
k7 varchar(20) COMMENT "",
k8 double MAX COMMENT "",
k9 float SUM COMMENT ""
) ENGINE=OLAP
AGGREGATE KEY(k1, k2, k3, k4, k5, k6, k10, k11, k7)
PARTITION BY RANGE(k1)
(PARTITION p1 VALUES LESS THAN ("-64"),
PARTITION p2 VALUES LESS THAN ("0"),
PARTITION p3 VALUES LESS THAN ("64"),
PARTITION p4 VALUES LESS THAN MAXVALUE)
DISTRIBUTED BY HASH(k1) BUCKETS 5
PROPERTIES (
"storage_type" = "COLUMN"
);
and we send the following query:
select * from test where k1 in (-1, 1.0) order by k1, k2, k3, k4;
we will get error:
Unexpected exception: org.apache.doris.analysis.DecimalLiteral cannot be cast to org.apache.doris.analysis.IntLiteral
the reason for this is that they are not casted to the same type when compare.

Metadata

Metadata

Labels

kind/fixCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions