Quellcode durchsuchen

Fix numRows check in hthor/thor engine for temp table

Renato Golin vor 13 Jahren
Ursprung
Commit
12f1f08df9

+ 0 - 2
ecl/hqlcpp/hqlhtcpp.cpp

@@ -15982,8 +15982,6 @@ ABoundActivity * HqlCppTranslator::doBuildActivityCountTransform(BuildCtx & ctx,
     BoundRow * selfCursor = bindSelf(funcctx, instance->dataset, "crSelf");
     IHqlExpression * self = selfCursor->querySelector();
     associateCounter(funcctx, counter, "row");
-    // FIXME: this should be fixed in the engine
-    funcctx.addQuoted("if (row == numRows()) return 0;");
     buildTransformBody(funcctx, transform, NULL, NULL, instance->dataset, self);
 
     // unsigned numRows() - count is guaranteed by lexer

+ 2 - 1
ecl/hthor/hthor.cpp

@@ -5842,12 +5842,13 @@ void CHThorTempTableActivity::ready()
     CHThorSimpleActivityBase::ready();
     eof = false;
     curRow = 0;
+    numRows = helper.numRows();
 }
 
 
 const void *CHThorTempTableActivity::nextInGroup()
 {
-    if (!eof)
+    if (!eof && curRow < numRows)
     {
         RtlDynamicRowBuilder rowBuilder(rowAllocator);
         size32_t size = helper.getRow(rowBuilder, curRow++);

+ 1 - 0
ecl/hthor/hthor.ipp

@@ -1495,6 +1495,7 @@ class CHThorTempTableActivity : public CHThorSimpleActivityBase
 {
     IHThorTempTableArg &helper;
     unsigned curRow;
+    unsigned numRows;
     bool eof;
 
 public:

+ 3 - 1
thorlcr/activities/temptable/thtmptableslave.cpp

@@ -29,6 +29,7 @@ private:
     IHThorTempTableArg * helper;
     bool eof;
     unsigned currentRow;
+    unsigned numRows;
     size32_t maxrecsize;
     bool isLocal;
 public:
@@ -49,6 +50,7 @@ public:
         currentRow = 0;
         isLocal = container.queryOwnerId() && container.queryOwner().isLocalOnly();
         eof = isLocal ? false : !firstNode();
+        numRows = helper->numRows();
     }
     void stop()
     {
@@ -57,7 +59,7 @@ public:
     CATCH_NEXTROW()
     {
         ActivityTimer t(totalCycles, timeActivities, NULL);
-        if (eof || abortSoon)
+        if (eof || abortSoon || currentRow >= numRows)
             return NULL;
         RtlDynamicRowBuilder row(queryRowAllocator());
         size32_t sizeGot = helper->getRow(row, currentRow++);