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/04/02 06:12:02 UTC
[22/50] [abbrv] git commit: Improve search for functions based on
things I learned from join.
Improve search for functions based on things I learned from join.
Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/6d0b66bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/6d0b66bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/6d0b66bb
Branch: refs/heads/prestonc/hash_join
Commit: 6d0b66bbd70fee58e2c9777878f9a913f6c42ef2
Parents: 5059420
Author: Preston Carman <pr...@apache.org>
Authored: Wed Mar 12 13:12:27 2014 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Tue Apr 1 20:56:24 2014 -0700
----------------------------------------------------------------------
.../rewriter/rules/util/ExpressionToolbox.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/6d0b66bb/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 78ceeb7..d674f76 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
@@ -18,8 +18,11 @@ package org.apache.vxquery.compiler.rewriter.rules.util;
import java.util.List;
+import javax.xml.namespace.QName;
+
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
+import org.apache.vxquery.context.StaticContext;
import org.apache.vxquery.context.StaticContextImpl;
import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
import org.apache.vxquery.functions.BuiltinFunctions;
@@ -78,7 +81,8 @@ public class ExpressionToolbox {
return null;
}
- public static void findVariableExpressions(Mutable<ILogicalExpression> mutableLe, List<Mutable<ILogicalExpression>> finds) {
+ public static void findVariableExpressions(Mutable<ILogicalExpression> mutableLe,
+ List<Mutable<ILogicalExpression>> finds) {
ILogicalExpression le = mutableLe.getValue();
if (le.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
finds.add(mutableLe);
@@ -144,14 +148,15 @@ public class ExpressionToolbox {
}
}
- public static Function getBuiltIn(Mutable<ILogicalExpression> mutableLe) {
+ public static Function getBuiltIn(Mutable<ILogicalExpression> mutableLe, StaticContext rootContext) {
ILogicalExpression le = mutableLe.getValue();
if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le;
- for (Function function : BuiltinFunctions.FUNCTION_COLLECTION) {
- if (function.getFunctionIdentifier().equals(afce.getFunctionIdentifier())) {
- return function;
- }
+ FunctionIdentifier fid = afce.getFunctionIdentifier();
+ QName functionName = new QName(fid.getNamespace(), fid.getName());
+ Function found = rootContext.lookupFunction(functionName, fid.getArity());
+ if (found != null) {
+ return found;
}
for (Function function : BuiltinOperators.OPERATOR_COLLECTION) {
if (function.getFunctionIdentifier().equals(afce.getFunctionIdentifier())) {
@@ -182,7 +187,7 @@ public class ExpressionToolbox {
return pTypeCode.getInteger();
}
- public static SequenceType getTypeExpressionTypeArgument(Mutable<ILogicalExpression> searchM, StaticContextImpl dCtx) {
+ public static SequenceType getTypeExpressionTypeArgument(Mutable<ILogicalExpression> searchM, StaticContext dCtx) {
int typeId = getTypeExpressionTypeArgument(searchM);
if (typeId > 0) {
return dCtx.lookupSequenceType(typeId);