This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new b17c421f52 [fix](datetime) will get String index out of range
exception (#17735)
b17c421f52 is described below
commit b17c421f52439869dd225742d1b7c1d21d49341a
Author: xueweizhang <[email protected]>
AuthorDate: Thu Mar 16 16:13:47 2023 +0800
[fix](datetime) will get String index out of range exception (#17735)
will get String index out of range exception when use error datetime values
like '2020-02-01'
before:
MySQL [test]> select test121.k1 from test121 where k1 != ('9102-12-');
ERROR 1105 (HY000): errCode = 2, detailMessage = Unexpected exception:
String index out of range: 8
after:
MySQL [test]> select test121.k1 from test121 where k1 = '9102-12-';
ERROR 1105 (HY000): errCode = 2, detailMessage = Incorrect datetime value:
'9102-12-' in expression: k1 = '9102-12-'
Signed-off-by: nextdreamblue <[email protected]>
---
fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
index 969ae83877..1063f67345 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
@@ -1630,8 +1630,8 @@ public class DateLiteral extends LiteralExpr {
continue;
}
// escape separator
- while (pre < dateStr.length() &&
(Character.toString(dateStr.charAt(pre)).matches("\\p{Punct}"))
- || Character.isSpaceChar(dateStr.charAt(pre))) {
+ while (pre < dateStr.length() &&
((Character.toString(dateStr.charAt(pre)).matches("\\p{Punct}"))
+ || Character.isSpaceChar(dateStr.charAt(pre)))) {
if (Character.isSpaceChar(dateStr.charAt(pre))) {
if (((1 << fieldIdx) & ALLOW_SPACE_MASK) == 0) {
throw new AnalysisException("parse datetime value
failed: " + dateStr);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]