-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Description
Search before asking
- I had searched in the issues and found no similar issues.
Version
3.1
3.0
master
What's Wrong?
SimplifyArithmeticComparisonRule will simply arranging ComparisonPredicate. But, if overflow, this behavior will result in error result or trigger exception.
For example:
date_sub(i, interval 1 day) <= '9999-12-31' will be rewrited to i <= date_add('9999-12-31', interval 1 day). But, date_add('9999-12-31', interval 1 day) will overflow.
What You Expected?
when overflow, ComparisonPredicate should not be rewritten.
How to Reproduce?
create table test_rewrite_arithmetic (`i` datetime NOT NULL) PROPERTIES ("replication_allocation" = "tag.location.default: 1");
insert into test_rewrite_arithmetic values('2026-01-20');
select date_sub(i, interval 1 day) <='9999-12-31' from test_rewrite_arithmetic;
3.0/3.1:
+--------------------------------------------+
| date_sub(i, interval 1 day) <='9999-12-31' |
+--------------------------------------------+
| NULL |
+--------------------------------------------+
master:
ERROR 1105 (HY000): errCode = 2, detailMessage = (172.19.0.2)[E-218]Operation day_add of 9999-12-31 00:00:00, 1 out of range
Anything Else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels