ccoffline opened a new issue #4833:
URL: https://github.com/apache/incubator-doris/issues/4833


   **Describe the bug**
   ```
   ERROR 1064 (HY000): errCode = 2, detailMessage = Unexpected exception: 
org.apache.doris.analysis.CastExpr cannot be cast to 
org.apache.doris.analysis.LiteralExpr
   ```
   
   **To Reproduce**
   ```sql
   CREATE DATABASE IF NOT EXISTS `test`; USE `test`;
   CREATE TABLE `test_t` (
     `dt` bigint(20) NULL,
     `id` bigint(20) NULL,
     `name` varchar(100) NULL
   ) ENGINE=OLAP
   DUPLICATE KEY(`dt`, `id`, `name`)
   PARTITION BY RANGE(`dt`) (
   PARTITION p20201001 VALUES [("19700101"), ("20201001")),
   PARTITION p20201002 VALUES [("20201001"), ("20201002")),
   PARTITION p20201003 VALUES [("20201002"), ("20201003")),
   PARTITION p20201004 VALUES [("20201003"), ("20201004")),
   PARTITION p20201005 VALUES [("20201004"), ("20201005")),
   PARTITION p20201006 VALUES [("20201005"), ("20201006")),
   PARTITION p20201007 VALUES [("20201006"), ("20201007")),
   PARTITION p20201008 VALUES [("20201007"), ("20201008")),
   PARTITION p20201009 VALUES [("20201008"), ("20201009")),
   PARTITION p20201010 VALUES [("20201009"), ("20201010")),
   PARTITION p20201011 VALUES [("20201010"), ("20201011")),
   PARTITION p20201012 VALUES [("20201011"), ("20201012")),
   PARTITION p20201013 VALUES [("20201012"), ("20201013")),
   PARTITION p20201014 VALUES [("20201013"), ("20201014")),
   PARTITION p20201015 VALUES [("20201014"), ("20201015")),
   PARTITION p20201016 VALUES [("20201015"), ("20201016")),
   PARTITION p20201017 VALUES [("20201016"), ("20201017")),
   PARTITION p20201018 VALUES [("20201017"), ("20201018")),
   PARTITION p20201019 VALUES [("20201018"), ("20201019")),
   PARTITION p20201020 VALUES [("20201019"), ("20201020")),
   PARTITION p20201021 VALUES [("20201020"), ("20201021")),
   PARTITION p20201022 VALUES [("20201021"), ("20201022")),
   PARTITION p20201023 VALUES [("20201022"), ("20201023")),
   PARTITION p20201024 VALUES [("20201023"), ("20201024")),
   PARTITION p20201025 VALUES [("20201024"), ("20201025")),
   PARTITION p20201026 VALUES [("20201025"), ("20201026")),
   PARTITION p20201027 VALUES [("20201026"), ("20201027")),
   PARTITION p20201028 VALUES [("20201027"), ("20201028")),
   PARTITION p20201029 VALUES [("20201028"), ("20201029")),
   PARTITION p20201030 VALUES [("20201029"), ("20201030")),
   PARTITION p20201031 VALUES [("20201030"), ("20201031")))
   DISTRIBUTED BY HASH(`id`) BUCKETS 5
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "DEFAULT"
   );
   
   SELECT *
   FROM `test`.`test_t`
   WHERE `dt` >= 20200801
   and `dt` < 20201101
   AND `id` = 1
   AND `name` = 'x'
   AND substr(`dt`, 7, 8) in ('09')
   ;
   
   ```
   
   **Expected behavior**
   Here `key.castTo(destType)` returns `CastExpr`
   
https://github.com/apache/incubator-doris/blob/b1c1ffda4a0d5ff2f0be4f9d2f25997a31537ea8/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionKey.java#L135-L150
   Maybe should call `getResultValue()`
   Does anyone have other advice?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to