You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2024/12/09 10:52:07 UTC
(shardingsphere) branch master updated: Fix sharding column route (#33974)
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 f33a6a2bb4f Fix sharding column route (#33974)
f33a6a2bb4f is described below
commit f33a6a2bb4f608574f13ed54b3a8e8e9ced049b9
Author: ZhangCheng <ch...@apache.org>
AuthorDate: Mon Dec 9 18:51:59 2024 +0800
Fix sharding column route (#33974)
---
.../engine/condition/engine/WhereClauseShardingConditionEngine.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngine.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngine.java
index 7613839e394..752f68dbff1 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngine.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngine.java
@@ -120,7 +120,8 @@ public final class WhereClauseShardingConditionEngine {
Map<Column, Collection<ShardingConditionValue>> result = new HashMap<>(predicates.size(), 1F);
for (ExpressionSegment each : predicates) {
for (ColumnSegment columnSegment : ColumnExtractor.extract(each)) {
- Optional<String> tableName = Optional.ofNullable(columnTableNames.get(columnSegment.getExpression()));
+ Optional<String> tableName = Optional.ofNullable(Optional.ofNullable(columnTableNames.get(columnSegment.getExpression()))
+ .orElse(columnSegment.getColumnBoundInfo().getOriginalTable().getValue()));
Optional<String> shardingColumn = tableName.flatMap(optional -> shardingRule.findShardingColumn(columnSegment.getColumnBoundInfo().getOriginalColumn().getValue(), optional));
if (!tableName.isPresent() || !shardingColumn.isPresent()) {
continue;