linghengqian commented on code in PR #30868: URL: https://github.com/apache/shardingsphere/pull/30868#discussion_r1718104027
########## proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/fieldlist/MySQLComFieldListPacketExecutor.java: ########## @@ -53,7 +53,7 @@ @RequiredArgsConstructor public final class MySQLComFieldListPacketExecutor implements CommandExecutor { - private static final String SQL = "SHOW COLUMNS FROM %s FROM %s"; + private static final String SQL = "SHOW COLUMNS FROM `%s` FROM %s"; Review Comment: - I saw your email, but it feels weird to reply to code via email, so I'll just comment on the current PR. You can actually create a class called `org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.fieldlist.MySQLComFieldListPacketExecutorTest` directly, and then mock the exceptions on the MySQL Server side. I don't think any integration tests are needed here. To a large extent I would say this is a hack to get unit test coverage. - The stack trace you issued in #30867 does not involve `org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.fieldlist.MySQLComFieldListPacketExecutor`. So I assume you can mock the following three logics of `MySQLComFieldListPacketExecutor#execute()`. Because `private static final String SQL = "SHOW COLUMNS FROM %s FROM %s";` is actually only read in these three places. ``` SQLStatement sqlStatement = sqlParserRule.getSQLParserEngine(TypedSPILoader.getService(DatabaseType.class, "MySQL")).parse(sql, false); HintValueContext hintValueContext = SQLHintUtils.extractHint(sql); QueryContext queryContext = new QueryContext(sqlStatementContext, sql, Collections.emptyList(), hintValueContext, connectionSession.getConnectionContext(), metaDataContexts.getMetaData()); ``` - Since I don't have the failed test case, it's hard for me to say that I know which logic really needs to be mocked. -- 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-unsubscr...@shardingsphere.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org