You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "jiangtao69039 (via GitHub)" <gi...@apache.org> on 2023/03/17 09:06:02 UTC

[GitHub] [shardingsphere] jiangtao69039 opened a new pull request, #24667: Fix mysql cast function parsing error (#24637)

jiangtao69039 opened a new pull request, #24667:
URL: https://github.com/apache/shardingsphere/pull/24667

   Fixes #24637 
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #24667: Fix mysql cast function parsing error (#24637)

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on code in PR #24667:
URL: https://github.com/apache/shardingsphere/pull/24667#discussion_r1141319431


##########
sql-parser/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java:
##########
@@ -907,7 +908,19 @@ public final ASTNode visitCastFunction(final CastFunctionContext ctx) {
                 result.getParameters().add((LiteralExpressionSegment) expr);
             }
         }
-        result.getParameters().add((DataTypeSegment) visit(ctx.dataType()));
+        if (null != ctx.dataType()) {
+            result.getParameters().add((DataTypeSegment) visit(ctx.dataType()));
+        }
+        if (null != ctx.DATETIME()) {
+            DataTypeSegment dataType = new DataTypeSegment();
+            dataType.setDataTypeName(ctx.DATETIME().getText());
+            dataType.setStartIndex(ctx.DATETIME().getSymbol().getStartIndex());
+            dataType.setStopIndex(ctx.DATETIME().getSymbol().getStopIndex());
+            if (ctx.typeDatetimePrecision() != null) {

Review Comment:
   Same problem here. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #24667: Fix mysql cast function parsing error (#24637)

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on code in PR #24667:
URL: https://github.com/apache/shardingsphere/pull/24667#discussion_r1141247366


##########
sql-parser/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java:
##########
@@ -907,7 +908,19 @@ public final ASTNode visitCastFunction(final CastFunctionContext ctx) {
                 result.getParameters().add((LiteralExpressionSegment) expr);
             }
         }
-        result.getParameters().add((DataTypeSegment) visit(ctx.dataType()));
+        if (ctx.dataType() != null) {

Review Comment:
   Please put `null` to the left of the equals sign, thank you!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on pull request #24667: Fix mysql cast function parsing error (#24637)

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on PR #24667:
URL: https://github.com/apache/shardingsphere/pull/24667#issuecomment-1475520008

   @jiangtao69039 Merged, thank you~


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang merged pull request #24667: Fix mysql cast function parsing error (#24637)

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang merged PR #24667:
URL: https://github.com/apache/shardingsphere/pull/24667


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org