falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkat...@apache.org
Subject [1/2] git commit: FALCON-185 Timestamp handled as int. Contributed by Shwetha GS
Date Wed, 13 Nov 2013 06:43:53 GMT
Updated Branches:
  refs/heads/master 2703d52ca -> bf63dbf19


FALCON-185 Timestamp handled as int. Contributed by Shwetha GS


Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/04392a69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/04392a69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/04392a69

Branch: refs/heads/master
Commit: 04392a6971dd6c36786968c2f22955608a94e983
Parents: 2703d52
Author: Venkatesh Seetharam <venkatesh@apache.org>
Authored: Tue Nov 12 22:31:14 2013 -0800
Committer: Venkatesh Seetharam <venkatesh@apache.org>
Committed: Tue Nov 12 22:31:14 2013 -0800

----------------------------------------------------------------------
 CHANGES.txt                                     | 10 ++--
 .../falcon/rerun/handler/LateRerunHandler.java  | 10 ++--
 .../rerun/handler/TestLateRerunHandler.java     | 50 ++++++++++++++++++++
 3 files changed, 62 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/04392a69/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 26baa73..0ceab04 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -81,9 +81,6 @@ Trunk (Unreleased)
     FALCON-188 hadoop-2 profile is not carried through to
     oozie package (Haohui Mai via Venkatesh Seetharam)
 
-    FALCON-159 Version API endpoint does not emit valid JSON
-    (Srimanth Gunturi via Venkatesh Seetharam)
-
     FALCON-171 Provide status in /api/entities/list.
     (Haohui Mai via Venkatesh Seetharam)
 
@@ -139,10 +136,17 @@ Trunk (Unreleased)
     (Shwetha GS via Srikanth Sundarrajan)
 
   OPTIMIZATIONS
+
     FALCON-67 Remove ant dependency in oozie workflows. (Shwetha GS via
     Srikanth Sundarrajan)
 
   BUG FIXES
+
+    FALCON-185 Timestamp handled as int (Shwetha GS via Venkatesh Seetharam)
+
+    FALCON-159 Version API endpoint does not emit valid JSON
+    (Srimanth Gunturi via Venkatesh Seetharam)
+
     FALCON-180 Disable table replication for multiple sources. (Venkatesh
     Seetharam via Srikanth Sundarrajan)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/04392a69/rerun/src/main/java/org/apache/falcon/rerun/handler/LateRerunHandler.java
----------------------------------------------------------------------
diff --git a/rerun/src/main/java/org/apache/falcon/rerun/handler/LateRerunHandler.java b/rerun/src/main/java/org/apache/falcon/rerun/handler/LateRerunHandler.java
index ee12332..897e7ab 100644
--- a/rerun/src/main/java/org/apache/falcon/rerun/handler/LateRerunHandler.java
+++ b/rerun/src/main/java/org/apache/falcon/rerun/handler/LateRerunHandler.java
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.falcon.rerun.handler;
 
 import org.apache.falcon.FalconException;
@@ -133,13 +134,11 @@ public class LateRerunHandler<M extends DelayedQueue<LaterunEvent>>
extends
         return wait;
     }
 
-    public static Date addTime(Date date, int milliSecondsToAdd) {
+    public static Date addTime(Date date, long milliSecondsToAdd) {
         return new Date(date.getTime() + milliSecondsToAdd);
     }
 
     public static Date getCutOffTime(Entity entity, String nominalTime) throws FalconException
{
-
-        ConfigurationStore store = ConfigurationStore.get();
         ExpressionHelper evaluator = ExpressionHelper.get();
         Date instanceStart = EntityUtil.parseDateUTC(nominalTime);
         ExpressionHelper.setReferenceDate(instanceStart);
@@ -155,10 +154,11 @@ public class LateRerunHandler<M extends DelayedQueue<LaterunEvent>>
extends
                     .toString();
             endTime = EntityUtil.parseDateUTC(nominalTime);
             long feedCutOffPeriod = evaluator.evaluate(lateCutOff, Long.class);
-            endTime = addTime(endTime, (int) feedCutOffPeriod);
+            endTime = addTime(endTime, feedCutOffPeriod);
             return endTime;
         } else if (entity.getEntityType() == EntityType.PROCESS) {
             Process process = (Process) entity;
+            ConfigurationStore store = ConfigurationStore.get();
             for (LateInput lp : process.getLateProcess().getLateInputs()) {
                 Feed feed = null;
                 String endInstanceTime = "";
@@ -182,7 +182,7 @@ public class LateRerunHandler<M extends DelayedQueue<LaterunEvent>>
extends
                 endTime = evaluator.evaluate(endInstanceTime, Date.class);
                 long feedCutOffPeriod = evaluator.evaluate(lateCutOff,
                         Long.class);
-                endTime = addTime(endTime, (int) feedCutOffPeriod);
+                endTime = addTime(endTime, feedCutOffPeriod);
 
                 if (endTime.after(feedCutOff)) {
                     feedCutOff = endTime;

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/04392a69/rerun/src/test/java/org/apache/falcon/rerun/handler/TestLateRerunHandler.java
----------------------------------------------------------------------
diff --git a/rerun/src/test/java/org/apache/falcon/rerun/handler/TestLateRerunHandler.java
b/rerun/src/test/java/org/apache/falcon/rerun/handler/TestLateRerunHandler.java
new file mode 100644
index 0000000..e02b495
--- /dev/null
+++ b/rerun/src/test/java/org/apache/falcon/rerun/handler/TestLateRerunHandler.java
@@ -0,0 +1,50 @@
+/**
+ * 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.falcon.rerun.handler;
+
+import junit.framework.Assert;
+import org.apache.falcon.FalconException;
+import org.apache.falcon.entity.EntityUtil;
+import org.apache.falcon.entity.v0.Frequency;
+import org.apache.falcon.entity.v0.feed.Feed;
+import org.apache.falcon.entity.v0.feed.LateArrival;
+import org.testng.annotations.Test;
+
+import java.util.Date;
+
+/**
+ * Tests org.apache.falcon.rerun.handler.LateRerunHandler.
+ */
+public class TestLateRerunHandler {
+
+    @Test
+    public void testFeedCutOff() throws FalconException {
+        Feed feed = new Feed();
+        LateArrival lateArrival = new LateArrival();
+        lateArrival.setCutOff(Frequency.fromString("days(1)"));
+        feed.setLateArrival(lateArrival);
+        String nm = "2013-10-01T12:00Z";
+        Date cutOff = LateRerunHandler.getCutOffTime(feed, nm);
+        Assert.assertEquals(EntityUtil.parseDateUTC("2013-10-02T12:00Z"), cutOff);
+
+        lateArrival.setCutOff(Frequency.fromString("days(10000000)"));
+        cutOff = LateRerunHandler.getCutOffTime(feed, nm);
+        Assert.assertTrue(cutOff.after(new Date()));
+    }
+}


Mime
View raw message