Browse Source

HPCC-8562 Always support LCR and used LCR for temporaries

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 12 years ago
parent
commit
4ec1367acb

+ 4 - 25
ecl/hqlcpp/hqlcpp.cpp

@@ -1577,12 +1577,10 @@ void HqlCppTranslator::cacheOptions()
         DebugOption(options.minimizeActivityClasses,"minimizeActivityClasses", true),
         DebugOption(options.maxRootMaybeThorActions, "maxRootMaybeThorActions", 0),
         DebugOption(options.includeHelperInGraph,"includeHelperInGraph", false),
-        DebugOption(options.supportsLinkedChildRows,"supportsLinkedChildRows", true),
         DebugOption(options.minimizeSkewBeforeSpill,"minimizeSkewBeforeSpill", false),
         DebugOption(options.createSerializeForUnknownSize,"createSerializeForUnknownSize", false),
         DebugOption(options.implicitLinkedChildRows,"implicitLinkedChildRows", false),
-        DebugOption(options.tempDatasetsUseLinkedRows,"tempDatasetsUseLinkedRows", false),
-//      DebugOption(options.mainRowsAreLinkCounted,"mainRowsAreLinkCounted", options.supportsLinkedChildRows),
+        DebugOption(options.mainRowsAreLinkCounted,"mainRowsAreLinkCounted", true),
         DebugOption(options.allowSections,"allowSections", true),
         DebugOption(options.autoPackRecords,"autoPackRecords", false),
         DebugOption(options.commonUniqueNameAttributes,"commonUniqueNameAttributes", true),
@@ -1738,9 +1736,6 @@ void HqlCppTranslator::cacheOptions()
     //The following cases handle options whose default values are dependent on other options.  
     //Or where one debug options sets more than one option
     options.hasResourceUseMpForDistribute = wu()->hasDebugValue("resourceUseMpForDistribute");
-    if (!options.supportsLinkedChildRows) 
-        options.implicitLinkedChildRows = false;
-
     if (options.spanMultipleCpp)
     {
         options.activitiesPerCpp = wu()->getDebugValueInt("activitiesPerCpp", DEFAULT_ACTIVITIES_PER_CPP);
@@ -1765,9 +1760,7 @@ void HqlCppTranslator::cacheOptions()
         options.optimizeResourcedProjects = true;
     }
 
-    options.mainRowsAreLinkCounted = options.supportsLinkedChildRows && getDebugFlag("mainRowsAreLinkCounted", true);
     options.minimizeWorkunitTemporaries = !options.workunitTemporaries || getDebugFlag("minimizeWorkunitTemporaries", false);//options.resourceConditionalActions);
-    options.tempDatasetsUseLinkedRows = getDebugFlag("tempDatasetsUseLinkedRows", options.implicitLinkedChildRows);
 
     options.inlineStringThreshold = wu()->getDebugValueInt("inlineStringThreshold", (options.targetCompiler != Vs6CppCompiler) ? 0 : 10000);
 
@@ -1779,10 +1772,9 @@ void HqlCppTranslator::cacheOptions()
 
     //A meta flag for enabling link counted child rows.
     bool useLCR = getDebugFlag("linkCountedRows", getDebugFlag("testLCR", true));
-    if (options.supportsLinkedChildRows && useLCR)
+    if (useLCR)
     {
         options.implicitLinkedChildRows = true;
-        options.tempDatasetsUseLinkedRows = true;
         options.useLinkedRawIterator = true;
         options.useLinkedNormalize = true;
         options.finalizeAllRows = true;     // inline temporary rows should actually be ok.
@@ -1805,20 +1797,7 @@ void HqlCppTranslator::postProcessOptions()
         options.limitMaxLength = false;
     }
 
-    if (options.supportsLinkedChildRows) 
-    {
-        options.maxStaticRowSize = 0;
-    }
-    else
-    {
-        options.maxStaticRowSize = (unsigned)-1;
-        options.implicitLinkedChildRows = false;
-        options.tempDatasetsUseLinkedRows = false;
-        options.useLinkedRawIterator = false;
-        options.useLinkedNormalize = false;
-        options.finalizeAllRows = false;
-        options.finalizeAllVariableRows = false;
-    }
+    options.maxStaticRowSize = 0;
 
     options.optimizeDiskFlag = 0;
     if (options.optimizeInlineSource) 
