falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject falcon git commit: FALCON-1104 Exception while adding process instance to graphdb when feed has partition expression. Contributed by Pavan Kumar Kolamuri
Date Wed, 03 Jun 2015 08:34:40 GMT
Repository: falcon
Updated Branches:
  refs/heads/master a6107758f -> aaed4c7a8


FALCON-1104 Exception while adding process instance to graphdb when feed has partition expression.
Contributed by Pavan Kumar Kolamuri


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

Branch: refs/heads/master
Commit: aaed4c7a83e4f1e3e2ceded35b2ab600bd73cd4d
Parents: a610775
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Wed Jun 3 13:47:50 2015 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Wed Jun 3 13:47:50 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                                  | 3 +++
 .../src/main/java/org/apache/falcon/entity/FeedHelper.java   | 5 ++++-
 .../falcon/metadata/InstanceRelationshipGraphBuilder.java    | 8 +++++++-
 .../test/java/org/apache/falcon/entity/FeedHelperTest.java   | 2 ++
 4 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/aaed4c7a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4d02409..e721841 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -31,6 +31,9 @@ Trunk (Unreleased)
     (Suhas Vasu)
 
   BUG FIXES
+    FALCON-1104 Exception while adding process instance to graphdb when feed has partition
expression
+    (Pavan Kumar Kolamuri via Ajay Yadava)
+
     FALCON-1252 The parameter "tagkey" should be "tagkeys" in EntityList and FalconCLI twiki
     (Ying Zheng via Sowmya Ramesh)
 

http://git-wip-us.apache.org/repos/asf/falcon/blob/aaed4c7a/common/src/main/java/org/apache/falcon/entity/FeedHelper.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/entity/FeedHelper.java b/common/src/main/java/org/apache/falcon/entity/FeedHelper.java
index 20f348d..acb8598 100644
--- a/common/src/main/java/org/apache/falcon/entity/FeedHelper.java
+++ b/common/src/main/java/org/apache/falcon/entity/FeedHelper.java
@@ -387,8 +387,11 @@ public final class FeedHelper {
             matchedVars.add(pathVar);
         }
 
+        String remTemplatePath = templatePath.substring(lastEnd);
         //Match the remaining constant at the end
-        if (!templatePath.substring(lastEnd).equals(path)) {
+        //Handling case where feed instancePath has partitions
+        if (StringUtils.isNotEmpty(path) && StringUtils.isNotEmpty(remTemplatePath)
+                && !path.contains(remTemplatePath)) {
             return null;
         }
 

http://git-wip-us.apache.org/repos/asf/falcon/blob/aaed4c7a/common/src/main/java/org/apache/falcon/metadata/InstanceRelationshipGraphBuilder.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/metadata/InstanceRelationshipGraphBuilder.java
b/common/src/main/java/org/apache/falcon/metadata/InstanceRelationshipGraphBuilder.java
index 2288443..213b020 100644
--- a/common/src/main/java/org/apache/falcon/metadata/InstanceRelationshipGraphBuilder.java
+++ b/common/src/main/java/org/apache/falcon/metadata/InstanceRelationshipGraphBuilder.java
@@ -35,10 +35,13 @@ import org.apache.falcon.entity.v0.feed.LocationType;
 import org.apache.falcon.entity.v0.process.Process;
 import org.apache.falcon.workflow.WorkflowExecutionArgs;
 import org.apache.falcon.workflow.WorkflowExecutionContext;
+import org.apache.hadoop.fs.Path;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.net.URISyntaxException;
+import java.util.Date;
+import java.util.TimeZone;
 
 /**
  * Instance Metadata relationship mapping helper.
@@ -304,9 +307,12 @@ public class InstanceRelationshipGraphBuilder extends RelationshipGraphBuilder
{
             instance = instance.replaceFirst(element, "");
         }
 
+        Date instanceTime = FeedHelper.getDate(feedPathTemplate,
+                new Path(feedInstancePath), TimeZone.getTimeZone("UTC"));
+
         return StringUtils.isEmpty(instance)
                 ? feed.getName() + "/" + nominalTime
                 : feed.getName() + "/"
-                        + SchemaHelper.formatDateUTCToISO8601(instance, FEED_INSTANCE_FORMAT);
+                        + SchemaHelper.formatDateUTC(instanceTime);
     }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/aaed4c7a/common/src/test/java/org/apache/falcon/entity/FeedHelperTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/falcon/entity/FeedHelperTest.java b/common/src/test/java/org/apache/falcon/entity/FeedHelperTest.java
index 63ab7da..266d029 100644
--- a/common/src/test/java/org/apache/falcon/entity/FeedHelperTest.java
+++ b/common/src/test/java/org/apache/falcon/entity/FeedHelperTest.java
@@ -70,6 +70,8 @@ public class FeedHelperTest {
             {"/data/${YEAR}/${MONTH}/${DAY}/data", "/data/2015/01/01/data", "2015-01-01T00:00Z"},
             {"/data/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}", "/data/2015-01-01/00/30",
null},
             {"/data/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}/data", "/data/2015-01-01/00/30",
null},
+            {"/data/${YEAR}/${MONTH}/${DAY}/${HOUR}/data", "/data/2015/05/25/00/data/{p1}/p2",
"2015-05-25T00:00Z"},
+            {"/data/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}/data", "/data/2015/05/25/00/00/{p1}/p2",
null},
         };
     }
 


Mime
View raw message