add option to execute the query (or not) to the web interface
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java
index 8ecd00f..659a224 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java
@@ -21,18 +21,20 @@
private final boolean printLogicalPlanParam;
private final boolean printOptimizedLogicalPlanParam;
private final boolean printPhysicalOpsOnly;
+ private final boolean executeQuery;
private final boolean generateJobSpec;
private final boolean printJob;
public SessionConfig(boolean optimize, boolean printExprParam, boolean printRewrittenExprParam,
boolean printLogicalPlanParam, boolean printOptimizedLogicalPlanParam, boolean printPhysicalOpsOnly,
- boolean generateJobSpec, boolean printJob) {
+ boolean executeQuery, boolean generateJobSpec, boolean printJob) {
this.optimize = optimize;
this.printExprParam = printExprParam;
this.printRewrittenExprParam = printRewrittenExprParam;
this.printLogicalPlanParam = printLogicalPlanParam;
this.printOptimizedLogicalPlanParam = printOptimizedLogicalPlanParam;
this.printPhysicalOpsOnly = printPhysicalOpsOnly;
+ this.executeQuery = executeQuery;
this.generateJobSpec = generateJobSpec;
this.printJob = printJob;
}
@@ -61,6 +63,10 @@
return printPhysicalOpsOnly;
}
+ public boolean isExecuteQuery() {
+ return executeQuery;
+ }
+
public boolean isOptimize() {
return optimize;
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
index 6b17cc9..55bf4c9 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
@@ -67,6 +67,7 @@
String printLogicalPlanParam = request.getParameter("print-logical-plan");
String printOptimizedLogicalPlanParam = request.getParameter("print-optimized-logical-plan");
String printJob = request.getParameter("print-job");
+ String executeQuery = request.getParameter("execute-query");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
@@ -88,7 +89,7 @@
List<Statement> aqlStatements = parser.Statement();
SessionConfig sessionConfig = new SessionConfig(true, isSet(printExprParam),
isSet(printRewrittenExprParam), isSet(printLogicalPlanParam),
- isSet(printOptimizedLogicalPlanParam), false, true, isSet(printJob));
+ isSet(printOptimizedLogicalPlanParam), false, isSet(executeQuery), true, isSet(printJob));
MetadataManager.INSTANCE.init();
AqlTranslator aqlTranslator = new AqlTranslator(aqlStatements, out, sessionConfig, format);
double duration = 0;
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
index 6086bc1..9f6b7eb 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
@@ -89,7 +89,7 @@
if (checkForbiddenStatements(aqlStatements, out)) {
return;
}
- SessionConfig sessionConfig = new SessionConfig(true, false, false, false, false, false, true, false);
+ SessionConfig sessionConfig = new SessionConfig(true, false, false, false, false, false, true, true, false);
MetadataManager.INSTANCE.init();
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 b6a262e..d550689 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
@@ -30,11 +30,6 @@
import edu.uci.ics.hyracks.api.job.JobSpecification;
import edu.uci.ics.asterix.aql.parser.AQLParser;
import edu.uci.ics.asterix.aql.parser.ParseException;
-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.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
public class AsterixJavaClient {
private IHyracksClientConnection hcc;
@@ -82,7 +77,7 @@
MetadataManager.INSTANCE.init();
SessionConfig pc = new SessionConfig(optimize, false, printRewrittenExpressions, printLogicalPlan,
- printOptimizedPlan, printPhysicalOpsOnly, generateBinaryRuntime, printJob);
+ printOptimizedPlan, printPhysicalOpsOnly, true, generateBinaryRuntime, printJob);
AqlTranslator aqlTranslator = new AqlTranslator(aqlStatements, writer, pc, DisplayFormat.TEXT);
aqlTranslator.compileAndExecute(hcc, null, false);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
index 3f752cb..1ec0937 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
@@ -1354,7 +1354,7 @@
MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
bActiveTxn = false;
- if (compiled != null) {
+ if (sessionConfig.isExecuteQuery() && compiled != null) {
GlobalConfig.ASTERIX_LOGGER.info(compiled.toJSON().toString(1));
JobId jobId = runJob(hcc, compiled, false);
diff --git a/asterix-app/src/main/resources/webui/querytemplate.html b/asterix-app/src/main/resources/webui/querytemplate.html
index 2085f22..0adb518 100644
--- a/asterix-app/src/main/resources/webui/querytemplate.html
+++ b/asterix-app/src/main/resources/webui/querytemplate.html
@@ -200,6 +200,7 @@
<label class="checkbox optlabel"><input type="checkbox" name="print-logical-plan" value="true" /> Print logical plan</label>
<label class="checkbox optlabel"><input type="checkbox" name="print-optimized-logical-plan" value="true" /> Print optimized logical plan</label>
<label class="checkbox optlabel"><input type="checkbox" name="print-job" value="true" /> Print Hyracks job</label>
+ <label class="checkbox optlabel"><input type="checkbox" name="execute-query" value="true" checked/> Execute query</label>
</div>
</form>
</div>