Repository: apache/shardingsphere
Issue: Result data incomplete when there's Limit sub clause

## Bug Report

### Which version of ShardingSphere did you use?

3.0.1-SNAPSHOT

### Which project did you use? Sharding-JDBC or Sharding-Proxy?

Sharding-JDBC and Sharding-Proxy

### Expected behavior

Take ShardingType.SHARDING_DATABASES for example:

The SQL is single routed to demo_ds_0.t_order.

SELECT * FROM t_order WHERE user_id = 0 LIMIT 5, 10;
10 rows are expected:
order_id: 0, user_id: 0, status: 6
order_id: 0, user_id: 0, status: 7
order_id: 0, user_id: 0, status: 8
order_id: 0, user_id: 0, status: 9
order_id: 0, user_id: 0, status: 10
order_id: 0, user_id: 0, status: 11
order_id: 0, user_id: 0, status: 12
order_id: 0, user_id: 0, status: 13
order_id: 0, user_id: 0, status: 14
order_id: 0, user_id: 0, status: 15

### Actual behavior

Get 5 rows result:
order_id: 0, user_id: 0, status: 11
order_id: 0, user_id: 0, status: 12
order_id: 0, user_id: 0, status: 13
order_id: 0, user_id: 0, status: 14
order_id: 0, user_id: 0, status: 15

### Reason analyze (If you can)

This will be happen only on single routing which do not rewrite the logical SQL's Limit sub clause.
5 rows is skipped. 5 is the offset of Limit sub clause. This is duo to offset skipping procedure in merge step.
When single routing, offset should not be skipped.

### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Take ShardingType.SHARDING_DATABASES for example:

The SQL is single routed to demo_ds_0.t_order.

SELECT * FROM t_order WHERE user_id = 0 LIMIT 5, 10;

### Example codes for reproduce this issue (such as a github link).

Offical example.

Changed files:
sharding-core/src/test/java/io/shardingsphere/core/merger/dql/DQLMergeEngineTest.java
sharding-core/src/main/java/io/shardingsphere/core/merger/dql/DQLMergeEngine.java

diff --git a/sharding-core/src/main/java/io/shardingsphere/core/merger/dql/DQLMergeEngine.java b/sharding-core/src/main/java/io/shardingsphere/core/merger/dql/DQLMergeEngine.java
index 9077f445e92..9cd897d915d 100644
--- a/sharding-core/src/main/java/io/shardingsphere/core/merger/dql/DQLMergeEngine.java
+++ b/sharding-core/src/main/java/io/shardingsphere/core/merger/dql/DQLMergeEngine.java
@@ -120,7 +120,7 @@ public final class DQLMergeEngine implements MergeEngine {
     
     private MergedResult decorate(final MergedResult mergedResult) throws SQLException {
         Limit limit = selectStatement.getLimit();
-        if (null == limit) {
+        if (null == limit || 1 == queryResults.size()) {
             return mergedResult;
         }
         if (DatabaseType.MySQL == limit.getDatabaseType() || DatabaseType.PostgreSQL == limit.getDatabaseType() || DatabaseType.H2 == limit.getDatabaseType()) {
diff --git a/sharding-core/src/test/java/io/shardingsphere/core/merger/dql/DQLMergeEngineTest.java b/sharding-core/src/test/java/io/shardingsphere/core/merger/dql/DQLMergeEngineTest.java
index e3633e3e532..97939af1b12 100644
--- a/sharding-core/src/test/java/io/shardingsphere/core/merger/dql/DQLMergeEngineTest.java
+++ b/sharding-core/src/test/java/io/shardingsphere/core/merger/dql/DQLMergeEngineTest.java
@@ -18,6 +18,7 @@
 package io.shardingsphere.core.merger.dql;
 
 import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
 import io.shardingsphere.core.constant.AggregationType;
 import io.shardingsphere.core.constant.DatabaseType;
 import io.shardingsphere.core.constant.OrderDirection;
@@ -41,6 +42,7 @@ import org.junit.Test;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
@@ -53,6 +55,8 @@ public final class DQLMergeEngineTest {
     
     private DQLMergeEngine mergeEngine;
     
+    private List<QueryResult> singleQueryResult;
+    
     private List<QueryResult> queryResults;
     
     private SelectStatement selectStatement;
@@ -65,7 +69,12 @@ public final class DQLMergeEngineTest {
         when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
         when(resultSetMetaData.getColumnCount()).thenReturn(1);
         when(resultSetMetaData.getColumnLabel(1)).thenReturn("count(*)");
-        queryResults = Collections.<QueryResult>singletonList(new TestQueryResult(resultSet));
+        singleQueryResult = Collections.<QueryResult>singletonList(new TestQueryResult(resultSet));
+        List<ResultSet> resultSets = Lists.newArrayList(resultSet, mock(ResultSet.class), mock(ResultSet.class), mock(ResultSet.class));
+        queryResults = new ArrayList<>(resultSets.size());
+        for (ResultSet each : resultSets) {
+            queryResults.add(new TestQueryResult(each));
+        }
         selectStatement = new SelectStatement();
     }
     
@@ -75,6 +84,13 @@ public final class DQLMergeEngineTest {
         assertThat(mergeEngine.merge(), instanceOf(IteratorStreamMergedResult.class));
     }
     
+    @Test
+    public void assertBuildIteratorStreamMergedResultWithLimit() throws SQLException {
+        selectStatement.setLimit(new Limit(DatabaseType.MySQL));
+        mergeEngine = new DQLMergeEngine(singleQueryResult, selectStatement);
+        assertThat(mergeEngine.merge(), instanceOf(IteratorStreamMergedResult.class));
+    }
+    
     @Test
     public void assertBuildIteratorStreamMergedResultWithMySQLLimit() throws SQLException {
         selectStatement.setLimit(new Limit(DatabaseType.MySQL));