You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by vi...@apache.org on 2012/06/25 16:20:31 UTC

svn commit: r1353568 - in /incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery: compiler/algebricks/ runtime/functions/sequence/ xmlquery/query/

Author: vinayakb
Date: Mon Jun 25 14:20:29 2012
New Revision: 1353568

URL: http://svn.apache.org/viewvc?rev=1353568&view=rev
Log:
Modified to work with the Algebricks change to use IExpressionRuntimeProvider natively. Added comparator factory

Added:
    incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java
Removed:
    incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryExpressionJobGen.java
Modified:
    incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/SequenceAggregateEvaluatorFactory.java
    incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java

Added: incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java?rev=1353568&view=auto
==============================================================================
--- incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java (added)
+++ incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java Mon Jun 25 14:20:29 2012
@@ -0,0 +1,40 @@
+package org.apache.vxquery.compiler.algebricks;
+
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+
+public class VXQueryComparatorFactoryProvider implements IBinaryComparatorFactoryProvider {
+    @Override
+    public IBinaryComparatorFactory getBinaryComparatorFactory(Object type, boolean ascending)
+            throws AlgebricksException {
+        return new BinaryComparatorFactory(type, ascending);
+    }
+
+    private static class BinaryComparatorFactory implements IBinaryComparatorFactory {
+        private static final long serialVersionUID = 1L;
+
+        private final boolean ascending;
+
+        public BinaryComparatorFactory(Object type, boolean ascending) {
+            this.ascending = ascending;
+        }
+
+        @Override
+        public IBinaryComparator createBinaryComparator() {
+            final TaggedValuePointable tvp1 = new TaggedValuePointable();
+            final TaggedValuePointable tvp2 = new TaggedValuePointable();
+            return new IBinaryComparator() {
+                @Override
+                public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                    tvp1.set(b1, s1, l1);
+                    tvp2.set(b2, s2, l2);
+                    return 0;
+                }
+            };
+        }
+    }
+}
\ No newline at end of file

Modified: incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/SequenceAggregateEvaluatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/SequenceAggregateEvaluatorFactory.java?rev=1353568&r1=1353567&r2=1353568&view=diff
==============================================================================
--- incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/SequenceAggregateEvaluatorFactory.java (original)
+++ incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/SequenceAggregateEvaluatorFactory.java Mon Jun 25 14:20:29 2012
@@ -43,11 +43,6 @@ public class SequenceAggregateEvaluatorF
             }
 
             @Override
-            public void finishPartial() throws AlgebricksException {
-
-            }
-
-            @Override
             public void finish(IPointable result) throws AlgebricksException {
                 if (slots.getSize() != 1) {
                     try {

Modified: incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java?rev=1353568&r1=1353567&r2=1353568&view=diff
==============================================================================
--- incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java (original)
+++ incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java Mon Jun 25 14:20:29 2012
@@ -19,8 +19,9 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.vxquery.compiler.CompilerControlBlock;
+import org.apache.vxquery.compiler.algebricks.VXQueryComparatorFactoryProvider;
 import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
-import org.apache.vxquery.compiler.algebricks.VXQueryExpressionJobGen;
+import org.apache.vxquery.compiler.algebricks.VXQueryExpressionRuntimeProvider;
 import org.apache.vxquery.compiler.algebricks.VXQueryPrinterFactoryProvider;
 import org.apache.vxquery.compiler.rewriter.RewriteRuleset;
 import org.apache.vxquery.exceptions.ErrorCode;
@@ -74,7 +75,8 @@ public class XMLQueryCompiler {
             }
         });
         builder.setPrinterProvider(VXQueryPrinterFactoryProvider.INSTANCE);
-        builder.setExprJobGen(new VXQueryExpressionJobGen());
+        builder.setExpressionRuntimeProvider(new VXQueryExpressionRuntimeProvider());
+        builder.setComparatorFactoryProvider(new VXQueryComparatorFactoryProvider());
         builder.setExpressionTypeComputer(new IExpressionTypeComputer() {
             @Override
             public Object getType(ILogicalExpression expr, IMetadataProvider<?, ?> metadataProvider,