kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lid...@apache.org
Subject [04/15] kylin git commit: revise sql response list typ
Date Mon, 16 May 2016 09:06:47 GMT
revise sql response list typ


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/67b84d20
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/67b84d20
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/67b84d20

Branch: refs/heads/1.5.x-CDH5.7
Commit: 67b84d20eeaefec91d2dd6e7be93a1d82f172976
Parents: 74fc2d9
Author: Hongbin Ma <mahongbin@apache.org>
Authored: Fri May 13 17:20:03 2016 +0800
Committer: Hongbin Ma <mahongbin@apache.org>
Committed: Fri May 13 17:20:16 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/rest/service/QueryService.java     | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/67b84d20/server/src/main/java/org/apache/kylin/rest/service/QueryService.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/service/QueryService.java b/server/src/main/java/org/apache/kylin/rest/service/QueryService.java
index 4770a73..08b338c 100644
--- a/server/src/main/java/org/apache/kylin/rest/service/QueryService.java
+++ b/server/src/main/java/org/apache/kylin/rest/service/QueryService.java
@@ -73,6 +73,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.stereotype.Component;
 
+import com.google.common.collect.Lists;
+
 /**
  * @author xduo
  */
@@ -341,8 +343,8 @@ public class QueryService extends BasicService {
         Statement stat = null;
         ResultSet resultSet = null;
 
-        List<List<String>> results = new LinkedList<List<String>>();
-        List<SelectedColumnMeta> columnMetas = new LinkedList<SelectedColumnMeta>();
+        List<List<String>> results = Lists.newArrayList();
+        List<SelectedColumnMeta> columnMetas = Lists.newArrayList();
 
         try {
             conn = cacheService.getOLAPDataSource(sqlRequest.getProject()).getConnection();
@@ -368,16 +370,14 @@ public class QueryService extends BasicService {
                 columnMetas.add(new SelectedColumnMeta(metaData.isAutoIncrement(i), metaData.isCaseSensitive(i),
metaData.isSearchable(i), metaData.isCurrency(i), metaData.isNullable(i), metaData.isSigned(i),
metaData.getColumnDisplaySize(i), metaData.getColumnLabel(i), metaData.getColumnName(i), metaData.getSchemaName(i),
metaData.getCatalogName(i), metaData.getTableName(i), metaData.getPrecision(i), metaData.getScale(i),
metaData.getColumnType(i), metaData.getColumnTypeName(i), metaData.isReadOnly(i), metaData.isWritable(i),
metaData.isDefinitelyWritable(i)));
             }
 
-            List<String> oneRow = new LinkedList<String>();
-
             // fill in results
             while (resultSet.next()) {
+                List<String> oneRow = Lists.newArrayListWithCapacity(columnCount);
                 for (int i = 0; i < columnCount; i++) {
                     oneRow.add((resultSet.getString(i + 1)));
                 }
 
-                results.add(new LinkedList<String>(oneRow));
-                oneRow.clear();
+                results.add(oneRow);
             }
         } finally {
             close(resultSet, stat, conn);


Mime
View raw message