You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2020/11/29 07:43:27 UTC

[shardingsphere] branch master updated: Use QueryResult.getMetaData instead of metadata methods (#8405)

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

menghaoran 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 6d1f786  Use QueryResult.getMetaData instead of metadata methods (#8405)
6d1f786 is described below

commit 6d1f7862cf269b60e3fe0301d52e7131a54a753d
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Nov 29 15:42:55 2020 +0800

    Use QueryResult.getMetaData instead of metadata methods (#8405)
    
    * Add JDBCQueryResultMetaData
    
    * Use QueryResult.getMetaData instead of metadata methods
    
    * Fix test cases
---
 .../merge/dql/ShardingDQLResultMerger.java         |  4 +-
 .../dql/groupby/GroupByMemoryMergedResult.java     |  4 +-
 .../dql/groupby/GroupByStreamMergedResult.java     |  2 +-
 .../sharding/merge/dql/orderby/OrderByValue.java   |  2 +-
 .../dal/show/ShowCreateTableMergedResultTest.java  |  4 +-
 .../merge/dal/show/ShowTablesMergedResultTest.java |  4 +-
 .../merge/dql/ShardingDQLResultMergerTest.java     | 13 +--
 .../dql/groupby/GroupByMemoryMergedResultTest.java | 15 ++--
 .../dql/groupby/GroupByRowComparatorTest.java      |  5 +-
 .../dql/groupby/GroupByStreamMergedResultTest.java | 23 ++---
 .../iterator/IteratorStreamMergedResultTest.java   | 15 ++--
 .../dql/orderby/OrderByStreamMergedResultTest.java | 44 ++++++----
 .../pagination/LimitDecoratorMergedResultTest.java |  3 +-
 .../RowNumberDecoratorMergedResultTest.java        |  3 +-
 .../TopAndRowNumberDecoratorMergedResultTest.java  |  3 +-
 .../sql/execute/result/query/QueryResult.java      | 99 +---------------------
 .../{QueryResult.java => QueryResultMetaData.java} | 55 +-----------
 .../result/query/jdbc/MemoryJDBCQueryResult.java   | 12 ++-
 .../result/query/jdbc/StreamJDBCQueryResult.java   | 11 ++-
 .../JDBCQueryResultMetaData.java}                  | 30 +++----
 .../execute/result/query/raw/RawQueryResult.java   | 63 ++------------
 ...ltMetaData.java => RawQueryResultMetaData.java} | 18 +++-
 .../fixture/AbstractJDBCQueryResultFixture.java    | 59 -------------
 .../JDBCQueryResultMetaDataTest.java}              | 17 ++--
 .../result/impl/memory/MemoryQueryResultRow.java   |  2 +-
 .../impl/memory/MemoryQueryResultRowTest.java      |  5 +-
 .../execute/engine/jdbc/JDBCExecuteEngine.java     |  2 +-
 .../backend/response/query/QueryHeaderBuilder.java | 20 ++---
 .../text/admin/ShowTablesBackendHandler.java       |  4 +-
 .../response/query/QueryHeaderBuilderTest.java     | 22 ++---
 .../binary/bind/PostgreSQLComBindExecutor.java     |  2 +-
 .../query/text/PostgreSQLComQueryExecutor.java     |  2 +-
 32 files changed, 177 insertions(+), 390 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMerger.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMerger.java
