apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.66k stars 3.27k forks source link

[Bug] Mysql date formate error where conditions in #12088

Closed sogngenWang closed 2 years ago

sogngenWang commented 2 years ago

Search before asking

Version

apache-doris-1.1.1

What's Wrong?

when use from_unixtime function in mysql client , it return wrong count and detail data from sql . like below: image

What You Expected?

it should return the same data with %s and %S in mysql date formate . which in my examle , it should also return 24 record instead of 18 record.

How to Reproduce?

create a unique table with long type of createtime. then select the data from it with from_unixtime and use %s or %s formate.

Anything Else?

No response

Are you willing to submit PR?

Code of Conduct

sogngenWang commented 2 years ago

CREATE TABLE l_test_log_3 ( uniqueid varchar(40) NULL COMMENT "", kid int(11) NULL COMMENT "", createtime int(11) NULL COMMENT "", dorisdate date NULL COMMENT "" ) ENGINE=OLAP UNIQUE KEY(uniqueid, kid, createtime, dorisdate) COMMENT "OLAP" PARTITION BY RANGE(dorisdate)() DISTRIBUTED BY HASH(uniqueid) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "dynamic_partition.enable" = "true", "dynamic_partition.time_unit" = "DAY", "dynamic_partition.time_zone" = "-05:00", "dynamic_partition.start" = "-3", "dynamic_partition.end" = "1", "dynamic_partition.prefix" = "p", "dynamic_partition.replication_allocation" = "tag.location.default: 1", "dynamic_partition.buckets" = "1", "dynamic_partition.create_history_partition" = "true", "dynamic_partition.history_partition_num" = "3", "dynamic_partition.hot_partition_num" = "0", "dynamic_partition.reserved_history_periods" = "NULL", "in_memory" = "false", "storage_format" = "V2" ) ;

insert into l_test_log_3 values('0',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('1',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('2',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('3',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('4',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('5',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('6',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('7',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('8',1,1661339109,'2022-08-24'); insert into l_test_log_3 values('9',1,1661339109,'2022-08-24');

select count(1) from l_test_log_3 where from_unixtime(createtime,'%Y-%m-%d %H:%i:%s')='2022-08-24 19:05:09' ; select count(1) from l_test_log_3 where from_unixtime(createtime,'%Y-%m-%d %H:%i:%S')='2022-08-24 19:05:09' ;

sogngenWang commented 2 years ago

b1332531355587c3b666006adcb8f3c

721459bb020b99648421b17c8aad8e8

sogngenWang commented 2 years ago

It is ok in version apache doris release v1.1.2