From f64efce30640eb3bdabcdc7b0839a16273cb16f2 Mon Sep 17 00:00:00 2001 From: mohan Date: Fri, 28 Jun 2019 16:06:38 +0530 Subject: [PATCH] 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;