Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1278

Change subject: allow more than one result for a request
......................................................................

allow more than one result for a request

Change-Id: Ib891b39e25d97ee60d4eb2d032d23bd94ad69b0e
---
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
1 file changed, 14 insertions(+), 5 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/78/1278/1

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.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 @@
     }
 
     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) -> {

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1278
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib891b39e25d97ee60d4eb2d032d23bd94ad69b0e
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <ti...@apache.org>

Reply via email to