asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject asterixdb git commit: allow more than one result for a request
Date Thu, 13 Oct 2016 18:10:11 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 791cc5d75 -> 48a506b88


allow more than one result for a request

Change-Id: Ib891b39e25d97ee60d4eb2d032d23bd94ad69b0e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1278
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/48a506b8
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/48a506b8
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/48a506b8

Branch: refs/heads/master
Commit: 48a506b883442cb7871f45d016fd5ef7731d4a82
Parents: 791cc5d
Author: Till Westmann <tillw@apache.org>
Authored: Thu Oct 13 10:02:56 2016 -0700
Committer: Till Westmann <tillw@apache.org>
Committed: Thu Oct 13 11:09:46 2016 -0700

----------------------------------------------------------------------
 .../api/http/servlet/QueryServiceServlet.java    | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/48a506b8/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
index 427e177..0f88f48 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
@@ -54,6 +54,7 @@ import org.apache.asterix.translator.IStatementExecutor.Stats;
 import org.apache.asterix.translator.IStatementExecutorFactory;
 import org.apache.asterix.translator.SessionConfig;
 import org.apache.commons.io.IOUtils;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.prettyprint.AlgebricksAppendable;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.dataset.IHyracksDataset;
@@ -284,11 +285,19 @@ public class QueryServiceServlet extends HttpServlet {
     }
 
     private static SessionConfig createSessionConfig(RequestParameters param, PrintWriter
resultWriter) {
-        SessionConfig.ResultDecorator resultPrefix = (AlgebricksAppendable app) -> {
-            app.append("\t\"");
-            app.append(ResultFields.RESULTS.str());
-            app.append("\": ");
-            return app;
+        SessionConfig.ResultDecorator resultPrefix = new SessionConfig.ResultDecorator()
{
+            int resultNo = -1;
+            @Override
+            public AlgebricksAppendable append(AlgebricksAppendable app) throws AlgebricksException
{
+                app.append("\t\"");
+                app.append(ResultFields.RESULTS.str());
+                if (resultNo >= 0) {
+                    app.append('-').append(String.valueOf(resultNo));
+                }
+                ++resultNo;
+                app.append("\": ");
+                return app;
+            }
         };
 
         SessionConfig.ResultDecorator resultPostfix = (AlgebricksAppendable app) -> {


Mime
View raw message