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

wuweijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 7721ed0eae8 fix issue #18528 (#19640)
7721ed0eae8 is described below

commit 7721ed0eae8411f06bd9c0a86e9f09af4efde85f
Author: xuup <[email protected]>
AuthorDate: Thu Jul 28 19:27:38 2022 +0800

    fix issue #18528 (#19640)
---
 .../proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java
index d96885d3554..1282dd8af20 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java
@@ -51,6 +51,7 @@ import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
 import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowProcessListStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTablesStatement;
 
+import java.util.Iterator;
 import java.util.Collection;
 import java.util.Optional;
 
@@ -137,8 +138,10 @@ public final class MySQLAdminExecutorCreator implements 
DatabaseAdminExecutorCre
     }
     
     private boolean isShowSpecialFunction(final SelectStatement sqlStatement, 
final String functionName) {
-        ProjectionSegment firstProjection = 
sqlStatement.getProjections().getProjections().iterator().next();
-        return firstProjection instanceof ExpressionProjectionSegment && 
functionName.equalsIgnoreCase(((ExpressionProjectionSegment) 
firstProjection).getText());
+        Iterator<ProjectionSegment> segmentIterator = 
sqlStatement.getProjections().getProjections().iterator();
+        ProjectionSegment firstProjection = segmentIterator.next();
+        return !segmentIterator.hasNext() && firstProjection instanceof 
ExpressionProjectionSegment
+                && 
functionName.equalsIgnoreCase(((ExpressionProjectionSegment) 
firstProjection).getText());
     }
     
     private boolean isQueryInformationSchema(final SelectStatement 
sqlStatement) {

Reply via email to