Repository: oozie Updated Branches: refs/heads/master fcbab9340 -> 0d497504e
OOZIE-2264 Fix coord:offset(n,DAY) to resolve correct data set Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/0d497504 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/0d497504 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/0d497504 Branch: refs/heads/master Commit: 0d497504e2ff016f3641de04dd2fb7acd31192de Parents: fcbab93 Author: Purshotam Shah <[email protected]> Authored: Mon Jun 15 14:19:27 2015 -0700 Committer: Purshotam Shah <[email protected]> Committed: Mon Jun 15 14:19:27 2015 -0700 ---------------------------------------------------------------------- .../oozie/command/coord/CoordCommandUtils.java | 2 +- .../command/coord/TestCoordCommandUtils.java | 23 ++++++++++++ .../src/test/resources/coord-dataset-offset.xml | 38 ++++++++++++++++++++ release-log.txt | 1 + 4 files changed, 63 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/0d497504/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java b/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java index 40a3c5c..7847c1f 100644 --- a/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java +++ b/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java @@ -263,7 +263,7 @@ public class CoordCommandUtils { List<Integer> expandedFreqs = CoordELFunctions.expandOffsetTimes(startCal, endCal, eval); for (int i = expandedFreqs.size() - 1; i >= 0; i--) { String matInstance = materializeInstance(event, "${coord:offset(" + expandedFreqs.get(i) - + ", \"MINUTE\")}", appInst, conf, eval); + + ", \"" + startRestArg + "\")}", appInst, conf, eval); if (matInstance == null || matInstance.length() == 0) { // Earlier than dataset's initial instance break; http://git-wip-us.apache.org/repos/asf/oozie/blob/0d497504/core/src/test/java/org/apache/oozie/command/coord/TestCoordCommandUtils.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/oozie/command/coord/TestCoordCommandUtils.java b/core/src/test/java/org/apache/oozie/command/coord/TestCoordCommandUtils.java index fc75d91..3477894 100644 --- a/core/src/test/java/org/apache/oozie/command/coord/TestCoordCommandUtils.java +++ b/core/src/test/java/org/apache/oozie/command/coord/TestCoordCommandUtils.java @@ -300,6 +300,29 @@ public class TestCoordCommandUtils extends XDataTestCase { } @Test + public void testCoordOffset() throws Exception { + CoordinatorJobBean job = addRecordToCoordJobTableForWaiting("coord-dataset-offset.xml", + CoordinatorJob.Status.RUNNING, false, true); + Path appPath = new Path(getFsTestCaseDir(), "coord"); + String actionXml = getCoordActionXml(appPath, "coord-dataset-offset.xml"); + CoordinatorActionBean actionBean = createCoordinatorActionBean(job); + Configuration jobConf = new XConfiguration(new StringReader(job.getConf())); + Element eAction = createActionElement(actionXml); + jobConf.set("startInstance", "coord:offset(-4,DAY)"); + jobConf.set("endInstance", "coord:offset(0,DAY)"); + String output = CoordCommandUtils.materializeOneInstance("jobId", true, eAction, + DateUtils.parseDateOozieTZ("2009-08-20T01:00Z"), DateUtils.parseDateOozieTZ("2009-08-20T01:00Z"), 1, + jobConf, actionBean); + eAction = XmlUtils.parseXml(output); + Element e = (Element) ((Element) eAction.getChildren("input-events", eAction.getNamespace()).get(0)) + .getChildren().get(0); + assertEquals(e.getChild("uris", e.getNamespace()).getTextTrim(), + "hdfs:///tmp/workflows/2009/08/20;region=us#hdfs:///tmp/workflows/2009/08/19;region=us#" + + "hdfs:///tmp/workflows/2009/08/18;region=us#hdfs:///tmp/workflows/2009/08/17;" + + "region=us#hdfs:///tmp/workflows/2009/08/16;region=us"); + } + + @Test public void testCoordAbsolute() throws Exception { CoordinatorJobBean job = addRecordToCoordJobTableForWaiting("coord-dataset-absolute.xml", CoordinatorJob.Status.RUNNING, false, true); http://git-wip-us.apache.org/repos/asf/oozie/blob/0d497504/core/src/test/resources/coord-dataset-offset.xml ---------------------------------------------------------------------- diff --git a/core/src/test/resources/coord-dataset-offset.xml b/core/src/test/resources/coord-dataset-offset.xml new file mode 100644 index 0000000..4a7a7a3 --- /dev/null +++ b/core/src/test/resources/coord-dataset-offset.xml @@ -0,0 +1,38 @@ +<!-- 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. --> + +<coordinator-app xmlns='uri:oozie:coordinator:0.2' name='NAME' + frequency="1" start='2009-08-20T01:00Z' end='2009-10-10T23:59Z' + timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'> + <controls> + <timeout>10</timeout> + <concurrency>2</concurrency> + <execution>LIFO</execution> + </controls> + <input-events> + <data-in name="input" dataset="test"> + <dataset name='test' frequency='1' initial-instance='2009-08-06T01:00Z' + timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'> + <uri-template>hdfs:///tmp/workflows/${YEAR}/${MONTH}/${DAY};region=us + </uri-template> + </dataset> + <start-instance>${startInstance}</start-instance> + <end-instance>${endInstance}</end-instance> + </data-in> + </input-events> + <action> + <workflow> + <app-path>hdfs:///tmp/workflows/</app-path> + <configuration> + </configuration> + </workflow> + </action> +</coordinator-app> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/oozie/blob/0d497504/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 79f19b8..e525c59 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 4.3.0 release (trunk - unreleased) +OOZIE-2264 Fix coord:offset(n,"DAY") to resolve correct data set(kailongs via puru) OOZIE-2178 fix javadoc to compile on JDK8 (rkanter) OOZIE-2268 Update ActiveMQ version for security and other fixes (rkanter) OOZIE-2215 Support glob in FS EL function (ryota)
