Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/96#discussion_r15444279
--- Diff:
tajo-core/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
---
@@ -428,19 +430,27 @@ public void testPi() throws IOException {
@Test
public void testRoundWithSpecifiedPrecision() throws IOException {
+ // divide zero
+ try {
+ testSimpleEval("select round(10.0/0.0,2) ", new String[]{""});
+ fail("10.0/0 should throw InvalidOperationException");
+ } catch (InvalidOperationException e) {
+ //success
+ }
+
testSimpleEval("select round(42.4382,2) ", new String[]{"42.44"});
testSimpleEval("select round(-42.4382,2) ", new String[]{"-42.44"});
- testSimpleEval("select round(-425,2) ", new String[]{"-425"});
- testSimpleEval("select round(425,2) ", new String[]{"425"});
+ testSimpleEval("select round(-425,2) ", new String[]{"-425.0"});
+ testSimpleEval("select round(425,2) ", new String[]{"425.0"});
- testSimpleEval("select round(1234567890,0) ", new
String[]{"1234567890"});
- testSimpleEval("select round(1234567890,1) ", new
String[]{"1234567890"});
- testSimpleEval("select round(1234567890,2) ", new
String[]{"1234567890"});
+ testSimpleEval("select round(1234567890,0) ", new
String[]{"1.23456789E9"});
+ testSimpleEval("select round(1234567890,1) ", new
String[]{"1.23456789E9"});
+ testSimpleEval("select round(1234567890,2) ", new
String[]{"1.23456789E9"});
testSimpleEval("select round(1.2345678901234567,13) ", new
String[]{"1.2345678901235"});
- testSimpleEval("select round(1234567890.1234567,3) ", new
String[]{"1234567890.123"});
- testSimpleEval("select round(1234567890.1234567,5) ", new
String[]{"1234567890.12346"});
- //testSimpleEval("select round(1234567890.1234567890,7) ", new
String[]{"1234567890.1234568"});
+ testSimpleEval("select round(1234567890.1234567,3) ", new
String[]{"1.234567890123E9"});
+ testSimpleEval("select round(1234567890.1234567,5) ", new
String[]{"1.23456789012346E9"});
+//testSimpleEval("select round(1234567890.1234567890,7) ", new
String[]{"1234567890.1234568"});
--- End diff --
Please remove commented out line.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---