index 10efc71..0f1a30e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMerger.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMerger.java
@@ -66,8 +66,8 @@ public final class ShardingDQLResultMerger implements ResultMerger {
     
     private Map<String, Integer> getColumnLabelIndexMap(final QueryResult queryResult) throws SQLException {
         Map<String, Integer> result = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
-        for (int i = queryResult.getColumnCount(); i > 0; i--) {
-            result.put(SQLUtil.getExactlyValue(queryResult.getColumnLabel(i)), i);
+        for (int i = queryResult.getMetaData().getColumnCount(); i > 0; i--) {
+            result.put(SQLUtil.getExactlyValue(queryResult.getMetaData().getColumnLabel(i)), i);
         }
         return result;
     }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java
index eff0903..7fe4ba1 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java
@@ -118,7 +118,7 @@ public final class GroupByMemoryMergedResult extends MemoryMergedResult<Sharding
     
     private List<Boolean> getValueCaseSensitive(final QueryResult queryResult, final SelectStatementContext selectStatementContext, final ShardingSphereSchema schema) throws SQLException {
         List<Boolean> result = Lists.newArrayList(false);
-        for (int columnIndex = 1; columnIndex <= queryResult.getColumnCount(); columnIndex++) {
+        for (int columnIndex = 1; columnIndex <= queryResult.getMetaData().getColumnCount(); columnIndex++) {
             result.add(getValueCaseSensitiveFromTables(queryResult, selectStatementContext, schema, columnIndex));
         }
         return result;
@@ -130,7 +130,7 @@ public final class GroupByMemoryMergedResult extends MemoryMergedResult<Sharding
             String tableName = each.getTableName().getIdentifier().getValue();
             TableMetaData tableMetaData = schema.get(tableName);
             Map<String, ColumnMetaData> columns = tableMetaData.getColumns();
-            String columnName = queryResult.getColumnName(columnIndex);
+            String columnName = queryResult.getMetaData().getColumnName(columnIndex);
             if (columns.containsKey(columnName)) {
                 return columns.get(columnName).isCaseSensitive();
             }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResult.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResult.java
index 51425fb..d33cb04 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResult.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResult.java
@@ -102,7 +102,7 @@ public final class GroupByStreamMergedResult extends OrderByStreamMergedResult {
     }
     
     private void cacheCurrentRow() throws SQLException {
-        for (int i = 0; i < getCurrentQueryResult().getColumnCount(); i++) {
+        for (int i = 0; i < getCurrentQueryResult().getMetaData().getColumnCount(); i++) {
             currentRow.add(getCurrentQueryResult().getValue(i + 1, Object.class));
         }
     }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByValue.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByValue.java
index a18e564..c2bdb38 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByValue.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/main/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByValue.java
@@ -80,7 +80,7 @@ public final class OrderByValue implements Comparable<OrderByValue> {
                 }
             } else if (orderByItemSegment instanceof IndexOrderByItemSegment) {
                 int columnIndex = ((IndexOrderByItemSegment) orderByItemSegment).getColumnIndex();
-                String columnName = queryResult.getColumnName(columnIndex);
+                String columnName = queryResult.getMetaData().getColumnName(columnIndex);
                 if (columns.containsKey(columnName)) {
                     return columns.get(columnName).isCaseSensitive();
                 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowCreateTableMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowCreateTableMergedResultTest.java
index d562640..617300e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowCreateTableMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowCreateTableMergedResultTest.java
@@ -76,8 +76,8 @@ public final class ShowCreateTableMergedResultTest {
     }
     
     private QueryResult mockQueryResult() throws SQLException {
-        QueryResult result = mock(QueryResult.class);
-        when(result.getColumnCount()).thenReturn(2);
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
+        when(result.getMetaData().getColumnCount()).thenReturn(2);
         when(result.next()).thenReturn(true, false);
         when(result.getValue(1, Object.class)).thenReturn("table_0");
         when(result.getValue(2, Object.class)).thenReturn("CREATE TABLE `t_order` (\n"
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowTablesMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowTablesMergedResultTest.java
index 2aa1787..92c1a8e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowTablesMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowTablesMergedResultTest.java
@@ -66,10 +66,10 @@ public final class ShowTablesMergedResultTest {
     }
     
     private QueryResult mockQueryResult(final String value) throws SQLException {
-        QueryResult result = mock(QueryResult.class);
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
         when(result.next()).thenReturn(true, false);
         when(result.getValue(1, Object.class)).thenReturn(value);
-        when(result.getColumnCount()).thenReturn(1);
+        when(result.getMetaData().getColumnCount()).thenReturn(1);
         return result;
     }
     
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java
index 3fad0da..6916d50 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java
@@ -60,6 +60,7 @@ import java.util.List;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -321,16 +322,16 @@ public final class ShardingDQLResultMergerTest {
         List<QueryResult> result = new LinkedList<>();
         QueryResult queryResult = createQueryResult();
         result.add(queryResult);
-        result.add(mock(QueryResult.class));
-        result.add(mock(QueryResult.class));
-        result.add(mock(QueryResult.class));
+        result.add(mock(QueryResult.class, RETURNS_DEEP_STUBS));
+        result.add(mock(QueryResult.class, RETURNS_DEEP_STUBS));
+        result.add(mock(QueryResult.class, RETURNS_DEEP_STUBS));
         return result;
     }
     
     private QueryResult createQueryResult() throws SQLException {
-        QueryResult result = mock(QueryResult.class);
-        when(result.getColumnCount()).thenReturn(1);
-        when(result.getColumnLabel(1)).thenReturn("count(*)");
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
+        when(result.getMetaData().getColumnCount()).thenReturn(1);
+        when(result.getMetaData().getColumnLabel(1)).thenReturn("count(*)");
         when(result.getValue(1, Object.class)).thenReturn(0);
         return result;
     }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
index 5dac083..9f70c94 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
@@ -46,6 +46,7 @@ import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -157,13 +158,13 @@ public final class GroupByMemoryMergedResultTest {
     }
     
     private QueryResult createQueryResult() throws SQLException {
-        QueryResult result = mock(QueryResult.class);
-        when(result.getColumnCount()).thenReturn(5);
-        when(result.getColumnLabel(1)).thenReturn("COUNT(*)");
-        when(result.getColumnLabel(2)).thenReturn("AVG(num)");
-        when(result.getColumnLabel(3)).thenReturn("id");
-        when(result.getColumnLabel(4)).thenReturn("AVG_DERIVED_COUNT_0");
-        when(result.getColumnLabel(5)).thenReturn("AVG_DERIVED_SUM_0");
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
+        when(result.getMetaData().getColumnCount()).thenReturn(5);
+        when(result.getMetaData().getColumnLabel(1)).thenReturn("COUNT(*)");
+        when(result.getMetaData().getColumnLabel(2)).thenReturn("AVG(num)");
+        when(result.getMetaData().getColumnLabel(3)).thenReturn("id");
+        when(result.getMetaData().getColumnLabel(4)).thenReturn("AVG_DERIVED_COUNT_0");
+        when(result.getMetaData().getColumnLabel(5)).thenReturn("AVG_DERIVED_SUM_0");
         return result;
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByRowComparatorTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByRowComparatorTest.java
index 35a3d34..41331e3 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByRowComparatorTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByRowComparatorTest.java
@@ -46,6 +46,7 @@ import java.util.List;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -295,8 +296,8 @@ public final class GroupByRowComparatorTest {
         ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class);
         when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
         when(resultSetMetaData.getColumnCount()).thenReturn(values.length);
-        QueryResult result = mock(QueryResult.class);
-        when(result.getColumnCount()).thenReturn(values.length);
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
+        when(result.getMetaData().getColumnCount()).thenReturn(values.length);
         int index = 0;
         for (Object each : values) {
             when(result.getValue(++index, Object.class)).thenReturn(each);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java
index b886eab..4afbca8 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java
@@ -52,6 +52,7 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -186,17 +187,17 @@ public final class GroupByStreamMergedResultTest {
     }
     
     private QueryResult mockQueryResult() throws SQLException {
-        QueryResult result = mock(QueryResult.class);
-        when(result.getColumnCount()).thenReturn(6);
-        when(result.getColumnLabel(1)).thenReturn("COUNT(*)");
-        when(result.getColumnLabel(2)).thenReturn("AVG(num)");
-        when(result.getColumnLabel(3)).thenReturn("id");
-        when(result.getColumnLabel(4)).thenReturn("date");
-        when(result.getColumnLabel(5)).thenReturn("AVG_DERIVED_COUNT_0");
-        when(result.getColumnLabel(6)).thenReturn("AVG_DERIVED_SUM_0");
-        when(result.getColumnName(1)).thenReturn("col1");
-        when(result.getColumnName(2)).thenReturn("col2");
-        when(result.getColumnName(3)).thenReturn("col3");
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
+        when(result.getMetaData().getColumnCount()).thenReturn(6);
+        when(result.getMetaData().getColumnLabel(1)).thenReturn("COUNT(*)");
+        when(result.getMetaData().getColumnLabel(2)).thenReturn("AVG(num)");
+        when(result.getMetaData().getColumnLabel(3)).thenReturn("id");
+        when(result.getMetaData().getColumnLabel(4)).thenReturn("date");
+        when(result.getMetaData().getColumnLabel(5)).thenReturn("AVG_DERIVED_COUNT_0");
+        when(result.getMetaData().getColumnLabel(6)).thenReturn("AVG_DERIVED_SUM_0");
+        when(result.getMetaData().getColumnName(1)).thenReturn("col1");
+        when(result.getMetaData().getColumnName(2)).thenReturn("col2");
+        when(result.getMetaData().getColumnName(3)).thenReturn("col3");
         return result;
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/iterator/IteratorStreamMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/iterator/IteratorStreamMergedResultTest.java
index 66e2650..6942da3 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/iterator/IteratorStreamMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/iterator/IteratorStreamMergedResultTest.java
@@ -37,6 +37,7 @@ import java.util.List;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -53,7 +54,7 @@ public final class IteratorStreamMergedResultTest {
     
     @Test
     public void assertNextForResultSetsAllEmpty() throws SQLException {
-        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
+        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS));
         ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
         MergedResult actual = resultMerger.merge(queryResults, selectStatementContext, null);
         assertFalse(actual.next());
@@ -61,7 +62,7 @@ public final class IteratorStreamMergedResultTest {
     
     @Test
     public void assertNextForResultSetsAllNotEmpty() throws SQLException {
-        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
+        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS));
         for (QueryResult each : queryResults) {
             when(each.next()).thenReturn(true, false);
         }
@@ -75,7 +76,7 @@ public final class IteratorStreamMergedResultTest {
     
     @Test
     public void assertNextForFirstResultSetsNotEmptyOnly() throws SQLException {
-        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
+        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS));
         when(queryResults.get(0).next()).thenReturn(true, false);
         ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
         MergedResult actual = resultMerger.merge(queryResults, selectStatementContext, null);
@@ -85,7 +86,7 @@ public final class IteratorStreamMergedResultTest {
     
     @Test
     public void assertNextForMiddleResultSetsNotEmpty() throws SQLException {
-        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
+        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS));
         when(queryResults.get(1).next()).thenReturn(true, false);
         ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
         MergedResult actual = resultMerger.merge(queryResults, selectStatementContext, null);
@@ -95,7 +96,7 @@ public final class IteratorStreamMergedResultTest {
     
     @Test
     public void assertNextForLastResultSetsNotEmptyOnly() throws SQLException {
-        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
+        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS));
         when(queryResults.get(2).next()).thenReturn(true, false);
         ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
         MergedResult actual = resultMerger.merge(queryResults, selectStatementContext, null);
@@ -105,8 +106,8 @@ public final class IteratorStreamMergedResultTest {
     
     @Test
     public void assertNextForMix() throws SQLException {
-        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), 
-                mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
+        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), 
+                mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS));
         when(queryResults.get(1).next()).thenReturn(true, false);
         when(queryResults.get(3).next()).thenReturn(true, false);
         when(queryResults.get(5).next()).thenReturn(true, false);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByStreamMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByStreamMergedResultTest.java
index 9fdb960..57ebb3c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByStreamMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/orderby/OrderByStreamMergedResultTest.java
@@ -18,25 +18,26 @@
 package org.apache.shardingsphere.sharding.merge.dql.orderby;
 
 import com.google.common.collect.ImmutableMap;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
-import org.apache.shardingsphere.infra.merge.result.MergedResult;
-import org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger;
-import org.apache.shardingsphere.infra.metadata.schema.model.ColumnMetaData;
-import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
-import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
 import org.apache.shardingsphere.infra.binder.segment.select.groupby.GroupByContext;
 import org.apache.shardingsphere.infra.binder.segment.select.orderby.OrderByContext;
 import org.apache.shardingsphere.infra.binder.segment.select.orderby.OrderByItem;
 import org.apache.shardingsphere.infra.binder.segment.select.pagination.PaginationContext;
 import org.apache.shardingsphere.infra.binder.segment.select.projection.ProjectionsContext;
 import org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.metadata.schema.model.ColumnMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
+import org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger;
 import org.apache.shardingsphere.sql.parser.sql.common.constant.OrderDirection;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ProjectionsSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.order.item.IndexOrderByItemSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
-import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -49,6 +50,7 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -72,7 +74,7 @@ public final class OrderByStreamMergedResultTest {
     
     @Test
     public void assertNextForResultSetsAllEmpty() throws SQLException {
-        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
+        List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS));
         ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
         MergedResult actual = resultMerger.merge(queryResults, selectStatementContext, buildSchema());
         assertFalse(actual.next());
@@ -82,8 +84,10 @@ public final class OrderByStreamMergedResultTest {
     public void assertNextForSomeResultSetsEmpty() throws SQLException {
         List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
         for (int i = 0; i < 3; i++) {
-            when(queryResults.get(i).getColumnName(1)).thenReturn("col1");
-            when(queryResults.get(i).getColumnName(2)).thenReturn("col2");
+            QueryResultMetaData metaData = mock(QueryResultMetaData.class);
+            when(queryResults.get(i).getMetaData()).thenReturn(metaData);
+            when(metaData.getColumnName(1)).thenReturn("col1");
+            when(metaData.getColumnName(2)).thenReturn("col2");
         }
         ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
         when(queryResults.get(0).next()).thenReturn(true, false);
@@ -104,8 +108,10 @@ public final class OrderByStreamMergedResultTest {
     public void assertNextForMix() throws SQLException {
         List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
         for (int i = 0; i < 3; i++) {
-            when(queryResults.get(i).getColumnName(1)).thenReturn("col1");
-            when(queryResults.get(i).getColumnName(2)).thenReturn("col2");
+            QueryResultMetaData metaData = mock(QueryResultMetaData.class);
+            when(queryResults.get(i).getMetaData()).thenReturn(metaData);
+            when(metaData.getColumnName(1)).thenReturn("col1");
+            when(metaData.getColumnName(2)).thenReturn("col2");
         }
         ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(DatabaseTypeRegistry.getActualDatabaseType("MySQL"));
         when(queryResults.get(0).next()).thenReturn(true, false);
@@ -134,8 +140,10 @@ public final class OrderByStreamMergedResultTest {
     public void assertNextForCaseSensitive() throws SQLException {
         List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
         for (int i = 0; i < 3; i++) {
-            when(queryResults.get(i).getColumnName(1)).thenReturn("col1");
-            when(queryResults.get(i).getColumnName(2)).thenReturn("col2");
+            QueryResultMetaData metaData = mock(QueryResultMetaData.class);
+            when(queryResults.get(i).getMetaData()).thenReturn(metaData);
+            when(metaData.getColumnName(1)).thenReturn("col1");
+            when(metaData.getColumnName(2)).thenReturn("col2");
         }
         when(queryResults.get(0).next()).thenReturn(true, false);
         when(queryResults.get(0).getValue(1, Object.class)).thenReturn("b");
@@ -160,8 +168,10 @@ public final class OrderByStreamMergedResultTest {
     public void assertNextForCaseInsensitive() throws SQLException {
         List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class), mock(QueryResult.class), mock(QueryResult.class));
         for (int i = 0; i < 3; i++) {
-            when(queryResults.get(i).getColumnName(1)).thenReturn("col1");
-            when(queryResults.get(i).getColumnName(2)).thenReturn("col2");
+            QueryResultMetaData metaData = mock(QueryResultMetaData.class);
+            when(queryResults.get(i).getMetaData()).thenReturn(metaData);
+            when(metaData.getColumnName(1)).thenReturn("col1");
+            when(metaData.getColumnName(2)).thenReturn("col2");
         }
         when(queryResults.get(0).next()).thenReturn(true, false);
         when(queryResults.get(0).getValue(2, Object.class)).thenReturn("b");
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/LimitDecoratorMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/LimitDecoratorMergedResultTest.java
index e256191..1474fd1 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/LimitDecoratorMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/LimitDecoratorMergedResultTest.java
@@ -36,6 +36,7 @@ import java.util.Collections;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -80,7 +81,7 @@ public final class LimitDecoratorMergedResultTest {
     }
     
     private QueryResult mockQueryResult() throws SQLException {
-        QueryResult result = mock(QueryResult.class);
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
         when(result.next()).thenReturn(true, true, false);
         return result;
     }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/RowNumberDecoratorMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/RowNumberDecoratorMergedResultTest.java
index f104ebb..af970e4 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/RowNumberDecoratorMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/RowNumberDecoratorMergedResultTest.java
@@ -36,6 +36,7 @@ import java.util.Collections;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -93,7 +94,7 @@ public final class RowNumberDecoratorMergedResultTest {
     }
     
     private QueryResult mockQueryResult() throws SQLException {
-        QueryResult result = mock(QueryResult.class);
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
         when(result.next()).thenReturn(true, true, false);
         return result;
     }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/TopAndRowNumberDecoratorMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/TopAndRowNumberDecoratorMergedResultTest.java
index 85d60b6..e8ae837 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/TopAndRowNumberDecoratorMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-merge/src/test/java/org/apache/shardingsphere/sharding/merge/dql/pagination/TopAndRowNumberDecoratorMergedResultTest.java
@@ -37,6 +37,7 @@ import java.util.Collections;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -109,7 +110,7 @@ public final class TopAndRowNumberDecoratorMergedResultTest {
     }
     
     private QueryResult mockQueryResult() throws SQLException {
-        QueryResult result = mock(QueryResult.class);
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
         when(result.next()).thenReturn(true, true, false);
         return result;
     }
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResult.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResult.java
index 1e84396..7dce18f 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResult.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResult.java
@@ -76,100 +76,9 @@ public interface QueryResult extends ExecuteResult {
     boolean wasNull() throws SQLException;
     
     /**
-     * Get column count.
-     *
-     * @return column count
-     * @throws SQLException SQL Exception
-     */
-    int getColumnCount() throws SQLException;
-    
-    /**
-     * Get table name.
-     *
-     * @param columnIndex column index
-     * @return table name
-     * @throws SQLException SQL Exception
-     */
-    String getTableName(int columnIndex) throws SQLException;
-    
-    /**
-     * Get column name.
-     *
-     * @param columnIndex column index
-     * @return column name
-     * @throws SQLException SQL Exception
-     */
-    String getColumnName(int columnIndex) throws SQLException;
-    
-    /**
-     * Get column label.
-     *
-     * @param columnIndex column index
-     * @return column label
-     * @throws SQLException SQL Exception
-     */
-    String getColumnLabel(int columnIndex) throws SQLException;
-    
-    /**
-     * Get column type.
-     *
-     * @param columnIndex column index
-     * @return column type
-     * @throws SQLException SQL Exception
-     */
-    int getColumnType(int columnIndex) throws SQLException;
-    
-    /**
-     * Get column type name.
-     *
-     * @param columnIndex column index
-     * @return column type name
-     * @throws SQLException SQL Exception
-     */
-    String getColumnTypeName(int columnIndex) throws SQLException;
-    
-    /**
-     * Get column length.
-     *
-     * @param columnIndex column index
-     * @return column length
-     * @throws SQLException SQL Exception
-     */
-    int getColumnLength(int columnIndex) throws SQLException;
-    
-    /**
-     * Get decimals.
-     *
-     * @param columnIndex column index
-     * @return decimals
-     * @throws SQLException SQL Exception
-     */
-    int getDecimals(int columnIndex) throws SQLException;
-    
-    /**
-     * Is signed.
-     *
-     * @param columnIndex column index
-     * @return signed or not
-     * @throws SQLException SQL Exception
-     */
-    boolean isSigned(int columnIndex) throws SQLException;
-    
-    /**
-     * Is not null.
-     *
-     * @param columnIndex column index
-     * @return not null or null
-     * @throws SQLException SQL Exception
-     */
-    boolean isNotNull(int columnIndex) throws SQLException;
-    
-    /**
-     * Is auto increment.
-     *
-     * @param columnIndex column index
-     * @return auto increment or not
-     * @throws SQLException SQL Exception
+     * Get query result meta data.
+     * 
+     * @return query result meta data
      */
-    boolean isAutoIncrement(int columnIndex) throws SQLException;
+    QueryResultMetaData getMetaData();
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResult.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResultMetaData.java
similarity index 69%
copy from shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResult.java
copy to shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResultMetaData.java
index 1e84396..6b3606f 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResult.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/QueryResultMetaData.java
@@ -17,63 +17,12 @@
 
 package org.apache.shardingsphere.infra.executor.sql.execute.result.query;
 
-import org.apache.shardingsphere.infra.executor.sql.execute.result.ExecuteResult;
-
-import java.io.InputStream;
 import java.sql.SQLException;
-import java.util.Calendar;
 
 /**
- * Query result.
+ * Query result meta data.
  */
-public interface QueryResult extends ExecuteResult {
-    
-    /**
-     * Iterate next data.
-     *
-     * @return has next data
-     * @throws SQLException SQL Exception
-     */
-    boolean next() throws SQLException;
-    
-    /**
-     * Get data value.
-     *
-     * @param columnIndex column index
-     * @param type class type of data value
-     * @return data value
-     * @throws SQLException SQL Exception
-     */
-    Object getValue(int columnIndex, Class<?> type) throws SQLException;
-    
-    /**
-     * Get calendar value.
-     *
-     * @param columnIndex column index
-     * @param type class type of data value
-     * @param calendar calendar
-     * @return calendar value
-     * @throws SQLException SQL Exception
-     */
-    Object getCalendarValue(int columnIndex, Class<?> type, Calendar calendar) throws SQLException;
-    
-    /**
-     * Get input stream.
-     *
-     * @param columnIndex column index
-     * @param type class type of data value
-     * @return input stream
-     * @throws SQLException SQL Exception
-     */
-    InputStream getInputStream(int columnIndex, String type) throws SQLException;
-    
-    /**
-     * Judge result set is null or not.
-     *
-     * @return result set is null or not
-     * @throws SQLException SQL Exception
-     */
-    boolean wasNull() throws SQLException;
+public interface QueryResultMetaData {
     
     /**
      * Get column count.
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/MemoryJDBCQueryResult.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/MemoryJDBCQueryResult.java
index 5fbf319..d4a9170 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/MemoryJDBCQueryResult.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/MemoryJDBCQueryResult.java
@@ -17,7 +17,10 @@
 
 package org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc;
 
+import lombok.Getter;
 import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc.metadata.JDBCQueryResultMetaData;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -39,20 +42,23 @@ import java.util.List;
 /**
  * JDBC query result for memory loading.
  */
-public final class MemoryJDBCQueryResult extends AbstractJDBCQueryResult {
+public final class MemoryJDBCQueryResult implements QueryResult {
+    
+    @Getter
+    private final JDBCQueryResultMetaData metaData;
     
     private final Iterator<List<Object>> rows;
     
     private List<Object> currentRow;
     
     public MemoryJDBCQueryResult(final ResultSet resultSet) throws SQLException {
-        super(resultSet.getMetaData());
+        metaData = new JDBCQueryResultMetaData(resultSet.getMetaData());
         rows = loadRows(resultSet);
     }
     
     private Iterator<List<Object>> loadRows(final ResultSet resultSet) throws SQLException {
         Collection<List<Object>> result = new LinkedList<>();
-        int columnCount = getColumnCount();
+        int columnCount = metaData.getColumnCount();
         while (resultSet.next()) {
             List<Object> rowData = new ArrayList<>(columnCount);
             for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/StreamJDBCQueryResult.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/StreamJDBCQueryResult.java
index 203ca7c..0fd675b 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/StreamJDBCQueryResult.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/StreamJDBCQueryResult.java
@@ -17,6 +17,10 @@
 
 package org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc;
 
+import lombok.Getter;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc.metadata.JDBCQueryResultMetaData;
+
 import java.io.InputStream;
 import java.math.BigDecimal;
 import java.sql.Array;
@@ -32,12 +36,15 @@ import java.util.Calendar;
 /**
  * JDBC query result for stream loading.
  */
-public final class StreamJDBCQueryResult extends AbstractJDBCQueryResult {
+public final class StreamJDBCQueryResult implements QueryResult {
+    
+    @Getter
+    private final JDBCQueryResultMetaData metaData;
     
     private final ResultSet resultSet;
     
     public StreamJDBCQueryResult(final ResultSet resultSet) throws SQLException {
-        super(resultSet.getMetaData());
+        metaData = new JDBCQueryResultMetaData(resultSet.getMetaData());
         this.resultSet = resultSet;
     }
     
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/AbstractJDBCQueryResult.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/metadata/JDBCQueryResultMetaData.java
similarity index 68%
rename from shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/AbstractJDBCQueryResult.java
rename to shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/metadata/JDBCQueryResultMetaData.java
index a0af69f..a828769 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/AbstractJDBCQueryResult.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/metadata/JDBCQueryResultMetaData.java
@@ -15,74 +15,74 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc;
+package org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc.metadata;
 
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 
 /**
- * Abstract JDBC query result.
+ * JDBC query result meta data.
  */
 @RequiredArgsConstructor
-public abstract class AbstractJDBCQueryResult implements QueryResult {
+public final class JDBCQueryResultMetaData implements QueryResultMetaData {
     
     private final ResultSetMetaData resultSetMetaData;
     
     @Override
-    public final int getColumnCount() throws SQLException {
+    public int getColumnCount() throws SQLException {
         return resultSetMetaData.getColumnCount();
     }
     
     @Override
-    public final String getTableName(final int columnIndex) throws SQLException {
+    public String getTableName(final int columnIndex) throws SQLException {
         return resultSetMetaData.getTableName(columnIndex);
     }
     
     @Override
-    public final String getColumnName(final int columnIndex) throws SQLException {
+    public String getColumnName(final int columnIndex) throws SQLException {
         return resultSetMetaData.getColumnName(columnIndex);
     }
     
     @Override
-    public final String getColumnLabel(final int columnIndex) throws SQLException {
+    public String getColumnLabel(final int columnIndex) throws SQLException {
         return resultSetMetaData.getColumnLabel(columnIndex);
     }
     
     @Override
-    public final int getColumnType(final int columnIndex) throws SQLException {
+    public int getColumnType(final int columnIndex) throws SQLException {
         return resultSetMetaData.getColumnType(columnIndex);
     }
     
     @Override
-    public final String getColumnTypeName(final int columnIndex) throws SQLException {
+    public String getColumnTypeName(final int columnIndex) throws SQLException {
         return resultSetMetaData.getColumnTypeName(columnIndex);
     }
     
     @Override
-    public final int getColumnLength(final int columnIndex) throws SQLException {
+    public int getColumnLength(final int columnIndex) throws SQLException {
         return resultSetMetaData.getColumnDisplaySize(columnIndex);
     }
     
     @Override
-    public final int getDecimals(final int columnIndex) throws SQLException {
+    public int getDecimals(final int columnIndex) throws SQLException {
         return resultSetMetaData.getScale(columnIndex);
     }
     
     @Override
-    public final boolean isSigned(final int columnIndex) throws SQLException {
+    public boolean isSigned(final int columnIndex) throws SQLException {
         return resultSetMetaData.isSigned(columnIndex);
     }
     
     @Override
-    public final boolean isNotNull(final int columnIndex) throws SQLException {
+    public boolean isNotNull(final int columnIndex) throws SQLException {
         return resultSetMetaData.isNullable(columnIndex) == ResultSetMetaData.columnNoNulls;
     }
     
     @Override
-    public final boolean isAutoIncrement(final int columnIndex) throws SQLException {
+    public boolean isAutoIncrement(final int columnIndex) throws SQLException {
         return resultSetMetaData.isAutoIncrement(columnIndex);
     }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/RawQueryResult.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/RawQueryResult.java
index 88431ec..cb98b83 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/RawQueryResult.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/RawQueryResult.java
@@ -17,9 +17,10 @@
 
 package org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw;
 
+import lombok.Getter;
 import lombok.SneakyThrows;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
-import org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.metadata.QueryResultMetaData;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.metadata.RawQueryResultMetaData;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.row.QueryResultDataRow;
 
 import java.io.ByteArrayInputStream;
@@ -36,13 +37,14 @@ import java.util.List;
  */
 public final class RawQueryResult implements QueryResult {
     
-    private final QueryResultMetaData metaData;
+    @Getter
+    private final RawQueryResultMetaData metaData;
     
     private final Iterator<QueryResultDataRow> rows;
     
     private QueryResultDataRow currentRow;
     
-    public RawQueryResult(final QueryResultMetaData metaData, final List<QueryResultDataRow> rows) {
+    public RawQueryResult(final RawQueryResultMetaData metaData, final List<QueryResultDataRow> rows) {
         this.metaData = metaData;
         this.rows = rows.iterator();
     }
@@ -86,59 +88,4 @@ public final class RawQueryResult implements QueryResult {
     public boolean wasNull() {
         return null == currentRow;
     }
-    
-    @Override
-    public int getColumnCount() {
-        return metaData.getColumnCount();
-    }
-    
-    @Override
-    public String getTableName(final int columnIndex) {
-        return metaData.getTableName(columnIndex);
-    }
-    
-    @Override
-    public String getColumnName(final int columnIndex) {
-        return metaData.getColumnName(columnIndex);
-    }
-    
-    @Override
-    public String getColumnLabel(final int columnIndex) {
-        return metaData.getColumnLabel(columnIndex);
-    }
-    
-    @Override
-    public int getColumnType(final int columnIndex) {
-        return metaData.getColumnType(columnIndex);
-    }
-    
-    @Override
-    public String getColumnTypeName(final int columnIndex) {
-        return metaData.getColumnTypeName(columnIndex);
-    }
-    
-    @Override
-    public int getColumnLength(final int columnIndex) {
-        return metaData.getColumnLength(columnIndex);
-    }
-    
-    @Override
-    public int getDecimals(final int columnIndex) {
-        return metaData.getDecimals(columnIndex);
-    }
-    
-    @Override
-    public boolean isSigned(final int columnIndex) {
-        return metaData.isSigned(columnIndex);
-    }
-    
-    @Override
-    public boolean isNotNull(final int columnIndex) {
-        return metaData.isNotNull(columnIndex);
-    }
-    
-    @Override
-    public boolean isAutoIncrement(final int columnIndex) {
-        return metaData.isAutoIncrement(columnIndex);
-    }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/metadata/QueryResultMetaData.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/metadata/RawQueryResultMetaData.java
similarity index 86%
rename from shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/metadata/QueryResultMetaData.java
rename to shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/metadata/RawQueryResultMetaData.java
index c7fbd81..0c1db3b 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/metadata/QueryResultMetaData.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/raw/metadata/RawQueryResultMetaData.java
@@ -17,60 +17,70 @@
 
 package org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.metadata;
 
-import lombok.Getter;
 import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
 
 import java.util.List;
 
 /**
- * Query result meta data.
+ * Raw query result meta data.
  */
 @RequiredArgsConstructor
-@Getter
-public final class QueryResultMetaData {
+public final class RawQueryResultMetaData implements QueryResultMetaData {
     
     private final List<QueryResultColumnMetaData> columns;
     
+    @Override
     public int getColumnCount() {
         return columns.size();
     }
     
+    @Override
     public String getTableName(final int columnIndex) {
         return columns.get(columnIndex).getTableName();
     }
     
+    @Override
     public String getColumnName(final int columnIndex) {
         return columns.get(columnIndex).getName();
     }
     
+    @Override
     public String getColumnLabel(final int columnIndex) {
         return columns.get(columnIndex).getLabel();
     }
     
+    @Override
     public int getColumnType(final int columnIndex) {
         return columns.get(columnIndex).getType();
     }
     
+    @Override
     public String getColumnTypeName(final int columnIndex) {
         return columns.get(columnIndex).getTypeName();
     }
     
+    @Override
     public int getColumnLength(final int columnIndex) {
         return columns.get(columnIndex).getLength();
     }
     
+    @Override
     public int getDecimals(final int columnIndex) {
         return columns.get(columnIndex).getDecimals();
     }
     
+    @Override
     public boolean isSigned(final int columnIndex) {
         return columns.get(columnIndex).isSigned();
     }
     
+    @Override
     public boolean isNotNull(final int columnIndex) {
         return columns.get(columnIndex).isNotNull();
     }
     
+    @Override
     public boolean isAutoIncrement(final int columnIndex) {
         return columns.get(columnIndex).isAutoIncrement();
     }
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/fixture/AbstractJDBCQueryResultFixture.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/fixture/AbstractJDBCQueryResultFixture.java
deleted file mode 100644
index 24028e9..0000000
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/fixture/AbstractJDBCQueryResultFixture.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc.fixture;
-
-import org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc.AbstractJDBCQueryResult;
-
-import java.io.InputStream;
-import java.sql.ResultSetMetaData;
-import java.util.Calendar;
-import java.util.Date;
-
-import static org.mockito.Mockito.mock;
-
-public final class AbstractJDBCQueryResultFixture extends AbstractJDBCQueryResult {
-    
-    public AbstractJDBCQueryResultFixture(final ResultSetMetaData resultSetMetaData) {
-        super(resultSetMetaData);
-    }
-    
-    @Override
-    public boolean next() {
-        return false;
-    }
-    
-    @Override
-    public Object getValue(final int columnIndex, final Class<?> type) {
-        return "";
-    }
-    
-    @Override
-    public Object getCalendarValue(final int columnIndex, final Class<?> type, final Calendar calendar) {
-        return new Date(0L);
-    }
-    
-    @Override
-    public InputStream getInputStream(final int columnIndex, final String type) {
-        return mock(InputStream.class);
-    }
-    
-    @Override
-    public boolean wasNull() {
-        return false;
-    }
-}
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/AbstractJDBCQueryResultTest.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/metadata/JDBCQueryResultMetaDataTest.java
similarity index 77%
rename from shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/AbstractJDBCQueryResultTest.java
rename to shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/metadata/JDBCQueryResultMetaDataTest.java
index 291afb2..1ccb171 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/AbstractJDBCQueryResultTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/jdbc/metadata/JDBCQueryResultMetaDataTest.java
@@ -15,9 +15,8 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc;
+package org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc.metadata;
 
-import org.apache.shardingsphere.infra.executor.sql.execute.result.query.jdbc.fixture.AbstractJDBCQueryResultFixture;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -29,13 +28,13 @@ import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-public final class AbstractJDBCQueryResultTest {
+public final class JDBCQueryResultMetaDataTest {
     
-    private AbstractJDBCQueryResultFixture queryResult;
+    private JDBCQueryResultMetaData queryResultMetaData;
     
     @Before
     public void setUp() throws SQLException {
-        queryResult = new AbstractJDBCQueryResultFixture(mockResultSetMetaData());
+        queryResultMetaData = new JDBCQueryResultMetaData(mockResultSetMetaData());
     }
     
     private ResultSetMetaData mockResultSetMetaData() throws SQLException {
@@ -49,21 +48,21 @@ public final class AbstractJDBCQueryResultTest {
     
     @Test
     public void assertGetColumnCount() throws SQLException {
-        assertThat(queryResult.getColumnCount(), is(1));
+        assertThat(queryResultMetaData.getColumnCount(), is(1));
     }
     
     @Test
     public void assertGetColumnName() throws SQLException {
-        assertThat(queryResult.getColumnName(1), is("order_id"));
+        assertThat(queryResultMetaData.getColumnName(1), is("order_id"));
     }
     
     @Test
     public void assertGetColumnLabel() throws SQLException {
-        assertThat(queryResult.getColumnLabel(1), is("oid"));
+        assertThat(queryResultMetaData.getColumnLabel(1), is("oid"));
     }
     
     @Test
     public void assertGetColumnTypeName() throws SQLException {
-        assertThat(queryResult.getColumnTypeName(1), is("INT"));
+        assertThat(queryResultMetaData.getColumnTypeName(1), is("INT"));
     }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/memory/MemoryQueryResultRow.java b/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/memory/MemoryQueryResultRow.java
index 2dca509..75032bd 100644
--- a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/memory/MemoryQueryResultRow.java
+++ b/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/memory/MemoryQueryResultRow.java
@@ -36,7 +36,7 @@ public final class MemoryQueryResultRow {
     }
     
     private Object[] load(final QueryResult queryResult) throws SQLException {
-        int columnCount = queryResult.getColumnCount();
+        int columnCount = queryResult.getMetaData().getColumnCount();
         Object[] result = new Object[columnCount];
         for (int i = 0; i < columnCount; i++) {
             result[i] = queryResult.getValue(i + 1, Object.class);
diff --git a/shardingsphere-infra/shardingsphere-infra-merge/src/test/java/org/apache/shardingsphere/infra/merge/result/impl/memory/MemoryQueryResultRowTest.java b/shardingsphere-infra/shardingsphere-infra-merge/src/test/java/org/apache/shardingsphere/infra/merge/result/impl/memory/MemoryQueryResultRowTest.java
index 52a80f87..235e1d0 100644
--- a/shardingsphere-infra/shardingsphere-infra-merge/src/test/java/org/apache/shardingsphere/infra/merge/result/impl/memory/MemoryQueryResultRowTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-merge/src/test/java/org/apache/shardingsphere/infra/merge/result/impl/memory/MemoryQueryResultRowTest.java
@@ -25,6 +25,7 @@ import java.sql.SQLException;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -34,8 +35,8 @@ public final class MemoryQueryResultRowTest {
     
     @Before
     public void setUp() throws SQLException {
-        QueryResult queryResult = mock(QueryResult.class);
-        when(queryResult.getColumnCount()).thenReturn(1);
+        QueryResult queryResult = mock(QueryResult.class, RETURNS_DEEP_STUBS);
+        when(queryResult.getMetaData().getColumnCount()).thenReturn(1);
         when(queryResult.getValue(1, Object.class)).thenReturn("value");
         memoryResultSetRow = new MemoryQueryResultRow(queryResult);
     }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/engine/jdbc/JDBCExecuteEngine.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/engine/jdbc/JDBCExecuteEngine.java
index d803ae2..b11c1bb 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/engine/jdbc/JDBCExecuteEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/engine/jdbc/JDBCExecuteEngine.java
@@ -110,7 +110,7 @@ public final class JDBCExecuteEngine implements SQLExecuteEngine {
         ExecuteResult executeResult = executeResults.iterator().next();
         if (executeResult instanceof QueryResult) {
             ShardingSphereMetaData metaData = ProxyContext.getInstance().getMetaData(backendConnection.getSchemaName());
-            int columnCount = ((QueryResult) executeResult).getColumnCount();
+            int columnCount = ((QueryResult) executeResult).getMetaData().getColumnCount();
             List<QueryHeader> queryHeaders = new ArrayList<>(columnCount);
             for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
                 if (hasSelectExpandProjections(executionContext.getSqlStatementContext())) {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/response/query/QueryHeaderBuilder.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/response/query/QueryHeaderBuilder.java
index 89686f7..c34e597 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/response/query/QueryHeaderBuilder.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/response/query/QueryHeaderBuilder.java
@@ -46,7 +46,7 @@ public final class QueryHeaderBuilder {
      * @throws SQLException SQL exception
      */
     public static QueryHeader build(final QueryResult queryResult, final ShardingSphereMetaData metaData, final int columnIndex) throws SQLException {
-        return build(queryResult, metaData, queryResult.getColumnName(columnIndex), columnIndex);
+        return build(queryResult, metaData, queryResult.getMetaData().getColumnName(columnIndex), columnIndex);
     }
     
     /**
@@ -65,7 +65,7 @@ public final class QueryHeaderBuilder {
     
     private static QueryHeader build(final QueryResult queryResult, final ShardingSphereMetaData metaData, final String columnName, final int columnIndex) throws SQLException {
         String schemaName = metaData.getName();
-        String actualTableName = queryResult.getTableName(columnIndex);
+        String actualTableName = queryResult.getMetaData().getTableName(columnIndex);
         Optional<DataNodeContainedRule> dataNodeContainedRule =
                 metaData.getRuleMetaData().getRules().stream().filter(each -> each instanceof DataNodeContainedRule).findFirst().map(rule -> (DataNodeContainedRule) rule);
         String tableName;
@@ -78,18 +78,18 @@ public final class QueryHeaderBuilder {
             tableName = actualTableName;
             primaryKey = false;
         }
-        String columnLabel = queryResult.getColumnLabel(columnIndex);
-        int columnLength = queryResult.getColumnLength(columnIndex);
-        int columnType = queryResult.getColumnType(columnIndex);
-        int decimals = queryResult.getDecimals(columnIndex);
-        boolean signed = queryResult.isSigned(columnIndex);
-        boolean notNull = queryResult.isNotNull(columnIndex);
-        boolean autoIncrement = queryResult.isAutoIncrement(columnIndex);
+        String columnLabel = queryResult.getMetaData().getColumnLabel(columnIndex);
+        int columnLength = queryResult.getMetaData().getColumnLength(columnIndex);
+        int columnType = queryResult.getMetaData().getColumnType(columnIndex);
+        int decimals = queryResult.getMetaData().getDecimals(columnIndex);
+        boolean signed = queryResult.getMetaData().isSigned(columnIndex);
+        boolean notNull = queryResult.getMetaData().isNotNull(columnIndex);
+        boolean autoIncrement = queryResult.getMetaData().isAutoIncrement(columnIndex);
         return new QueryHeader(schemaName, tableName, columnLabel, columnName, columnLength, columnType, decimals, signed, primaryKey, notNull, autoIncrement);
     }
     
     private static String getColumnName(final ProjectionsContext projectionsContext, final QueryResult queryResult, final int columnIndex) throws SQLException {
         Projection projection = projectionsContext.getExpandProjections().get(columnIndex - 1);
-        return projection instanceof ColumnProjection ? ((ColumnProjection) projection).getName() : queryResult.getColumnName(columnIndex);
+        return projection instanceof ColumnProjection ? ((ColumnProjection) projection).getName() : queryResult.getMetaData().getColumnName(columnIndex);
     }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/ShowTablesBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/ShowTablesBackendHandler.java
index b5ae8d0..a962226 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/ShowTablesBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/ShowTablesBackendHandler.java
@@ -21,7 +21,7 @@ import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.row.QueryResultDataRow;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.RawQueryResult;
-import org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.metadata.QueryResultMetaData;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.metadata.RawQueryResultMetaData;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.query.raw.metadata.QueryResultColumnMetaData;
 import org.apache.shardingsphere.proxy.backend.response.query.QueryHeader;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -54,7 +54,7 @@ public final class ShowTablesBackendHandler implements TextProtocolBackendHandle
         if (!ProxyContext.getInstance().getMetaData(backendConnection.getSchemaName()).isComplete()) {
             return result;
         }
-        QueryResultMetaData metaData = new QueryResultMetaData(Collections.singletonList(new QueryResultColumnMetaData(
+        RawQueryResultMetaData metaData = new RawQueryResultMetaData(Collections.singletonList(new QueryResultColumnMetaData(
                 null, result.getQueryHeaders().get(0).getColumnName(), result.getQueryHeaders().get(0).getColumnLabel(), Types.VARCHAR, "VARCHAR", 255, 0, false, false, false)));
         Collection<String> allTableNames = ProxyContext.getInstance().getMetaData(backendConnection.getSchemaName()).getSchema().getAllTableNames();
         List<QueryResultDataRow> rows = allTableNames.stream().map(each -> new QueryResultDataRow(Collections.singletonList(each))).collect(Collectors.toList());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/response/query/QueryHeaderBuilderTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/response/query/QueryHeaderBuilderTest.java
index 81cd57d..15fb907 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/response/query/QueryHeaderBuilderTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/response/query/QueryHeaderBuilderTest.java
@@ -145,17 +145,17 @@ public final class QueryHeaderBuilderTest {
     }
     
     private QueryResult createQueryResult() throws SQLException {
-        QueryResult result = mock(QueryResult.class);
-        when(result.getTableName(1)).thenReturn("t_order");
-        when(result.getColumnLabel(1)).thenReturn("order_id");
-        when(result.getColumnName(1)).thenReturn("order_id");
-        when(result.getColumnName(2)).thenReturn("expr");
-        when(result.getColumnType(1)).thenReturn(Types.INTEGER);
-        when(result.isSigned(1)).thenReturn(true);
-        when(result.isAutoIncrement(1)).thenReturn(true);
-        when(result.getColumnLength(1)).thenReturn(1);
-        when(result.getDecimals(1)).thenReturn(1);
-        when(result.isNotNull(1)).thenReturn(true);
+        QueryResult result = mock(QueryResult.class, RETURNS_DEEP_STUBS);
+        when(result.getMetaData().getTableName(1)).thenReturn("t_order");
+        when(result.getMetaData().getColumnLabel(1)).thenReturn("order_id");
+        when(result.getMetaData().getColumnName(1)).thenReturn("order_id");
+        when(result.getMetaData().getColumnName(2)).thenReturn("expr");
+        when(result.getMetaData().getColumnType(1)).thenReturn(Types.INTEGER);
+        when(result.getMetaData().isSigned(1)).thenReturn(true);
+        when(result.getMetaData().isAutoIncrement(1)).thenReturn(true);
+        when(result.getMetaData().getColumnLength(1)).thenReturn(1);
+        when(result.getMetaData().getDecimals(1)).thenReturn(1);
+        when(result.getMetaData().isNotNull(1)).thenReturn(true);
         return result;
     }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
index 6410d0b..0f09e23 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
@@ -110,7 +110,7 @@ public final class PostgreSQLComBindExecutor implements QueryCommandExecutor {
         List<QueryResult> queryResults = queryResponse.getQueryResults();
         int columnIndex = 0;
         for (QueryHeader each : queryResponse.getQueryHeaders()) {
-            String columnTypeName = queryResults.isEmpty() ? null : queryResults.get(0).getColumnTypeName(columnIndex + 1);
+            String columnTypeName = queryResults.isEmpty() ? null : queryResults.get(0).getMetaData().getColumnTypeName(columnIndex + 1);
             result.add(new PostgreSQLColumnDescription(each.getColumnName(), ++columnIndex, each.getColumnType(), each.getColumnLength(), columnTypeName));
         }
         return result;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/text/PostgreSQLComQueryExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/text/PostgreSQLComQueryExecutor.java
index 8f5443e..af9632d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/text/PostgreSQLComQueryExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/text/PostgreSQLComQueryExecutor.java
@@ -85,7 +85,7 @@ public final class PostgreSQLComQueryExecutor implements QueryCommandExecutor {
         List<QueryResult> queryResults = queryResponse.getQueryResults();
         int columnIndex = 0;
         for (QueryHeader each : queryResponse.getQueryHeaders()) {
-            String columnTypeName = queryResults.isEmpty() ? null : queryResults.get(0).getColumnTypeName(columnIndex + 1);
+            String columnTypeName = queryResults.isEmpty() ? null : queryResults.get(0).getMetaData().getColumnTypeName(columnIndex + 1);
             result.add(new PostgreSQLColumnDescription(each.getColumnName(), ++columnIndex, each.getColumnType(), each.getColumnLength(), columnTypeName));
         }
         return result;