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/28 20:30:46 UTC

[05/11] vxquery git commit: changes made to include github comments

changes made to include github comments


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

Branch: refs/heads/master
Commit: 480a38fb0545e6fa0f588ea1a3e51848bb3a3556
Parents: 3129824
Author: Shivani Mall <sm...@ucr.edu>
Authored: Fri Jun 26 16:36:15 2015 -0700
Committer: Shivani Mall <sm...@ucr.edu>
Committed: Fri Jun 26 16:36:15 2015 -0700

----------------------------------------------------------------------
 .../EliminateUnnestAggregateSubplanRule.java    |  1 -
 .../rules/ReplaceSourceMapInDocExpression.java  | 20 +++++++-------------
 .../rewriter/rules/util/OperatorToolbox.java    |  3 ---
 .../ExpectedTestResults/Simple/fn_doc.xml       | 18 +++++++++++++++++-
 4 files changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/480a38fb/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSubplanRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSubplanRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSubplanRule.java
index c9e9586..193b53d 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSubplanRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateUnnestAggregateSubplanRule.java
@@ -78,7 +78,6 @@ public class EliminateUnnestAggregateSubplanRule implements IAlgebraicRewriteRul
             return false;
         }
         AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression;
-
         if (!functionCall.getFunctionIdentifier().equals(BuiltinOperators.ITERATE.getFunctionIdentifier())) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/vxquery/blob/480a38fb/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ReplaceSourceMapInDocExpression.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ReplaceSourceMapInDocExpression.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ReplaceSourceMapInDocExpression.java
index b656185..29e0def 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ReplaceSourceMapInDocExpression.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ReplaceSourceMapInDocExpression.java
@@ -20,8 +20,6 @@ import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.io.File;
 import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
 import java.util.List;
 
 import org.apache.commons.lang3.mutable.Mutable;
@@ -81,6 +79,8 @@ public class ReplaceSourceMapInDocExpression implements IAlgebraicRewriteRule {
     final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
     final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
     final DataOutput dOut = abvs.getDataOutput();
+    StringBuilder toStr = new StringBuilder();
+    String docArg = null;
 
     @Override
     public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
@@ -136,24 +136,18 @@ public class ReplaceSourceMapInDocExpression implements IAlgebraicRewriteRule {
             return false;
         }
         tvp.set(constantValue.getValue(), 0, constantValue.getValue().length);
-        String collectionName = null;
         tvp.getValue(stringp);
         if (tvp.getTag() != ValueTag.XS_STRING_TAG) {
             return false;
         }
-        try {
-            bbis.setByteBuffer(
-                    ByteBuffer.wrap(Arrays.copyOfRange(stringp.getByteArray(), stringp.getStartOffset(),
-                            stringp.getLength() + stringp.getStartOffset())), 0);
-            collectionName = di.readUTF();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
+        stringp.toString(toStr);
+        docArg = toStr.toString();
+
         VXQueryMetadataProvider mdp = (VXQueryMetadataProvider) context.getMetadataProvider();
-        if (!mdp.getSourceFileMap().containsKey(collectionName)) {
+        if (!mdp.getSourceFileMap().containsKey(docArg)) {
             return false;
         }
-        File file = mdp.getSourceFileMap().get(collectionName);
+        File file = mdp.getSourceFileMap().get(docArg);
         StringValueBuilder svb = new StringValueBuilder();
         try {
             abvs.reset();

http://git-wip-us.apache.org/repos/asf/vxquery/blob/480a38fb/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 d0384a8..78cd80f 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
@@ -67,9 +67,6 @@ public class OperatorToolbox {
         switch (op.getOperatorTag()) {
             case AGGREGATE:
             case ASSIGN:
-                AbstractAssignOperator aap = (AbstractAssignOperator) op;
-                result.addAll(aap.getExpressions());
-                break;
             case RUNNINGAGGREGATE:
                 AbstractAssignOperator aao = (AbstractAssignOperator) op;
                 result.addAll(aao.getExpressions());

http://git-wip-us.apache.org/repos/asf/vxquery/blob/480a38fb/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/fn_doc.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/fn_doc.xml b/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/fn_doc.xml
index 169a175..e934f2c 100644
--- a/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/fn_doc.xml
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/fn_doc.xml
@@ -1 +1,17 @@
-<stationCollection pageSize="100"pageCount="1"totalCount="1"><station><id>GHCND:US000000001</id><displayName>Station 1</displayName><latitude>10.000</latitude><longitude>-10.000</longitude><elevation>1000.0</elevation><locationLabels><type>ST</type><id>FIPS:1</id><displayName>State 1</displayName></locationLabels><locationLabels><type>CNTY</type><id>FIPS:-9999</id><displayName>County 1</displayName></locationLabels><locationLabels><type>CNTRY</type><id>FIPS:US</id><displayName>UNITED STATES</displayName></locationLabels></station></stationCollection>
\ No newline at end of file
+<!--
+  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.
+-->
+<stationCollection pageSize="100" pageCount="1" totalCount="1"><station><id>GHCND:US000000001</id><displayName>Station 1</displayName><latitude>10.000</latitude><longitude>-10.000</longitude><elevation>1000.0</elevation><locationLabels><type>ST</type><id>FIPS:1</id><displayName>State 1</displayName></locationLabels><locationLabels><type>CNTY</type><id>FIPS:-9999</id><displayName>County 1</displayName></locationLabels><locationLabels><type>CNTRY</type><id>FIPS:US</id><displayName>UNITED STATES</displayName></locationLabels></station></stationCollection>
\ No newline at end of file