You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "xuse (via GitHub)" <gi...@apache.org> on 2024/10/22 11:01:27 UTC

[I] When MySQLFormatVisitor visit 'PrecisionContext', got duplicate text "(p,s)(p,s)" [shardingsphere]

xuse opened a new issue, #33349:
URL: https://github.com/apache/shardingsphere/issues/33349

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   shardingsphere-parser-sql-mysql-5.5.0.jar 
   v5.5.0
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   shardingsphere-parser-sql-mysql-5.5.0.jar
   
   ```java
   	@Test
   	public void shardSphereBug() {
   		final SQLParserEngine parser = new SQLParserEngine("mysql", new CacheOption(100, 100));
   		ParseASTNode node = parser.parse("create table t(c DECIMAL (5,1))", false);
   				String sql=node.getRootNode().accept(new MySQLFormatVisitor());
   		System.out.println(sql);
   		assertFalse(sql.contains("(5, 1)(5 , 1)"));
   	}
   ```
   
   
   ### Expected behavior
   
   The unit test should print 
   >   CREATE TABLE t ( c DECIMAL(5, 1)
   
   BUT actually is
   
   >  CREATE TABLE t (c DECIMAL(5, 1)(5 , 1))
   
   
   ### Actual behavior
   
   BUT actually is
   
   >  CREATE TABLE t (c DECIMAL(5, 1)(5 , 1))
   
   ### Reason analyze (If you can)
   
    原因是这个文件
   https://github.com/apache/shardingsphere/blob/master/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/MySQLFormatVisitor.java
   
    第 #636 行,应该是
   
   ```java
   return formattedSQL.toString();
   ```
   但是笔误为
   ```java
   return super.visitPrecision(ctx);
   ```
   造成访问器访问了两遍!
   
   Please fix it ASAP, Thanks.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   See the unit test case. above.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   See the unit test case. above.
   


-- 
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.apache.org

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


Re: [I] When MySQLFormatVisitor visit 'PrecisionContext', got duplicate text "(p,s)(p,s)" [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #33349: When MySQLFormatVisitor visit 'PrecisionContext', got duplicate text "(p,s)(p,s)"
URL: https://github.com/apache/shardingsphere/issues/33349


-- 
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


Re: [I] When MySQLFormatVisitor visit 'PrecisionContext', got duplicate text "(p,s)(p,s)" [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #33349:
URL: https://github.com/apache/shardingsphere/issues/33349#issuecomment-2429317004

   **For English only**, other languages will not accept.


-- 
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


Re: [I] When MySQLFormatVisitor visit 'PrecisionContext', got duplicate text "(p,s)(p,s)" [shardingsphere]

Posted by "xuse (via GitHub)" <gi...@apache.org>.
xuse commented on issue #33349:
URL: https://github.com/apache/shardingsphere/issues/33349#issuecomment-2428980462

   我以为是我的代码写错了,调试了三个小时,今天不得不加班了 :-((


-- 
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