Pass the initialized result reader client object to the Aql compiler in the client API.
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_result_distribution@1148 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/java/AsterixJavaClient.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/java/AsterixJavaClient.java
index 7e72d94..4025e6b 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/java/AsterixJavaClient.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/java/AsterixJavaClient.java
@@ -15,6 +15,7 @@
import edu.uci.ics.asterix.aql.translator.AqlTranslator;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.metadata.MetadataManager;
+import edu.uci.ics.asterix.result.ResultReader;
import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
import edu.uci.ics.hyracks.api.job.JobSpecification;
@@ -52,7 +53,7 @@
int ch;
StringBuilder builder = new StringBuilder();
while ((ch = queryText.read()) != -1) {
- builder.append((char)ch);
+ builder.append((char) ch);
}
AQLParser parser = new AQLParser(builder.toString());
List<Statement> aqlStatements;
@@ -67,8 +68,11 @@
false, printRewrittenExpressions, printLogicalPlan, printOptimizedPlan, printPhysicalOpsOnly,
generateBinaryRuntime, printJob);
+ ResultReader resultReader = new ResultReader(hcc, writer);
+ new Thread(resultReader).start();
+
AqlTranslator aqlTranslator = new AqlTranslator(aqlStatements, writer, pc, DisplayFormat.TEXT);
- aqlTranslator.compileAndExecute(hcc);
+ aqlTranslator.compileAndExecute(hcc, resultReader);
writer.flush();
}