You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2013/12/21 13:52:07 UTC

git commit: TAJO-436: Implement ceiling(FLOAT8) function. (DaeMyung Kang via hyunsik)

Updated Branches:
  refs/heads/master 450fbcb93 -> 9409a0514


TAJO-436: Implement ceiling(FLOAT8) function. (DaeMyung Kang via hyunsik)


Project: http://git-wip-us.apache.org/repos/asf/incubator-tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tajo/commit/9409a051
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tajo/tree/9409a051
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tajo/diff/9409a051

Branch: refs/heads/master
Commit: 9409a051435b56865a94b92aecad8ae4834dfff6
Parents: 450fbcb
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Dec 21 21:51:50 2013 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Dec 21 21:51:50 2013 +0900

----------------------------------------------------------------------
 CHANGES.txt                                      |  4 +++-
 .../java/org/apache/tajo/master/TajoMaster.java  | 10 ++++++++++
 .../tajo/engine/function/TestMathFunctions.java  | 19 +++++++++++++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9409a051/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 89b89ee..72e6320 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,7 +4,9 @@ Release 0.8.0 - unreleased
 
   NEW FEATURES
 
-    TAJO-338 - Add Query Optimization Part for Column-Partitioned Tables.
+    TAJO-436: Implement ceiling(FLOAT8) function. (DaeMyung Kang via hyunsik)
+
+    TAJO-338 : Add Query Optimization Part for Column-Partitioned Tables.
     (hyunsik)
 
     TAJO-333: Add metric system to Tajo. (hyoungjunkim via jihoon)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9409a051/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
index e3d4c01..5f35540 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
@@ -521,6 +521,16 @@ public class TajoMaster extends CompositeService {
             CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4)));
 
     sqlFuncs.add(
+        new FunctionDesc("ceiling", Ceil.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.INT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT8)));
+
+    sqlFuncs.add(
+        new FunctionDesc("ceiling", Ceil.class, FunctionType.GENERAL,
+            CatalogUtil.newSimpleDataType(Type.INT8),
+            CatalogUtil.newSimpleDataTypeArray(Type.FLOAT4)));
+
+    sqlFuncs.add(
         new FunctionDesc("strpos", StrPos.class, FunctionType.GENERAL,
             CatalogUtil.newSimpleDataType(Type.INT4),
             CatalogUtil.newSimpleDataTypeArray(Type.TEXT, Type.TEXT)));

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9409a051/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
index b84b90d..09f7f68 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestMathFunctions.java
@@ -84,6 +84,25 @@ public class TestMathFunctions extends ExprTestBase {
   }
 
   @Test
+  public void testCeiling() throws IOException {
+    testSimpleEval("select ceiling(5.0) as col1 ", new String[]{"5"});
+    testSimpleEval("select ceiling(5.1) as col1 ", new String[]{"6"});
+    testSimpleEval("select ceiling(5.5) as col1 ", new String[]{"6"});
+    testSimpleEval("select ceiling(5.6) as col1 ", new String[]{"6"});
+
+    testSimpleEval("select ceiling(-5.1) as col1 ", new String[]{"-5"});
+    testSimpleEval("select ceiling(-5.6) as col1 ", new String[]{"-5"});
+
+    Schema schema = new Schema();
+    schema.addColumn("col1", FLOAT8);
+    schema.addColumn("col2", FLOAT8);
+    schema.addColumn("col3", FLOAT8);
+
+    testEval(schema, "table1", "1.0, 0.2, 0.1", "select ceiling(col1 + col2 + col3) from table1",
+        new String[]{"2"});
+  }
+
+  @Test
   public void testSin() throws IOException {
     testSimpleEval("select sin(0.0) as col1 ", new String[]{"0.0"});
     testSimpleEval("select sin(0.7) as col1 ", new String[]{"0.644217687237691"});