TAJO-957: ROUND should be support INT parameter. (Mai Hai Thanh via hyunsik)
Project: http://git-wip-us.apache.org/repos/asf/tajo/repo Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/8024f6ab Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/8024f6ab Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/8024f6ab Branch: refs/heads/index_support Commit: 8024f6ab324e9e3ba2c1968386292f9243f44b97 Parents: b637416 Author: Hyunsik Choi <[email protected]> Authored: Thu Jul 31 19:41:02 2014 +0900 Committer: Hyunsik Choi <[email protected]> Committed: Fri Aug 1 14:23:58 2014 +0900 ---------------------------------------------------------------------- CHANGES | 2 ++ .../org/apache/tajo/engine/function/math/Round.java | 7 +++++-- .../apache/tajo/engine/function/TestMathFunctions.java | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tajo/blob/8024f6ab/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 4390177..f423548 100644 --- a/CHANGES +++ b/CHANGES @@ -96,6 +96,8 @@ Release 0.9.0 - unreleased (Hyoungjun Kim via hyunsik) BUG FIXES + + TAJO-957: ROUND should be support INT parameter. (Mai Hai Thanh via hyunsik) TAJO-980: execution page in Web UI broken. (hyunsik) http://git-wip-us.apache.org/repos/asf/tajo/blob/8024f6ab/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java ---------------------------------------------------------------------- diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java index 9740888..e457791 100644 --- a/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java +++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/math/Round.java @@ -39,8 +39,11 @@ import org.apache.tajo.storage.Tuple; example = "> SELECT round(42.4)\n" + "42", returnType = TajoDataTypes.Type.INT8, - paramTypes = {@ParamTypes(paramTypes = {TajoDataTypes.Type.FLOAT4}), - @ParamTypes(paramTypes = {TajoDataTypes.Type.FLOAT8})} + paramTypes = {@ParamTypes(paramTypes = {TajoDataTypes.Type.FLOAT4}), + @ParamTypes(paramTypes = {TajoDataTypes.Type.FLOAT8}), + @ParamTypes(paramTypes = {TajoDataTypes.Type.INT4}), + @ParamTypes(paramTypes = {TajoDataTypes.Type.INT8}), + } ) public class Round extends GeneralFunction { public Round() { http://git-wip-us.apache.org/repos/asf/tajo/blob/8024f6ab/tajo-core/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java b/tajo-core/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java index 99c31c6..41fcbfe 100644 --- a/tajo-core/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java +++ b/tajo-core/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java @@ -23,8 +23,10 @@ import org.apache.tajo.engine.eval.ExprTestBase; import org.junit.Test; import java.io.IOException; +import java.sql.ResultSet; import static org.apache.tajo.common.TajoDataTypes.Type.*; +import static org.junit.Assert.assertEquals; public class TestMathFunctions extends ExprTestBase { @Test @@ -44,6 +46,16 @@ public class TestMathFunctions extends ExprTestBase { testEval(schema, "table1", "1.0, 0.2, 0.4", "select round(col1 + col2 + col3) from table1", new String[]{"2"}); + + Schema schema2 = new Schema(); + schema2.addColumn("col1", INT4); + schema2.addColumn("col2", INT8); + schema2.addColumn("col3", FLOAT4); + schema2.addColumn("col4", FLOAT8); + + testEval(schema2, "table1", "9,9,9.5,9.5", + "select round(col1), round (col2), round(col3), round(col4) from table1", + new String [] {"9", "9", "10", "10"}); } @Test
