Initail check to see if there is any on condition
@@ -53,6 +53,7 @@ import io.siddhi.query.api.exception.SiddhiAppValidationException;
import io.siddhi.query.api.expression.AttributeFunction;
import io.siddhi.query.api.expression.Expression;
import io.siddhi.query.api.expression.condition.Compare;
+import io.siddhi.query.api.expression.constant.BoolConstant;
import java.util.ArrayList;
import java.util.HashMap;
@@ -355,6 +356,11 @@ public class AggregationRuntime implements MemoryCalculable {
// Create compile condition per each table used to persist aggregates.
// These compile conditions are used to check whether the aggregates in tables are within the given duration.
// Combine with and on condition for table query
+ boolean shouldApplyReducedCondition = false;
+ Expression reducedExpression = null;
+
+ //Check if there is no on conditions
+ if (!(expression instanceof BoolConstant)) {
AggregationExpressionBuilder aggregationExpressionBuilder = new AggregationExpressionBuilder(expression);
AggregationExpressionVisitor expressionVisitor = new AggregationExpressionVisitor(
metaStreamEventForTableLookups.getInputReferenceId(),
@@ -362,8 +368,9 @@ public class AggregationRuntime implements MemoryCalculable {
this.tableAttributesNameList
);
aggregationExpressionBuilder.build(expressionVisitor);
- boolean shouldApplyReducedCondition = expressionVisitor.applyReducedExpression();
- Expression reducedExpression = expressionVisitor.getReducedExpression();
+ shouldApplyReducedCondition = expressionVisitor.applyReducedExpression();
+ reducedExpression = expressionVisitor.getReducedExpression();
+ }
Expression withinExpressionTable;
if (shouldApplyReducedCondition) {
