|
@@ -1312,6 +1312,8 @@ void ParentExtract::gatherActiveRows(BuildCtx & ctx)
|
|
|
if (localisation == GraphCoLocal || localisation == GraphCoNonLocal)
|
|
|
{
|
|
|
OwnedHqlExpr colocal = createQuoted("colocal", makeVoidType());
|
|
|
+ HqlExprCopyArray matchBound;
|
|
|
+ HqlExprCopyArray matchAlias;
|
|
|
ForEachItemInRev(i, activeRows)
|
|
|
{
|
|
|
BoundRow & cur = activeRows.item(i);
|
|
@@ -1337,16 +1339,25 @@ void ParentExtract::gatherActiveRows(BuildCtx & ctx)
|
|
|
}
|
|
|
else if (serialization)
|
|
|
{
|
|
|
- //A cursor active in the current scope => add it to the extract, and create an alias in the
|
|
|
- //child contexts.
|
|
|
- //Need to add these fields to the extract record, and do the assignments at the point of call
|
|
|
- Owned<ITypeInfo> fieldType = makeRowReferenceType(cur.queryDataset());
|
|
|
- if (hasOutOfLineModifier(bound->queryType()))
|
|
|
- fieldType.setown(makeAttributeModifier(LINK(fieldType), getLinkCountedAttr()));
|
|
|
- OwnedHqlExpr expandedAlias = serialization->createField(NULL, fieldType);
|
|
|
- OwnedHqlExpr castSource = createValue(no_implicitcast, LINK(fieldType), LINK(bound));
|
|
|
- OwnedHqlExpr translated = createTranslated(castSource);
|
|
|
- translator.buildAssign(ctx, expandedAlias, translated);
|
|
|
+ unsigned match = matchBound.find(*bound);
|
|
|
+ OwnedHqlExpr expandedAlias;
|
|
|
+ if (match == NotFound)
|
|
|
+ {
|
|
|
+ //A cursor active in the current scope => add it to the extract, and create an alias in the
|
|
|
+ //child contexts.
|
|
|
+ //Need to add these fields to the extract record, and do the assignments at the point of call
|
|
|
+ Owned<ITypeInfo> fieldType = makeRowReferenceType(cur.queryDataset());
|
|
|
+ if (hasOutOfLineModifier(bound->queryType()))
|
|
|
+ fieldType.setown(makeAttributeModifier(LINK(fieldType), getLinkCountedAttr()));
|
|
|
+ expandedAlias.setown(serialization->createField(NULL, fieldType));
|
|
|
+ OwnedHqlExpr castSource = createValue(no_implicitcast, LINK(fieldType), LINK(bound));
|
|
|
+ OwnedHqlExpr translated = createTranslated(castSource);
|
|
|
+ translator.buildAssign(ctx, expandedAlias, translated);
|
|
|
+ matchBound.append(*bound);
|
|
|
+ matchAlias.append(*expandedAlias);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ expandedAlias.set(&matchAlias.item(match));
|
|
|
|
|
|
newRow = new BoundAliasRow(cur, NULL, expandedAlias);
|
|
|
newRow->setInherited(true);
|