@@ -4133,7 +4112,7 @@ void HqlCppTranslator::createTempFor(BuildCtx & ctx, ITypeInfo * _exprType, CHql
                 assertex(format != FormatBlockedDataset);
                 format = FormatLinkedDataset;
             }
-            else if (options.tempDatasetsUseLinkedRows && (format == FormatNatural))
+            else if (format == FormatNatural)
                 format = FormatLinkedDataset;
             break;
         }

+ 0 - 2
ecl/hqlcpp/hqlcpp.ipp

@@ -612,10 +612,8 @@ struct HqlCppOptions
     bool                canGenerateSimpleAction;
     bool                minimizeActivityClasses;
     bool                includeHelperInGraph;
-    bool                supportsLinkedChildRows;
     bool                minimizeSkewBeforeSpill;
     bool                createSerializeForUnknownSize;
-    bool                tempDatasetsUseLinkedRows;
     bool                implicitLinkedChildRows;
     bool                mainRowsAreLinkCounted;
     bool                allowSections;

+ 1 - 9
ecl/hqlcpp/hqlcppds.cpp

@@ -946,8 +946,6 @@ bool HqlCppTranslator::canBuildOptimizedCount(BuildCtx & ctx, IHqlExpression * d
         }
         break;
     default:
-        if (!options.tempDatasetsUseLinkedRows)
-            break;
         if (!alwaysEvaluatesToBound(dataset))
             break;
         //fall through
@@ -2305,10 +2303,6 @@ void HqlCppTranslator::doBuildDataset(BuildCtx & ctx, IHqlExpression * expr, CHq
                         throwError(HQLERR_LinkedDatasetNoContext);
                     format = FormatBlockedDataset;
                 }
-                else if ((record == serializedRecord) && !options.tempDatasetsUseLinkedRows)
-                {
-                    format = FormatBlockedDataset;
-                }
                 else
                 {
                     format = FormatLinkedDataset;
@@ -5008,9 +5002,7 @@ void HqlCppTranslator::doBuildExprGetGraphResult(BuildCtx & ctx, IHqlExpression
         }
     }
 
