This is in continuation of the previous check-in that removed the compileQuery method and refactored code around the invocations
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@898 eaa15691-b419-025a-1212-ee371bd00084
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 82fba4f..7a87acb 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
@@ -241,7 +241,6 @@
case QUERY: {
executionResult.add(handleQuery(metadataProvider, (Query) stmt, hcc));
- metadataProvider.setWriteTransaction(false);
break;
}
@@ -694,14 +693,15 @@
metadataProviderQueryCompilation.setWriterFactory(metadataProvider.getWriterFactory());
metadataProviderQueryCompilation.setOutputFile(metadataProvider.getOutputFile());
metadataProviderQueryCompilation.setConfig(metadataProvider.getConfig());
+ metadataProviderQueryCompilation.setWriteTransaction(metadataProvider.isWriteTransaction());
sessionConfig.setGenerateJobSpec(true);
- JobSpecification spec = APIFramework.compileQuery(declaredFunctions, metadataProvider, query,
+ JobSpecification spec = APIFramework.compileQuery(declaredFunctions, metadataProviderQueryCompilation, query,
reWrittenQuery.second, stmt == null ? null : stmt.getDatasetName(), sessionConfig, out, pdf, stmt);
sessionConfig.setGenerateJobSpec(false);
Pair<JobSpecification, FileSplit> compiled = new Pair<JobSpecification, FileSplit>(spec,
- metadataProvider.getOutputFile());
+ metadataProviderQueryCompilation.getOutputFile());
return compiled;
}
@@ -746,6 +746,7 @@
private QueryResult handleQuery(AqlMetadataProvider metadataProvider, Query query, IHyracksClientConnection hcc)
throws Exception {
Pair<JobSpecification, FileSplit> compiled = rewriteCompileQuery(metadataProvider, query, null);
+ MetadataManager.INSTANCE.commitTransaction(metadataProvider.getMetadataTxnContext());
runJob(hcc, compiled.first);
GlobalConfig.ASTERIX_LOGGER.info(compiled.first.toJSON().toString(1));
return new QueryResult(query, compiled.second.getLocalFile().getFile().getAbsolutePath());