You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by ti...@apache.org on 2014/01/31 16:20:18 UTC
[1/3] git commit: add VXQueryLogicalExpressionPrettyPrintVisitor add
.gitignore
Updated Branches:
refs/heads/westmann/prettyprint [created] 36fddcc5d
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/westmann/prettyprint
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/3] git commit: have Eclipse ignore the antrun and javacc plugins
Posted by ti...@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/westmann/prettyprint
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>
[2/3] git commit: move to hyracks 0.2.11-SNAPSHOT
Posted by ti...@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/westmann/prettyprint
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;
}