-    bool useLinkCounted = recordRequiresLinkCount(expr->queryRecord()) || options.tempDatasetsUseLinkedRows;
-
-    OwnedHqlExpr call = buildGetLocalResult(ctx, expr, useLinkCounted);
+    OwnedHqlExpr call = buildGetLocalResult(ctx, expr, true);
     switch (expr->queryType()->getTypeCode())
     {
     case type_row:

+ 5 - 7
ecl/hqlcpp/hqlhtcpp.cpp

@@ -4773,7 +4773,7 @@ void HqlCppTranslator::buildGetResultInfo(BuildCtx & ctx, IHqlExpression * expr,
                 record.set(::queryRecord(type));
                 //NB: The result type (including grouping) will be overridden when this function is bound
                 func = getResultDatasetAtom;
-                bool defaultLCR = targetAssign ? hasLinkedRow(targetAssign->queryType()) : options.tempDatasetsUseLinkedRows;
+                bool defaultLCR = targetAssign ? hasLinkedRow(targetAssign->queryType()) : true;
                 if (hasLinkCountedModifier(type) || defaultLCR)
                 {
                     ensureSerialized = false;
@@ -7383,9 +7383,8 @@ void HqlCppTranslator::doBuildExprGetResult(BuildCtx & ctx, IHqlExpression * exp
         return;
 
     ITypeInfo * exprType = expr->queryType();
-    ExpressionFormat format = (hasLinkCountedModifier(exprType) || options.tempDatasetsUseLinkedRows) ? FormatLinkedDataset : FormatBlockedDataset;
     CHqlBoundTarget tempTarget;
-    createTempFor(ctx, exprType, tempTarget, typemod_none, format);
+    createTempFor(ctx, exprType, tempTarget, typemod_none, FormatLinkedDataset);
     buildGetResultInfo(ctx, expr, NULL, &tempTarget);
     tgt.setFromTarget(tempTarget);
     ctx.associateExpr(expr, tgt);
@@ -13221,7 +13220,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityAggregate(BuildCtx & ctx, IHql
 
 ABoundActivity * HqlCppTranslator::doBuildActivityChildDataset(BuildCtx & ctx, IHqlExpression * expr)
 {
-    if ((options.mainRowsAreLinkCounted && options.supportsLinkedChildRows && options.useLinkedRawIterator) || isGrouped(expr))
+    if ((options.mainRowsAreLinkCounted && options.useLinkedRawIterator) || isGrouped(expr))
         return doBuildActivityRawChildDataset(ctx, expr);
 
 
@@ -13340,8 +13339,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityRawChildDataset(BuildCtx & ctx
     //If it is possible to create a linked child rows we need to use a linked raw child dataset iterator - 
     //otherwise the dataset may not be in the right format (and I can't work out how to efficiently force it otherwise.)
     //If main rows are link counted then it is always going to be as good or better to generate a link counted raw iterator.
-    if (options.implicitLinkedChildRows || options.tempDatasetsUseLinkedRows)
-        return doBuildActivityLinkedRawChildDataset(ctx, expr);
+    return doBuildActivityLinkedRawChildDataset(ctx, expr);
 
     StringBuffer s;
     Owned<ActivityInstance> instance = new ActivityInstance(*this, ctx, TAKrawiterator, expr, "RawIterator");
@@ -14133,7 +14131,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityNormalizeChild(BuildCtx & ctx,
 
     // INormalizeChildIterator * queryIterator();
     {
-        bool outOfLine = options.tempDatasetsUseLinkedRows;
+        bool outOfLine = true;
         if (childDataset->isDatarow())
             childDataset.setown(createDatasetFromRow(childDataset.getClear()));
         if (childDataset->getOperator() == no_select)

+ 3 - 3
ecl/hqlcpp/hqlnlp.cpp

@@ -987,10 +987,10 @@ IReferenceSelector * HqlCppTranslator::doBuildRowMatchAttr(BuildCtx & ctx, IHqlE
     IHqlExpression * record = expr->queryRecord();
     StringBuffer rowName;
     getUniqueId(rowName.append("row"));
-    //MORE: Production rows should be a linkable match row - would help in parsing.
+
     OwnedITypeInfo rowType = makeConstantModifier(makeRowReferenceType(record));
-    if (options.supportsLinkedChildRows)
-        rowType.setown(makeAttributeModifier(LINK(rowType), getLinkCountedAttr()));
+    rowType.setown(makeAttributeModifier(LINK(rowType), getLinkCountedAttr()));
+
     OwnedHqlExpr row = createVariable(rowName, rowType.getClear());
     ctx.addDeclare(row);
     ctx.addAssign(row, call);

+ 4 - 9
ecl/hqlcpp/hqlresource.cpp

@@ -1824,7 +1824,6 @@ EclResourcer::EclResourcer(IErrorReceiver * _errors, IConstWorkUnit * _wu, Clust
     options.useGraphResults = false;        // modified by later call
     options.groupedChildIterators = _translatorOptions.groupedChildIterators;
     options.allowSplitBetweenSubGraphs = false;//(targetClusterType == RoxieCluster);
-    options.supportsChildQueries = true;
     options.clusterSize = clusterSize;
     options.preventKeyedSplit = _translatorOptions.preventKeyedSplit;
     options.preventSteppedSplit = _translatorOptions.preventSteppedSplit;
@@ -2095,8 +2094,8 @@ protected:
 class EclChildSplitPointLocator : public EclHoistLocator
 {
 public:
-    EclChildSplitPointLocator(IHqlExpression * _original, HqlExprCopyArray & _selectors, HqlExprCopyArray & _originalMatches, HqlExprArray & _matches, BoolArray & _singleNode, BoolArray & _alwaysHoistMatches, bool _groupedChildIterators, bool _supportsChildQueries)
-    : EclHoistLocator(_originalMatches, _matches, _singleNode, _alwaysHoistMatches), selectors(_selectors), groupedChildIterators(_groupedChildIterators), supportsChildQueries(_supportsChildQueries)
+    EclChildSplitPointLocator(IHqlExpression * _original, HqlExprCopyArray & _selectors, HqlExprCopyArray & _originalMatches, HqlExprArray & _matches, BoolArray & _singleNode, BoolArray & _alwaysHoistMatches, bool _groupedChildIterators)
+    : EclHoistLocator(_originalMatches, _matches, _singleNode, _alwaysHoistMatches), selectors(_selectors), groupedChildIterators(_groupedChildIterators)
     { 
         original = _original;
         okToSelect = false; 
@@ -2146,10 +2145,7 @@ protected:
         if (executedOnce)
         {
             if (conditionalDepth != 0)
-            {
-                if (supportsChildQueries || canProcessInline(NULL, ds))
-                    alwaysHoist = false;
-            }
+                alwaysHoist = false;
         }
         return alwaysHoist;
     }
@@ -2498,7 +2494,6 @@ protected:
     bool gathered;
     bool groupedChildIterators;
     bool executedOnce;
-    bool supportsChildQueries;
 };
 
 
@@ -2506,7 +2501,7 @@ protected:
 void EclResourcer::gatherChildSplitPoints(IHqlExpression * expr, BoolArray & alwaysHoistChild, ResourcerInfo * info, unsigned first, unsigned last)
 {
     //NB: Don't call member functions to ensure correct nesting of transform mutexes.
-    EclChildSplitPointLocator locator(expr, activeSelectors, info->originalChildDependents, info->childDependents, info->childSingleNode, alwaysHoistChild, options.groupedChildIterators, options.supportsChildQueries);
+    EclChildSplitPointLocator locator(expr, activeSelectors, info->originalChildDependents, info->childDependents, info->childSingleNode, alwaysHoistChild, options.groupedChildIterators);
     unsigned max = expr->numChildren();
 
     //If child queries are supported then don't hoist the expressions if they might only be evaluated once

+ 0 - 1
ecl/hqlcpp/hqlresource.ipp

@@ -56,7 +56,6 @@ public:
     bool     isChildQuery;
     bool     groupedChildIterators;
     bool     allowSplitBetweenSubGraphs;
-    bool     supportsChildQueries;
     bool     preventKeyedSplit;
     bool     preventSteppedSplit;
     bool     mangleSpillNameWithWuid;

+ 2 - 5
ecl/hqlcpp/hqltcppc.cpp

@@ -2709,10 +2709,7 @@ IHqlExpression * CXmlColumnInfo::getXmlDatasetExpr(HqlCppTranslator & translator
     //Create the builder for generating a temporary set.
     IHqlExpression * record = expr->queryRecord();
     Owned<IHqlCppDatasetBuilder> builder;
-    if (recordRequiresLinkCount(expr->queryRecord()) || translator.queryOptions().tempDatasetsUseLinkedRows)
-        builder.setown(translator.createLinkedDatasetBuilder(record));
-    else
-        builder.setown(translator.createBlockedDatasetBuilder(record));
+    builder.setown(translator.createLinkedDatasetBuilder(record));
     builder->buildDeclare(ctx);
 
     //Generate the code to process a child iterator
@@ -3443,7 +3440,7 @@ IHqlExpression * SerializationRow::ensureSerialized(IHqlExpression * path, IHqlE
     Owned<ITypeInfo> unqualifiedType = getFullyUnqualifiedType(pathType);
     Owned<ITypeInfo> serializeType = cloneEssentialFieldModifiers(pathType, unqualifiedType);
     if (colocal && path->isDataset() && 
-        (hasLinkedRow(pathType) || (hasOutOfLineModifier(pathType) && translator.queryOptions().tempDatasetsUseLinkedRows)))
+        (hasLinkedRow(pathType) || hasOutOfLineModifier(pathType)))
         serializeType.setown(setLinkCountedAttr(serializeType, true));
     return addSerializedValue(path, serializeType, colocal, isConditional);
 }