Переглянути джерело

Merge pull request #11327 from jakesmith/hpcc-19874

HPCC-19874 Ensure filter inputs are not marked fast through

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 7 роки тому
батько
коміт
bc3776b712

+ 2 - 1
thorlcr/activities/diskread/thdiskreadslave.cpp

@@ -372,6 +372,8 @@ public:
                 info.unknownRowsOutput = info.canReduceNumRows = true;
                 info.byteTotal = (offset_t)-1;
             }
+            else
+                info.fastThrough = true;
         }
     };
 
@@ -466,7 +468,6 @@ public:
             initMetaInfo(cachedMetaInfo);
             cachedMetaInfo.isSource = true;
             getPartsMetaInfo(cachedMetaInfo, partDescs.ordinality(), partDescs.getArray(), partHandler);
-            cachedMetaInfo.fastThrough = true;
         }
         info = cachedMetaInfo;
         if (info.totalRowsMin==info.totalRowsMax)

+ 0 - 1
thorlcr/activities/filter/thfilterslave.cpp

@@ -42,7 +42,6 @@ public:
     virtual void getMetaInfo(ThorDataLinkMetaInfo &info) override
     {
         initMetaInfo(info);
-        info.fastThrough = true;
         info.canReduceNumRows = true;
         calcMetaInfoSize(info, queryInput(0));
     }

+ 17 - 7
thorlcr/activities/thactivityutil.cpp

@@ -374,36 +374,46 @@ void calcMetaInfoSize(ThorDataLinkMetaInfo &info, CThorInputArray &inputs)
         info.totalRowsMin = 0; // a good bet
 }
 
-void calcMetaInfoSize(ThorDataLinkMetaInfo &info, ThorDataLinkMetaInfo *infos, unsigned num)
+void calcMetaInfoSize(ThorDataLinkMetaInfo &info, const ThorDataLinkMetaInfo *infos, unsigned num)
 {
     if (!infos||(num<=1))
     {
         if (1 == num)
             info = infos[0];
+        else
+        {
+            info.fastThrough = true;
+            info.totalRowsMin = info.totalRowsMax = 0;
+        }
         return;
     }
     if (!info.unknownRowsOutput)
     {
         __int64 min=0;
         __int64 max=0;
-        for (unsigned i=0;i<num;i++ )
+        for (unsigned i=0; i<num; i++)
         {
-            ThorDataLinkMetaInfo &prev = infos[i];
+            const ThorDataLinkMetaInfo &currentInfo = infos[i];
             if (min>=0)
             {
-                if (prev.totalRowsMin>=0)
-                    min += prev.totalRowsMin;
+                if (currentInfo.totalRowsMin>=0)
+                    min += currentInfo.totalRowsMin;
                 else
                     min = -1;
             }
             if (max>=0)
             {
-                if (prev.totalRowsMax>=0)
-                    max += prev.totalRowsMax;
+                if (currentInfo.totalRowsMax>=0)
+                    max += currentInfo.totalRowsMax;
                 else
                     max = -1;
             }
+            if (0 == i)
+                info.fastThrough = currentInfo.fastThrough;
+            else if (info.fastThrough && !currentInfo.fastThrough) // i.e. if was true and this one is false, set return fastThrough to false
+                info.fastThrough = false;
         }
+
         if (info.totalRowsMin<=0)
         {
             if (!info.canReduceNumRows)

+ 1 - 1
thorlcr/activities/thactivityutil.ipp

@@ -71,7 +71,7 @@ IRowStream *createSequentialPartHandler(CPartHandler *partHandler, IArrayOf<IPar
 void initMetaInfo(ThorDataLinkMetaInfo &info);
 void calcMetaInfoSize(ThorDataLinkMetaInfo &info, IThorDataLink *link);
 void calcMetaInfoSize(ThorDataLinkMetaInfo &info, CThorInputArray &inputs);
-void calcMetaInfoSize(ThorDataLinkMetaInfo &info, ThorDataLinkMetaInfo *infos, unsigned num);
+void calcMetaInfoSize(ThorDataLinkMetaInfo &info, const ThorDataLinkMetaInfo *infos, unsigned num);
 
 interface ILookAheadStopNotify
 {