[bug] sql函数str_to_date函数针对空格字符处理有问题,针对null,空字符串的处理结果正确

Viewed 45

版本:V2.0.9

现象:

第6行能够正常插入进去,但三方工具或者jdbc协议查询必定报错,mysql client查询正常。
Snipaste 2025-03-07 18.31.17.png

复现步骤:

use ods_dev;
CREATE TABLE if not exists `test_empty_value_20250306`
(
    `bill_pk`                      varchar(150)  NOT NULL COMMENT '任务流水主键',
    `flow_proc_end_time`           datetime      NULL COMMENT '流程结束时间'
)
    ENGINE = OLAP
    UNIQUE KEY(`bill_pk`)
    COMMENT '流程详情表'DISTRIBUTED BY HASH(`bill_pk`) BUCKETS 1
    PROPERTIES ("is_being_synced" = "false","storage_format" = "V2",
    "enable_unique_key_merge_on_write" = "true",
    "light_schema_change" = "true",
    "disable_auto_compaction" = "false",
    "enable_single_replica_compaction" = "false");

insert into test_empty_value_20250306 values ('1', null);
insert into test_empty_value_20250306 values ('2', '');
insert into test_empty_value_20250306 values ('3', ' ');
insert into test_empty_value_20250306 values ('4', STR_TO_DATE (null, '%Y-%m-%d %H:%i:%s') );
insert into test_empty_value_20250306 values ('5', STR_TO_DATE ('', '%Y-%m-%d %H:%i:%s'));
insert into test_empty_value_20250306 values ('6', STR_TO_DATE (' ', '%Y-%m-%d %H:%i:%s'));

select * from test_empty_value_20250306;

select * from  test_empty_value_20250306 where bill_pk = '1';
select * from  test_empty_value_20250306 where bill_pk = '2';
select * from  test_empty_value_20250306 where bill_pk = '3';
select * from  test_empty_value_20250306 where bill_pk = '4';
select * from  test_empty_value_20250306 where bill_pk = '5';
select * from  test_empty_value_20250306 where bill_pk = '6';

drop table test_empty_value_20250306;
1 Answers

这个问题我们在跟进中,之后会在各个新版本修复