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 2016/07/25 21:15:49 UTC
vxquery git commit: VXQUERY-64 issue resolved-fn:trace is supported
Repository: vxquery
Updated Branches:
refs/heads/master ef8efbc26 -> dae8391e4
VXQUERY-64 issue resolved-fn:trace is supported
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/dae8391e
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/dae8391e
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/dae8391e
Branch: refs/heads/master
Commit: dae8391e45b63b5f87240dc5fecd8fef4827234a
Parents: ef8efbc
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Mon Jul 25 12:21:05 2016 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Jul 25 14:15:00 2016 -0700
----------------------------------------------------------------------
.../vxquery/functions/builtin-functions.xml | 1 +
.../error/FnErrorScalarEvaluatorFactory.java | 18 +++--
.../trace/FnTraceScalarEvaluatorFactory.java | 60 ++++++++++++++++
.../runtime/functions/util/FunctionHelper.java | 69 +++++++------------
vxquery-xtest/results/xqts.txt | 72 ++++++++++----------
.../ExpectedTestResults/Json/Trace/trace.txt | 1 +
.../Queries/XQuery/Json/Trace/trace.xq | 18 +++++
.../src/test/resources/VXQueryCatalog.xml | 15 ++++
.../src/test/resources/cat/TraceQuery.xml | 28 ++++++++
9 files changed, 198 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
index 0e64d46..27f0768 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
+++ b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
@@ -1106,6 +1106,7 @@
<property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
<argument value="0"/>
</property>
+ <runtime type="scalar" class="org.apache.vxquery.runtime.functions.trace.FnTraceScalarEvaluatorFactory"/>
</function>
<!-- fn:translate($arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string -->
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/error/FnErrorScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/error/FnErrorScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/error/FnErrorScalarEvaluatorFactory.java
index 0588820..e728953 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/error/FnErrorScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/error/FnErrorScalarEvaluatorFactory.java
@@ -17,6 +17,7 @@
package org.apache.vxquery.runtime.functions.error;
import java.io.DataInputStream;
+import java.io.IOException;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -76,9 +77,13 @@ public class FnErrorScalarEvaluatorFactory extends AbstractTaggedValueArgumentSc
tvp1.getValue(qnamep);
qnamep.getUri(urip);
qnamep.getLocalName(localnamep);
- namespaceURI = FunctionHelper.getStringFromPointable(urip, bbis, di);
- localPart = FunctionHelper.getStringFromPointable(localnamep, bbis, di);
+ try {
+ namespaceURI = FunctionHelper.getStringFromPointable(urip, bbis, di);
+ localPart = FunctionHelper.getStringFromPointable(localnamep, bbis, di);
+ } catch (IOException e) {
+ throw new SystemException(ErrorCode.FOER0000);
+ }
// TODO Update to dynamic error.
throw new SystemException(ErrorCode.FOER0000);
}
@@ -98,8 +103,13 @@ public class FnErrorScalarEvaluatorFactory extends AbstractTaggedValueArgumentSc
tvp1.getValue(qnamep);
qnamep.getUri(urip);
qnamep.getLocalName(localnamep);
- namespaceURI = FunctionHelper.getStringFromPointable(urip, bbis, di);
- localPart = FunctionHelper.getStringFromPointable(localnamep, bbis, di);
+ try {
+ namespaceURI = FunctionHelper.getStringFromPointable(urip, bbis, di);
+
+ localPart = FunctionHelper.getStringFromPointable(localnamep, bbis, di);
+ } catch (IOException e) {
+ throw new SystemException(ErrorCode.FORG0006);
+ }
} else {
throw new SystemException(ErrorCode.FORG0006);
}
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/trace/FnTraceScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/trace/FnTraceScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/trace/FnTraceScalarEvaluatorFactory.java
new file mode 100644
index 0000000..a202dc5
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/trace/FnTraceScalarEvaluatorFactory.java
@@ -0,0 +1,60 @@
+/*
+* 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.
+*/
+package org.apache.vxquery.runtime.functions.trace;
+
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.exceptions.ErrorCode;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
+import org.apache.vxquery.serializer.XMLSerializer;
+
+public class FnTraceScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
+
+ private static final long serialVersionUID = 1L;
+
+ public FnTraceScalarEvaluatorFactory(IScalarEvaluatorFactory[] args) {
+ super(args);
+ }
+
+ @Override
+ protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
+ throws AlgebricksException {
+ return new AbstractTaggedValueArgumentScalarEvaluator(args) {
+
+ @Override
+ protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
+ TaggedValuePointable tvpValue = args[0];
+ TaggedValuePointable tvpLabel = args[1];
+ if (tvpLabel.getTag() != ValueTag.XS_STRING_TAG) {
+ throw new SystemException(ErrorCode.FORG0006);
+ }
+ result.set(tvpValue);
+ XMLSerializer printer = new XMLSerializer();
+ printer.printTaggedValuePointable(System.err, tvpLabel);
+ printer.printTaggedValuePointable(System.err, tvpValue);
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
index 6d280f2..60c80ea 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
@@ -21,6 +21,7 @@ import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -1134,14 +1135,10 @@ public class FunctionHelper {
}
public static String getStringFromPointable(UTF8StringPointable stringp, ByteBufferInputStream bbis,
- DataInputStream di) throws SystemException {
- try {
- bbis.setByteBuffer(ByteBuffer.wrap(Arrays.copyOfRange(stringp.getByteArray(), stringp.getStartOffset(),
- stringp.getLength() + stringp.getStartOffset())), 0);
- return di.readUTF();
- } catch (IOException e) {
- throw new SystemException(ErrorCode.SYSE0001, e);
- }
+ DataInputStream di) throws IOException {
+ bbis.setByteBuffer(ByteBuffer.wrap(Arrays.copyOfRange(stringp.getByteArray(), stringp.getStartOffset(),
+ stringp.getLength() + stringp.getStartOffset())), 0);
+ return di.readUTF();
}
public static long getTimezone(ITimezone timezonep) {
@@ -1222,56 +1219,40 @@ public class FunctionHelper {
}
public static void readInDocFromPointable(UTF8StringPointable stringp, ByteBufferInputStream bbis,
- DataInputStream di, ArrayBackedValueStorage abvs, IParser parser)
- throws NumberFormatException, JsonParseException, IOException {
- String fName;
- try {
- fName = getStringFromPointable(stringp, bbis, di);
- } catch (SystemException e) {
- throw new HyracksDataException(e);
- }
+ DataInputStream di, ArrayBackedValueStorage abvs, IParser parser) throws IOException {
+ String fName = getStringFromPointable(stringp, bbis, di);
readInDocFromString(fName, bbis, di, abvs, parser);
}
public static void readInDocFromString(String fName, ByteBufferInputStream bbis, DataInputStream di,
- ArrayBackedValueStorage abvs, IParser parser)
- throws NumberFormatException, JsonParseException, IOException {
- int bufferSize = Integer.parseInt(System.getProperty("vxquery.buffer_size", "-1"));
+ ArrayBackedValueStorage abvs, IParser parser) throws IOException {
Reader input;
if (!fName.contains("hdfs:/")) {
File file = new File(fName);
-
if (file.exists()) {
- if (bufferSize > 0) {
- input = new BufferedReader(new InputStreamReader(new FileInputStream(file)), bufferSize);
- } else {
- input = new InputStreamReader(new FileInputStream(file));
- }
+ input = new InputStreamReader(new FileInputStream(file));
parser.parse(input, abvs);
+ } else {
+ throw new FileNotFoundException(file.getAbsolutePath());
}
- }
- //else check in HDFS file system
- else {
+ } else {
+ // else check in HDFS file system
HDFSFunctions hdfs = new HDFSFunctions(null, null);
FileSystem fs = hdfs.getFileSystem();
if (fs != null) {
- try {
- String fHdfsName = fName.replaceAll("hdfs:/", "");
- Path xmlDocument = new Path(fHdfsName);
- if (fs.exists(xmlDocument)) {
- InputStream in = fs.open(xmlDocument).getWrappedStream();
- if (bufferSize > 0) {
- input = new BufferedReader(new InputStreamReader(in), bufferSize);
- } else {
- input = new InputStreamReader(in);
- }
- parser.parse(input, abvs);
- in.close();
- }
- fs.close();
- } catch (IOException e) {
- throw new HyracksDataException(e);
+ String fHdfsName = fName.replaceAll("hdfs:/", "");
+ Path xmlDocument = new Path(fHdfsName);
+ if (fs.exists(xmlDocument)) {
+ InputStream in = fs.open(xmlDocument).getWrappedStream();
+ input = new InputStreamReader(in);
+ parser.parse(input, abvs);
+ in.close();
+ } else {
+ throw new FileNotFoundException(xmlDocument.getName());
}
+ fs.close();
+ } else {
+ throw new IOException();
}
}
}
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-xtest/results/xqts.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/results/xqts.txt b/vxquery-xtest/results/xqts.txt
index 3e5a114..1d9fc6d 100644
--- a/vxquery-xtest/results/xqts.txt
+++ b/vxquery-xtest/results/xqts.txt
@@ -10366,7 +10366,7 @@ Expressions/SeqExpr/FilterExpr//K-FilterExpr-36, EXPECTED_RESULT_GOT_SAME_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-37, EXPECTED_RESULT_GOT_ERROR
Expressions/SeqExpr/FilterExpr//K-FilterExpr-38, EXPECTED_ERROR_GOT_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-39, EXPECTED_RESULT_GOT_ERROR
-Expressions/SeqExpr/FilterExpr//K-FilterExpr-4, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/SeqExpr/FilterExpr//K-FilterExpr-4, EXPECTED_ERROR_GOT_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-40, EXPECTED_ERROR_GOT_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-41, EXPECTED_RESULT_GOT_SAME_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-42, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
@@ -10377,7 +10377,7 @@ Expressions/SeqExpr/FilterExpr//K-FilterExpr-46, EXPECTED_RESULT_GOT_DIFFERENT_R
Expressions/SeqExpr/FilterExpr//K-FilterExpr-47, EXPECTED_RESULT_GOT_SAME_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-48, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-49, EXPECTED_ERROR_GOT_RESULT
-Expressions/SeqExpr/FilterExpr//K-FilterExpr-5, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/SeqExpr/FilterExpr//K-FilterExpr-5, EXPECTED_ERROR_GOT_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-50, EXPECTED_RESULT_GOT_ERROR
Expressions/SeqExpr/FilterExpr//K-FilterExpr-51, EXPECTED_ERROR_GOT_RESULT
Expressions/SeqExpr/FilterExpr//K-FilterExpr-52, EXPECTED_ERROR_GOT_RESULT
@@ -13117,7 +13117,7 @@ Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-19, EXPECT
Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-20, EXPECTED_RESULT_GOT_SAME_RESULT
Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-21, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
-Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-22, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-22, EXPECTED_RESULT_GOT_SAME_RESULT
Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-23, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-24, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
Functions/ContextFunc/ContextCurrentDatetimeFunc//fn-current-dateTime-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
@@ -14370,18 +14370,18 @@ Functions/NodeFunc/NodeRootFunc//K2-NodeRootFunc-6, EXPECTED_RESULT_GOT_ERROR
Functions/NodeFunc/NodeRootFunc//K2-NodeRootFunc-7, EXPECTED_RESULT_GOT_ERROR
Functions/NodeFunc/NodeRootFunc//K2-NodeRootFunc-8, EXPECTED_RESULT_GOT_ERROR
Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-1, EXPECTED_ERROR_GOT_SAME_ERROR
-Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-10, EXPECTED_RESULT_GOT_ERROR
-Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-10d, EXPECTED_RESULT_GOT_FAILURE
-Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-2, EXPECTED_ERROR_GOT_FAILURE
-Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-3, EXPECTED_ERROR_GOT_FAILURE
+Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-10, EXPECTED_RESULT_GOT_FAILURE
+Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-10d, EXPECTED_RESULT_GOT_ERROR
+Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-2, EXPECTED_ERROR_GOT_RESULT
+Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-3, EXPECTED_ERROR_GOT_RESULT
Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-4, EXPECTED_RESULT_GOT_ERROR
Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-4d, EXPECTED_RESULT_GOT_ERROR
Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-5, EXPECTED_RESULT_GOT_ERROR
Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-5d, EXPECTED_RESULT_GOT_ERROR
-Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-6, EXPECTED_RESULT_GOT_ERROR
-Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-7, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
-Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-8, EXPECTED_RESULT_GOT_ERROR
-Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-9, EXPECTED_RESULT_GOT_FAILURE
+Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-6, EXPECTED_RESULT_GOT_FAILURE
+Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-7, EXPECTED_ERROR_GOT_FAILURE
+Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-8, EXPECTED_RESULT_GOT_FAILURE
+Functions/NodeSeqFunc/SeqCollectionFunc//fn-collection-9, EXPECTED_RESULT_GOT_ERROR
Functions/NodeSeqFunc/SeqDocAvailableFunc//fn-doc-available-1, EXPECTED_ERROR_GOT_SAME_ERROR
Functions/NodeSeqFunc/SeqDocAvailableFunc//fn-doc-available-2, EXPECTED_ERROR_GOT_RESULT
Functions/NodeSeqFunc/SeqDocAvailableFunc//fn-doc-available-3, EXPECTED_RESULT_GOT_FAILURE
@@ -16862,8 +16862,8 @@ Functions/SeqFunc/HeadTailFunc//tail-003, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
Functions/SeqFunc/HeadTailFunc//tail-004, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
Functions/SeqFunc/HeadTailFunc//tail-005, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
Functions/SeqFunc/HeadTailFunc//tail-006, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
-Functions/SeqFunc/NodeSeqFunc/SeqCollectionFunc//K2-SeqCollectionFunc-1, EXPECTED_ERROR_GOT_FAILURE
-Functions/SeqFunc/NodeSeqFunc/SeqCollectionFunc//K2-SeqCollectionFunc-2, EXPECTED_ERROR_GOT_FAILURE
+Functions/SeqFunc/NodeSeqFunc/SeqCollectionFunc//K2-SeqCollectionFunc-1, EXPECTED_ERROR_GOT_RESULT
+Functions/SeqFunc/NodeSeqFunc/SeqCollectionFunc//K2-SeqCollectionFunc-2, EXPECTED_ERROR_GOT_RESULT
Functions/SeqFunc/NodeSeqFunc/SeqDocFunc//K2-SeqDocFunc-1, EXPECTED_RESULT_GOT_SAME_RESULT
Functions/SeqFunc/NodeSeqFunc/SeqDocFunc//K2-SeqDocFunc-10, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
Functions/SeqFunc/NodeSeqFunc/SeqDocFunc//K2-SeqDocFunc-11, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
@@ -17083,32 +17083,32 @@ Functions/SeqFunc/SeqDeepEqualFunc//K2-SeqDeepEqualFunc-7, EXPECTED_RESULT_GOT_E
Functions/SeqFunc/SeqDeepEqualFunc//K2-SeqDeepEqualFunc-8, EXPECTED_ERROR_GOT_SAME_ERROR
Functions/SeqFunc/SeqDeepEqualFunc//K2-SeqDeepEqualFunc-9, EXPECTED_ERROR_GOT_SAME_ERROR
Functions/TraceFunc//fn-trace-1, EXPECTED_ERROR_GOT_SAME_ERROR
-Functions/TraceFunc//fn-trace-10, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-11, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-12, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-13, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-14, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-15, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-16, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-17, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-18, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-19, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
-Functions/TraceFunc//fn-trace-2, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-20, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-21, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-3, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-4, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-5, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-6, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-7, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-8, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//fn-trace-9, EXPECTED_RESULT_GOT_ERROR
+Functions/TraceFunc//fn-trace-10, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-11, EXPECTED_RESULT_GOT_FAILURE
+Functions/TraceFunc//fn-trace-12, EXPECTED_RESULT_GOT_FAILURE
+Functions/TraceFunc//fn-trace-13, EXPECTED_RESULT_GOT_SAME_RESULT
+Functions/TraceFunc//fn-trace-14, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-15, EXPECTED_RESULT_GOT_SAME_RESULT
+Functions/TraceFunc//fn-trace-16, EXPECTED_RESULT_GOT_SAME_RESULT
+Functions/TraceFunc//fn-trace-17, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-18, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-19, EXPECTED_ERROR_GOT_RESULT
+Functions/TraceFunc//fn-trace-2, EXPECTED_RESULT_GOT_SAME_RESULT
+Functions/TraceFunc//fn-trace-20, EXPECTED_RESULT_GOT_SAME_RESULT
+Functions/TraceFunc//fn-trace-21, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-4, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-5, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-6, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-7, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-8, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Functions/TraceFunc//fn-trace-9, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
Functions/TraceFunc//K-TraceFunc-1, EXPECTED_ERROR_GOT_SAME_ERROR
Functions/TraceFunc//K-TraceFunc-2, EXPECTED_ERROR_GOT_SAME_ERROR
Functions/TraceFunc//K-TraceFunc-3, EXPECTED_ERROR_GOT_SAME_ERROR
-Functions/TraceFunc//K-TraceFunc-4, EXPECTED_RESULT_GOT_ERROR
-Functions/TraceFunc//K-TraceFunc-5, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
-Functions/TraceFunc//K-TraceFunc-6, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Functions/TraceFunc//K-TraceFunc-4, EXPECTED_RESULT_GOT_SAME_RESULT
+Functions/TraceFunc//K-TraceFunc-5, EXPECTED_ERROR_GOT_RESULT
+Functions/TraceFunc//K-TraceFunc-6, EXPECTED_ERROR_GOT_SAME_ERROR
Functions/URIFunc/ResolveURIFunc//fn-resolve-uri-1, EXPECTED_RESULT_GOT_ERROR
Functions/URIFunc/ResolveURIFunc//fn-resolve-uri-10, EXPECTED_RESULT_GOT_ERROR
Functions/URIFunc/ResolveURIFunc//fn-resolve-uri-11, EXPECTED_RESULT_GOT_ERROR
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Trace/trace.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Trace/trace.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Trace/trace.txt
new file mode 100644
index 0000000..6ed63af
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Trace/trace.txt
@@ -0,0 +1 @@
+[1,2]
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Trace/trace.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Trace/trace.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Trace/trace.xq
new file mode 100644
index 0000000..5345918
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Trace/trace.xq
@@ -0,0 +1,18 @@
+(: 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. :)
+
+fn:trace(([1,2]),"the value is ")
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
index f678fba..0ac46f4 100644
--- a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
+++ b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
@@ -51,6 +51,8 @@
<!ENTITY JsonArrayNavigationQueries SYSTEM "cat/JsonArrayNavigationQueries.xml">
<!ENTITY JsonParserQueries SYSTEM "cat/JsonParserQueries.xml">
+<!ENTITY TraceQuery SYSTEM "cat/TraceQuery.xml">
+
]>
<test-suite xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -328,4 +330,17 @@
&JsonParserQueries;
</test-group>
</test-group>
+ <test-group name="TraceQuery" featureOwner="Christina Pavlopoulou">
+ <GroupInfo>
+ <title>Trace Function Queries</title>
+ <description/>
+ </GroupInfo>
+ <test-group name="TraceTesting" featureOwner="Christina Pavlopoulou">
+ <GroupInfo>
+ <title>Trace Function Tests</title>
+ <description/>
+ </GroupInfo>
+ &TraceQuery;
+ </test-group>
+ </test-group>
</test-suite>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/dae8391e/vxquery-xtest/src/test/resources/cat/TraceQuery.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/cat/TraceQuery.xml b/vxquery-xtest/src/test/resources/cat/TraceQuery.xml
new file mode 100644
index 0000000..741b970
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/cat/TraceQuery.xml
@@ -0,0 +1,28 @@
+<!--
+ 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.
+-->
+
+<test-group xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog" name="JsonArrayNavigationQueries" featureOwner="VXQuery">
+ <GroupInfo>
+ <title>Trace Function</title>
+ <description/>
+ </GroupInfo>
+ <test-case name="trace" FilePath="Json/Trace" Creator="Christina Pavlopoulou">
+ <description>Using trace function.</description>
+ <query name="trace" date="2016-07-20"/>
+ <output-file compare="Text">trace.txt</output-file>
+ </test-case>
+</test-group>