From e4a857f51c8129d288f1949d6596d236d7d72709 Mon Sep 17 00:00:00 2001 From: Zhengqiang Duan Date: Fri, 18 Oct 2024 19:43:45 +0800 Subject: [PATCH] Add exclude field in SubstitutableColumnNameToken to avoid token duplicate (#33307) * Add exclude field in SubstitutableColumnNameToken to avoid token duplicate * fix unit test --- .../engine/segment/from/type/SimpleTableSegmentBinder.java | 2 +- .../common/pojo/generic/SubstitutableColumnNameToken.java | 3 ++- 2 files changed, 3 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 f02b27f33e53c..11efe5897433d 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 @@ -123,7 +123,7 @@ private static void checkTableExists(final SQLStatementBinderContext binderConte if (SystemSchemaManager.isSystemTable(schemaName, tableName)) { return; } - if (binderContext.getExternalTableBinderContexts().containsKey(tableName)) { + if (binderContext.getExternalTableBinderContexts().containsKey(new CaseInsensitiveString(tableName))) { return; } ShardingSpherePreconditions.checkState(binderContext.getMetaData().containsDatabase(databaseName) diff --git a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/pojo/generic/SubstitutableColumnNameToken.java b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/pojo/generic/SubstitutableColumnNameToken.java index e7d114d406e54..e4cec11c35447 100644 --- a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/pojo/generic/SubstitutableColumnNameToken.java +++ b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/pojo/generic/SubstitutableColumnNameToken.java @@ -39,7 +39,8 @@ /** * Substitutable column name token. */ -@EqualsAndHashCode(callSuper = false) +// TODO remove @EqualsAndHashCode in token rewriter +@EqualsAndHashCode(callSuper = false, exclude = "projections") public final class SubstitutableColumnNameToken extends SQLToken implements Substitutable, RouteUnitAware { private static final String COLUMN_NAME_SPLITTER = ", ";