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 2014/02/05 05:07:42 UTC

[1/6] git commit: add VXQueryLogicalExpressionPrettyPrintVisitor add .gitignore

Updated Branches:
  refs/heads/prestonc/benchmarks ee2ac9add -> fb47b9f00


add VXQueryLogicalExpressionPrettyPrintVisitor
add .gitignore


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

Branch: refs/heads/prestonc/benchmarks
Commit: 38b67fffc9613ee02726b68699733b541b804f1c
Parents: cca368e
Author: Till Westmann <we...@gmail.com>
Authored: Fri Jan 31 07:12:02 2014 -0800
Committer: Till Westmann <we...@gmail.com>
Committed: Fri Jan 31 07:12:02 2014 -0800

----------------------------------------------------------------------
 .gitignore                                      |   4 +
 .../java/org/apache/vxquery/cli/VXQuery.java    |   6 +-
 ...ueryLogicalExpressionPrettyPrintVisitor.java | 150 +++++++++++++++++++
 3 files changed, 159 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/38b67fff/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f69f244
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.project
+.settings
+.classpath
+target

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/38b67fff/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
----------------------------------------------------------------------
diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
index cddff1b..9c93f69 100644
--- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
+++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
@@ -29,9 +29,11 @@ import java.util.Map;
 import org.apache.commons.io.FileUtils;
 import org.apache.vxquery.compiler.CompilerControlBlock;
 import org.apache.vxquery.compiler.algebricks.VXQueryGlobalDataFactory;
+import org.apache.vxquery.compiler.algebricks.prettyprint.VXQueryLogicalExpressionPrettyPrintVisitor;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.context.DynamicContextImpl;
 import org.apache.vxquery.context.RootStaticContextImpl;
+import org.apache.vxquery.context.StaticContext;
 import org.apache.vxquery.context.StaticContextImpl;
 import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.result.ResultUtils;
