Define separate metaInfoHolder for the processors that come after ON condition.
@@ -89,6 +89,7 @@ public abstract class AbstractQueryableRecordTable extends AbstractRecordTable i
while (records.hasNext()) {
Object[] record = records.next();
StreamEvent streamEvent = storeEventPool.borrowEvent();
+ streamEvent.setOutputData(new Object[outputAttributes.length]);
System.arraycopy(record, 0, streamEvent.getOutputData(), 0, record.length);
streamEventComplexEventChunk.add(streamEvent);
}
@@ -133,18 +134,23 @@ public abstract class AbstractQueryableRecordTable extends AbstractRecordTable i
selectAttributeBuilders.add(new SelectAttributeBuilder(expressionBuilder, outputAttribute.getRename()));
}
+ MatchingMetaInfoHolder metaInfoHolderForGroupBy = new MatchingMetaInfoHolder(
+ matchingMetaInfoHolder.getMetaStateEvent(), matchingMetaInfoHolder.getMatchingStreamEventIndex(),
+ matchingMetaInfoHolder.getStoreEventIndex(), matchingMetaInfoHolder.getMatchingStreamDefinition(),
+ matchingMetaInfoHolder.getMatchingStreamDefinition(), matchingMetaInfoHolder.getCurrentState());
+
List<ExpressionBuilder> groupByExpressionBuilders = null;
if (selector.getGroupByList().size() != 0) {
groupByExpressionBuilders = new ArrayList<>(outputAttributes.size());
for (Variable variable : selector.getGroupByList()) {
- groupByExpressionBuilders.add(new ExpressionBuilder(variable, matchingMetaInfoHolder, siddhiAppContext,
- variableExpressionExecutors, tableMap, queryName));
+ groupByExpressionBuilders.add(new ExpressionBuilder(variable, metaInfoHolderForGroupBy,
+ siddhiAppContext, variableExpressionExecutors, tableMap, queryName));
}
}
ExpressionBuilder havingExpressionBuilder = null;
if (selector.getHavingExpression() != null) {
- havingExpressionBuilder = new ExpressionBuilder(selector.getHavingExpression(), matchingMetaInfoHolder,
+ havingExpressionBuilder = new ExpressionBuilder(selector.getHavingExpression(), metaInfoHolderForGroupBy,
siddhiAppContext, variableExpressionExecutors, tableMap, queryName);
}
@@ -153,7 +159,7 @@ public abstract class AbstractQueryableRecordTable extends AbstractRecordTable i
orderByAttributeBuilders = new ArrayList<>(selector.getOrderByList().size());
for (OrderByAttribute orderByAttribute : selector.getOrderByList()) {
ExpressionBuilder expressionBuilder = new ExpressionBuilder(orderByAttribute.getVariable(),
- matchingMetaInfoHolder, siddhiAppContext, variableExpressionExecutors,
+ metaInfoHolderForGroupBy, siddhiAppContext, variableExpressionExecutors,
tableMap, queryName);
orderByAttributeBuilders.add(new OrderByAttributeBuilder(expressionBuilder,
orderByAttribute.getOrder()));
@@ -164,7 +170,7 @@ public abstract class AbstractQueryableRecordTable extends AbstractRecordTable i
Long offset = null;
if (selector.getLimit() != null) {
ExpressionExecutor expressionExecutor = ExpressionParser.parseExpression((Expression) selector.getLimit(),
- matchingMetaInfoHolder.getMetaStateEvent(), SiddhiConstants.HAVING_STATE, tableMap,
+ metaInfoHolderForGroupBy.getMetaStateEvent(), SiddhiConstants.HAVING_STATE, tableMap,
variableExpressionExecutors, siddhiAppContext, false, 0, queryName);
limit = ((Number) (((ConstantExpressionExecutor) expressionExecutor).getValue())).longValue();
if (limit < 0) {
@@ -174,7 +180,7 @@ public abstract class AbstractQueryableRecordTable extends AbstractRecordTable i
}
if (selector.getOffset() != null) {
ExpressionExecutor expressionExecutor = ExpressionParser.parseExpression((Expression) selector.getOffset(),
- matchingMetaInfoHolder.getMetaStateEvent(), SiddhiConstants.HAVING_STATE, tableMap,
+ metaInfoHolderForGroupBy.getMetaStateEvent(), SiddhiConstants.HAVING_STATE, tableMap,
variableExpressionExecutors, siddhiAppContext, false, 0, queryName);
offset = ((Number) (((ConstantExpressionExecutor) expressionExecutor).getValue())).longValue();
if (offset < 0) {
