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 2015/04/01 20:35:09 UTC
[08/12] vxquery git commit: Patch for VXQUERY-66 from Shivani Mall.
Patch for VXQUERY-66 from Shivani Mall.
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/90ee8b8f
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/90ee8b8f
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/90ee8b8f
Branch: refs/heads/prestonc/xmark
Commit: 90ee8b8ffcfcc0f5eb682fae90f1d54e0fd22e05
Parents: 563c6b7
Author: Eldon Carman <ec...@ucr.edu>
Authored: Thu Mar 26 21:32:26 2015 -0700
Committer: Eldon Carman <ec...@ucr.edu>
Committed: Wed Apr 1 11:34:54 2015 -0700
----------------------------------------------------------------------
.../functions/cast/CastToDecimalOperation.java | 43 ++++++++++++--------
.../functions/numeric/FnCeilingOperation.java | 6 ++-
.../functions/numeric/FnFloorOperation.java | 6 ++-
...FnRoundHalfToEvenScalarEvaluatorFactory.java | 25 ++++++++----
.../functions/numeric/FnRoundOperation.java | 2 +-
.../GhcndRecords/Partition-1/q03_records-1.txt | 3 ++
.../GhcndRecords/Partition-1/q03_records-2.txt | 3 ++
.../GhcndRecords/Partition-1/q03_records-3.txt | 3 ++
.../GhcndRecords/Partition-1/q03_records-4.txt | 3 ++
.../GhcndRecords/Partition-1/q03_records-5.txt | 3 ++
.../ExpectedTestResults/Numerics/fn_floor.txt | 8 ++++
.../Numerics/fn_round-half-to-even.txt | 16 ++++++++
.../ExpectedTestResults/Numerics/fn_round.txt | 8 ++++
.../Queries/XQuery/Numerics/fn_floor.xq | 22 ++++++++++
.../XQuery/Numerics/fn_round-half-to-even.xq | 39 ++++++++++++++++++
.../Queries/XQuery/Numerics/fn_round.xq | 22 ++++++++++
.../FunctionsAndOperatorsOnNumericsQueries.xml | 15 +++++++
.../cat/GhcndRecordsPartition1Queries.xml | 5 +++
18 files changed, 202 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDecimalOperation.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDecimalOperation.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDecimalOperation.java
index fde37b2..03a1e14 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDecimalOperation.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDecimalOperation.java
@@ -89,9 +89,7 @@ public class CastToDecimalOperation extends AbstractCastToOperation {
@Override
public void convertInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
- dOut.write(ValueTag.XS_DECIMAL_TAG);
- dOut.write((byte) 0);
- dOut.writeLong(longp.getLong());
+ writeIntegerAsDecimal(longp, dOut);
}
@Override
@@ -179,57 +177,66 @@ public class CastToDecimalOperation extends AbstractCastToOperation {
* Derived Datatypes
*/
public void convertByte(BytePointable bytep, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(bytep, dOut);
+ writeIntegerAsDecimal(bytep, dOut);
}
public void convertInt(IntegerPointable intp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(intp, dOut);
+ writeIntegerAsDecimal(intp, dOut);
}
public void convertLong(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(longp, dOut);
+ writeIntegerAsDecimal(longp, dOut);
}
public void convertNegativeInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(longp, dOut);
+ writeIntegerAsDecimal(longp, dOut);
}
public void convertNonNegativeInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(longp, dOut);
+ writeIntegerAsDecimal(longp, dOut);
}
public void convertNonPositiveInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(longp, dOut);
+ writeIntegerAsDecimal(longp, dOut);
}
public void convertPositiveInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(longp, dOut);
+ writeIntegerAsDecimal(longp, dOut);
}
public void convertShort(ShortPointable shortp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(shortp, dOut);
+ writeIntegerAsDecimal(shortp, dOut);
}
public void convertUnsignedByte(ShortPointable shortp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(shortp, dOut);
+ writeIntegerAsDecimal(shortp, dOut);
}
public void convertUnsignedInt(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(longp, dOut);
+ writeIntegerAsDecimal(longp, dOut);
}
public void convertUnsignedLong(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(longp, dOut);
+ writeIntegerAsDecimal(longp, dOut);
}
public void convertUnsignedShort(IntegerPointable intp, DataOutput dOut) throws SystemException, IOException {
- writeDecimalValue(intp, dOut);
+ writeIntegerAsDecimal(intp, dOut);
}
- private void writeDecimalValue(INumeric numericp, DataOutput dOut) throws SystemException, IOException {
+ private void writeIntegerAsDecimal(INumeric numericp, DataOutput dOut) throws SystemException, IOException {
+ byte decimalPlace = 0;
+ long value = numericp.longValue();
+
+ // Normalize the value and take off trailing zeros.
+ while (value != 0 && value % 10 == 0) {
+ value /= 10;
+ --decimalPlace;
+ }
+
dOut.write(ValueTag.XS_DECIMAL_TAG);
- dOut.write((byte) 0);
- dOut.writeLong(numericp.longValue());
+ dOut.write(decimalPlace);
+ dOut.writeLong(value);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnCeilingOperation.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnCeilingOperation.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnCeilingOperation.java
index d7579e1..5916348 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnCeilingOperation.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnCeilingOperation.java
@@ -33,7 +33,11 @@ public class FnCeilingOperation extends AbstractNumericOperation {
public void operateDecimal(XSDecimalPointable decp, DataOutput dOut) throws SystemException, IOException {
dOut.write(ValueTag.XS_DECIMAL_TAG);
dOut.write(0);
- dOut.writeLong((long) Math.ceil(decp.doubleValue()));
+ if (decp.getDecimalValue() > 0 && decp.getDecimalPlace() > 0) {
+ dOut.writeLong((long) (decp.getBeforeDecimalPlace()) + 1);
+ } else {
+ dOut.writeLong((long) (decp.getBeforeDecimalPlace()));
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnFloorOperation.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnFloorOperation.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnFloorOperation.java
index a8675e7..6bdeeec 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnFloorOperation.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnFloorOperation.java
@@ -33,7 +33,11 @@ public class FnFloorOperation extends AbstractNumericOperation {
public void operateDecimal(XSDecimalPointable decp, DataOutput dOut) throws SystemException, IOException {
dOut.write(ValueTag.XS_DECIMAL_TAG);
dOut.write(0);
- dOut.writeLong(decp.getBeforeDecimalPlace());
+ if (decp.getDecimalValue() < 0 && decp.getDecimalPlace() > 0) {
+ dOut.writeLong((long) (decp.getBeforeDecimalPlace()) - 1);
+ } else {
+ dOut.writeLong((long) (decp.getBeforeDecimalPlace()));
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundHalfToEvenScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundHalfToEvenScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundHalfToEvenScalarEvaluatorFactory.java
index 0ec2aa4..fbb07ab 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundHalfToEvenScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundHalfToEvenScalarEvaluatorFactory.java
@@ -99,28 +99,35 @@ public class FnRoundHalfToEvenScalarEvaluatorFactory extends AbstractTaggedValue
return;
}
break;
-
}
} catch (Exception e) {
throw new SystemException(ErrorCode.SYSE0001, e);
}
-
// Prepare input.
try {
getDecimalPointable(tp, tvp1);
} catch (IOException e) {
throw new SystemException(ErrorCode.SYSE0001, e);
}
-
// Perform rounding on decimal value.
- // TODO round half to the nearest even number.
- long decimalPlace = tp.decp.getDecimalPlace();
- if ((precision - decimalPlace) < 0) {
- long decimalValue = tp.decp.getDecimalValue();
- decimalValue = (long) (decimalValue / Math.pow(10, -(precision - decimalPlace)));
+ byte decimalPlace = tp.decp.getDecimalPlace();
+ long decimalValue = tp.decp.getDecimalValue();
+ long newValue;
+ //check if the input needs to rounded to even or normally
+ if (decimalPlace - precision == 1 && (Math.abs(decimalValue) % 10 == 5)) {
+ newValue = decimalValue / 10;
+ if (!(newValue % 2 == 0)) {
+ if (newValue > 0) {
+ newValue += 1;
+ } else {
+ newValue -= 1;
+ }
+ }
+ tp.decp.setDecimal(newValue, (byte) precision);
+ } else if ((precision - decimalPlace) < 0) {
+ decimalValue = (long) Math.round(decimalValue / Math.pow(10, -(precision - decimalPlace)));
tp.decp.setDecimal(decimalValue, (byte) precision);
}
-
// Return result.
try {
switch (tvp1.getTag()) {
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundOperation.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundOperation.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundOperation.java
index 90e5156..28ff1c4 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundOperation.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundOperation.java
@@ -33,7 +33,7 @@ public class FnRoundOperation extends AbstractNumericOperation {
public void operateDecimal(XSDecimalPointable decp, DataOutput dOut) throws SystemException, IOException {
dOut.write(ValueTag.XS_DECIMAL_TAG);
dOut.write(0);
- dOut.writeLong(Math.round(decp.doubleValue()));
+ dOut.writeLong((long) (decp.getBeforeDecimalPlaceRounded()));
}
@Override
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-1.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-1.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-1.txt
new file mode 100644
index 0000000..b1db973
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-1.txt
@@ -0,0 +1,3 @@
+<value>33</value>
+<value>32</value>
+<value>31</value>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-2.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-2.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-2.txt
new file mode 100644
index 0000000..d93567e
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-2.txt
@@ -0,0 +1,3 @@
+<value>33</value>
+<value>31</value>
+<value>32</value>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-3.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-3.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-3.txt
new file mode 100644
index 0000000..2ab8764
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-3.txt
@@ -0,0 +1,3 @@
+<value>32</value>
+<value>33</value>
+<value>31</value>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-4.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-4.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-4.txt
new file mode 100644
index 0000000..d1d6bb7
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-4.txt
@@ -0,0 +1,3 @@
+<value>32</value>
+<value>31</value>
+<value>33</value>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-5.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-5.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-5.txt
new file mode 100644
index 0000000..2044b18
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/GhcndRecords/Partition-1/q03_records-5.txt
@@ -0,0 +1,3 @@
+<value>31</value>
+<value>33</value>
+<value>32</value>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_floor.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_floor.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_floor.txt
new file mode 100644
index 0000000..194ba86
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_floor.txt
@@ -0,0 +1,8 @@
+5
+5
+5
+5
+-6
+-5
+-6
+-6
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_round-half-to-even.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_round-half-to-even.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_round-half-to-even.txt
new file mode 100644
index 0000000..c3d7781
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_round-half-to-even.txt
@@ -0,0 +1,16 @@
+5.2
+5
+5.2
+5.2
+-5.2
+-5
+-5.2
+-5.2
+400
+400
+400
+400
+500
+500
+500
+500
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_round.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_round.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_round.txt
new file mode 100644
index 0000000..063f1da
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Numerics/fn_round.txt
@@ -0,0 +1,8 @@
+6
+5
+6
+6
+-5
+-5
+-6
+-5
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_floor.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_floor.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_floor.xq
new file mode 100644
index 0000000..a48d0e6
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_floor.xq
@@ -0,0 +1,22 @@
+(: 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. :)
+
+(: XQuery fn:floor :)
+(
+ fn:floor(xs:decimal(5.5)), fn:floor(xs:integer(5)), fn:floor(xs:float(5.5)), fn:floor(xs:double(5.5)),
+ fn:floor(xs:decimal(-5.5)), fn:floor(xs:integer(-5)), fn:floor(xs:float(-5.5)), fn:floor(xs:double(-5.5))
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_round-half-to-even.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_round-half-to-even.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_round-half-to-even.xq
new file mode 100644
index 0000000..79c9064
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_round-half-to-even.xq
@@ -0,0 +1,39 @@
+(: 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. :)
+
+(: XQuery fn:round-half-to-even :)
+(
+ fn:round-half-to-even(xs:decimal(5.15), 1),
+ fn:round-half-to-even(xs:integer(5), 1),
+ fn:round-half-to-even(xs:float(5.15), 1),
+ fn:round-half-to-even(xs:double(5.15), 1),
+
+ fn:round-half-to-even(xs:decimal(-5.15), 1),
+ fn:round-half-to-even(xs:integer(-5), 1),
+ fn:round-half-to-even(xs:float(-5.15), 1),
+ fn:round-half-to-even(xs:double(-5.15), 1),
+
+ fn:round-half-to-even(xs:decimal(450), -2),
+ fn:round-half-to-even(xs:integer(450), -2),
+ fn:round-half-to-even(xs:float(450), -2),
+ fn:round-half-to-even(xs:double(450), -2),
+
+ fn:round-half-to-even(xs:decimal(460), -2),
+ fn:round-half-to-even(xs:integer(460), -2),
+ fn:round-half-to-even(xs:float(460), -2),
+ fn:round-half-to-even(xs:double(460), -2)
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_round.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_round.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_round.xq
new file mode 100644
index 0000000..7bded3a
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Numerics/fn_round.xq
@@ -0,0 +1,22 @@
+(: 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. :)
+
+(: XQuery fn:round :)
+(
+ fn:round(xs:decimal(5.5)), fn:round(xs:integer(5)), fn:round(xs:float(5.5)), fn:round(xs:double(5.5)),
+ fn:round(xs:decimal(-5.5)), fn:round(xs:integer(-5)), fn:floor(xs:float(-5.5)), fn:round(xs:double(-5.5))
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/cat/FunctionsAndOperatorsOnNumericsQueries.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/cat/FunctionsAndOperatorsOnNumericsQueries.xml b/vxquery-xtest/src/test/resources/cat/FunctionsAndOperatorsOnNumericsQueries.xml
index 4b6555d..aacc9ea 100644
--- a/vxquery-xtest/src/test/resources/cat/FunctionsAndOperatorsOnNumericsQueries.xml
+++ b/vxquery-xtest/src/test/resources/cat/FunctionsAndOperatorsOnNumericsQueries.xml
@@ -30,4 +30,19 @@
<query name="fn_ceiling" date="2015-01-05"/>
<output-file compare="Text">fn_ceiling.txt</output-file>
</test-case>
+ <test-case name="functions-and-operators-on-numerics-fn_round-half-to-even" FilePath="Numerics/" Creator="Shivani Mall">
+ <description>Query for fn:round-half-to-even with all numeric types.</description>
+ <query name="fn_round-half-to-even" date="2015-02-25"/>
+ <output-file compare="Text">fn_round-half-to-even.txt</output-file>
+ </test-case>
+ <test-case name="functions-and-operators-on-numerics-fn_round" FilePath="Numerics/" Creator="Shivani Mall">
+ <description>Query for fn:round with all numeric types.</description>
+ <query name="fn_round" date="2015-02-25"/>
+ <output-file compare="Text">fn_round.txt</output-file>
+ </test-case>
+ <test-case name="functions-and-operators-on-numerics-fn_floor" FilePath="Numerics/" Creator="Shivani Mall">
+ <description>Query for fn:floor with all numeric types.</description>
+ <query name="fn_floor" date="2015-02-25"/>
+ <output-file compare="Text">fn_floor.txt</output-file>
+ </test-case>
</test-group>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/90ee8b8f/vxquery-xtest/src/test/resources/cat/GhcndRecordsPartition1Queries.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/cat/GhcndRecordsPartition1Queries.xml b/vxquery-xtest/src/test/resources/cat/GhcndRecordsPartition1Queries.xml
index 65ca953..f55153c 100644
--- a/vxquery-xtest/src/test/resources/cat/GhcndRecordsPartition1Queries.xml
+++ b/vxquery-xtest/src/test/resources/cat/GhcndRecordsPartition1Queries.xml
@@ -29,6 +29,11 @@
<description>Count records returned for q03 from the weather benchmark with 1 partition.</description>
<query name="q03_records" date="2014-04-01"/>
<output-file compare="Text">q03_records.txt</output-file>
+ <output-file compare="Text">q03_records-1.txt</output-file>
+ <output-file compare="Text">q03_records-2.txt</output-file>
+ <output-file compare="Text">q03_records-3.txt</output-file>
+ <output-file compare="Text">q03_records-4.txt</output-file>
+ <output-file compare="Text">q03_records-5.txt</output-file>
</test-case>
<test-case name="ghcnd-records-partition-1-q05" FilePath="GhcndRecords/Partition-1/" Creator="Preston Carman">
<description>Count records returned for q05 from the weather benchmark with 1 partition.</description>