@@ -205,7 +207,9 @@ public class VXQuery {
                 public void notifyOptimizedResult(Module module) {
                     if (opts.showOET) {
                         try {
-                            LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
+                            StaticContext ctx = module.getCompilerControlBlock().getStaticContext();
+                        	VXQueryLogicalExpressionPrettyPrintVisitor ev = new VXQueryLogicalExpressionPrettyPrintVisitor(ctx);
+                            LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor(ev);
                             StringBuilder buffer = new StringBuilder();
                             PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
                             System.err.println(buffer.toString());

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/38b67fff/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/prettyprint/VXQueryLogicalExpressionPrettyPrintVisitor.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/prettyprint/VXQueryLogicalExpressionPrettyPrintVisitor.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/prettyprint/VXQueryLogicalExpressionPrettyPrintVisitor.java
new file mode 100644
index 0000000..48e923b
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/prettyprint/VXQueryLogicalExpressionPrettyPrintVisitor.java
@@ -0,0 +1,150 @@
+/*
+ * 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.compiler.algebricks.prettyprint;
+
+import java.util.List;
+
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
+import org.apache.vxquery.context.StaticContext;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.functions.BuiltinOperators;
+import org.apache.vxquery.types.SequenceType;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.StatefulFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.UnnestingFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionVisitor;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+
+public class VXQueryLogicalExpressionPrettyPrintVisitor implements ILogicalExpressionVisitor<String, Integer> {
+
+    StaticContext ctx;
+    IntegerPointable ip;
+    TaggedValuePointable tvp;
+
+    public VXQueryLogicalExpressionPrettyPrintVisitor(StaticContext ctx) {
+        this.ctx = ctx;
+        this.ip = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
+        this.tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+    }
+
+    @Override
+    public String visitConstantExpression(ConstantExpression expr, Integer indent) throws AlgebricksException {
+        return expr.toString();
+    }
+
+    @Override
+    public String visitVariableReferenceExpression(VariableReferenceExpression expr, Integer indent)
+            throws AlgebricksException {
+        return expr.toString();
+    }
+
+    @Override
+    public String visitAggregateFunctionCallExpression(AggregateFunctionCallExpression expr, Integer indent)
+            throws AlgebricksException {
+        return appendFunction(new StringBuilder(), expr, indent).toString();
+    }
+
+    @Override
+    public String visitScalarFunctionCallExpression(ScalarFunctionCallExpression expr, Integer indent)
+            throws AlgebricksException {
+        assert expr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL;
+
+        StringBuilder sb = new StringBuilder();
+
+        FunctionIdentifier fi = expr.getFunctionIdentifier();
+        if (identifiesTypeOperator(fi)) {
+            final ILogicalExpression typeEx = expr.getArguments().get(1).getValue();
+            assert typeEx.getExpressionTag() == LogicalExpressionTag.CONSTANT;
+            SequenceType type = getSequenceType((ConstantExpression) typeEx);
+            sb.append(fi + " <" + type + ">, Args:");
+            appendArgument(sb, expr.getArguments().get(0), indent + 2);
+        } else {
+            appendFunction(sb, expr, indent);
+        }
+        return sb.toString();
+    }
+
+    @Override
+    public String visitStatefulFunctionCallExpression(StatefulFunctionCallExpression expr, Integer indent)
+            throws AlgebricksException {
+        return appendFunction(new StringBuilder(), expr, indent).toString();
+    }
+
+    @Override
+    public String visitUnnestingFunctionCallExpression(UnnestingFunctionCallExpression expr, Integer indent)
+            throws AlgebricksException {
+        return appendFunction(new StringBuilder(), expr, indent).toString();
+    }
+
+    protected boolean identifiesTypeOperator(FunctionIdentifier fi) {
+        return BuiltinOperators.PROMOTE.getFunctionIdentifier().equals(fi)
+                || BuiltinOperators.TREAT.getFunctionIdentifier().equals(fi)
+                || BuiltinOperators.CAST.getFunctionIdentifier().equals(fi)
+                || BuiltinOperators.CASTABLE.getFunctionIdentifier().equals(fi)
+                || BuiltinOperators.INSTANCE_OF.getFunctionIdentifier().equals(fi);
+    }
+
+    protected StringBuilder appendFunction(StringBuilder sb, AbstractFunctionCallExpression expr, Integer indent)
+            throws AlgebricksException {
+        sb.append("function-call: " + expr.getFunctionIdentifier() + ", Args:");
+        appendArguments(sb, expr.getArguments(), indent + 2);
+        return sb;
+    }
+
+    protected StringBuilder appendArguments(StringBuilder sb, List<Mutable<ILogicalExpression>> args, Integer indent)
+            throws AlgebricksException {
+        sb.append("[\n");
+        for (Mutable<ILogicalExpression> arg : args) {
+            addIndent(sb, indent + 2).append(arg.getValue().accept(this, indent + 2)).append("\n");
+        }
+        return addIndent(sb, indent).append("]");
+    }
+
+    protected StringBuilder appendArgument(StringBuilder sb, Mutable<ILogicalExpression> arg, Integer indent)
+            throws AlgebricksException {
+        sb.append("[\n");
+        addIndent(sb, indent + 2).append(arg.getValue().accept(this, indent + 2)).append("\n");
+        return addIndent(sb, indent).append("]");
+    }
+
+    protected SequenceType getSequenceType(final ConstantExpression cTypeEx) {
+        final VXQueryConstantValue typeCodeVal = (VXQueryConstantValue) cTypeEx.getValue();
+        tvp.set(typeCodeVal.getValue(), 0, typeCodeVal.getValue().length);
+        assert tvp.getTag() == ValueTag.XS_INT_TAG;
+        tvp.getValue(ip);
+        int typeCode = ip.getInteger();
+        SequenceType type = ctx.lookupSequenceType(typeCode);
+        return type;
+    }
+
+    protected static final StringBuilder addIndent(StringBuilder buffer, int level) {
+        for (int i = 0; i < level; ++i) {
+            buffer.append(' ');
+        }
+        return buffer;
+    }
+
+}


[3/6] git commit: have Eclipse ignore the antrun and javacc plugins

Posted by pr...@apache.org.
have Eclipse ignore the antrun and javacc plugins


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

Branch: refs/heads/prestonc/benchmarks
Commit: 36fddcc5dcfbd3dc399150aa3663a02220dc4e4a
Parents: 9ac0146
Author: Till Westmann <we...@gmail.com>
Authored: Fri Jan 31 07:16:06 2014 -0800
Committer: Till Westmann <we...@gmail.com>
Committed: Fri Jan 31 07:16:06 2014 -0800

----------------------------------------------------------------------
 vxquery-core/pom.xml | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/36fddcc5/vxquery-core/pom.xml
----------------------------------------------------------------------
diff --git a/vxquery-core/pom.xml b/vxquery-core/pom.xml
index 3e66a1a..ebfb1a7 100644
--- a/vxquery-core/pom.xml
+++ b/vxquery-core/pom.xml
@@ -128,6 +128,48 @@
       </plugin>
       -->
     </plugins>
+    <pluginManagement>
+      <plugins>
+        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-antrun-plugin</artifactId>
+                    <versionRange>[1.6,)</versionRange>
+                    <goals>
+                      <goal>run</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>javacc-maven-plugin</artifactId>
+                    <versionRange>[2.6,)</versionRange>
+                    <goals>
+                      <goal>javacc</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
   </build>
 
   <dependencies>


[5/6] git commit: Merge branch 'westmann/prettyprint' into prestonc/benchmarks

Posted by pr...@apache.org.
Merge branch 'westmann/prettyprint' into prestonc/benchmarks

* westmann/prettyprint:
  pass a LogicalOperatorPrettyPrintVisitor to the OptimizationContext to pretty print during optimization clean up plan printing in the CLI
  have Eclipse ignore the antrun and javacc plugins
  move to hyracks 0.2.11-SNAPSHOT
  add VXQueryLogicalExpressionPrettyPrintVisitor add .gitignore

Conflicts:
	vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java


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

Branch: refs/heads/prestonc/benchmarks
Commit: 6297a95e3cad3d34fd98d514fc3c3abc2dc779f6
Parents: ee2ac9a 64f6eb9
Author: Preston Carman <pr...@apache.org>
Authored: Mon Feb 3 16:49:25 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Feb 3 16:49:25 2014 -0800

----------------------------------------------------------------------
 .gitignore                                      |   4 +
 .../java/org/apache/vxquery/cli/VXQuery.java    |  33 ++--
 vxquery-core/pom.xml                            |  42 ++++++
 ...ueryLogicalExpressionPrettyPrintVisitor.java | 150 +++++++++++++++++++
 .../rewriter/VXQueryOptimizationContext.java    |   7 +-
 .../xmlquery/query/XMLQueryCompiler.java        |   8 +-
 6 files changed, 224 insertions(+), 20 deletions(-)
----------------------------------------------------------------------



[6/6] git commit: Latest round of updates for the benchmark and little code clean up.

Posted by pr...@apache.org.
Latest round of updates for the benchmark and little code clean up.


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

Branch: refs/heads/prestonc/benchmarks
Commit: fb47b9f00dde64d0801e94271ada1ff199d98135
Parents: 6297a95
Author: Preston Carman <pr...@apache.org>
Authored: Tue Feb 4 20:07:27 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Tue Feb 4 20:07:27 2014 -0800

----------------------------------------------------------------------
 .../noaa-ghcn-daily/scripts/weather_cli.py      | 28 +++++++--
 .../scripts/weather_data_files.py               | 66 +++++++++++++-------
 ...tractRemoveRedundantTypeExpressionsRule.java | 36 +----------
 .../rewriter/rules/util/ExpressionToolbox.java  | 41 ++++++++++++
 .../rewriter/rules/util/OperatorToolbox.java    |  8 ++-
 5 files changed, 115 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/fb47b9f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py
index d9f83eb..108d7e6 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py
@@ -31,6 +31,7 @@ COMPRESSED = False
 #
 def main(argv):
     append = False
+    base_paths = []
     download_path = ""
     max_records = 0
     package = "ghcnd_gsn"
@@ -43,9 +44,10 @@ def main(argv):
     test = ""
     token = ""
     update = False
+    virtual_partitions = 0
     
     try:
-        opts, args = getopt.getopt(argv, "acd:f:hl:m:n:p:rs:t:uvw:", ["download_directory=", "file=", "locality=", "max_station_files=", "nodes=", "save_directory=", "package=", "partitions=", "web_service="])
+        opts, args = getopt.getopt(argv, "ab:cd:f:hl:m:n:p:rs:t:uvw:", ["base_paths", "download_directory=", "file=", "locality=", "max_station_files=", "nodes=", "save_directory=", "package=", "partitions=", "virtual_partitions=", "web_service="])
     except getopt.GetoptError:
         print 'The file options for weather_cli.py were not correctly specified.'
         print 'To see a full list of options try:'
@@ -55,6 +57,7 @@ def main(argv):
         if opt == '-h':
             print 'Converting weather daily files to xml options:'
             print '    -a        Append the results to the progress file.'
+            print '    -b (str)  The directories for saving the partitioned files seperated by a vertical bar (|).'
             print '    -c        Compress the produced XML file with .gz.'
             print '    --download_directory (str)  The directory for saving the downloaded files. (default: downloads)'
             print '    -d (str)  The directory for saving the downloaded files and generated XML files.'
@@ -71,10 +74,18 @@ def main(argv):
             print '    -r        Reset the build process. (For one section or all sections depending on other parameters.)'
             print '    -u        Recalculate the file count and data size for each data source file.'
             print '    -v        Extra debug information.'
+            print '    --virtual_partitions (int)  The number of partitions viewable for benchmarking.'
             print '    -w (str)  Downloads the station XML file form the web service.'
             sys.exit()
         elif opt in ('-a', "--append"):
             append = True
+        elif opt in ('-b', "--base_paths"):
+            # check if directories exist.
+            base_paths = arg.split('|')
+            for base_path in base_paths:
+                if not os.path.exists(base_path):
+                    print 'Error: Argument must be a directory list --base_paths (-b).'
+                    sys.exit()
         elif opt == '-c':
             global COMPRESSED
             COMPRESSED = True
@@ -139,6 +150,12 @@ def main(argv):
             reset = True
         elif opt == '-u':
             update = True
+        elif opt == "--virtual_partitions":
+            if arg.isdigit():
+                virtual_partitions = int(arg)
+            else:
+                print 'Error: Argument must be an integer for --virtual_partitions.'
+                sys.exit()
         elif opt == '-v':
             global DEBUG_OUTPUT
             DEBUG_OUTPUT = True
@@ -234,16 +251,17 @@ def main(argv):
             else:
                 data.update_file_station_status(file_name, WeatherDataFiles.DATA_FILE_MISSING)
                 
-    if section in ("all", "partition") and partitions > 1:
+    if section in ("all", "partition") and partitions > 0:
         print 'Processing the partition section.'
         data.reset()
-        data.copy_to_n_partitions(xml_data_save_path, partitions)
+        data_key = "_partition_" + package + ("_xml_gz" if COMPRESSED else "_xml")
+        data.copy_to_n_partitions(xml_data_save_path, data_key, partitions, base_paths)
 
     if section in ("test_links"):
-        if test and partitions > 0 and nodes > -1:
+        if test and partitions > 0 and virtual_partitions > 0 and nodes > -1:
             print 'Processing the test links section.'
             data.reset()
-            data.create_test_links(save_path, test, nodes, partitions)
+            data.create_test_links(save_path, xml_data_save_path, test, nodes, partitions, virtual_partitions, base_paths)
         else:
             print 'Error: Not enough information for this section.'
             sys.exit()

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/fb47b9f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py
index a2d8731..a9ba997 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py
@@ -92,39 +92,51 @@ class WeatherDataFiles:
             self.close_progress_data(True)
         self.reset()
         
-    def create_test_links(self, save_path, test, node, partitions):
+    def create_test_links(self, save_path, xml_save_path, test, node, partitions, virtual_partitions, base_paths=[]):
+        if (len(base_paths) == 0):
+            base_paths.append(os.path.dirname(save_path))
+        partition_list = sorted(self.get_partition_paths(xml_save_path, partitions, base_paths))
+        
         test_path = save_path + "/" + test
         if not os.path.isdir(test_path):
             os.makedirs(test_path)
-        for i in range(partitions):
-            test_partition_path = test_path + "/partition" + str(i+1)
-            if (node <= i):
-                # link
-                if test == "speed_up":
-                    os.symlink(save_path + "/" + str(i+1) + "." + str(node) + "_partition_ghcnd_all_xml_gz", test_partition_path)
-                if test == "batch_scale_up":
-                    os.symlink(save_path + "/" + str(partitions) + "." + str(node) + "_partition_ghcnd_all_xml_gz", test_partition_path)
-            else:
-                # fake directories
-                os.makedirs(test_partition_path + "/sensors")
-                os.makedirs(test_partition_path + "/stations")
+        for i in range(virtual_partitions):
+            # one virtual partition per disk
+            for j in range(len(base_paths)):
+                for index, path in enumerate(partition_list):
+                    offset = partitions * j
+                    test_partition_path = test_path + "/partition" + str(i + 1) + "_disk" + str(j + 1)
+                    if not os.path.isdir(test_partition_path):
+                        os.makedirs(test_partition_path)
+                    if (node <= i):
+                        if test == "speed_up":
+                            group = partitions / (i + 1)
+                        elif test == "batch_scale_up":
+                            group = partitions / virtual_partitions
+                        else:
+                            group = -1
+                        # link
+                        if (group) * node + offset <= index and index < (group) * (node + 1) + offset:
+                            os.symlink(path, test_partition_path + "/index" + str(index))
+                    else:
+                        # fake directories
+                        os.makedirs(test_partition_path + "/sensors")
+                        os.makedirs(test_partition_path + "/stations")
             
         
     # Once the initial data has been generated, the data can be copied into a set number of partitions. 
-    def copy_to_n_partitions(self, save_path, partitions):
+    def copy_to_n_partitions(self, save_path, data_key, partitions, base_paths=[]):
+        if (len(base_paths) == 0):
+            return
         
-                
         # Initialize the partition paths.
-        partition_paths = []
         partition_sizes = []
-        for i in range(0, partitions):
-            new_partition_path = save_path.replace("1.0_partition", str(partitions) + "." + str(i) + "_partition")
-            partition_paths.append(new_partition_path)
+        partition_paths = self.get_partition_paths(data_key, partitions, base_paths)
+        for path in partition_paths:
             partition_sizes.append(0)
-            
             # Make sure the xml folder is available.
-            if not os.path.isdir(new_partition_path):
-                os.makedirs(new_partition_path)
+            if not os.path.isdir(path):
+                os.makedirs(path)
 
         # copy stations and sensors into each partition
         current_partition = 0
@@ -153,7 +165,15 @@ class WeatherDataFiles:
                 if not os.path.isdir(new_file_base):
                     os.makedirs(new_file_base)
                 shutil.copyfile(file_path, new_file_path)
-            
+    
+    def get_partition_paths(self, data_key, partitions, base_paths):        
+        partition_paths = []
+        for i in range(0, partitions):
+            for j in range(0, len(base_paths)):
+                new_partition_path = base_paths[j] + "/p" + str(partitions) + ".i" + str(i) + ".d" + str(j) + data_key + "/"
+                partition_paths.append(new_partition_path)
+        return partition_paths
+
     def get_csv_in_partition_order(self):
         self.open_progress_data()
         row_count = len(self.progress_data)

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/fb47b9f0/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
index 2d68a6e..10dbd53 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
@@ -104,7 +104,7 @@ public abstract class AbstractRemoveRedundantTypeExpressionsRule implements IAlg
             Mutable<ILogicalExpression> argFirstM = searchFunction.getArguments().get(ARG_DATA);
 
             // Find the input return type.
-            inputSequenceType = getOutputSequenceType(opRef, argFirstM);
+            inputSequenceType = ExpressionToolbox.getOutputSequenceType(opRef, argFirstM);
 
             // Find the treat type.
             SequenceType sTypeArg = null;
@@ -121,40 +121,6 @@ public abstract class AbstractRemoveRedundantTypeExpressionsRule implements IAlg
         return modified;
     }
 
-    private SequenceType getOutputSequenceType(Mutable<ILogicalOperator> opRef, Mutable<ILogicalExpression> argFirstM) {
-        ILogicalExpression argFirstLe = argFirstM.getValue();
-        switch (argFirstLe.getExpressionTag()) {
-            case FUNCTION_CALL:
-                // Only process defined functions.
-                Function function = ExpressionToolbox.getBuiltIn(argFirstM);
-                if (function == null) {
-                    return null;
-                } else if (function.getFunctionIdentifier().equals(BuiltinOperators.CAST.getFunctionIdentifier())) {
-                    // Special case since case has multiple type outputs.
-                    return ExpressionToolbox.getTypeExpressionTypeArguement(argFirstM, dCtx);
-                } else {
-                    return function.getSignature().getReturnType();
-                }
-            case CONSTANT:
-                // Consider constant values.
-                ConstantExpression constantExpression = (ConstantExpression) argFirstLe;
-                VXQueryConstantValue constantValue = (VXQueryConstantValue) constantExpression.getValue();
-                return constantValue.getType();
-            case VARIABLE:
-                VariableReferenceExpression variableRefExp = (VariableReferenceExpression) argFirstLe;
-                LogicalVariable variableId = variableRefExp.getVariableReference();
-                Mutable<ILogicalOperator> variableProducer = OperatorToolbox.findProducerOf(opRef, variableId);
-                if (variableProducer == null) {
-                    return null;
-                }
-                AbstractLogicalOperator variableOp = (AbstractLogicalOperator) variableProducer.getValue();
-                if (variableOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
-                    return SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_ONE);
-                }
-        }
-        return null;
-    }
-
     public abstract boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput);
 
     public boolean hasTypeArgument() {

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/fb47b9f0/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
index 955634d..ef5753e 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
@@ -20,20 +20,26 @@ import java.util.List;
 
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
+import org.apache.vxquery.context.RootStaticContextImpl;
 import org.apache.vxquery.context.StaticContextImpl;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.functions.BuiltinFunctions;
 import org.apache.vxquery.functions.BuiltinOperators;
 import org.apache.vxquery.functions.Function;
+import org.apache.vxquery.types.AnyNodeType;
+import org.apache.vxquery.types.Quantifier;
 import org.apache.vxquery.types.SequenceType;
 
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
 import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
 
 public class ExpressionToolbox {
@@ -174,4 +180,39 @@ public class ExpressionToolbox {
             return null;
         }
     }
+    
+    public static SequenceType getOutputSequenceType(Mutable<ILogicalOperator> opRef, Mutable<ILogicalExpression> argFirstM) {
+        final StaticContextImpl dCtx = new StaticContextImpl(RootStaticContextImpl.INSTANCE);
+        ILogicalExpression argFirstLe = argFirstM.getValue();
+        switch (argFirstLe.getExpressionTag()) {
+            case FUNCTION_CALL:
+                // Only process defined functions.
+                Function function = ExpressionToolbox.getBuiltIn(argFirstM);
+                if (function == null) {
+                    return null;
+                } else if (function.getFunctionIdentifier().equals(BuiltinOperators.CAST.getFunctionIdentifier())) {
+                    // Special case since case has multiple type outputs.
+                    return ExpressionToolbox.getTypeExpressionTypeArguement(argFirstM, dCtx);
+                } else {
+                    return function.getSignature().getReturnType();
+                }
+            case CONSTANT:
+                // Consider constant values.
+                ConstantExpression constantExpression = (ConstantExpression) argFirstLe;
+                VXQueryConstantValue constantValue = (VXQueryConstantValue) constantExpression.getValue();
+                return constantValue.getType();
+            case VARIABLE:
+                VariableReferenceExpression variableRefExp = (VariableReferenceExpression) argFirstLe;
+                LogicalVariable variableId = variableRefExp.getVariableReference();
+                Mutable<ILogicalOperator> variableProducer = OperatorToolbox.findProducerOf(opRef, variableId);
+                if (variableProducer == null) {
+                    return null;
+                }
+                AbstractLogicalOperator variableOp = (AbstractLogicalOperator) variableProducer.getValue();
+                if (variableOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
+                    return SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_ONE);
+                }
+        }
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/fb47b9f0/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java
index bbf9b45..e1589ce 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java
@@ -220,7 +220,13 @@ public class OperatorToolbox {
             case WRITE:
             case WRITE_RESULT:
             default:
-                // TODO Not yet implemented.
+                // Skip operators and go look at input.
+                for (Mutable<ILogicalOperator> input : op.getInputs()) {
+                    Mutable<ILogicalOperator> opInput = findProducerOf(input, lv);
+                    if (opInput != null) {
+                        return opInput;
+                    }
+                }
                 break;
         }
         return null;


[2/6] git commit: move to hyracks 0.2.11-SNAPSHOT

Posted by pr...@apache.org.
move to hyracks 0.2.11-SNAPSHOT


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

Branch: refs/heads/prestonc/benchmarks
Commit: 9ac01462588ce36d69b09813c2aeb4ca523fef5d
Parents: 38b67ff
Author: Till Westmann <we...@gmail.com>
Authored: Fri Jan 31 07:12:55 2014 -0800
Committer: Till Westmann <we...@gmail.com>
Committed: Fri Jan 31 07:12:55 2014 -0800

----------------------------------------------------------------------
 pom.xml                                                        | 2 +-
 .../org/apache/vxquery/compiler/rewriter/RewriteRuleset.java   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/9ac01462/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ebaec0f..db91760 100644
--- a/pom.xml
+++ b/pom.xml
@@ -424,7 +424,7 @@
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-    <hyracks.version>0.2.10-SNAPSHOT</hyracks.version>
+    <hyracks.version>0.2.11-SNAPSHOT</hyracks.version>
   </properties>
 
   <modules>

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/9ac01462/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
index 8ca3218..4ffdd44 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
@@ -57,7 +57,7 @@ import edu.uci.ics.hyracks.algebricks.rewriter.rules.IntroduceGroupByCombinerRul
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.IntroduceProjectsRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.IsolateHyracksOperatorsRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PullSelectOutOfEqJoin;
-import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushLimitDownRule;
+import edu.uci.ics.hyracks.algebricks.rewriter.rules.CopyLimitDownRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushProjectDownRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushProjectIntoDataSourceScanRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushSelectDownRule;
@@ -238,13 +238,13 @@ public class RewriteRuleset {
         physicalPlanRewrites.add(new SetAlgebricksPhysicalOperatorsRule());
         physicalPlanRewrites.add(new EnforceStructuralPropertiesRule());
         physicalPlanRewrites.add(new PushProjectDownRule());
-        physicalPlanRewrites.add(new PushLimitDownRule());
+        physicalPlanRewrites.add(new CopyLimitDownRule());
         return physicalPlanRewrites;
     }
 
     public final static List<IAlgebraicRewriteRule> buildPhysicalRewritesTopLevelRuleCollection() {
         List<IAlgebraicRewriteRule> physicalPlanRewrites = new LinkedList<IAlgebraicRewriteRule>();
-        physicalPlanRewrites.add(new PushLimitDownRule());
+        physicalPlanRewrites.add(new CopyLimitDownRule());
         return physicalPlanRewrites;
     }
 


[4/6] git commit: pass a LogicalOperatorPrettyPrintVisitor to the OptimizationContext to pretty print during optimization clean up plan printing in the CLI

Posted by pr...@apache.org.
pass a LogicalOperatorPrettyPrintVisitor to the OptimizationContext to pretty print during optimization
clean up plan printing in the CLI


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

Branch: refs/heads/prestonc/benchmarks
Commit: 64f6eb91e847568fe1384781d88aabd740eb8b4e
Parents: 36fddcc
Author: Till Westmann <we...@gmail.com>
Authored: Mon Feb 3 15:37:33 2014 -0800
Committer: Till Westmann <we...@gmail.com>
Committed: Mon Feb 3 15:37:33 2014 -0800

----------------------------------------------------------------------
 .../java/org/apache/vxquery/cli/VXQuery.java    | 33 +++++++++-----------
 .../rewriter/VXQueryOptimizationContext.java    |  7 +++--
 .../xmlquery/query/XMLQueryCompiler.java        |  8 ++++-
 3 files changed, 26 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/64f6eb91/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
----------------------------------------------------------------------
diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
index 9c93f69..537b990 100644
--- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
+++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
@@ -51,6 +51,7 @@ 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.client.HyracksConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
 import edu.uci.ics.hyracks.api.client.NodeControllerInfo;
@@ -182,14 +183,7 @@ public class VXQuery {
                 @Override
                 public void notifyTranslationResult(Module module) {
                     if (opts.showTET) {
-                        try {
-                            LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
-                            StringBuilder buffer = new StringBuilder();
-                            PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
-                            System.err.println(buffer.toString());
-                        } catch (AlgebricksException e) {
-                            e.printStackTrace();
-                        }
+                        System.err.println(appendPrettyPlan(new StringBuilder(), module).toString());
                     }
                 }
 
@@ -206,16 +200,7 @@ public class VXQuery {
                 @Override
                 public void notifyOptimizedResult(Module module) {
                     if (opts.showOET) {
-                        try {
-                            StaticContext ctx = module.getCompilerControlBlock().getStaticContext();
-                        	VXQueryLogicalExpressionPrettyPrintVisitor ev = new VXQueryLogicalExpressionPrettyPrintVisitor(ctx);
-                            LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor(ev);
-                            StringBuilder buffer = new StringBuilder();
-                            PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
-                            System.err.println(buffer.toString());
-                        } catch (AlgebricksException e) {
-                            e.printStackTrace();
-                        }
+                        System.err.println(appendPrettyPlan(new StringBuilder(), module).toString());
                     }
                 }
 
@@ -231,6 +216,18 @@ public class VXQuery {
                         System.err.println(new XStream(new DomDriver()).toXML(moduleNode));
                     }
                 }
+                
+                private StringBuilder appendPrettyPlan(StringBuilder sb, Module module) {
+                    try {
+                        StaticContext ctx = module.getCompilerControlBlock().getStaticContext();
+                        ILogicalExpressionVisitor<String, Integer> ev = new VXQueryLogicalExpressionPrettyPrintVisitor(ctx);
+                        LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor(ev);
+                        PlanPrettyPrinter.printPlan(module.getBody(), sb, v, 0);
+                    } catch (AlgebricksException e) {
+                        e.printStackTrace();
+                    }
+                    return sb;
+                }
             };
 
             XMLQueryCompiler compiler = new XMLQueryCompiler(listener, getNodeList(), opts.frameSize);

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/64f6eb91/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java
index b985a6a..a763649 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java
@@ -27,6 +27,7 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSi
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
+import edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.LogicalOperatorPrettyPrintVisitor;
 import edu.uci.ics.hyracks.algebricks.core.rewriter.base.AlgebricksOptimizationContext;
 import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
 
@@ -40,10 +41,10 @@ public class VXQueryOptimizationContext extends AlgebricksOptimizationContext {
 
     public VXQueryOptimizationContext(int varCounter, IExpressionEvalSizeComputer expressionEvalSizeComputer,
             IMergeAggregationExpressionFactory mergeAggregationExpressionFactory,
-            IExpressionTypeComputer expressionTypeComputer,
-            INullableTypeComputer nullableTypeComputer, PhysicalOptimizationConfig physicalOptimizationConfig) {
+            IExpressionTypeComputer expressionTypeComputer, INullableTypeComputer nullableTypeComputer,
+            PhysicalOptimizationConfig physicalOptimizationConfig, LogicalOperatorPrettyPrintVisitor prettyPrintVisitor) {
         super(varCounter, expressionEvalSizeComputer, mergeAggregationExpressionFactory, expressionTypeComputer,
-                nullableTypeComputer, physicalOptimizationConfig);
+                nullableTypeComputer, physicalOptimizationConfig, prettyPrintVisitor);
     }
 
     public VXQueryCollectionDataSource getCollectionDataSourceMap(String collectionName) {

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/64f6eb91/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
index 79637d6..8b10efc 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
@@ -26,6 +26,7 @@ import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
 import org.apache.vxquery.compiler.algebricks.VXQueryExpressionRuntimeProvider;
 import org.apache.vxquery.compiler.algebricks.VXQueryNullWriterFactory;
 import org.apache.vxquery.compiler.algebricks.VXQueryPrinterFactoryProvider;
+import org.apache.vxquery.compiler.algebricks.prettyprint.VXQueryLogicalExpressionPrettyPrintVisitor;
 import org.apache.vxquery.compiler.rewriter.RewriteRuleset;
 import org.apache.vxquery.compiler.rewriter.VXQueryOptimizationContext;
 import org.apache.vxquery.exceptions.ErrorCode;
@@ -58,6 +59,7 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IMergeAggregation
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
 import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+import edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.LogicalOperatorPrettyPrintVisitor;
 import edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController;
 import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
 import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IOptimizationContextFactory;
@@ -75,6 +77,8 @@ public class XMLQueryCompiler {
     private final ICompilerFactory cFactory;
 
     private final VXQueryMetadataProvider mdProvider;
+    
+    private LogicalOperatorPrettyPrintVisitor pprinter;
 
     private ModuleNode moduleNode;
 
@@ -97,7 +101,7 @@ public class XMLQueryCompiler {
                             PhysicalOptimizationConfig physicalOptimizationConfig) {
                         return new VXQueryOptimizationContext(varCounter, expressionEvalSizeComputer,
                                 mergeAggregationExpressionFactory, expressionTypeComputer, nullableTypeComputer,
-                                physicalOptimizationConfig);
+                                physicalOptimizationConfig, pprinter);
                     }
                 });
         builder.getPhysicalOptimizationConfig().setFrameSize(this.frameSize);
@@ -150,6 +154,8 @@ public class XMLQueryCompiler {
         moduleNode = XMLQueryParser.parse(name, query);
         listener.notifyParseResult(moduleNode);
         module = new XMLQueryTranslator(ccb).translateModule(moduleNode);
+        pprinter = new LogicalOperatorPrettyPrintVisitor(new VXQueryLogicalExpressionPrettyPrintVisitor(module
+                .getCompilerControlBlock().getStaticContext()));
         compiler = cFactory.createCompiler(module.getBody(), mdProvider, 0);
         listener.notifyTranslationResult(module);
         XMLQueryTypeChecker.typeCheckModule(module);