Source:
public void dateSubFunctionExtension7() throws InterruptedException { log.info("DateSubFunctionExtensionTestCaseFirstArgumentNull"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "" + "define stream inputStream (symbol string,dateValue string,dateFormat string,timestampInMilliseconds long,expr int);"; String query = ("@info(name = 'query1') " + "from inputStream select symbol ,time:dateSub(dateValue,expr,'year',dateFormat) as yearSubtracted,time:dateSub(dateValue,expr," + "'month',dateFormat) as monthSubtracted,time:dateSub(timestampInMilliseconds,expr,'year') as yearSubtractedUnix "+ "insert into outputStream;"); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); executionPlanRuntime.addCallback("query1", new QueryCallback() { @Override public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) { EventPrinter.print(timeStamp, inEvents, removeEvents); eventArrived = true; for(int cnt=0;cnt<inEvents.length;cnt++){ count++; log.info("Event : " + count + ",YEAR_SUBTRACTED : " + inEvents[cnt].getData(1) +"," + "MONTH_SUBTRACTED : "+inEvents[cnt].getData(2) + "," + "YEAR_SUBTRACTED_IN_MILLS : "+inEvents[cnt].getData(3)); } } }); InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); executionPlanRuntime.start(); inputHandler.send(new Object[]{"IBM",null, "yyyy-MM-dd HH:mm:ss",1415692424000L,2}); Thread.sleep(100); Assert.assertEquals(1, count); Assert.assertTrue(eventArrived); executionPlanRuntime.shutdown(); }

Target:
public void dateSubFunctionExtension7() throws InterruptedException { log.info("DateSubFunctionExtensionTestCaseFirstArgumentNull"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "" + "define stream inputStream (symbol string,dateValue string,dateFormat string,timestampInMilliseconds long,expr int);"; String query = ("@info(name = 'query1') " + "from inputStream select symbol ,time:dateSub(dateValue,expr,'year',dateFormat) as yearSubtracted,time:dateSub(dateValue,expr," + "'month',dateFormat) as monthSubtracted,time:dateSub(timestampInMilliseconds,expr,'year') as yearSubtractedUnix "+ "insert into outputStream;"); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); executionPlanRuntime.addCallback("query1", new QueryCallback() { @Override public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) { EventPrinter.print(timeStamp, inEvents, removeEvents); eventArrived = true; for (Event event : inEvents) { count++; if (count == 1) { Assert.assertEquals(null, event.getData(1)); Assert.assertEquals(null, event.getData(2)); Assert.assertEquals("1352620424000", event.getData(3)); } if (count == 2) { Assert.assertEquals(null, event.getData(1)); Assert.assertEquals(null,event.getData(2)); Assert.assertEquals("1352620424000", event.getData(3)); } } } }); InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); executionPlanRuntime.start(); inputHandler.send(new Object[]{"IBM",null, "yyyy-MM-dd HH:mm:ss",1415692424000L,2}); inputHandler.send(new Object[]{"IBM",null, "ss",1415692424000L,2}); Thread.sleep(100); Assert.assertEquals(2, count); Assert.assertTrue(eventArrived); executionPlanRuntime.shutdown(); }