felixwluo opened a new issue, #26153:
URL: https://github.com/apache/doris/issues/26153

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   branch-1.2-lts
   
   ### What's Wrong?
   
   CREATE TABLE `test_table_datev2` (
     `user_id` largeint(40) NOT NULL COMMENT '用户id',
     `username` varchar(50) NOT NULL COMMENT '用户昵称',
     `dt` date NULL COMMENT '分区',
     `city` varchar(20) NULL COMMENT '用户所在城市',
     `create_time` datetimeV2 NULL
   ) ENGINE=OLAP
   UNIQUE KEY(`user_id`, `username`, `dt`)
   COMMENT 'OLAP'
   PARTITION BY RANGE(`dt`)
   (PARTITION P20231101 VALUES [('2023-11-01'), ('2023-11-02')),
   PARTITION P20231102 VALUES [('2023-11-02'), ('2023-11-03')))
   DISTRIBUTED BY HASH(`user_id`) BUCKETS 1
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "dynamic_partition.enable" = "true",
   "dynamic_partition.time_unit" = "DAY",
   "dynamic_partition.time_zone" = "Asia/Shanghai",
   "dynamic_partition.start" = "-7",
   "dynamic_partition.end" = "7",
   "dynamic_partition.prefix" = "P",
   "dynamic_partition.replication_allocation" = "tag.location.default: 1",
   "dynamic_partition.buckets" = "2",
   "dynamic_partition.create_history_partition" = "true",
   "dynamic_partition.history_partition_num" = "-1",
   "dynamic_partition.hot_partition_num" = "0",
   "dynamic_partition.reserved_history_periods" = "NULL",
   "dynamic_partition.storage_policy" = "",
   "dynamic_partition.storage_medium" = "HDD",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   insert into test.test_table_datev2 values 
(1,'xyz','2023-10-27','gz','2023-10-16 11:17:06');
   select query: select TIMESTAMPDIFF(MONTH, '2023-09-01', create_time), 
TIMESTAMPDIFF(MONTH, '2023-09-01','202310-16 11:17:06') from 
test.test_table_datev2 where user_id = 1;
   The correct result of the first query should be 1, but the result is 0
   
   ### What You Expected?
   
   <img width="1244" alt="企业微信截图_4b8c597c-f639-48de-9ea9-94acca646f61" 
src="https://github.com/apache/doris/assets/131352377/f7d71925-29e8-4686-a078-9e4a6bf76a5d";>
   
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org

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