You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2015/06/18 22:22:44 UTC

[40/41] vxquery git commit: Merge branch 'shivanim/gsoc_xmark' of github.com:shivani1494/vxquery into prestonc/xmark

Merge branch 'shivanim/gsoc_xmark' of github.com:shivani1494/vxquery into prestonc/xmark

Change includes documentation updates for XDM and improved parameters for running xtest.


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/232e62f6
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/232e62f6
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/232e62f6

Branch: refs/heads/master
Commit: 232e62f6c39975e16b1634334d97eda7f6cede4c
Parents: c144249 c784058
Author: Eldon Carman <ec...@ucr.edu>
Authored: Thu Jun 18 13:10:19 2015 -0700
Committer: Eldon Carman <ec...@ucr.edu>
Committed: Thu Jun 18 13:10:19 2015 -0700

----------------------------------------------------------------------
 src/site/apt/development_xml_document.apt       | 607 +++++++++++++++++++
 src/site/apt/development_xml_node_details.apt   |  36 +-
 src/site/site.xml                               |   5 +-
 .../java/org/apache/vxquery/cli/VXQuery.java    |  90 +--
 .../query/VXQueryCompilationListener.java       | 117 ++++
 .../org/apache/vxquery/xtest/TestRunner.java    |  22 +-
 .../org/apache/vxquery/xtest/XTestOptions.java  |  31 +-
 .../cat/GhcndRecordsPartition2Queries.xml       |   5 +
 .../cat/GhcndRecordsPartition4Queries.xml       |   5 +
 9 files changed, 807 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/232e62f6/src/site/site.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/vxquery/blob/232e62f6/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/VXQueryCompilationListener.java
