|
@@ -4764,7 +4764,11 @@ IHqlExpression * CExprFolderTransformer::doFoldTransformed(IHqlExpression * unfo
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if (!newRow || !newRow->isPure())
|
|
|
+ if (!newRow)
|
|
|
+ break;
|
|
|
+
|
|
|
+ //Instead of evaluating once newRow will be evaluated multiple times. Is that ok (e.g., volatile)
|
|
|
+ if (!canDuplicateActivity(newRow))
|
|
|
break;
|
|
|
|
|
|
OwnedHqlExpr replacementRow = createRow(no_newrow, LINK(newRow));
|
|
@@ -4905,7 +4909,7 @@ IHqlExpression * CExprFolderTransformer::doFoldTransformed(IHqlExpression * unfo
|
|
|
switch (childOp)
|
|
|
{
|
|
|
case no_inlinetable:
|
|
|
- if ((foldOptions & HFOconstantdatasets) && isPureInlineDataset(child))
|
|
|
+ if ((foldOptions & HFOconstantdatasets) && isNoSkipInlineDataset(child))
|
|
|
ret = queryOptimizeAggregateInline(expr, child->queryChild(0)->numChildren());
|
|
|
break;
|
|
|
default:
|
|
@@ -4924,7 +4928,7 @@ IHqlExpression * CExprFolderTransformer::doFoldTransformed(IHqlExpression * unfo
|
|
|
switch (childOp)
|
|
|
{
|
|
|
case no_inlinetable:
|
|
|
- if (isPureInlineDataset(child))
|
|
|
+ if (isNoSkipInlineDataset(child))
|
|
|
return createConstant(expr->queryType()->castFrom(false, (__int64)child->queryChild(0)->numChildren()));
|
|
|
break;
|
|
|
case no_null:
|
|
@@ -4958,7 +4962,7 @@ IHqlExpression * CExprFolderTransformer::doFoldTransformed(IHqlExpression * unfo
|
|
|
switch (childOp)
|
|
|
{
|
|
|
case no_inlinetable:
|
|
|
- if (isPureInlineDataset(child))
|
|
|
+ if (isNoSkipInlineDataset(child))
|
|
|
{
|
|
|
bool hasChildren = (child->queryChild(0)->numChildren() != 0);
|
|
|
return createConstant(hasChildren);
|