From b7311959d25dbf86104197fef14ac93a8e10d93e Mon Sep 17 00:00:00 2001 From: wuyu Date: Mon, 25 Mar 2019 19:25:35 +0800 Subject: [PATCH] fix SQL rewrite issue --- .../core/route/router/sharding/ParsingSQLRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ParsingSQLRouter.java b/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ParsingSQLRouter.java index 95b0dad10e381..f37ba5e0514d3 100644 --- a/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ParsingSQLRouter.java +++ b/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ParsingSQLRouter.java @@ -102,7 +102,7 @@ public SQLRouteResult route(final String logicSQL, final List parameters mergeShardingValues(optimizeResult.getShardingConditions()); } RoutingResult routingResult = RoutingEngineFactory.newInstance(shardingRule, shardingMetaData.getDataSource(), sqlStatement, optimizeResult).route(); - if (sqlStatement instanceof SelectStatement && null != ((SelectStatement) sqlStatement).getLimit()) { + if (sqlStatement instanceof SelectStatement && null != ((SelectStatement) sqlStatement).getLimit() && !routingResult.isSingleRouting()) { processLimit(parameters, (SelectStatement) sqlStatement, routingResult.isSingleRouting()); } if (needMerge) {