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/26 04:57:55 UTC

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

Author: vinayakb
Date: Tue Jun 26 02:57:53 2012
New Revision: 1353806

URL: http://svn.apache.org/viewvc?rev=1353806&view=rev
Log:
Added inspector factories

Added:
    incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java
    incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java
Modified:
    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/VXQueryBinaryBooleanInspectorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java?rev=1353806&view=auto
==============================================================================
--- incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java (added)
+++ incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java Tue Jun 26 02:57:53 2012
@@ -0,0 +1,28 @@
+package org.apache.vxquery.compiler.algebricks;
+
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+
+import edu.uci.ics.hyracks.algebricks.data.IBinaryBooleanInspector;
+import edu.uci.ics.hyracks.algebricks.data.IBinaryBooleanInspectorFactory;
+import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.data.std.primitive.BooleanPointable;
+
+public class VXQueryBinaryBooleanInspectorFactory implements IBinaryBooleanInspectorFactory {
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public IBinaryBooleanInspector createBinaryBooleanInspector(IHyracksTaskContext ctx) {
+        final TaggedValuePointable tvp = new TaggedValuePointable();
+        final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
+        return new IBinaryBooleanInspector() {
+            @Override
+            public boolean getBooleanValue(byte[] bytes, int offset, int length) {
+                tvp.set(bytes, offset, length);
+                assert tvp.getTag() == ValueTag.XS_BOOLEAN_TAG;
+                tvp.getValue(bp);
+                return bp.getBoolean();
+            }
+        };
+    }
+}
\ No newline at end of file

Added: incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java?rev=1353806&view=auto
==============================================================================
--- incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java (added)
+++ incubator/vxquery/branches/vxquery_algebricks/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java Tue Jun 26 02:57:53 2012
@@ -0,0 +1,28 @@
+package org.apache.vxquery.compiler.algebricks;
+
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+
+import edu.uci.ics.hyracks.algebricks.data.IBinaryIntegerInspector;
+import edu.uci.ics.hyracks.algebricks.data.IBinaryIntegerInspectorFactory;
+import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+
+public class VXQueryBinaryIntegerInspectorFactory implements IBinaryIntegerInspectorFactory {
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public IBinaryIntegerInspector createBinaryIntegerInspector(IHyracksTaskContext ctx) {
+        final TaggedValuePointable tvp = new TaggedValuePointable();
+        final IntegerPointable ip = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
+        return new IBinaryIntegerInspector() {
+            @Override
+            public int getIntegerValue(byte[] bytes, int offset, int length) {
+                tvp.set(bytes, offset, length);
+                assert tvp.getTag() == ValueTag.XS_INT_TAG;
+                tvp.getValue(ip);
+                return ip.getInteger();
+            }
+        };
+    }
+}
\ No newline at end of file

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=1353806&r1=1353805&r2=1353806&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 Tue Jun 26 02:57:53 2012
@@ -19,6 +19,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.vxquery.compiler.CompilerControlBlock;
+import org.apache.vxquery.compiler.algebricks.VXQueryBinaryBooleanInspectorFactory;
+import org.apache.vxquery.compiler.algebricks.VXQueryBinaryIntegerInspectorFactory;
 import org.apache.vxquery.compiler.algebricks.VXQueryComparatorFactoryProvider;
 import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
 import org.apache.vxquery.compiler.algebricks.VXQueryExpressionRuntimeProvider;
@@ -77,6 +79,8 @@ public class XMLQueryCompiler {
         builder.setPrinterProvider(VXQueryPrinterFactoryProvider.INSTANCE);
         builder.setExpressionRuntimeProvider(new VXQueryExpressionRuntimeProvider());
         builder.setComparatorFactoryProvider(new VXQueryComparatorFactoryProvider());
+        builder.setBinaryBooleanInspectorFactory(new VXQueryBinaryBooleanInspectorFactory());
+        builder.setBinaryIntegerInspectorFactory(new VXQueryBinaryIntegerInspectorFactory());
         builder.setExpressionTypeComputer(new IExpressionTypeComputer() {
             @Override
             public Object getType(ILogicalExpression expr, IMetadataProvider<?, ?> metadataProvider,