From ec35d4fe9fbce37b53b082e3f682e0d3adb6c660 Mon Sep 17 00:00:00 2001 From: mohan Date: Wed, 26 Jun 2019 15:12:11 +0530 Subject: [PATCH 1/8] Add parameterOverloads configuration to extension annotation --- docs/api/latest.md | 14 ++++++++++++-- .../executor/function/CastFunctionExecutor.java | 4 ++++ .../function/CoalesceFunctionExecutor.java | 4 ++++ .../executor/function/ConvertFunctionExecutor.java | 4 ++++ .../function/CreateSetFunctionExecutor.java | 4 ++++ .../CurrentTimeMillisFunctionExecutor.java | 4 ++++ .../executor/function/DefaultFunctionExecutor.java | 4 ++++ .../function/EventTimestampFunctionExecutor.java | 4 ++++ .../function/IfThenElseFunctionExecutor.java | 4 ++++ .../InstanceOfBooleanFunctionExecutor.java | 4 ++++ .../function/InstanceOfDoubleFunctionExecutor.java | 4 ++++ .../function/InstanceOfFloatFunctionExecutor.java | 4 ++++ .../InstanceOfIntegerFunctionExecutor.java | 4 ++++ .../function/InstanceOfLongFunctionExecutor.java | 4 ++++ .../function/InstanceOfStringFunctionExecutor.java | 4 ++++ .../executor/function/MaximumFunctionExecutor.java | 4 ++++ .../executor/function/MinimumFunctionExecutor.java | 4 ++++ .../function/SizeOfSetFunctionExecutor.java | 4 ++++ .../executor/function/UUIDFunctionExecutor.java | 4 ++++ .../function/Pol2CartStreamFunctionProcessor.java | 6 ++++++ .../stream/window/BatchWindowProcessor.java | 4 ++++ .../stream/window/CronWindowProcessor.java | 5 ++++- .../stream/window/DelayWindowProcessor.java | 4 ++++ .../window/ExternalTimeBatchWindowProcessor.java | 7 ++++++- .../stream/window/ExternalTimeWindowProcessor.java | 4 ++++ .../stream/window/FrequentWindowProcessor.java | 4 ++++ .../stream/window/LengthBatchWindowProcessor.java | 5 +++++ .../stream/window/LengthWindowProcessor.java | 4 ++++ .../window/LossyFrequentWindowProcessor.java | 6 ++++++ .../stream/window/SessionWindowProcessor.java | 9 ++++++++- .../stream/window/SortWindowProcessor.java | 5 +++++ .../stream/window/TimeWindowProcessor.java | 4 ++++ .../aggregator/AndAttributeAggregatorExecutor.java | 4 ++++ .../aggregator/AvgAttributeAggregatorExecutor.java | 4 ++++ .../CountAttributeAggregatorExecutor.java | 4 ++++ .../DistinctCountAttributeAggregatorExecutor.java | 4 ++++ .../aggregator/MaxAttributeAggregatorExecutor.java | 4 ++++ .../MaxForeverAttributeAggregatorExecutor.java | 4 ++++ .../aggregator/MinAttributeAggregatorExecutor.java | 4 ++++ .../MinForeverAttributeAggregatorExecutor.java | 4 ++++ .../aggregator/OrAttributeAggregatorExecutor.java | 4 ++++ .../StdDevAttributeAggregatorExecutor.java | 4 ++++ .../aggregator/SumAttributeAggregatorExecutor.java | 4 ++++ .../UnionSetAttributeAggregatorExecutor.java | 4 ++++ .../AvgIncrementalAttributeAggregator.java | 4 ++++ .../CountIncrementalAttributeAggregator.java | 4 ++++ ...istinctCountIncrementalAttributeAggregator.java | 4 ++++ .../MaxIncrementalAttributeAggregator.java | 4 ++++ .../MinIncrementalAttributeAggregator.java | 4 ++++ .../SumIncrementalAttributeAggregator.java | 4 ++++ .../core/stream/input/source/InMemorySource.java | 4 ++++ .../core/stream/output/sink/InMemorySink.java | 4 ++++ .../io/siddhi/core/stream/output/sink/LogSink.java | 7 +++++++ 53 files changed, 235 insertions(+), 5 deletions(-) diff --git a/docs/api/latest.md b/docs/api/latest.md index e3c07ded4e..3135cb5069 100644 --- a/docs/api/latest.md +++ b/docs/api/latest.md @@ -1180,6 +1180,8 @@ insert into sizeStream;

The pol2Cart function calculating the cartesian coordinates x & y for the given theta, rho coordinates and adding them as new attributes to the existing events.

Syntax ``` +pol2Cart() +pol2Cart( theta, rho) pol2Cart( theta, rho, z) ``` @@ -1536,6 +1538,8 @@ insert expired events into outputStream ;

A batch (tumbling) time window based on external time, that holds events arrived during windowTime periods, and gets updated for every windowTime.

Syntax ``` +externalTimeBatch( timestamp, window.time) +externalTimeBatch( timestamp, window.time, start.time) externalTimeBatch( timestamp, window.time, start.time, timeout) ``` @@ -1713,6 +1717,7 @@ insert all events into outputStream ;

A batch (tumbling) length window that holds and process a number of events as specified in the window.length.

Syntax ``` +lengthBatch( window.length) lengthBatch( window.length, stream.current.event) ``` @@ -1788,6 +1793,8 @@ insert all events into OutputStream ;

This window identifies and returns all the events of which the current frequency exceeds the value specified for the supportThreshold parameter.

Syntax ``` +lossyFrequent( support.threshold) +lossyFrequent( support.threshold, error.bound) lossyFrequent( support.threshold, error.bound, attribute) ``` @@ -1861,7 +1868,9 @@ insert all events into PotentialFraud;

This is a session window that holds events that belong to a specific session. The events that belong to a specific session are identified by a grouping attribute (i.e., a session key). A session gap period is specified to determine the time period after which the session is considered to be expired. A new event that arrives with a specific value for the session key is matched with the session window with the same session key.
 There can be out of order and late arrival of events, these events can arrive after the session is expired, to include those events to the matching session key specify a latency time period that is less than the session gap period.To have aggregate functions with session windows, the events need to be grouped by the session key via a 'group by' clause.