----------------------------------------------------------------------
diff --cc vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/VXQueryCompilationListener.java
index 0000000,7969c9e..344f161
mode 000000,100644..100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/VXQueryCompilationListener.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/VXQueryCompilationListener.java
@@@ -1,0 -1,107 +1,117 @@@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements. See the NOTICE file distributed with
++ * this work for additional information regarding copyright ownership.
++ * The ASF licenses this file to You under the Apache License, Version 2.0
++ * (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ * http://www.apache.org/licenses/LICENSE-2.0
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
+ package org.apache.vxquery.xmlquery.query;
+ 
+ import org.apache.vxquery.compiler.algebricks.prettyprint.VXQueryLogicalExpressionPrettyPrintVisitor;
+ import org.apache.vxquery.xmlquery.ast.ModuleNode;
 -import org.apache.vxquery.xmlquery.query.Module;
 -import org.apache.vxquery.xmlquery.query.XQueryCompilationListener;
+ import org.json.JSONException;
 -import org.kohsuke.args4j.Option;
+ 
+ import com.thoughtworks.xstream.XStream;
+ import com.thoughtworks.xstream.io.xml.DomDriver;
+ 
+ import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+ import edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.LogicalOperatorPrettyPrintVisitor;
+ import edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPrettyPrinter;
+ import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionVisitor;
+ import edu.uci.ics.hyracks.api.job.JobSpecification;
+ 
+ public class VXQueryCompilationListener implements XQueryCompilationListener {
 -    
++
+     boolean showTET, showRP, showOET, showAST;
+ 
+     public VXQueryCompilationListener(boolean showAST, boolean showTET, boolean showOET, boolean showRP) {
+         this.showTET = showTET;
+         this.showRP = showRP;
+         this.showOET = showOET;
+         this.showAST = showAST;
+     }
+ 
+     /**
+      * Outputs the query inputs, outputs and user constraints for each module as result of code generation.
+      * 
+      * @param module
+      */
+     public void notifyCodegenResult(Module module) {
+         if (showRP) {
+             JobSpecification jobSpec = module.getHyracksJobSpecification();
+             try {
+                 System.err.println("***Runtime Plan: ");
+                 System.err.println(jobSpec.toJSON().toString(2));
+             } catch (JSONException e) {
+                 e.printStackTrace();
+                 System.err.println(jobSpec.toString());
+             }
+         }
+     }
+ 
+     /**
+      * Outputs the syntax translation tree for the module in the format: "-- logical operator(if exists) | execution mode |"
+      * where execution mode can be one of: UNPARTITIONED,PARTITIONED,LOCAL
+      * 
+      * @param module
+      */
+     @Override
+     public void notifyTranslationResult(Module module) {
+         if (showTET) {
+             System.err.println("***Translated Expression Tree: ");
+             System.err.println(appendPrettyPlan(new StringBuilder(), module).toString());
+         }
+     }
+ 
+     @Override
+     public void notifyTypecheckResult(Module module) {
+     }
+ 
+     /**
+      * Outputs the optimized expression tree for the module in the format:
+      * "-- logical operator(if exists) | execution mode |" where execution mode can be one of: UNPARTITIONED,PARTITIONED,LOCAL
+      * 
+      * @param module
+      */
+     @Override
+     public void notifyOptimizedResult(Module module) {
+         if (showOET) {
+             System.err.println("***Optimized Expression Tree: ");
+             System.err.println(appendPrettyPlan(new StringBuilder(), module).toString());
+         }
+     }
+ 
+     /**
+      * Outputs the abstract syntax tree obtained from parsing by serializing the DomDriver object to a pretty-printed XML
+      * String.
+      * 
+      * @param moduleNode
+      */
+     @Override
+     public void notifyParseResult(ModuleNode moduleNode) {
+         if (showAST) {
+             System.err.println("***Abstract Syntax Tree: ");
+             System.err.println(new XStream(new DomDriver()).toXML(moduleNode));
+         }
+     }
+ 
+     private StringBuilder appendPrettyPlan(StringBuilder sb, Module module) {
+         try {
+             ILogicalExpressionVisitor<String, Integer> ev = new VXQueryLogicalExpressionPrettyPrintVisitor(
+                     module.getModuleContext());
+             LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor(ev);
+             PlanPrettyPrinter.printPlan(module.getBody(), sb, v, 0);
+         } catch (AlgebricksException e) {
+             e.printStackTrace();
+         }
+         return sb;
+     }
 -    
+ 
+ }

http://git-wip-us.apache.org/repos/asf/vxquery/blob/232e62f6/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
----------------------------------------------------------------------
diff --cc vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
index facc698,1e3e4ca..0dfefb5
--- a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
@@@ -99,10 -101,20 +101,19 @@@ public class TestRunner 
          if (opts.verbose) {
              System.err.println("Starting " + testCase.getXQueryDisplayName());
          }
+ 
          long start = System.currentTimeMillis();
 -
          try {
              try {
-                 XMLQueryCompiler compiler = new XMLQueryCompiler(null, new String[] { "nc1" }, opts.frameSize);
+                 FileInputStream query = new FileInputStream(testCase.getXQueryFile());
+                 if (opts.showQuery) {
+                     System.err.println("***Query for " + testCase.getXQueryDisplayName() + ": ");
+                     System.err.println(IOUtils.toString(query, "UTF-8"));
+                 }
+ 
+                 VXQueryCompilationListener listener = new VXQueryCompilationListener(opts.showAST, opts.showTET,
+                         opts.showOET, opts.showRP);
+                 XMLQueryCompiler compiler = new XMLQueryCompiler(listener, new String[] { "nc1" }, opts.frameSize);
                  Reader in = new InputStreamReader(new FileInputStream(testCase.getXQueryFile()), "UTF-8");
                  CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(
                          RootStaticContextImpl.INSTANCE), new ResultSetId(testCase.getXQueryDisplayName().hashCode()),

http://git-wip-us.apache.org/repos/asf/vxquery/blob/232e62f6/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTestOptions.java
----------------------------------------------------------------------
diff --cc vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTestOptions.java
index 10dfa1c,1ddeb76..53403f2
--- a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTestOptions.java
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTestOptions.java
@@@ -17,7 -17,7 +17,7 @@@ package org.apache.vxquery.xtest
  import org.kohsuke.args4j.Option;
  
  public class XTestOptions {
--    @Option(name = "-O", required = false, usage = "Optimization Level")
++    @Option(name = "-O", required = false, usage = "Optimization level")
      int optimizationLevel = Integer.MAX_VALUE;
  
      @Option(name = "-frameSize", required = false, usage = "Setting frame size")
@@@ -26,7 -26,7 +26,7 @@@
      @Option(name = "-port", required = false, usage = "Port for web server to listen on")
      int port;
  
--    @Option(name = "-catalog", required = true, usage = "Test Catalog XML")
++    @Option(name = "-catalog", required = true, usage = "Test catalog XML")
      String catalog;
  
      @Option(name = "-threads", required = false, usage = "Number of threads")
@@@ -47,12 -47,33 +47,33 @@@
      @Option(name = "-keepalive", required = false, usage = "Milliseconds to keep server alive after tests have completed")
      long keepalive;
  
--    @Option(name = "-textreport", required = false, usage = "Text Report output file")
++    @Option(name = "-textreport", required = false, usage = "Text report output file")
      String diffable;
  
--    @Option(name = "-xmlreport", required = false, usage = "XML Report output file")
++    @Option(name = "-xmlreport", required = false, usage = "XML report output file")
      String xmlReport;
  
--    @Option(name = "-htmlreport", required = false, usage = "HTML Report output file")
++    @Option(name = "-htmlreport", required = false, usage = "HTML report output file")
      String htmlReport;
+ 
+     @Option(name = "-showquery", usage = "Show query string")
+     boolean showQuery;
+ 
+     @Option(name = "-showast", usage = "Show abstract syntax tree")
+     boolean showAST;
+ 
+     @Option(name = "-showtet", usage = "Show translated expression tree")
+     boolean showTET;
+ 
+     @Option(name = "-showoet", usage = "Show optimized expression tree")
+     boolean showOET;
+ 
 -    @Option(name = "-showrp", usage = "Show Runtime plan")
++    @Option(name = "-showrp", usage = "Show runtime plan")
+     boolean showRP;
+ 
+     @Option(name = "-compileonly", usage = "Compile the query and stop")
+     boolean compileOnly;
+ 
+     @Option(name = "-showresult", usage = "Show query result")
+     boolean showResult;
  }