Repository: vxquery Updated Branches: refs/heads/master 3a2ff97d8 -> e85551f36
Merge for Shivani's fis for query translation expressions missing fn:data. Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/e85551f3 Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/e85551f3 Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/e85551f3 Branch: refs/heads/master Commit: e85551f36d6f90796a10b70e395576bf4b8c1ce4 Parents: 3a2ff97 Author: Preston Carman <[email protected]> Authored: Thu Jul 16 12:32:27 2015 -0700 Committer: Preston Carman <[email protected]> Committed: Thu Jul 16 12:32:27 2015 -0700 ---------------------------------------------------------------------- .../vxquery/xmlquery/translator/XMLQueryTranslator.java | 9 +++++++-- .../test/resources/Queries/XQuery/Ghcnd/Partition-1/q01.xq | 2 +- .../test/resources/Queries/XQuery/Ghcnd/Partition-2/q01.xq | 2 +- .../test/resources/Queries/XQuery/Ghcnd/Partition-4/q01.xq | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/vxquery/blob/e85551f3/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java index d684730..a8ffade 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java +++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java @@ -161,6 +161,7 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator; import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan; import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag; import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable; +import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractLogicalExpression; 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; @@ -1165,7 +1166,7 @@ public class XMLQueryTranslator { } default: - content.add(vre(translateExpression(aVal, tCtx))); + content.add(data(vre(translateExpression(aVal, tCtx)))); } } ILogicalExpression contentExpr = content.size() == 1 ? content.get(0) : sfce(BuiltinOperators.CONCATENATE, @@ -1969,6 +1970,10 @@ public class XMLQueryTranslator { } } + private ILogicalExpression data(ILogicalExpression expr) throws SystemException { + return new ScalarFunctionCallExpression(BuiltinFunctions.FN_DATA_1, Collections.singletonList(mutable(expr))); + } + private ILogicalExpression promote(ILogicalExpression expr, SequenceType type) throws SystemException { int typeCode = currCtx.lookupSequenceType(type); return sfce(BuiltinOperators.PROMOTE, expr, @@ -1983,7 +1988,7 @@ public class XMLQueryTranslator { private ILogicalExpression cast(ILogicalExpression expr, SequenceType type) throws SystemException { int typeCode = currCtx.lookupSequenceType(type); - return sfce(BuiltinOperators.CAST, expr, + return sfce(BuiltinOperators.CAST, data(expr), ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), typeCode)); } http://git-wip-us.apache.org/repos/asf/vxquery/blob/e85551f3/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-1/q01.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-1/q01.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-1/q01.xq index 0fed630..145c021 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-1/q01.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-1/q01.xq @@ -21,5 +21,5 @@ (: meters per second). (Wind value is in tenth of a meter per second) :) let $collection := "ghcnd" for $r in collection($collection)/dataCollection/data -where $r/dataType eq "AWND" and xs:decimal(fn:data($r/value)) gt 491.744 +where $r/dataType eq "AWND" and xs:decimal($r/value) gt 491.744 return $r http://git-wip-us.apache.org/repos/asf/vxquery/blob/e85551f3/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-2/q01.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-2/q01.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-2/q01.xq index bc62d73..6de4195 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-2/q01.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-2/q01.xq @@ -21,5 +21,5 @@ (: meters per second). (Wind value is in tenth of a meter per second) :) let $collection := "ghcnd_half_1|ghcnd_half_2" for $r in collection($collection)/dataCollection/data -where $r/dataType eq "AWND" and xs:decimal(fn:data($r/value)) gt 491.744 +where $r/dataType eq "AWND" and xs:decimal($r/value) gt 491.744 return $r http://git-wip-us.apache.org/repos/asf/vxquery/blob/e85551f3/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-4/q01.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-4/q01.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-4/q01.xq index 2de2690..7ea1c48 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-4/q01.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Ghcnd/Partition-4/q01.xq @@ -21,5 +21,5 @@ (: meters per second). (Wind value is in tenth of a meter per second) :) let $collection := "ghcnd_quarter_1|ghcnd_quarter_2|ghcnd_quarter_3|ghcnd_quarter_4" for $r in collection($collection)/dataCollection/data -where $r/dataType eq "AWND" and xs:decimal(fn:data($r/value)) gt 491.744 +where $r/dataType eq "AWND" and xs:decimal($r/value) gt 491.744 return $r