Syntax ``` -session( window.session, window.key, window.allowedlatency) +session( window.session) +session( window.session, window.key) +session( window.session, window.key, window.allowed.latency) ``` QUERY PARAMETERS @@ -1891,7 +1900,7 @@ session( window.session, window.key, win No - window.allowedlatency + window.allowed.latency This specifies the time period for which the session window is valid after the expiration of the session. The time period specified here should be less than the session time gap (which is specified via the 'window.session' parameter). 0 INT
LONG
TIME @@ -1917,6 +1926,7 @@ insert all events into OutputStream;

This window holds a batch of events that equal the number specified as the windowLength and sorts them in the given order.

Syntax ``` +sort( window.length, attribute) sort( window.length, attribute, order) ``` diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CastFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CastFunctionExecutor.java index aa0ed69ff1..2620549084 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CastFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CastFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -53,6 +54,9 @@ "following strings values: int, long, float, double, string, bool.", type = {DataType.STRING}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"to.be.caster", "cast.to"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be defined by the cast.to string constant value.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java index c709da0dc2..1f2d87db06 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -46,6 +47,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"args"}) + }, returnAttributes = @ReturnAttribute( description = "This will be the same as the type of the first input parameter.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/ConvertFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/ConvertFunctionExecutor.java index a5198d7c13..c813742943 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/ConvertFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/ConvertFunctionExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -49,6 +50,9 @@ "'string', 'bool'.", type = DataType.STRING) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"to.be.converted", "converted.to"}) + }, returnAttributes = @ReturnAttribute( description = "Based on the given convertedTo parameter.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CreateSetFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CreateSetFunctionExecutor.java index 2d5d7ad3fe..48c37f4461 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CreateSetFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CreateSetFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -48,6 +49,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"input"}) + }, returnAttributes = @ReturnAttribute( description = "The set that includes the input element.", type = {DataType.OBJECT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CurrentTimeMillisFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CurrentTimeMillisFunctionExecutor.java index f08476181b..5f0051bb0b 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CurrentTimeMillisFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CurrentTimeMillisFunctionExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -40,6 +41,9 @@ namespace = "", description = "Returns the current timestamp of siddhi application in milliseconds.", parameters = {}, + parameterOverloads = { + @ParameterOverload() + }, returnAttributes = @ReturnAttribute( description = "siddhi application's current timestamp in milliseconds.", type = DataType.LONG), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/DefaultFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/DefaultFunctionExecutor.java index baf6b21b90..8ebf9b11a7 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/DefaultFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/DefaultFunctionExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -51,6 +52,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"attribute", "default"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be same as the 'attribute' and 'default' type.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/EventTimestampFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/EventTimestampFunctionExecutor.java index 95c8cd8cf4..faee8af4d5 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/EventTimestampFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/EventTimestampFunctionExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -40,6 +41,9 @@ namespace = "", description = "Returns the timestamp of the processed event.", parameters = {}, + parameterOverloads = { + @ParameterOverload() + }, returnAttributes = @ReturnAttribute( description = "timestamp of the event.", type = DataType.LONG), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/IfThenElseFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/IfThenElseFunctionExecutor.java index 306b72ca9a..a6a5f0f711 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/IfThenElseFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/IfThenElseFunctionExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -57,6 +58,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"condition", "if.expression", "else.expression"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be same as the 'if.expression' and 'else.expression' type.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfBooleanFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfBooleanFunctionExecutor.java index 0ff4f40ae7..cd96119130 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfBooleanFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfBooleanFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -44,6 +45,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be boolean and true if and only if the input is a instance " + "of Boolean.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfDoubleFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfDoubleFunctionExecutor.java index 17ecc06650..e81c5c82b6 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfDoubleFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfDoubleFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -44,6 +45,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be boolean and true if and only if the input " + "is a instance of Double.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfFloatFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfFloatFunctionExecutor.java index 5bca3a1552..f80726508e 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfFloatFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfFloatFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -44,6 +45,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be boolean and true if and only if the input is a instance of Float.", type = {DataType.BOOL}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfIntegerFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfIntegerFunctionExecutor.java index b1a48553e4..7caeaf2ec4 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfIntegerFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfIntegerFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -44,6 +45,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be boolean and true if and only if the input is " + "a instance of Integer.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfLongFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfLongFunctionExecutor.java index fb8ffc1559..70383e2a0f 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfLongFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfLongFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -44,6 +45,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be boolean and true if and only if the input is a instance of Long.", type = {DataType.BOOL}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfStringFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfStringFunctionExecutor.java index 78e352b235..8b2e6c76a4 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfStringFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfStringFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -44,6 +45,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL, DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returned type will be boolean and true if and only if the input is " + "a instance of String.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java index 4577bbd1b1..2a3078a661 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -45,6 +46,9 @@ "All the specified parameters should be of the same type.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "This will be the same as the type of the first input parameter.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java index 996c87e106..6c6c23361b 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java @@ -22,6 +22,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -46,6 +47,9 @@ "All the specified parameters should be of the same type.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "This will be the same as the type of the first input parameter.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/SizeOfSetFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/SizeOfSetFunctionExecutor.java index c2669f49e5..cb01ae5d35 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/SizeOfSetFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/SizeOfSetFunctionExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -49,6 +50,9 @@ "A set object may be created by the 'set' attribute aggregator in Siddhi. ", type = {DataType.OBJECT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"set"}) + }, returnAttributes = @ReturnAttribute( description = "The size of the set.", type = {DataType.INT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/UUIDFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/UUIDFunctionExecutor.java index a363de7356..7c3f2b398d 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/UUIDFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/UUIDFunctionExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -39,6 +40,9 @@ namespace = "", description = "Generates a UUID (Universally Unique Identifier).", parameters = {}, + parameterOverloads = { + @ParameterOverload() + }, returnAttributes = @ReturnAttribute( description = "Returns a UUID string.", type = {DataType.STRING}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java index d2b7fe55fb..4e7701d85d 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.executor.ExpressionExecutor; @@ -54,6 +55,11 @@ optional = true, defaultValue = "If z value is not given, drop the third parameter of the output.") }, + parameterOverloads = { + @ParameterOverload(), + @ParameterOverload(parameterNames = {"theta", "rho"}), + @ParameterOverload(parameterNames = {"theta", "rho", "z"}) + }, examples = { @Example( syntax = "from PolarStream#pol2Cart(theta, rho)\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/BatchWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/BatchWindowProcessor.java index 88d4b1ff1a..0b82196701 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/BatchWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/BatchWindowProcessor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEvent; @@ -70,6 +71,9 @@ "the whole batch as once" ), }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"window.length"}) + }, examples = { @Example( syntax = diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/CronWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/CronWindowProcessor.java index b585baf898..10618d55da 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/CronWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/CronWindowProcessor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiAppContext; import io.siddhi.core.config.SiddhiQueryContext; @@ -66,7 +67,9 @@ description = "The cron expression that resets the window.", type = {DataType.STRING}) }, - + parameterOverloads = { + @ParameterOverload(parameterNames = {"cron.expression"}) + }, examples = { @Example( syntax = "define stream InputEventStream (symbol string, price float, volume int);\n\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/DelayWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/DelayWindowProcessor.java index ca5aa9e83b..31225fb2fe 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/DelayWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/DelayWindowProcessor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEventChunk; @@ -62,6 +63,9 @@ " the window should delay the events.", type = {DataType.INT, DataType.LONG, DataType.TIME}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"window.delay"}) + }, examples = { @Example( syntax = "define window delayWindow(symbol string, volume int) delay(1 hour);\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java index 5d89d498ec..1982ada818 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEvent; @@ -83,7 +84,11 @@ optional = true, defaultValue = "System waits till an event from next batch arrives to flush current batch") }, - + parameterOverloads = { + @ParameterOverload(parameterNames = {"timestamp", "window.time"}), + @ParameterOverload(parameterNames = {"timestamp", "window.time", "start.time"}), + @ParameterOverload(parameterNames = {"timestamp", "window.time", "start.time", "timeout"}) + }, examples = { @Example( syntax = "define window cseEventWindow (symbol string, price float, volume int) " + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeWindowProcessor.java index 261dc6d5a1..54f867d76d 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeWindowProcessor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEventChunk; @@ -69,6 +70,9 @@ description = "The sliding time period for which the window should hold events.", type = {DataType.INT, DataType.LONG, DataType.TIME}), }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"timestamp", "window.time"}) + }, examples = @Example( syntax = "define window cseEventWindow (symbol string, price float, volume int) " + "externalTime(eventTime, 20 sec) output expired events;\n\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FrequentWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FrequentWindowProcessor.java index 55f101ad32..ae47a646e8 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FrequentWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FrequentWindowProcessor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEventChunk; @@ -68,6 +69,9 @@ optional = true, defaultValue = "The concatenation of all the attributes of the event is considered.") }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"event.count", "attribute"}) + }, examples = { @Example( syntax = "@info(name = 'query1')\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthBatchWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthBatchWindowProcessor.java index deb0e6b66c..e1acf6956c 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthBatchWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthBatchWindowProcessor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEvent; @@ -69,6 +70,10 @@ optional = true, defaultValue = "false") }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"window.length"}), + @ParameterOverload(parameterNames = {"window.length", "stream.current.event"}) + }, examples = { @Example( syntax = "define stream InputEventStream (symbol string, price float, volume int);\n\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthWindowProcessor.java index fa81a64576..25059296cf 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthWindowProcessor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEvent; @@ -61,6 +62,9 @@ description = "The number of events that should be included in a sliding length window.", type = {DataType.INT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"window.length"}) + }, examples = @Example( syntax = "define window StockEventWindow (symbol string, price float, volume int) " + "length(10) output all events;\n\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LossyFrequentWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LossyFrequentWindowProcessor.java index c2ded7a4e4..14087ae313 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LossyFrequentWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LossyFrequentWindowProcessor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEventChunk; @@ -70,6 +71,11 @@ optional = true, defaultValue = "The concatenation of all the attributes of the event is considered.") }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"support.threshold"}), + @ParameterOverload(parameterNames = {"support.threshold", "error.bound"}), + @ParameterOverload(parameterNames = {"support.threshold", "error.bound", "attribute"}) + }, examples = { @Example( syntax = "define stream purchase (cardNo string, price float);\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java index 8391750a45..9a2a8dca3a 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEvent; @@ -79,12 +80,18 @@ @Parameter(name = "window.key", description = "The grouping attribute for events.", type = {DataType.STRING}, optional = true, defaultValue = "default-key"), - @Parameter(name = "window.allowedlatency", + @Parameter(name = "window.allowed.latency", description = "This specifies the time period for which the session window is valid after " + "the expiration of the session. The time period specified here should be less than " + "the session time gap (which is specified via the 'window.session' parameter).", type = {DataType.INT, DataType.LONG, DataType.TIME}, optional = true, defaultValue = "0") }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"window.session"}), + @ParameterOverload(parameterNames = {"window.session", "window.key"}), + @ParameterOverload(parameterNames = {"window.session", "window.key", "window.allowed.latency"}) + + }, examples = { @Example( syntax = "define stream PurchaseEventStream " diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java index 1b689d42e5..3939b59345 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEventChunk; @@ -80,6 +81,10 @@ optional = true, defaultValue = "asc") }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"window.length", "attribute"}), + @ParameterOverload(parameterNames = {"window.length", "attribute", "order"}) + }, examples = @Example( syntax = "define stream cseEventStream (symbol string, price float, volume long);\n" + "define window cseEventWindow (symbol string, price float, volume long) sort(2,volume, 'asc')" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/TimeWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/TimeWindowProcessor.java index fe18749c7e..06ba3092fe 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/TimeWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/TimeWindowProcessor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEventChunk; @@ -64,6 +65,9 @@ description = "The sliding time period for which the window should hold events.", type = {DataType.INT, DataType.LONG, DataType.TIME}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"window.time"}) + }, examples = { @Example( syntax = "define window cseEventWindow (symbol string, price float, volume int) " + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AndAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AndAttributeAggregatorExecutor.java index 8abd5d7eb7..e2d2396664 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AndAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AndAttributeAggregatorExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -46,6 +47,9 @@ description = "The value that needs to be AND operation.", type = {DataType.BOOL}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns true only if all of its operands are true, else false.", type = {DataType.BOOL}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AvgAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AvgAttributeAggregatorExecutor.java index 777498a48c..0b656b1c68 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AvgAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AvgAttributeAggregatorExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -47,6 +48,9 @@ description = "The value that need to be averaged.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the calculated average value as a double.", type = {DataType.DOUBLE}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/CountAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/CountAttributeAggregatorExecutor.java index 83f55d25e2..f26d888b3a 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/CountAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/CountAttributeAggregatorExecutor.java @@ -19,6 +19,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -40,6 +41,9 @@ namespace = "", description = "Returns the count of all the events.", parameters = {}, + parameterOverloads = { + @ParameterOverload() + }, returnAttributes = @ReturnAttribute( description = "Returns the event count as a long.", type = {DataType.LONG}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/DistinctCountAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/DistinctCountAttributeAggregatorExecutor.java index d1cb69fc1f..f21f8deee8 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/DistinctCountAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/DistinctCountAttributeAggregatorExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -48,6 +49,9 @@ description = "The object for which the number of distinct occurences needs to be counted.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the count of distinct occurrences for a given arg.", type = {DataType.LONG}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java index 999c446201..3665c25a3f 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -50,6 +51,9 @@ description = "The value that needs to be compared to find the maximum value.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the maximum value in the same data type as the input.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxForeverAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxForeverAttributeAggregatorExecutor.java index 2743ccad55..6d202833bc 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxForeverAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxForeverAttributeAggregatorExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -49,6 +50,9 @@ description = "The value that needs to be compared to find the maximum value.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the maximum value in the same data type as the input.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinAttributeAggregatorExecutor.java index b714404a9b..4b27e95733 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinAttributeAggregatorExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -50,6 +51,9 @@ description = "The value that needs to be compared to find the minimum value.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the minimum value in the same type as the input.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinForeverAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinForeverAttributeAggregatorExecutor.java index b8da027c94..be616795ac 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinForeverAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinForeverAttributeAggregatorExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -48,6 +49,9 @@ description = "The value that needs to be compared to find the minimum value.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the minimum value in the same data type as the input.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/OrAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/OrAttributeAggregatorExecutor.java index edf021c02b..d00884d061 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/OrAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/OrAttributeAggregatorExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -46,6 +47,9 @@ description = "The value that needs to be OR operation.", type = {DataType.BOOL}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns false only if all of its operands are false, else true.", type = {DataType.BOOL}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutor.java index acaea2c1d5..4d2d27bb43 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -48,6 +49,9 @@ description = "The value that should be used to calculate the standard deviation.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the calculated standard deviation value as a double.", type = {DataType.DOUBLE}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/SumAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/SumAttributeAggregatorExecutor.java index 1862f5b30e..4cc9bdc9c9 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/SumAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/SumAttributeAggregatorExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -47,6 +48,9 @@ description = "The value that needs to be summed.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns long if the input parameter type is int or long, and returns double if the " + "input parameter type is float or double.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java index 9e2ac663bd..2e6ab0bad8 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; @@ -52,6 +53,9 @@ returnAttributes = @ReturnAttribute( description = "Returns a java.util.Set object which is the union of aggregated sets", type = {DataType.OBJECT}), + parameterOverloads = { + @ParameterOverload(parameterNames = {"set"}) + }, examples = @Example( syntax = "from stockStream \n" + "select createSet(symbol) as initialSet \n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/AvgIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/AvgIncrementalAttributeAggregator.java index f86d178ed4..44ac2fe286 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/AvgIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/AvgIncrementalAttributeAggregator.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.exception.SiddhiAppCreationException; @@ -39,6 +40,9 @@ description = "The value that needs to be averaged incrementally, for different durations.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the calculated average value as a double.", type = {DataType.DOUBLE}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/CountIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/CountIncrementalAttributeAggregator.java index eabd0cb49f..3e461e3933 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/CountIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/CountIncrementalAttributeAggregator.java @@ -19,6 +19,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.query.api.definition.Attribute; @@ -32,6 +33,9 @@ namespace = "incrementalAggregator", description = "Returns the count of all events, in incremental event processing", parameters = {}, + parameterOverloads = { + @ParameterOverload() + }, returnAttributes = @ReturnAttribute( description = "Returns the event count as a long.", type = {DataType.LONG}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/DistinctCountIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/DistinctCountIncrementalAttributeAggregator.java index 29587d61c2..d53d53b72a 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/DistinctCountIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/DistinctCountIncrementalAttributeAggregator.java @@ -20,6 +20,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.exception.SiddhiAppRuntimeException; @@ -39,6 +40,9 @@ type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, DataType.BOOL}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the distinct event count as a long.", type = {DataType.LONG}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MaxIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MaxIncrementalAttributeAggregator.java index 93e9d48561..08f4c7d59a 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MaxIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MaxIncrementalAttributeAggregator.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.exception.SiddhiAppCreationException; @@ -40,6 +41,9 @@ description = "The value that needs to be compared to find the maximum value.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the maximum value in the same data type as the input.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MinIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MinIncrementalAttributeAggregator.java index ec0a13439a..4215d80f42 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MinIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MinIncrementalAttributeAggregator.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.exception.SiddhiAppCreationException; @@ -40,6 +41,9 @@ description = "The value that needs to be compared to find the minimum value.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns the minimum value in the same data type as the input.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}), diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java index d17f336991..87ca2aad84 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; import io.siddhi.core.exception.SiddhiAppCreationException; @@ -40,6 +41,9 @@ description = "The value that needs to be summed.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"arg"}) + }, returnAttributes = @ReturnAttribute( description = "Returns long if the input parameter type is int or long, and returns double if the " + "input parameter type is float or double.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/stream/input/source/InMemorySource.java b/modules/siddhi-core/src/main/java/io/siddhi/core/stream/input/source/InMemorySource.java index 91e1570385..eaa6a6755c 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/stream/input/source/InMemorySource.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/stream/input/source/InMemorySource.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiAppContext; import io.siddhi.core.exception.ConnectionUnavailableException; @@ -42,6 +43,9 @@ "is assumed that the publisher and subscriber of a topic uses same event schema (stream definition).", parameters = @Parameter(name = "topic", type = DataType.STRING, description = "Subscribes to sent on the " + "given topic."), + parameterOverloads = { + @ParameterOverload(parameterNames = {"topic"}) + }, examples = @Example( syntax = "@source(type='inMemory', @map(type='passThrough'))\n" + "define stream BarStream (symbol string, price float, volume long)", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/sink/InMemorySink.java b/modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/sink/InMemorySink.java index 368d998b73..95967c9f8b 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/sink/InMemorySink.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/sink/InMemorySink.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiAppContext; import io.siddhi.core.exception.ConnectionUnavailableException; @@ -48,6 +49,9 @@ "is assumed that the publisher and subscriber of a topic uses same event schema (stream definition).", parameters = @Parameter(name = "topic", type = DataType.STRING, description = "Event will be delivered to all" + "the subscribers of the same topic"), + parameterOverloads = { + @ParameterOverload(parameterNames = {"topic"}) + }, examples = @Example( syntax = "@sink(type='inMemory', @map(type='passThrough'))\n" + "define stream BarStream (symbol string, price float, volume long)", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/sink/LogSink.java b/modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/sink/LogSink.java index ba00d52bb7..9c2090f0d4 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/sink/LogSink.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/sink/LogSink.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiAppContext; import io.siddhi.core.exception.ConnectionUnavailableException; @@ -62,6 +63,12 @@ defaultValue = "default prefix will be : " ) }, + parameterOverloads = { + @ParameterOverload(), + @ParameterOverload(parameterNames = {"priority"}), + @ParameterOverload(parameterNames = {"prefix"}), + @ParameterOverload(parameterNames = {"priority", "prefix"}) + }, examples = { @Example( syntax = "@sink(type='log', prefix='My Log', priority='DEBUG') \n" + From d6e1a806818a30009031aa0dca648f2038d8d4c3 Mon Sep 17 00:00:00 2001 From: mohan Date: Wed, 26 Jun 2019 17:31:01 +0530 Subject: [PATCH 2/8] Remove dynamic validation for executions & add annotation config changes --- ...regationAttributeValidationAnnotationProcessor.java | 7 ------- .../FunctionExecutorValidationAnnotationProcessor.java | 9 +-------- ...regationAttributeValidationAnnotationProcessor.java | 7 ------- ...FunctionProcessorValidationAnnotationProcessor.java | 8 +------- .../StreamProcessorValidationAnnotationProcessor.java | 8 +------- .../WindowProcessorValidationAnnotationProcessor.java | 8 +------- .../core/executor/function/CastFunctionExecutor.java | 6 ++++-- .../executor/function/CoalesceFunctionExecutor.java | 3 ++- .../executor/function/ConvertFunctionExecutor.java | 6 ++++-- .../executor/function/CreateSetFunctionExecutor.java | 3 ++- .../executor/function/DefaultFunctionExecutor.java | 6 ++++-- .../executor/function/IfThenElseFunctionExecutor.java | 9 ++++++--- .../function/InstanceOfBooleanFunctionExecutor.java | 3 ++- .../function/InstanceOfDoubleFunctionExecutor.java | 3 ++- .../function/InstanceOfFloatFunctionExecutor.java | 3 ++- .../function/InstanceOfIntegerFunctionExecutor.java | 3 ++- .../function/InstanceOfLongFunctionExecutor.java | 3 ++- .../function/InstanceOfStringFunctionExecutor.java | 3 ++- .../executor/function/MaximumFunctionExecutor.java | 3 ++- .../executor/function/MinimumFunctionExecutor.java | 3 ++- .../executor/function/SizeOfSetFunctionExecutor.java | 3 ++- .../aggregator/AndAttributeAggregatorExecutor.java | 3 ++- .../aggregator/AvgAttributeAggregatorExecutor.java | 3 ++- .../DistinctCountAttributeAggregatorExecutor.java | 3 ++- .../aggregator/MaxAttributeAggregatorExecutor.java | 3 ++- .../MaxForeverAttributeAggregatorExecutor.java | 3 ++- .../aggregator/MinAttributeAggregatorExecutor.java | 3 ++- .../MinForeverAttributeAggregatorExecutor.java | 3 ++- .../aggregator/OrAttributeAggregatorExecutor.java | 3 ++- .../aggregator/StdDevAttributeAggregatorExecutor.java | 3 ++- .../aggregator/SumAttributeAggregatorExecutor.java | 3 ++- .../UnionSetAttributeAggregatorExecutor.java | 10 +++++----- .../incremental/AvgIncrementalAttributeAggregator.java | 3 ++- .../DistinctCountIncrementalAttributeAggregator.java | 3 ++- .../incremental/MaxIncrementalAttributeAggregator.java | 3 ++- .../incremental/MinIncrementalAttributeAggregator.java | 3 ++- .../incremental/SumIncrementalAttributeAggregator.java | 3 ++- 37 files changed, 79 insertions(+), 83 deletions(-) diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AggregationAttributeValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AggregationAttributeValidationAnnotationProcessor.java index adc6b43790..06945e413a 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AggregationAttributeValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AggregationAttributeValidationAnnotationProcessor.java @@ -57,13 +57,6 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat " name:{0} -> type annotated in class {1} is null or empty.", parameterName, extensionClassFullName)); } - //Check if the @Parameter dynamic property false or empty in the classes extending - //super classes except the Sink & SinkMapper. - if (parameter.dynamic()) { - throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + - " name:{0} -> dynamic property cannot be annotated true in class {1}.", parameterName, - extensionClassFullName)); - } } } diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/FunctionExecutorValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/FunctionExecutorValidationAnnotationProcessor.java index 8c7b01e5e3..10effa7b12 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/FunctionExecutorValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/FunctionExecutorValidationAnnotationProcessor.java @@ -57,14 +57,7 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat "-> name:{0} -> type annotated in class {1} is null or empty.", parameterName, extensionClassFullName)); } - //Check if the @Parameter dynamic property false or empty in the classes extending - //super classes except the Sink & SinkMapper. - if (parameter.dynamic()) { - throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + - "-> name:{0} -> dynamic property cannot be annotated true in class {1}. " + - "Only classes extending Sink and SinkMapper can have the dynamic parameters.", - parameterName, extensionClassFullName)); - } + if (parameter.optional()) { if (parameter.defaultValue().isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter -> " + diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/IncrementalAggregationAttributeValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/IncrementalAggregationAttributeValidationAnnotationProcessor.java index cb724129f3..9841c80ff5 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/IncrementalAggregationAttributeValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/IncrementalAggregationAttributeValidationAnnotationProcessor.java @@ -58,13 +58,6 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat " name:{0} -> type annotated in class {1} is null or empty.", parameterName, extensionClassFullName)); } - //Check if the @Parameter dynamic property false or empty in the classes extending - //super classes except the Sink & SinkMapper. - if (parameter.dynamic()) { - throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + - " name:{0} -> dynamic property cannot be annotated true in class {1}.", parameterName, - extensionClassFullName)); - } } } diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamFunctionProcessorValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamFunctionProcessorValidationAnnotationProcessor.java index 90a6d6d0e7..2d2b4eedfa 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamFunctionProcessorValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamFunctionProcessorValidationAnnotationProcessor.java @@ -57,13 +57,7 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat " name:{0} -> type annotated in class {1} is null or empty.", parameterName, extensionClassFullName)); } - //Check if the @Parameter dynamic property false or empty in the classes extending - //super classes except the Sink & SinkMapper. - if (parameter.dynamic()) { - throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + - " name:{0} -> dynamic property cannot be annotated true in class {1}.", parameterName, - extensionClassFullName)); - } + if (parameter.optional()) { if (parameter.defaultValue().isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter -> " + diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamProcessorValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamProcessorValidationAnnotationProcessor.java index b46f6155d8..8e314082cc 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamProcessorValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamProcessorValidationAnnotationProcessor.java @@ -57,13 +57,7 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat " name:{0} -> type annotated in class {1} is null or empty.", parameterName, extensionClassFullName)); } - //Check if the @Parameter dynamic property false or empty in the classes extending - //super classes except the Sink & SinkMapper. - if (parameter.dynamic()) { - throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + - " name:{0} -> dynamic property cannot be annotated true in class {1}.", parameterName, - extensionClassFullName)); - } + if (parameter.optional()) { if (parameter.defaultValue().isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter -> " + diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/WindowProcessorValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/WindowProcessorValidationAnnotationProcessor.java index d5d9f5471a..45100bafff 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/WindowProcessorValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/WindowProcessorValidationAnnotationProcessor.java @@ -57,13 +57,7 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat " name:{0} -> type annotated in class {1} is null or empty.", parameterName, extensionClassFullName)); } - //Check if the @Parameter dynamic property false or empty in the classes extending - //super classes except the Sink & SinkMapper. - if (parameter.dynamic()) { - throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + - " name:{0} -> dynamic property cannot be annotated true in class {1}.", parameterName, - extensionClassFullName)); - } + if (parameter.optional()) { if (parameter.defaultValue().isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter -> " + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CastFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CastFunctionExecutor.java index 2620549084..b9267ef165 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CastFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CastFunctionExecutor.java @@ -48,11 +48,13 @@ @Parameter(name = "to.be.caster", description = "This specifies the attribute to be casted.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}), + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true), @Parameter(name = "cast.to", description = "A string constant parameter expressing the cast to type using one of the " + "following strings values: int, long, float, double, string, bool.", - type = {DataType.STRING}) + type = {DataType.STRING}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"to.be.caster", "cast.to"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java index 1f2d87db06..dccf0b53bc 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java @@ -45,7 +45,8 @@ "They can belong to any one of the available types." + " All the specified parameters should be of the same type.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"args"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/ConvertFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/ConvertFunctionExecutor.java index c813742943..1c28e08539 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/ConvertFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/ConvertFunctionExecutor.java @@ -43,12 +43,14 @@ @Parameter(name = "to.be.converted", description = "This specifies the value to be converted.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING, - DataType.BOOL}), + DataType.BOOL}, + dynamic = true), @Parameter(name = "converted.to", description = "A string constant parameter to which type the attribute need to be converted " + " using one of the following strings values: 'int', 'long', 'float', 'double', " + "'string', 'bool'.", - type = DataType.STRING) + type = DataType.STRING, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"to.be.converted", "converted.to"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CreateSetFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CreateSetFunctionExecutor.java index 48c37f4461..97a67c933e 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CreateSetFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CreateSetFunctionExecutor.java @@ -47,7 +47,8 @@ @Parameter(name = "input", description = "The input that needs to be added into the set.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, - DataType.FLOAT, DataType.STRING, DataType.BOOL}) + DataType.FLOAT, DataType.STRING, DataType.BOOL}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"input"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/DefaultFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/DefaultFunctionExecutor.java index 8ebf9b11a7..57b4641466 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/DefaultFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/DefaultFunctionExecutor.java @@ -46,11 +46,13 @@ @Parameter(name = "attribute", description = "The attribute that could be null.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}), + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true), @Parameter(name = "default", description = "The default value that will be used when 'attribute' parameter is null", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"attribute", "default"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/IfThenElseFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/IfThenElseFunctionExecutor.java index a6a5f0f711..3dc4381c0f 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/IfThenElseFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/IfThenElseFunctionExecutor.java @@ -46,17 +46,20 @@ parameters = { @Parameter(name = "condition", description = "This specifies the if then else condition value.", - type = {DataType.BOOL}), + type = {DataType.BOOL}, + dynamic = true), @Parameter(name = "if.expression", description = "This specifies the value to be returned if " + "the value of the condition parameter is true.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}), + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true), @Parameter(name = "else.expression", description = "This specifies the value to be returned if " + "the value of the condition parameter is false.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"condition", "if.expression", "else.expression"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfBooleanFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfBooleanFunctionExecutor.java index cd96119130..6d4ee850bf 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfBooleanFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfBooleanFunctionExecutor.java @@ -43,7 +43,8 @@ @Parameter(name = "arg", description = "The parameter to be checked.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfDoubleFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfDoubleFunctionExecutor.java index e81c5c82b6..1627834ac1 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfDoubleFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfDoubleFunctionExecutor.java @@ -43,7 +43,8 @@ @Parameter(name = "arg", description = "The parameter to be checked.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfFloatFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfFloatFunctionExecutor.java index f80726508e..4219668f06 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfFloatFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfFloatFunctionExecutor.java @@ -43,7 +43,8 @@ @Parameter(name = "arg", description = "The parameter to be checked.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfIntegerFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfIntegerFunctionExecutor.java index 7caeaf2ec4..d67ae02ee7 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfIntegerFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfIntegerFunctionExecutor.java @@ -43,7 +43,8 @@ @Parameter(name = "arg", description = "The parameter to be checked.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfLongFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfLongFunctionExecutor.java index 70383e2a0f..3d9c3e1e17 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfLongFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfLongFunctionExecutor.java @@ -43,7 +43,8 @@ @Parameter(name = "arg", description = "The parameter to be checked.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfStringFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfStringFunctionExecutor.java index 8b2e6c76a4..63a04bb79e 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfStringFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/InstanceOfStringFunctionExecutor.java @@ -43,7 +43,8 @@ @Parameter(name = "arg", description = "The parameter to be checked.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, - DataType.STRING, DataType.BOOL, DataType.OBJECT}) + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java index 2a3078a661..77cdf75ce0 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java @@ -44,7 +44,8 @@ description = "This function accepts one or more parameters. " + "They can belong to any one of the available types. " + "All the specified parameters should be of the same type.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java index 6c6c23361b..4aa908cb52 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java @@ -45,7 +45,8 @@ description = "This function accepts one or more parameters. " + "They can belong to any one of the available types. " + "All the specified parameters should be of the same type.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/SizeOfSetFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/SizeOfSetFunctionExecutor.java index cb01ae5d35..bd9167f6af 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/SizeOfSetFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/SizeOfSetFunctionExecutor.java @@ -48,7 +48,8 @@ description = "The set object. " + "This parameter should be of type java.util.Set. " + "A set object may be created by the 'set' attribute aggregator in Siddhi. ", - type = {DataType.OBJECT}) + type = {DataType.OBJECT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"set"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AndAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AndAttributeAggregatorExecutor.java index e2d2396664..da3d27a334 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AndAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AndAttributeAggregatorExecutor.java @@ -45,7 +45,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be AND operation.", - type = {DataType.BOOL}) + type = {DataType.BOOL}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AvgAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AvgAttributeAggregatorExecutor.java index 0b656b1c68..078d8a2512 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AvgAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/AvgAttributeAggregatorExecutor.java @@ -46,7 +46,8 @@ parameters = { @Parameter(name = "arg", description = "The value that need to be averaged.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/DistinctCountAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/DistinctCountAttributeAggregatorExecutor.java index f21f8deee8..6b3afe7d41 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/DistinctCountAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/DistinctCountAttributeAggregatorExecutor.java @@ -47,7 +47,8 @@ parameters = { @Parameter(name = "arg", description = "The object for which the number of distinct occurences needs to be counted.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, DataType.STRING}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java index 3665c25a3f..0a70145035 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java @@ -49,7 +49,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be compared to find the maximum value.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxForeverAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxForeverAttributeAggregatorExecutor.java index 6d202833bc..827d968be7 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxForeverAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxForeverAttributeAggregatorExecutor.java @@ -48,7 +48,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be compared to find the maximum value.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinAttributeAggregatorExecutor.java index 4b27e95733..ae9f1ab5b1 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinAttributeAggregatorExecutor.java @@ -49,7 +49,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be compared to find the minimum value.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinForeverAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinForeverAttributeAggregatorExecutor.java index be616795ac..872c1afca0 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinForeverAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MinForeverAttributeAggregatorExecutor.java @@ -47,7 +47,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be compared to find the minimum value.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/OrAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/OrAttributeAggregatorExecutor.java index d00884d061..64b76f9718 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/OrAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/OrAttributeAggregatorExecutor.java @@ -45,7 +45,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be OR operation.", - type = {DataType.BOOL}) + type = {DataType.BOOL}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutor.java index 4d2d27bb43..1fed7091c5 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutor.java @@ -47,7 +47,8 @@ parameters = { @Parameter(name = "arg", description = "The value that should be used to calculate the standard deviation.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/SumAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/SumAttributeAggregatorExecutor.java index 4cc9bdc9c9..ad92f46080 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/SumAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/SumAttributeAggregatorExecutor.java @@ -46,7 +46,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be summed.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java index 2e6ab0bad8..fc71bd1b3d 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java @@ -48,14 +48,14 @@ parameters = @Parameter(name = "set", description = "The java.util.Set object that needs to be added into the union set.", - type = {DataType.OBJECT}) - , - returnAttributes = @ReturnAttribute( - description = "Returns a java.util.Set object which is the union of aggregated sets", - type = {DataType.OBJECT}), + type = {DataType.OBJECT}, + dynamic = true), parameterOverloads = { @ParameterOverload(parameterNames = {"set"}) }, + returnAttributes = @ReturnAttribute( + description = "Returns a java.util.Set object which is the union of aggregated sets", + type = {DataType.OBJECT}), examples = @Example( syntax = "from stockStream \n" + "select createSet(symbol) as initialSet \n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/AvgIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/AvgIncrementalAttributeAggregator.java index 44ac2fe286..87e8029d1c 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/AvgIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/AvgIncrementalAttributeAggregator.java @@ -38,7 +38,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be averaged incrementally, for different durations.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/DistinctCountIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/DistinctCountIncrementalAttributeAggregator.java index d53d53b72a..8df670ad68 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/DistinctCountIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/DistinctCountIncrementalAttributeAggregator.java @@ -38,7 +38,8 @@ @Parameter(name = "arg", description = "The attribute that needs to be counted.", type = {DataType.INT, DataType.LONG, DataType.DOUBLE, - DataType.FLOAT, DataType.STRING, DataType.BOOL}) + DataType.FLOAT, DataType.STRING, DataType.BOOL}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MaxIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MaxIncrementalAttributeAggregator.java index 08f4c7d59a..dc41f6533c 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MaxIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MaxIncrementalAttributeAggregator.java @@ -39,7 +39,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be compared to find the maximum value.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MinIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MinIncrementalAttributeAggregator.java index 4215d80f42..29245aada4 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MinIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/MinIncrementalAttributeAggregator.java @@ -39,7 +39,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be compared to find the minimum value.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java index 87ca2aad84..b50d5b37ae 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/incremental/SumIncrementalAttributeAggregator.java @@ -39,7 +39,8 @@ parameters = { @Parameter(name = "arg", description = "The value that needs to be summed.", - type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}) + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT}, + dynamic = true) }, parameterOverloads = { @ParameterOverload(parameterNames = {"arg"}) From 2fa2603c1b63e6eb667620ece0319af529f99613 Mon Sep 17 00:00:00 2001 From: mohan Date: Fri, 28 Jun 2019 07:45:22 +0530 Subject: [PATCH 3/8] Fix compile time annotations due to paramOverloadMethod changes --- .../AbstractAnnotationProcessor.java | 10 +++++++--- ...ttributeValidationAnnotationProcessor.java | 3 ++- ...ExecutorValidationAnnotationProcessor.java | 4 +++- ...ttributeValidationAnnotationProcessor.java | 3 ++- ...rocessorValidationAnnotationProcessor.java | 3 ++- ...rocessorValidationAnnotationProcessor.java | 3 ++- ...rocessorValidationAnnotationProcessor.java | 3 ++- .../gen/core/utils/DocumentationUtils.java | 20 ++++++++++++++++++- 8 files changed, 39 insertions(+), 10 deletions(-) diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AbstractAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AbstractAnnotationProcessor.java index 9da21fb2c4..535babcd4a 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AbstractAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AbstractAnnotationProcessor.java @@ -39,6 +39,7 @@ public class AbstractAnnotationProcessor { protected static final Pattern CORE_PACKAGE_PATTERN = Pattern.compile("^io.siddhi.core."); protected static final Pattern PARAMETER_NAME_PATTERN = Pattern.compile("^[a-z][a-z0-9]*(\\.[a-z][a-z0-9]*)*$"); + protected static final String REPETITIVE_PARAMETER_NOTATION = "..."; protected static final Pattern CAMEL_CASE_PATTERN = Pattern.compile("^(([a-z][a-z0-9]+)([A-Z]{0,1}[a-z0-9]*)*)$"); protected String extensionClassFullName; @@ -92,7 +93,8 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat if (parameterName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter -> " + "name annotated in class {0} is null or empty.", extensionClassFullName)); - } else if (!PARAMETER_NAME_PATTERN.matcher(parameterName).find()) { + } else if (!(PARAMETER_NAME_PATTERN.matcher(parameterName).find() || + REPETITIVE_PARAMETER_NOTATION.equals(parameterName))) { //Check if the @Parameter name is in a correct format 'abc.def.ghi' using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter -> " + "name {0} annotated in class {1} is not in proper format 'abc.def.ghi'.", @@ -144,13 +146,15 @@ public void parameterOverloadValidation(ParameterOverload[] parameterOverloads, throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ParameterOverload -> parameterNames annotated in class {0} is null or empty.", extensionClassFullName)); - } else if (!PARAMETER_NAME_PATTERN.matcher(overloadParameterName).find()) { + } else if (!(PARAMETER_NAME_PATTERN.matcher(overloadParameterName).find() || + REPETITIVE_PARAMETER_NOTATION.equals(overloadParameterName))) { //Check if the @Parameter name is in a correct format 'abc.def.ghi' using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ParameterOverload -> parameterNames {0} annotated in class {1} is not " + "in proper format 'abc.def.ghi'.", overloadParameterName, extensionClassFullName)); } - if (!parameterMap.containsKey(overloadParameterName)) { + if (!(parameterMap.containsKey(overloadParameterName) || + REPETITIVE_PARAMETER_NOTATION.equals(overloadParameterName))) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ParameterOverload -> parameterNames {0} annotated in class {1} is not defined in " + "@Extension -> @Parameter.", overloadParameterName, extensionClassFullName)); diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AggregationAttributeValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AggregationAttributeValidationAnnotationProcessor.java index 06945e413a..ee0424fce5 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AggregationAttributeValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/AggregationAttributeValidationAnnotationProcessor.java @@ -39,7 +39,8 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat if (parameterName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "-> name annotated in class {0} is null or empty.", extensionClassFullName)); - } else if (!PARAMETER_NAME_PATTERN.matcher(parameterName).find()) { + } else if (!(PARAMETER_NAME_PATTERN.matcher(parameterName).find() || + REPETITIVE_PARAMETER_NOTATION.equals(parameterName))) { //Check if the @Parameter name is in a correct format 'abc.def.ghi' using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "-> name:{0} annotated in class {1} is not in proper format ''abc.def.ghi''.", diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/FunctionExecutorValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/FunctionExecutorValidationAnnotationProcessor.java index 10effa7b12..ca2a12aeb7 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/FunctionExecutorValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/FunctionExecutorValidationAnnotationProcessor.java @@ -39,7 +39,9 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat if (parameterName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "-> name annotated in class {0} is null or empty.", extensionClassFullName)); - } else if (!PARAMETER_NAME_PATTERN.matcher(parameterName).find()) { + } else if (!(PARAMETER_NAME_PATTERN.matcher(parameterName).find() || + REPETITIVE_PARAMETER_NOTATION.equals(parameterName))) { + //Check if the @Parameter name is in a correct format 'abc.def.ghi' using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "-> name:{0} annotated in class {1} is not in proper format ''abc.def.ghi''.", diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/IncrementalAggregationAttributeValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/IncrementalAggregationAttributeValidationAnnotationProcessor.java index 9841c80ff5..a4f8aa7c9b 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/IncrementalAggregationAttributeValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/IncrementalAggregationAttributeValidationAnnotationProcessor.java @@ -40,7 +40,8 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat if (parameterName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "-> name annotated in class {0} is null or empty.", extensionClassFullName)); - } else if (!PARAMETER_NAME_PATTERN.matcher(parameterName).find()) { + } else if (!(PARAMETER_NAME_PATTERN.matcher(parameterName).find() || + REPETITIVE_PARAMETER_NOTATION.equals(parameterName))) { //Check if the @Parameter name is in a correct format 'abc.def.ghi' using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "-> name:{0} annotated in class {1} is not in proper format ''abc.def.ghi''.", diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamFunctionProcessorValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamFunctionProcessorValidationAnnotationProcessor.java index 2d2b4eedfa..0891f257c7 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamFunctionProcessorValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamFunctionProcessorValidationAnnotationProcessor.java @@ -39,7 +39,8 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat if (parameterName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name annotated in class {0} is null or empty.", extensionClassFullName)); - } else if (!PARAMETER_NAME_PATTERN.matcher(parameterName).find()) { + } else if (!(PARAMETER_NAME_PATTERN.matcher(parameterName).find() || + REPETITIVE_PARAMETER_NOTATION.equals(parameterName))) { //Check if the @Parameter name is in a correct format 'abc.def.ghi' using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name:{0} annotated in class {1} is not in proper format ''abc.def.ghi''.", diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamProcessorValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamProcessorValidationAnnotationProcessor.java index 8e314082cc..0e0f34e20f 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamProcessorValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/StreamProcessorValidationAnnotationProcessor.java @@ -39,7 +39,8 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat if (parameterName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name annotated in class {0} is null or empty.", extensionClassFullName)); - } else if (!PARAMETER_NAME_PATTERN.matcher(parameterName).find()) { + } else if (!(PARAMETER_NAME_PATTERN.matcher(parameterName).find() || + REPETITIVE_PARAMETER_NOTATION.equals(parameterName))) { //Check if the @Parameter name is in a correct format 'abc.def.ghi' using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name:{0} annotated in class {1} is not in proper format ''abc.def.ghi''.", diff --git a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/WindowProcessorValidationAnnotationProcessor.java b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/WindowProcessorValidationAnnotationProcessor.java index 45100bafff..73a7769d88 100644 --- a/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/WindowProcessorValidationAnnotationProcessor.java +++ b/modules/siddhi-annotations/src/main/java/io/siddhi/annotation/processor/WindowProcessorValidationAnnotationProcessor.java @@ -39,7 +39,8 @@ public void parameterValidation(Parameter[] parameters) throws AnnotationValidat if (parameterName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name annotated in class {0} is null or empty.", extensionClassFullName)); - } else if (!PARAMETER_NAME_PATTERN.matcher(parameterName).find()) { + } else if (!(PARAMETER_NAME_PATTERN.matcher(parameterName).find() || + REPETITIVE_PARAMETER_NOTATION.equals(parameterName))) { //Check if the @Parameter name is in a correct format 'abc.def.ghi' using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name:{0} annotated in class {1} is not in proper format ''abc.def.ghi''.", diff --git a/modules/siddhi-doc-gen/src/main/java/io/siddhi/doc/gen/core/utils/DocumentationUtils.java b/modules/siddhi-doc-gen/src/main/java/io/siddhi/doc/gen/core/utils/DocumentationUtils.java index c8825c3863..cb89a24ee5 100644 --- a/modules/siddhi-doc-gen/src/main/java/io/siddhi/doc/gen/core/utils/DocumentationUtils.java +++ b/modules/siddhi-doc-gen/src/main/java/io/siddhi/doc/gen/core/utils/DocumentationUtils.java @@ -28,6 +28,7 @@ import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.SystemParameter; +import io.siddhi.core.util.SiddhiConstants; import io.siddhi.doc.gen.core.freemarker.FormatDescriptionMethod; import io.siddhi.doc.gen.extensions.ExtensionDocCache; import io.siddhi.doc.gen.extensions.ExtensionDocRetriever; @@ -681,7 +682,24 @@ private static void addExtensionMetaDataIntoNamespaceList(List Date: Fri, 28 Jun 2019 07:46:34 +0530 Subject: [PATCH 4/8] Fix compatibility issues in test cases due to annotation changes --- .../function/CoalesceFunctionExecutor.java | 4 +- .../function/MaximumFunctionExecutor.java | 2 +- .../function/MinimumFunctionExecutor.java | 2 +- .../processor/stream/LogStreamProcessor.java | 1 + .../Pol2CartStreamFunctionProcessor.java | 7 +- .../stream/window/BatchWindowProcessor.java | 1 + .../ExternalTimeBatchWindowProcessor.java | 14 +++- .../window/ExternalTimeWindowProcessor.java | 3 +- .../window/FrequentWindowProcessor.java | 2 + .../window/LossyFrequentWindowProcessor.java | 1 + .../stream/window/SessionWindowProcessor.java | 2 +- .../stream/window/SortWindowProcessor.java | 4 +- .../io/siddhi/core/table/InMemoryTable.java | 2 +- .../io/siddhi/core/util/SiddhiConstants.java | 2 + .../validator/InputParameterValidator.java | 43 +++++++++- .../aggregation/Aggregation2TestCase.java | 40 ---------- .../core/managment/PersistenceTestCase.java | 2 +- .../MaxAggregatorExtensionTestCase.java | 80 ------------------- ...MaxForeverAggregatorExtensionTestCase.java | 38 --------- ...MinForeverAggregatorExtensionTestCase.java | 37 --------- .../query/partition/PartitionTestCase1.java | 2 +- .../SnapshotOutputRateLimitTestCase.java | 2 +- .../TimeOutputRateLimitTestCase.java | 6 +- ...evAttributeAggregatorExecutorTestCase.java | 36 --------- .../core/query/sequence/SequenceTestCase.java | 2 +- .../ExternalTimeBatchWindowTestCase.java | 4 +- .../window/LengthBatchWindowTestCase.java | 10 +-- .../query/window/LengthWindowTestCase.java | 8 +- .../core/window/DelayWindowTestCase.java | 8 +- .../ExternalTimeBatchWindowTestCase.java | 4 +- .../core/window/SessionWindowTestCase.java | 35 ++++---- 31 files changed, 114 insertions(+), 290 deletions(-) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java index dccf0b53bc..456b37a996 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/CoalesceFunctionExecutor.java @@ -40,7 +40,7 @@ description = "Returns the value of the first input parameter that is not null, " + "and all input parameters have to be on the same type.", parameters = { - @Parameter(name = "args", + @Parameter(name = "arg", description = "This function accepts one or more parameters. " + "They can belong to any one of the available types." + " All the specified parameters should be of the same type.", @@ -49,7 +49,7 @@ dynamic = true) }, parameterOverloads = { - @ParameterOverload(parameterNames = {"args"}) + @ParameterOverload(parameterNames = {"arg", "..."}) }, returnAttributes = @ReturnAttribute( description = "This will be the same as the type of the first input parameter.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java index 77cdf75ce0..bbccc87ecf 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MaximumFunctionExecutor.java @@ -48,7 +48,7 @@ dynamic = true) }, parameterOverloads = { - @ParameterOverload(parameterNames = {"arg"}) + @ParameterOverload(parameterNames = {"arg", "..."}) }, returnAttributes = @ReturnAttribute( description = "This will be the same as the type of the first input parameter.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java index 4aa908cb52..c30e59f60b 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/executor/function/MinimumFunctionExecutor.java @@ -49,7 +49,7 @@ dynamic = true) }, parameterOverloads = { - @ParameterOverload(parameterNames = {"arg"}) + @ParameterOverload(parameterNames = {"arg", "..."}) }, returnAttributes = @ReturnAttribute( description = "This will be the same as the type of the first input parameter.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/LogStreamProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/LogStreamProcessor.java index 2ea1048d8f..7bffb9dcc4 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/LogStreamProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/LogStreamProcessor.java @@ -62,6 +62,7 @@ @Parameter(name = "log.message", description = "This message will be logged.", defaultValue = " :", optional = true, + dynamic = true, type = {DataType.STRING}), @Parameter(name = "is.event.logged", description = "To log the processed event.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java index 4e7701d85d..287126002f 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java @@ -45,14 +45,17 @@ parameters = { @Parameter(name = "theta", description = "The theta value of the coordinates.", - type = {DataType.DOUBLE}), + type = {DataType.DOUBLE}, + dynamic = true), @Parameter(name = "rho", description = "The rho value of the coordinates.", - type = {DataType.DOUBLE}), + type = {DataType.DOUBLE}, + dynamic = true), @Parameter(name = "z", description = "z value of the cartesian coordinates.", type = {DataType.DOUBLE}, optional = true, + dynamic = true, defaultValue = "If z value is not given, drop the third parameter of the output.") }, parameterOverloads = { diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/BatchWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/BatchWindowProcessor.java index 0b82196701..c3d46581d0 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/BatchWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/BatchWindowProcessor.java @@ -72,6 +72,7 @@ ), }, parameterOverloads = { + @ParameterOverload(), @ParameterOverload(parameterNames = {"window.length"}) }, examples = { diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java index 1982ada818..5134b93f2d 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeBatchWindowProcessor.java @@ -65,7 +65,8 @@ @Parameter(name = "timestamp", description = "The time which the window determines as current time and will act upon. " + "The value of this parameter should be monotonically increasing.", - type = {DataType.LONG}), + type = {DataType.LONG}, + dynamic = true), @Parameter(name = "window.time", description = "The batch time period for which the window should hold events.", type = {DataType.INT, DataType.LONG, DataType.TIME}), @@ -76,18 +77,27 @@ "startTime.", type = {DataType.INT, DataType.LONG, DataType.TIME}, optional = true, + dynamic = true, defaultValue = "Timestamp of first event"), @Parameter(name = "timeout", description = "Time to wait for arrival of new event, before flushing " + "and giving output for events belonging to a specific batch.", type = {DataType.INT, DataType.LONG, DataType.TIME}, optional = true, + defaultValue = "System waits till an event from next batch arrives to flush current batch"), + @Parameter(name = "replace.with.batchtime", + description = "This indicates to replace the expired event timeStamp as the batch end " + + "timeStamp", + type = {DataType.BOOL}, + optional = true, defaultValue = "System waits till an event from next batch arrives to flush current batch") }, parameterOverloads = { @ParameterOverload(parameterNames = {"timestamp", "window.time"}), @ParameterOverload(parameterNames = {"timestamp", "window.time", "start.time"}), - @ParameterOverload(parameterNames = {"timestamp", "window.time", "start.time", "timeout"}) + @ParameterOverload(parameterNames = {"timestamp", "window.time", "start.time", "timeout"}), + @ParameterOverload(parameterNames = {"timestamp", "window.time", "start.time", "timeout", + "replace.with.batchtime"}) }, examples = { @Example( diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeWindowProcessor.java index 54f867d76d..bc017e1de8 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExternalTimeWindowProcessor.java @@ -64,7 +64,8 @@ @Parameter(name = "timestamp", description = "The time which the window determines as current time and will act upon. " + "The value of this parameter should be monotonically increasing.", - type = {DataType.LONG}), + type = {DataType.LONG}, + dynamic = true), @Parameter(name = "window.time", description = "The sliding time period for which the window should hold events.", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FrequentWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FrequentWindowProcessor.java index ae47a646e8..65812829ca 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FrequentWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/FrequentWindowProcessor.java @@ -67,9 +67,11 @@ "the concatenation of all the attributes of the event is considered.", type = {DataType.STRING}, optional = true, + dynamic = true, defaultValue = "The concatenation of all the attributes of the event is considered.") }, parameterOverloads = { + @ParameterOverload(parameterNames = {"event.count"}), @ParameterOverload(parameterNames = {"event.count", "attribute"}) }, examples = { diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LossyFrequentWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LossyFrequentWindowProcessor.java index 14087ae313..b08647a988 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LossyFrequentWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LossyFrequentWindowProcessor.java @@ -69,6 +69,7 @@ "the concatenation of all the attributes of the event is considered.", type = {DataType.STRING}, optional = true, + dynamic = true, defaultValue = "The concatenation of all the attributes of the event is considered.") }, parameterOverloads = { diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java index 9a2a8dca3a..babb39c793 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java @@ -79,7 +79,7 @@ type = {DataType.INT, DataType.LONG, DataType.TIME}), @Parameter(name = "window.key", description = "The grouping attribute for events.", - type = {DataType.STRING}, optional = true, defaultValue = "default-key"), + type = {DataType.STRING}, optional = true, defaultValue = "default-key", dynamic = true), @Parameter(name = "window.allowed.latency", description = "This specifies the time period for which the session window is valid after " + "the expiration of the session. The time period specified here should be less than " + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java index 3939b59345..b45dc390af 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java @@ -72,8 +72,10 @@ type = {DataType.INT}), @Parameter(name = "attribute", description = "The attribute that should be checked for the order.", - type = {DataType.STRING}, + type = {DataType.STRING, DataType.DOUBLE, DataType.INT, DataType.LONG, DataType.FLOAT, + DataType.LONG}, optional = true, + dynamic = true, defaultValue = "The concatenation of all the attributes of the event is considered."), @Parameter(name = "order", description = "The order define as \"asc\" or \"desc\".", diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/table/InMemoryTable.java b/modules/siddhi-core/src/main/java/io/siddhi/core/table/InMemoryTable.java index acfd7b8004..601f7470dc 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/table/InMemoryTable.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/table/InMemoryTable.java @@ -132,7 +132,7 @@ public void updateOrAdd(ComplexEventChunk updateOrAddingEventChunk, state.eventHolder, (InMemoryCompiledUpdateSet) compiledUpdateSet, addingStreamEventExtractor); - if (failedEvents.getFirst() != null) { + if (failedEvents != null && failedEvents.getFirst() != null) { state.eventHolder.add(failedEvents); } } finally { diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/util/SiddhiConstants.java b/modules/siddhi-core/src/main/java/io/siddhi/core/util/SiddhiConstants.java index 7f4b100031..c9389dd8d5 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/util/SiddhiConstants.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/util/SiddhiConstants.java @@ -133,4 +133,6 @@ public final class SiddhiConstants { public static final String AGG_EXTERNAL_TIMESTAMP_COL = "AGG_EVENT_TIMESTAMP"; public static final String AGG_LAST_TIMESTAMP_COL = "AGG_LAST_EVENT_TIMESTAMP"; public static final String AGG_SHARD_ID_COL = "SHARD_ID"; + + public static final String REPETITIVE_PARAMETER_NOTATION = "..."; } diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/util/extension/validator/InputParameterValidator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/util/extension/validator/InputParameterValidator.java index aed743b647..243ac16908 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/util/extension/validator/InputParameterValidator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/util/extension/validator/InputParameterValidator.java @@ -33,6 +33,8 @@ import java.util.List; import java.util.Map; +import static io.siddhi.core.util.SiddhiConstants.REPETITIVE_PARAMETER_NOTATION; + /** * Validates the extension specific parameters of siddhi App with the patterns specified in the * {@literal @}ParameterOverload annotation in the extension class @@ -74,7 +76,10 @@ public static void validateExpressionExecutors(Object objectHavingAnnotation, ParameterOverload parameterOverload = null; for (ParameterOverload aParameterOverload : parameterOverloads) { String[] overloadParameterNames = aParameterOverload.parameterNames(); - if (overloadParameterNames.length == attributeExpressionExecutors.length) { + if (overloadParameterNames.length == attributeExpressionExecutors.length && + ((overloadParameterNames.length == 0) || (overloadParameterNames.length > 0) + && !(overloadParameterNames[overloadParameterNames.length - 1]. + equals(REPETITIVE_PARAMETER_NOTATION)))) { boolean isExpectedParameterOverload = true; for (int i = 0; i < overloadParameterNames.length; i++) { String overloadParameterName = overloadParameterNames[i]; @@ -96,6 +101,37 @@ public static void validateExpressionExecutors(Object objectHavingAnnotation, parameterOverload = aParameterOverload; break; } + } else if (overloadParameterNames.length > 0 && + overloadParameterNames[overloadParameterNames.length - 1].equals(REPETITIVE_PARAMETER_NOTATION)) { + + Parameter previousParameter = null; + boolean isExpectedParameterOverload = true; + for (int i = 0; i < attributeExpressionExecutors.length; i++) { + Parameter parameter = null; + String overloadParameterName = null; + if (i < overloadParameterNames.length - 1) { + overloadParameterName = overloadParameterNames[i]; + } else { + overloadParameterName = overloadParameterNames[overloadParameterNames.length - 2]; + } + parameter = parameterMap.get(overloadParameterName); + boolean supportedReturnType = false; + for (DataType type : parameter.type()) { + if (attributeExpressionExecutors[i].getReturnType().toString(). + equalsIgnoreCase(type.toString())) { + supportedReturnType = true; + break; + } + } + if (!supportedReturnType) { + isExpectedParameterOverload = false; + break; + } + } + if (isExpectedParameterOverload) { + parameterOverload = aParameterOverload; + break; + } } } @@ -120,15 +156,14 @@ public static void validateExpressionExecutors(Object objectHavingAnnotation, for (int i = 0; i < overloadParameterNames.length; i++) { String overloadParameterName = overloadParameterNames[i]; Parameter parameter = parameterMap.get(overloadParameterName); - if (!parameter.dynamic() && !(attributeExpressionExecutors[i] - instanceof ConstantExpressionExecutor)) { + if (parameter != null && !parameter.dynamic() && + !(attributeExpressionExecutors[i] instanceof ConstantExpressionExecutor)) { throw new SiddhiAppValidationException("The '" + key + "' expects input parameter '" + parameter.name() + "' at position '" + i + "' to be static," + " but found a dynamic attribute."); } } } - } } diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/aggregation/Aggregation2TestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/aggregation/Aggregation2TestCase.java index 692517c8d1..28c3cafc50 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/aggregation/Aggregation2TestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/aggregation/Aggregation2TestCase.java @@ -665,46 +665,6 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { } - @Test - public void avgAggregatorTest60() throws InterruptedException { - - LOG.info("avgAggregator Test 60"); - - SiddhiManager siddhiManager = new SiddhiManager(); - - String execPlan = "" + - "@app:name('avgAggregatorTests') " + - "" + - "define stream cseEventStream (weight string, deviceId string);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream#window.length(5) " + - "select avg(weight) as avgWeight " + - "insert into outputStream;"; - - SiddhiAppRuntime execPlanRunTime = siddhiManager.createSiddhiAppRuntime(execPlan); - execPlanRunTime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - - EventPrinter.print(timestamp, inEvents, removeEvents); - AssertJUnit.assertEquals(26, inEvents[0].getData()[0]); - } - }); - - InputHandler inputHandler = execPlanRunTime.getInputHandler("cseEventStream"); - - execPlanRunTime.start(); - inputHandler.send(new Object[]{"20", "Box1"}); - inputHandler.send(new Object[]{"30", "Box2"}); - inputHandler.send(new Object[]{"20", "Box3"}); - inputHandler.send(new Object[]{"40", "Box4"}); - inputHandler.send(new Object[]{"20", "Box5"}); - Thread.sleep(100); - execPlanRunTime.shutdown(); - - } - @Test(dependsOnMethods = {"incrementalStreamProcessorTest56"}) public void incrementalStreamProcessorTest57() throws InterruptedException { LOG.info("Check interrupted exception being thrown when SiddhiRuntime has already been shutdown"); diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/managment/PersistenceTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/managment/PersistenceTestCase.java index 3761bb1ecb..91b74a2d12 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/managment/PersistenceTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/managment/PersistenceTestCase.java @@ -972,7 +972,7 @@ public void persistenceTest12() throws InterruptedException { "partition with ( deviceID of TempInternalStream )\n" + "begin\n" + "from TempInternalStream\n" + - "select deviceID, count(deviceID) as count\n" + + "select deviceID, count() as count\n" + "insert into DeviceTempStream\n" + "end;"; diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MaxAggregatorExtensionTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MaxAggregatorExtensionTestCase.java index fc36bd7751..e9e7d423ae 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MaxAggregatorExtensionTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MaxAggregatorExtensionTestCase.java @@ -101,46 +101,6 @@ public void receive(Event[] events) { } - @Test - public void maxAttributeAggregatorTest1() throws InterruptedException { - - log.info("maxAttributeAggregator Test #1"); - - SiddhiManager siddhiManager = new SiddhiManager(); - - String execPlan = "" + - "@app:name('minAttributeAggregatorTests') " + - "" + - "define stream cseEventStream (weight string, deviceId string);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream#window.lengthBatch(5) " + - "select max(weight) as max " + - "insert into outputStream;"; - - SiddhiAppRuntime execPlanRunTime = siddhiManager.createSiddhiAppRuntime(execPlan); - execPlanRunTime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - - EventPrinter.print(timestamp, inEvents, removeEvents); - AssertJUnit.assertEquals(50, inEvents[0].getData()[0]); - } - }); - - InputHandler inputHandler = execPlanRunTime.getInputHandler("cseEventStream"); - - execPlanRunTime.start(); - inputHandler.send(new Object[]{"20", "Box1"}); - inputHandler.send(new Object[]{"30", "Box2"}); - inputHandler.send(new Object[]{"10", "Box3"}); - inputHandler.send(new Object[]{"40", "Box4"}); - inputHandler.send(new Object[]{"50", "Box5"}); - Thread.sleep(100); - execPlanRunTime.shutdown(); - - } - @Test(expectedExceptions = SiddhiAppCreationException.class) public void maxAttributeAggregatorTest2() throws InterruptedException { @@ -180,46 +140,6 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { execPlanRunTime.shutdown(); } - @Test - public void minAttributeAggregatorTest1() throws InterruptedException { - - log.info("minAttributeAggregator Test #1"); - - SiddhiManager siddhiManager = new SiddhiManager(); - - String execPlan = "" + - "@app:name('minAttributeAggregatorTests') " + - "" + - "define stream cseEventStream (weight string, deviceId string);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream#window.lengthBatch(5) " + - "select min(weight) as max " + - "insert into outputStream;"; - - SiddhiAppRuntime execPlanRunTime = siddhiManager.createSiddhiAppRuntime(execPlan); - execPlanRunTime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - - EventPrinter.print(timestamp, inEvents, removeEvents); - AssertJUnit.assertEquals(10, inEvents[0].getData()[0]); - } - }); - - InputHandler inputHandler = execPlanRunTime.getInputHandler("cseEventStream"); - - execPlanRunTime.start(); - inputHandler.send(new Object[]{"20", "Box1"}); - inputHandler.send(new Object[]{"30", "Box2"}); - inputHandler.send(new Object[]{"10", "Box3"}); - inputHandler.send(new Object[]{"40", "Box4"}); - inputHandler.send(new Object[]{"50", "Box5"}); - Thread.sleep(100); - execPlanRunTime.shutdown(); - - } - @Test(expectedExceptions = SiddhiAppCreationException.class) public void minAttributeAggregatorTest2() throws InterruptedException { diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MaxForeverAggregatorExtensionTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MaxForeverAggregatorExtensionTestCase.java index 9ca4f89347..4227137f82 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MaxForeverAggregatorExtensionTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MaxForeverAggregatorExtensionTestCase.java @@ -290,44 +290,6 @@ public void testMaxForeverAggregatorExtension5() throws InterruptedException { query); } - @Test - public void maxForeverAttributeAggregatorTest6() throws InterruptedException { - - log.info("maxForeverAttributeAggregator Test 6"); - - SiddhiManager siddhiManager = new SiddhiManager(); - - String execPlan = "" + - "@app:name('MaxForeverAttributeAggregatorTests') " + - "" + - "define stream cseEventStream (price1 string, price2 string, price3 string);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream " + - "select maxForever(price1) as max " + - "insert into outputStream;"; - - SiddhiAppRuntime execPlanRunTime = siddhiManager.createSiddhiAppRuntime(execPlan); - execPlanRunTime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - - EventPrinter.print(timestamp, inEvents, removeEvents); - AssertJUnit.assertEquals(20, inEvents[0].getData()[0]); - AssertJUnit.assertEquals(30.00, inEvents[1].getData()[0]); - } - }); - - InputHandler inputHandler = execPlanRunTime.getInputHandler("cseEventStream"); - - execPlanRunTime.start(); - inputHandler.send(new Object[]{"20", "20", "20"}); - inputHandler.send(new Object[]{"30.00", "30.88", "20"}); - Thread.sleep(100); - execPlanRunTime.shutdown(); - - } - @Test public void maxForeverAttributeAggregatorTest7() throws InterruptedException { diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MinForeverAggregatorExtensionTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MinForeverAggregatorExtensionTestCase.java index 83ea39ed49..911460dce3 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MinForeverAggregatorExtensionTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/aggregator/MinForeverAggregatorExtensionTestCase.java @@ -289,43 +289,6 @@ public void testMinForeverAggregatorExtension5() throws InterruptedException { query); } - @Test - public void minForeverAttributeAggregatorTest6() throws InterruptedException { - - log.info("minForeverAttributeAggregator Test 6"); - - SiddhiManager siddhiManager = new SiddhiManager(); - - String execPlan = "" + - "@app:name('MinForeverAttributeAggregatorTests') " + - "" + - "define stream cseEventStream (price1 string, price2 string, price3 string);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream " + - "select minForever(price1) as max " + - "insert into outputStream;"; - - SiddhiAppRuntime execPlanRunTime = siddhiManager.createSiddhiAppRuntime(execPlan); - execPlanRunTime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - - EventPrinter.print(timestamp, inEvents, removeEvents); - AssertJUnit.assertEquals(20, inEvents[0].getData()[0]); - } - }); - - InputHandler inputHandler = execPlanRunTime.getInputHandler("cseEventStream"); - - execPlanRunTime.start(); - inputHandler.send(new Object[]{"20", "20.0", "20.0"}); - inputHandler.send(new Object[]{"30", "35.0", "25.0"}); - Thread.sleep(100); - execPlanRunTime.shutdown(); - - } - @Test public void minForeverAttributeAggregatorTest7() throws InterruptedException { diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/partition/PartitionTestCase1.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/partition/PartitionTestCase1.java index 3d10dd417f..582e86459a 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/partition/PartitionTestCase1.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/partition/PartitionTestCase1.java @@ -778,7 +778,7 @@ public void testPartitionQuery11() throws InterruptedException { + "define stream cseEventStream1 (symbol string, price float,volume int);" + "partition with (symbol of cseEventStream)" + "begin" - + "@info(name = 'query') from cseEventStream select count(symbol) as entries insert into " + + + "@info(name = 'query') from cseEventStream select count() as entries insert into " + "OutStockStream ;" + "end "; diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/SnapshotOutputRateLimitTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/SnapshotOutputRateLimitTestCase.java index ee6850b19a..ce8361939d 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/SnapshotOutputRateLimitTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/SnapshotOutputRateLimitTestCase.java @@ -357,7 +357,7 @@ public void testSnapshotOutputRateLimitQuery5_1() throws InterruptedException { "" + "@info(name = 'query1') " + "from LoginEvents#window.time(2 sec) " + - "select ip, count(calls) as totalCalls " + + "select ip, count() as totalCalls " + "group by ip " + "output snapshot every 1 sec " + "insert all events into uniqueIps ;"; diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/TimeOutputRateLimitTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/TimeOutputRateLimitTestCase.java index fcce8c00f9..938ab7c08d 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/TimeOutputRateLimitTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/TimeOutputRateLimitTestCase.java @@ -587,7 +587,7 @@ public void testTimeOutputRateLimitQuery10() throws InterruptedException { "" + "@info(name = 'query1') " + "from LoginEvents#window.lengthBatch(2) " + - "select ip, count(*) as total " + + "select ip, count() as total " + "group by ip " + "output first every 1 sec " + "insert expired events into uniqueIps ;"; @@ -646,7 +646,7 @@ public void testTimeOutputRateLimitQuery11() throws InterruptedException { "" + "@info(name = 'query1') " + "from LoginEvents#window.lengthBatch(2) " + - "select ip, count(*) as total " + + "select ip, count() as total " + "group by ip " + "output first every 1 sec " + "insert all events into uniqueIps ;"; @@ -707,7 +707,7 @@ public void testTimeOutputRateLimitQuery12() throws InterruptedException { "" + "@info(name = 'query1') " + "from LoginEvents#window.lengthBatch(2) " + - "select ip, count(*) as total " + + "select ip, count() as total " + "group by ip " + "output last every 1 sec " + "insert all events into uniqueIps ;"; diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutorTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutorTestCase.java index 21300adc0d..0d40111d0c 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutorTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/selector/attribute/aggregator/StdDevAttributeAggregatorExecutorTestCase.java @@ -285,42 +285,6 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { execPlanRunTime.shutdown(); } - @Test - public void stdDevAggregatorTest7() throws InterruptedException { - - log.info("stdDevAggregator Test #7"); - - SiddhiManager siddhiManager = new SiddhiManager(); - - String execPlan = "" + - "@app:name('stdDevAggregatorTests') " + - "" + - "define stream cseEventStream (symbol string, price string);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream#window.lengthBatch(1) " + - "select stdDev(price) as deviation " + - "group by symbol " + - "insert into outputStream;"; - - SiddhiAppRuntime execPlanRunTime = siddhiManager.createSiddhiAppRuntime(execPlan); - execPlanRunTime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - - EventPrinter.print(timestamp, inEvents, removeEvents); - AssertJUnit.assertTrue(Math.abs((Double) inEvents[0].getData(0) - 0) < epsilon); - } - }); - - InputHandler inputHandler = execPlanRunTime.getInputHandler("cseEventStream"); - - execPlanRunTime.start(); - inputHandler.send(new Object[]{"WSO2", "1345"}); - Thread.sleep(100); - execPlanRunTime.shutdown(); - } - @Test(expectedExceptions = SiddhiAppCreationException.class) public void stdDevAggregatorTest8() throws InterruptedException { diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/sequence/SequenceTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/sequence/SequenceTestCase.java index ecaa83304e..9129fd9499 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/sequence/SequenceTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/sequence/SequenceTestCase.java @@ -2094,7 +2094,7 @@ public void testTimeBatchAndSequence() throws Exception { String query = "" + "@info(name = 'query1') " + "from received_reclamations#window.timeBatch(1 sec) " + - "select product_id, defect_category, count(product_id) as num " + + "select product_id, defect_category, count() as num " + "group by product_id, defect_category " + "insert into reclamation_averages;" + "" + diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/ExternalTimeBatchWindowTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/ExternalTimeBatchWindowTestCase.java index 636c1fc08a..8377daaac9 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/ExternalTimeBatchWindowTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/ExternalTimeBatchWindowTestCase.java @@ -94,7 +94,7 @@ private SiddhiAppRuntime simpleQueryRuntime() { String query = "define stream jmxMetric(cpu int, timestamp long); " + "@info(name='query')" + "from jmxMetric#window.externalTimeBatch(timestamp, 10 sec) " - + "select avg(cpu) as avgCpu, count(1) as count insert into tmp;"; + + "select avg(cpu) as avgCpu, count() as count insert into tmp;"; return siddhiManager.createSiddhiAppRuntime(query); } @@ -174,7 +174,7 @@ public void test01DownSampling() throws Exception { + " '|' as s3, " + " timestamp as timeWindowEnds, " + " '|' as s4, " - + " count(1) as metric_count " + + " count() as metric_count " + " INSERT INTO tmp;"; SiddhiManager sm = new SiddhiManager(); diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthBatchWindowTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthBatchWindowTestCase.java index 5835463edf..a342686fe5 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthBatchWindowTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthBatchWindowTestCase.java @@ -543,7 +543,7 @@ public void lengthBatchWindowTest11() throws InterruptedException { "" + "@info(name = 'query1') " + "from cseEventStream#window.lengthBatch(" + length + ", true) " + - "select symbol, price, count(volume) as volumes " + + "select symbol, price, count() as volumes " + "insert into outputStream ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); @@ -601,7 +601,7 @@ public void lengthBatchWindowTest12() throws InterruptedException { "" + "@info(name = 'query1') " + "from cseEventStream#window.lengthBatch(" + length + ", true) " + - "select symbol, price, count(volume) as volumes " + + "select symbol, price, count() as volumes " + "insert expired events into outputStream ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); @@ -753,7 +753,7 @@ public void lengthBatchWindowTest15() throws InterruptedException { "" + "@info(name = 'query1') " + "from cseEventStream#window.lengthBatch(" + length + ", true) " + - "select symbol, price, count(volume) as volumes " + + "select symbol, price, count() as volumes " + "insert all events into outputStream ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); @@ -809,7 +809,7 @@ public void lengthBatchWindowTest16() throws InterruptedException { "" + "@info(name = 'query1') " + "from cseEventStream#window.lengthBatch(" + length + ") " + - "select symbol, price, count(volume) as volumes " + + "select symbol, price, count() as volumes " + "insert all events into outputStream ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); @@ -865,7 +865,7 @@ public void lengthBatchWindowTest17() throws InterruptedException { "" + "@info(name = 'query1') " + "from cseEventStream#window.lengthBatch(" + length + ") " + - "select symbol, price, count(volume) as volumes " + + "select symbol, price, count() as volumes " + "insert all events into outputStream ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp); diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthWindowTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthWindowTestCase.java index 9ac368b10a..a1b9341fe1 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthWindowTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthWindowTestCase.java @@ -201,16 +201,16 @@ public void lengthWindowTest4() throws InterruptedException { "from cseEventStream#window.length(4) " + "select " + "max(price) as maxp, min(price) as minp, sum(price) as sump, avg(price) as avgp, " + - "stdDev(price) as stdp, count(price) as cp, distinctCount(price) as dcp," + + "stdDev(price) as stdp, count() as cp, distinctCount(price) as dcp," + "max(volume) as maxvolumep, min(volume) as minvolumep, sum(volume) as sumvolumep," + " avg(volume) as avgvolumep, " + - "stdDev(volume) as stdvolumep, count(volume) as cvolumep, distinctCount(volume) as dcvolumep," + + "stdDev(volume) as stdvolumep, count() as cvolumep, distinctCount(volume) as dcvolumep," + "max(price2) as maxprice2p, min(price2) as minprice2p, sum(price2) as sumprice2p," + " avg(price2) as avgprice2p, " + - "stdDev(price2) as stdprice2p, count(price2) as cpprice2, distinctCount(price2) as dcprice2p," + + "stdDev(price2) as stdprice2p, count() as cpprice2, distinctCount(price2) as dcprice2p," + "max(volume2) as maxvolume2p, min(volume2) as minvolume2p, sum(volume2) as sumvolume2p," + " avg(volume2) as avgvolume2p, " + - "stdDev(volume2) as stdvolume2p, count(volume2) as cvolume2p, distinctCount(volume2) as dcvolume2p" + + "stdDev(volume2) as stdvolume2p, count() as cvolume2p, distinctCount(volume2) as dcvolume2p" + " " + "insert all events into outputStream ;"; diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/window/DelayWindowTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/window/DelayWindowTestCase.java index 8b72964627..ca04918289 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/window/DelayWindowTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/window/DelayWindowTestCase.java @@ -84,8 +84,8 @@ public void delayWindowTest1() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(query); } catch (SiddhiAppCreationException e) { error = false; - AssertJUnit.assertEquals("Delay window should only have one parameter ( delayTime), " + - "but found 2 input attributes", e.getCause().getMessage()); + AssertJUnit.assertEquals("There is no parameterOverload for 'delay' that matches attribute types " + + "'[INT, INT]'.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { @@ -105,8 +105,8 @@ public void delayWindowTest2() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(query); } catch (SiddhiAppCreationException e) { error = false; - AssertJUnit.assertEquals("Delay window's parameter attribute should be either int or long, " + - "but found STRING", e.getCause().getMessage()); + AssertJUnit.assertEquals("There is no parameterOverload for 'delay' that matches attribute types " + + "'[STRING]'.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/window/ExternalTimeBatchWindowTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/window/ExternalTimeBatchWindowTestCase.java index e213487598..a0f49aa8ec 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/window/ExternalTimeBatchWindowTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/window/ExternalTimeBatchWindowTestCase.java @@ -886,7 +886,7 @@ public void testExternalTimeBatchWindow14() throws Exception { "" + "@info(name='query1') " + "from jmxMetricWindow " + - "select avg(cpu) as avgCpu, count(1) as count insert into tmp;"; + "select avg(cpu) as avgCpu, count() as count insert into tmp;"; SiddhiAppRuntime runtime = siddhiManager.createSiddhiAppRuntime(query); @@ -956,7 +956,7 @@ public void testExternalTimeBatchWindow15() throws Exception { + " '|' as s3, " + " timestamp as timeWindowEnds, " + " '|' as s4, " - + " count(1) as metric_count " + + " count() as metric_count " + " INSERT INTO tmp;"; SiddhiManager sm = new SiddhiManager(); diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/window/SessionWindowTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/window/SessionWindowTestCase.java index 66822036c7..0d9e350bce 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/window/SessionWindowTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/window/SessionWindowTestCase.java @@ -87,9 +87,8 @@ public void testSessionWindow1() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query); } catch (SiddhiAppCreationException e) { - AssertJUnit.assertEquals("Session window should only have one to three parameters " - + "( sessionGap, sessionKey, allowedLatency, " - + "but found 4 input attributes", e.getCause().getMessage()); + AssertJUnit.assertEquals("There is no parameterOverload for 'session' that matches attribute types " + + "'[LONG, STRING, LONG, INT]'.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { @@ -118,9 +117,8 @@ public void testSessionWindow2() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query); } catch (SiddhiAppCreationException e) { - AssertJUnit.assertEquals("Session window's 1st parameter, session gap should be a constant parameter" - + " attribute but found a dynamic attribute " + - "io.siddhi.core.executor.VariableExpressionExecutor", e.getCause().getMessage()); + AssertJUnit.assertEquals("The 'session' expects input parameter 'window.session' at position '0' " + + "to be static, but found a dynamic attribute.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { @@ -151,8 +149,8 @@ public void testSessionWindow3() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query); } catch (SiddhiAppCreationException e) { - AssertJUnit.assertEquals("Session window's session gap parameter should be either " - + "int or long, but found STRING", e.getCause().getMessage()); + AssertJUnit.assertEquals("There is no parameterOverload for 'session' that matches attribute types " + + "'[STRING, STRING, LONG]'.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { @@ -216,8 +214,8 @@ public void testSessionWindow5() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query); } catch (SiddhiAppCreationException e) { - AssertJUnit.assertEquals("Session window's session key parameter type " - + "should be string, but found INT", e.getCause().getMessage()); + AssertJUnit.assertEquals("There is no parameterOverload for 'session' that matches attribute types " + + "'[LONG, INT, LONG]'.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { @@ -248,9 +246,8 @@ public void testSessionWindow6() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query); } catch (SiddhiAppCreationException e) { - AssertJUnit.assertEquals("Session window's 3rd parameter, allowedLatency should be a " - + "constant parameter attribute but found a dynamic attribute " - + "io.siddhi.core.executor.VariableExpressionExecutor", e.getCause().getMessage()); + AssertJUnit.assertEquals("The 'session' expects input parameter 'window.allowed.latency' at position " + + "'2' to be static, but found a dynamic attribute.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { @@ -281,8 +278,8 @@ public void testSessionWindow7() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query); } catch (SiddhiAppCreationException e) { - AssertJUnit.assertEquals("Session window's allowedLatency parameter should be " - + "either int or long, but found STRING", e.getCause().getMessage()); + AssertJUnit.assertEquals("There is no parameterOverload for 'session' that matches attribute " + + "types '[LONG, STRING, STRING]'.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { @@ -314,8 +311,8 @@ public void testSessionWindow8() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query); } catch (SiddhiAppCreationException e) { - AssertJUnit.assertEquals("Session window's session key parameter type should be string, " - + "but found INT", e.getCause().getMessage()); + AssertJUnit.assertEquals("There is no parameterOverload for 'session' that matches attribute types" + + " '[LONG, INT]'.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { @@ -379,8 +376,8 @@ public void testSessionWindow10() { siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query); } catch (SiddhiAppCreationException e) { - AssertJUnit.assertEquals("Session window's allowedLatency parameter value should not be greater than " - + "the session gap parameter value", e.getCause().getMessage()); + AssertJUnit.assertEquals("There is no parameterOverload for 'session' that matches attribute types " + + "'[LONG, LONG]'.", e.getCause().getMessage()); throw e; } finally { if (siddhiAppRuntime != null) { From e804b278f5ca26ed8fb87531349db9430d37f54f Mon Sep 17 00:00:00 2001 From: mohan Date: Fri, 28 Jun 2019 09:16:32 +0530 Subject: [PATCH 5/8] Add minor syntax fixes for test cases --- .../TimeOutputRateLimitTestCase.java | 8 ++-- .../query/window/LengthWindowTestCase.java | 38 ------------------- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/TimeOutputRateLimitTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/TimeOutputRateLimitTestCase.java index 938ab7c08d..3684441efa 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/TimeOutputRateLimitTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/ratelimit/TimeOutputRateLimitTestCase.java @@ -768,7 +768,7 @@ public void testTimeOutputRateLimitQuery13() throws InterruptedException { "" + "@info(name = 'query1') " + "from LoginEvents#window.lengthBatch(2) " + - "select ip, count(*) as total " + + "select ip, count() as total " + "group by ip " + "output all every 1 sec " + "insert all events into uniqueIps ;"; @@ -885,7 +885,7 @@ public void testTimeOutputRateLimitQuery15() throws InterruptedException { "" + "@info(name = 'query1') " + "from LoginEvents " + - "select ip, count(*) as total " + + "select ip, count() as total " + "output first every 1 sec " + "insert all events into uniqueIps ;"; @@ -940,7 +940,7 @@ public void testTimeOutputRateLimitQuery16() throws InterruptedException { "" + "@info(name = 'query1') " + "from LoginEvents " + - "select ip, count(*) as total " + + "select ip, count() as total " + "group by ip " + "output first every 1 sec " + "insert all events into uniqueIps ;"; @@ -996,7 +996,7 @@ public void testTimeOutputRateLimitQuery17() throws InterruptedException { "" + "@info(name = 'query1') " + "from LoginEvents#window.lengthBatch(2) " + - "select ip, count(*) as total " + + "select ip, count() as total " + "group by ip " + "output first every 1 sec " + "insert into uniqueIps ;"; diff --git a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthWindowTestCase.java b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthWindowTestCase.java index 305edd8cbe..5efca8e660 100644 --- a/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthWindowTestCase.java +++ b/modules/siddhi-core/src/test/java/io/siddhi/core/query/window/LengthWindowTestCase.java @@ -387,42 +387,4 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { execPlanRunTime.shutdown(); } - - @Test - public void avgAggregatorTest60() throws InterruptedException { - - SiddhiManager siddhiManager = new SiddhiManager(); - - String execPlan = "" + - "@app:name('avgAggregatorTests') " + - "" + - "define stream cseEventStream (weight string, deviceId string);" + - "" + - "@info(name = 'query1') " + - "from cseEventStream#window.length(5) " + - "select avg(weight) as avgWeight " + - "insert into outputStream;"; - - SiddhiAppRuntime execPlanRunTime = siddhiManager.createSiddhiAppRuntime(execPlan); - execPlanRunTime.addCallback("query1", new QueryCallback() { - @Override - public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { - - EventPrinter.print(timestamp, inEvents, removeEvents); - AssertJUnit.assertEquals(26, inEvents[0].getData()[0]); - } - }); - - InputHandler inputHandler = execPlanRunTime.getInputHandler("cseEventStream"); - - execPlanRunTime.start(); - inputHandler.send(new Object[]{"20", "Box1"}); - inputHandler.send(new Object[]{"30", "Box2"}); - inputHandler.send(new Object[]{"20", "Box3"}); - inputHandler.send(new Object[]{"40", "Box4"}); - inputHandler.send(new Object[]{"20", "Box5"}); - Thread.sleep(100); - execPlanRunTime.shutdown(); - - } } From 3f2d38151be4a6febddf3a3242a1cab9f0669d6e Mon Sep 17 00:00:00 2001 From: mohan Date: Fri, 28 Jun 2019 09:53:55 +0530 Subject: [PATCH 6/8] Remove ParameterOverloads annotation for sort window --- .../processor/stream/window/SortWindowProcessor.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java index b45dc390af..00290f44bc 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java @@ -21,7 +21,6 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; -import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEventChunk; @@ -82,12 +81,7 @@ type = {DataType.STRING}, optional = true, defaultValue = "asc") - }, - parameterOverloads = { - @ParameterOverload(parameterNames = {"window.length", "attribute"}), - @ParameterOverload(parameterNames = {"window.length", "attribute", "order"}) - }, - examples = @Example( + }, examples = @Example( syntax = "define stream cseEventStream (symbol string, price float, volume long);\n" + "define window cseEventWindow (symbol string, price float, volume long) sort(2,volume, 'asc')" + ";\n@info(name = 'query0')\n" + From f64efce30640eb3bdabcdc7b0839a16273cb16f2 Mon Sep 17 00:00:00 2001 From: mohan Date: Fri, 28 Jun 2019 16:06:38 +0530 Subject: [PATCH 7/8] Add minor refactoring changes --- .../processor/stream/window/SortWindowProcessor.java | 9 ++++++++- .../extension/validator/InputParameterValidator.java | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java index 00290f44bc..4665f0225a 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SortWindowProcessor.java @@ -21,6 +21,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.util.DataType; import io.siddhi.core.config.SiddhiQueryContext; import io.siddhi.core.event.ComplexEventChunk; @@ -81,7 +82,13 @@ type = {DataType.STRING}, optional = true, defaultValue = "asc") - }, examples = @Example( + }, + parameterOverloads = { + @ParameterOverload(parameterNames = {"window.length", "attribute"}), + @ParameterOverload(parameterNames = {"window.length", "attribute", "order", "..."}), + @ParameterOverload(parameterNames = {"window.length", "attribute", "order", "attribute", "..."}) + }, + examples = @Example( syntax = "define stream cseEventStream (symbol string, price float, volume long);\n" + "define window cseEventWindow (symbol string, price float, volume long) sort(2,volume, 'asc')" + ";\n@info(name = 'query0')\n" + diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/util/extension/validator/InputParameterValidator.java b/modules/siddhi-core/src/main/java/io/siddhi/core/util/extension/validator/InputParameterValidator.java index 243ac16908..2213abe124 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/util/extension/validator/InputParameterValidator.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/util/extension/validator/InputParameterValidator.java @@ -103,8 +103,6 @@ public static void validateExpressionExecutors(Object objectHavingAnnotation, } } else if (overloadParameterNames.length > 0 && overloadParameterNames[overloadParameterNames.length - 1].equals(REPETITIVE_PARAMETER_NOTATION)) { - - Parameter previousParameter = null; boolean isExpectedParameterOverload = true; for (int i = 0; i < attributeExpressionExecutors.length; i++) { Parameter parameter = null; From d12e4820fc25186a54d3cc5137371d02f020d890 Mon Sep 17 00:00:00 2001 From: mohan Date: Fri, 28 Jun 2019 16:21:36 +0530 Subject: [PATCH 8/8] Fix the CountAttributeAggregator for backward compatibility --- .../CountAttributeAggregatorExecutor.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/CountAttributeAggregatorExecutor.java b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/CountAttributeAggregatorExecutor.java index f26d888b3a..3b209dcd36 100644 --- a/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/CountAttributeAggregatorExecutor.java +++ b/modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/CountAttributeAggregatorExecutor.java @@ -19,6 +19,7 @@ import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; import io.siddhi.annotation.ParameterOverload; import io.siddhi.annotation.ReturnAttribute; import io.siddhi.annotation.util.DataType; @@ -40,9 +41,18 @@ name = "count", namespace = "", description = "Returns the count of all the events.", - parameters = {}, + parameters = { + @Parameter(name = "arg", + description = "This function accepts one parameter. " + + "It can belong to any one of the available types.", + type = {DataType.INT, DataType.LONG, DataType.DOUBLE, DataType.FLOAT, + DataType.STRING, DataType.BOOL, DataType.OBJECT}, + dynamic = true, + optional = true) + }, parameterOverloads = { - @ParameterOverload() + @ParameterOverload(), + @ParameterOverload(parameterNames = {"arg"}) }, returnAttributes = @ReturnAttribute( description = "Returns the event count as a long.",