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

duanzhengqiang 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 c55155f2705 Minor refactor for 
SimpleTableSegmentBinder#createSimpleTableBinderContext method (#32123)
c55155f2705 is described below

commit c55155f27051d112b32e00c82d408a7904003cea
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Tue Jul 16 15:43:38 2024 +0800

    Minor refactor for SimpleTableSegmentBinder#createSimpleTableBinderContext 
method (#32123)
---
 .../engine/segment/from/type/SimpleTableSegmentBinder.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/from/type/SimpleTableSegmentBinder.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/from/type/SimpleTableSegmentBinder.java
index 69b9f47fbc8..0fccc867238 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/from/type/SimpleTableSegmentBinder.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/from/type/SimpleTableSegmentBinder.java
@@ -133,9 +133,15 @@ public final class SimpleTableSegmentBinder {
     private static SimpleTableSegmentBinderContext 
createSimpleTableBinderContext(final SimpleTableSegment segment, final 
ShardingSphereSchema schema, final IdentifierValue databaseName,
                                                                                
   final IdentifierValue schemaName, final SQLStatementBinderContext 
binderContext) {
         IdentifierValue tableName = segment.getTableName().getIdentifier();
-        if 
(!binderContext.getMetaData().getDatabase(databaseName.getValue()).getSchema(schemaName.getValue()).containsTable(tableName.getValue()))
 {
-            return new 
SimpleTableSegmentBinderContext(Collections.emptyList());
+        if 
(binderContext.getMetaData().getDatabase(databaseName.getValue()).getSchema(schemaName.getValue()).containsTable(tableName.getValue()))
 {
+            return createSimpleTableSegmentBinderContextWithMetaData(segment, 
schema, databaseName, schemaName, binderContext, tableName);
         }
+        return new SimpleTableSegmentBinderContext(Collections.emptyList());
+    }
+    
+    private static SimpleTableSegmentBinderContext 
createSimpleTableSegmentBinderContextWithMetaData(final SimpleTableSegment 
segment, final ShardingSphereSchema schema,
+                                                                               
                      final IdentifierValue databaseName, final IdentifierValue 
schemaName,
+                                                                               
                      final SQLStatementBinderContext binderContext, final 
IdentifierValue tableName) {
         Collection<ProjectionSegment> projectionSegments = new LinkedList<>();
         QuoteCharacter quoteCharacter = new 
DatabaseTypeRegistry(binderContext.getDatabaseType()).getDialectDatabaseMetaData().getQuoteCharacter();
         for (ShardingSphereColumn each : 
schema.getTable(tableName.getValue()).getColumnValues()) {

Reply via email to