Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] (DATE) Invalid date string is recognized as valid #46902

Closed
3 tasks done
liutang123 opened this issue Jan 13, 2025 · 1 comment
Closed
3 tasks done

[Bug] (DATE) Invalid date string is recognized as valid #46902

liutang123 opened this issue Jan 13, 2025 · 1 comment

Comments

@liutang123
Copy link
Contributor

liutang123 commented Jan 13, 2025

Search before asking

  • I had searched in the issues and found no similar issues.

Version

2.0
2.1

What's Wrong?

CREATE TABLE `aec` (
  `CD` date NOT NULL,
  `PI` varchar(160) NOT NULL
) ENGINE=OLAP
UNIQUE KEY(`CD`, `PI`)
PARTITION BY RANGE(`CD`)
(PARTITION p_0 VALUES [('0000-01-01'), ('2018-01-01')),
PARTITION p_1 VALUES [('2028-01-01'), ('9999-01-01')))
DISTRIBUTED BY HASH(`CD`, `PI`) BUCKETS 2
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
); 
insert into aec (`CD`, `PI`) values ('2028-01-01', '2028-01-01__wer1q23rads');

-- In 2.0 and 2.1
select PI,  trim(PI),cast(PI  AS datetimev2),cast(trim(PI)  AS datetimev2) from aec where CD = trim('2028-01-01_')\G

*************************** 1. row ***************************
                               PI: 2028-01-01__wer1q23rads
                       trim(`PI`): 2028-01-01__wer1q23rads
      CAST(`PI` AS datetimev2(0)): 2028-01-01 00:00:00
CAST(trim(`PI`) AS datetimev2(0)): 2028-01-01 00:00:00

-- In master
 select PI, CD,  trim(PI),cast(PI  AS datetimev2),cast(trim(PI) AS datetimev2), PI=CD from aec where CD = trim('2028-01-01') and  PI=CD\G
*************************** 1. row ***************************
                                                     PI: 2028-01-01__wer1q23rads
                                                     CD: 2028-01-01
                                               trim(PI): 2028-01-01__wer1q23rads
                              cast(PI as DATETIMEV2(0)): 2028-01-01 00:00:00
                        cast(trim(PI) as DATETIMEV2(0)): 2028-01-01 00:00:00
(cast(PI as DATETIMEV2(0)) = cast(CD as DATETIMEV2(0))): 1

What You Expected?

The value 2028-01-01__wer1q23rads is a invalid date.

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@liutang123
Copy link
Contributor Author

Making the format strict can lead to more problems sunch as select cast(123.123 as date).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant