This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 307c61f9e3ade831e0dcedf9fad36a8b9b5345e6
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 d7615151f1..eb9973ff94 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
@@ -1619,8 +1619,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]

Reply via email to