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 2014/05/20 20:46:17 UTC

[19/48] git commit: Revert "TAJO-780: Implements ADD_MONTHS() function. (Hyoungjun Kim via hyunsik)"

Revert "TAJO-780: Implements ADD_MONTHS() function. (Hyoungjun Kim via hyunsik)"

This reverts commit 698ff73344a20bd9ccf89d01cf1566dce21f1147.


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

Branch: refs/heads/window_function
Commit: 5f1b8e25b40217ceb6257d7aea55cad42892319c
Parents: 698ff73
Author: Hyunsik Choi <hy...@apache.org>
Authored: Wed Apr 30 14:55:27 2014 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Wed Apr 30 14:55:27 2014 +0900

----------------------------------------------------------------------
 CHANGES                                         |  2 -
 .../engine/function/datetime/AddMonths.java     | 64 --------------------
 .../engine/function/TestDateTimeFunctions.java  | 19 ------
 3 files changed, 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/5f1b8e25/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 8fc7a4d..4d4e101 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,8 +6,6 @@ Release 0.9.0 - unreleased
 
     TAJO-761: Implements INTERVAL type. (Hyoungjun Kim via hyunsik)
 
-    TAJO-780: Implements ADD_MONTHS() function. (Hyoungjun Kim via hyunsik)
-
   IMPROVEMENT
 
     TAJO-425: RAWFILE_SYNC_INTERVAL has not default value. (jinho)

http://git-wip-us.apache.org/repos/asf/tajo/blob/5f1b8e25/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java
deleted file mode 100644
index 4af4ff9..0000000
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/AddMonths.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.tajo.engine.function.datetime;
-
-import org.apache.tajo.catalog.Column;
-import org.apache.tajo.common.TajoDataTypes;
-import org.apache.tajo.common.TajoDataTypes.Type;
-import org.apache.tajo.datum.Datum;
-import org.apache.tajo.datum.IntervalDatum;
-import org.apache.tajo.engine.function.GeneralFunction;
-import org.apache.tajo.engine.function.annotation.Description;
-import org.apache.tajo.engine.function.annotation.ParamTypes;
-import org.apache.tajo.storage.Tuple;
-
-@Description(
-    functionName = "add_months",
-    description = "Return date value which is added with given parameter.",
-    example = "> SELECT add_months(date '2013-12-17', 2);\n"
-        + "2014-02-17 00:00:00",
-    returnType = Type.TIMESTAMP,
-    paramTypes = {
-        @ParamTypes(paramTypes = {Type.DATE, Type.INT2}),
-        @ParamTypes(paramTypes = {Type.DATE, Type.INT4}),
-        @ParamTypes(paramTypes = {Type.DATE, Type.INT8}),
-        @ParamTypes(paramTypes = {Type.TIMESTAMP, Type.INT2}),
-        @ParamTypes(paramTypes = {Type.TIMESTAMP, Type.INT4}),
-        @ParamTypes(paramTypes = {Type.TIMESTAMP, Type.INT8})
-    }
-)
-public class AddMonths extends GeneralFunction {
-  public AddMonths() {
-    super(new Column[]{
-        new Column("date", TajoDataTypes.Type.DATE),
-        new Column("month", TajoDataTypes.Type.INT4)
-    });
-  }
-
-  @Override
-  public Datum eval(Tuple params) {
-    Datum dateDatum = params.get(0);
-    int val = params.get(1).asInt4();
-    if (val >= 0) {
-      return dateDatum.plus(new IntervalDatum(val, 0));
-    } else {
-      return dateDatum.minus(new IntervalDatum(0- val, 0));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/5f1b8e25/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java b/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
index dea847f..8641548 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
@@ -256,23 +256,4 @@ public class TestDateTimeFunctions extends ExprTestBase {
     testSimpleEval("select to_date('2014-01-04', 'yyyy-MM-dd')", new String[]{"2014-01-04"});
     testSimpleEval("select to_date('2014-01-04', 'yyyy-MM-dd') + interval '1 day'", new String[]{"2014-01-05 00:00:00"});
   }
-
-  @Test
-  public void testAddMonths() throws Exception {
-    testSimpleEval("SELECT add_months(date '2013-12-17', 2::INT2);", new String[]{"2014-02-17 00:00:00"});
-    testSimpleEval("SELECT add_months(date '2013-12-17', 2::INT4);", new String[]{"2014-02-17 00:00:00"});
-    testSimpleEval("SELECT add_months(date '2013-12-17', 2::INT8);", new String[]{"2014-02-17 00:00:00"});
-
-    testSimpleEval("SELECT add_months(timestamp '2013-12-17 12:10:20', 2::INT2);", new String[]{"2014-02-17 12:10:20"});
-    testSimpleEval("SELECT add_months(timestamp '2013-12-17 12:10:20', 2::INT4);", new String[]{"2014-02-17 12:10:20"});
-    testSimpleEval("SELECT add_months(timestamp '2013-12-17 12:10:20', 2::INT8);", new String[]{"2014-02-17 12:10:20"});
-
-    testSimpleEval("SELECT add_months(date '2014-02-05', -3::INT2);", new String[]{"2013-11-05 00:00:00"});
-    testSimpleEval("SELECT add_months(date '2014-02-05', -3::INT4);", new String[]{"2013-11-05 00:00:00"});
-    testSimpleEval("SELECT add_months(date '2014-02-05', -3::INT8);", new String[]{"2013-11-05 00:00:00"});
-
-    testSimpleEval("SELECT add_months(timestamp '2014-02-05 12:10:20', -3::INT2);", new String[]{"2013-11-05 12:10:20"});
-    testSimpleEval("SELECT add_months(timestamp '2014-02-05 12:10:20', -3::INT4);", new String[]{"2013-11-05 12:10:20"});
-    testSimpleEval("SELECT add_months(timestamp '2014-02-05 12:10:20', -3::INT8);", new String[]{"2013-11-05 12:10:20"});
-  }
 }