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

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


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new f5aa4f91fa [cherry-pick](flex) support scientific notation(aEb) parser 
(#22345)
f5aa4f91fa is described below

commit f5aa4f91fab139ae697a9d421f6852941d5c4a7f
Author: zhangstar333 <87313068+zhangstar...@users.noreply.github.com>
AuthorDate: Fri Jul 28 17:24:26 2023 +0800

    [cherry-pick](flex) support scientific notation(aEb) parser (#22345)
---
 fe/fe-core/src/main/jflex/sql_scanner.flex | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/jflex/sql_scanner.flex 
b/fe/fe-core/src/main/jflex/sql_scanner.flex
index 597c23eec1..52dcdd5e8d 100644
--- a/fe/fe-core/src/main/jflex/sql_scanner.flex
+++ b/fe/fe-core/src/main/jflex/sql_scanner.flex
@@ -597,7 +597,8 @@ FLit1 = [0-9]+ \. [0-9]*
 FLit2 = \. [0-9]+
 FLit3 = [0-9]+
 Exponent = [eE] [+-]? [0-9]+
-DoubleLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}?
+DoubleLiteral = ({FLit1}|{FLit2}|{FLit3})
+ExponentLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}
 
 EolHintBegin = "--" " "* "+"
 CommentedHintBegin = "/*" " "* "+"
@@ -656,6 +657,17 @@ EndOfLineComment = "--" 
!({HintContent}|{ContainsLineTerminator}) {LineTerminato
 "'" { return newToken(SqlParserSymbols.UNMATCHED_STRING_LITERAL, null); }
 "`" { return newToken(SqlParserSymbols.UNMATCHED_STRING_LITERAL, null); }
 
+{ExponentLiteral} {
+   BigDecimal decimal_val;
+   try {
+     decimal_val = new BigDecimal(yytext());
+   } catch (NumberFormatException e) {
+     return newToken(SqlParserSymbols.NUMERIC_OVERFLOW, yytext());
+   }
+
+   return newToken(SqlParserSymbols.DECIMAL_LITERAL, decimal_val);
+ }
+
 {QuotedIdentifier} {
     // Remove the quotes
     String trimmedIdent = yytext().substring(1, yytext().length() - 1);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to