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

Merge remote-tracking branch 'origin/candidate-4.2.8' into closedown-5.0.x

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 11 роки тому
батько
коміт
70c84149ed

+ 23 - 11
ecl/hthor/hthorkey.cpp

@@ -225,7 +225,8 @@ const void *CHThorNullAggregateActivity::nextInGroup()
 class CHThorNullCountActivity : public CHThorNullActivity
 {
 public:
-    CHThorNullCountActivity(IAgentContext &agent, unsigned _activityId, unsigned _subgraphId, IHThorArg & _arg, ThorActivityKind _kind) : CHThorNullActivity(agent, _activityId, _subgraphId, _arg, _kind) {}
+    CHThorNullCountActivity(IAgentContext &agent, unsigned _activityId, unsigned _subgraphId, IHThorArg & _arg, ThorActivityKind _kind)
+        : CHThorNullActivity(agent, _activityId, _subgraphId, _arg, _kind), finished(false) {}
 
     //interface IHThorInput
     virtual void ready();
@@ -804,11 +805,9 @@ CHThorIndexReadActivity::CHThorIndexReadActivity(IAgentContext &_agent, unsigned
 {
     steppedExtra = static_cast<IHThorSteppedSourceExtra *>(helper.selectInterface(TAIsteppedsourceextra_1));
     needTransform = helper.needTransform();
-    keyedLimit = helper.getKeyedLimit();
-    rowLimit = helper.getRowLimit();
-    if (helper.getFlags() & TIRlimitskips)
-        rowLimit = (unsigned __int64) -1;
-    stopAfter = helper.getChooseNLimit();
+    keyedLimit = (unsigned __int64)-1;
+    rowLimit = (unsigned __int64)-1;
+    stopAfter = (unsigned __int64)-1;
     keyedLimitReached = false;
     keyedLimitSkips = ((helper.getFlags() & TIRkeyedlimitskips) != 0);
     keyedLimitCreates = ((helper.getFlags() & TIRkeyedlimitcreates) != 0);
@@ -844,6 +843,11 @@ void CHThorIndexReadActivity::ready()
 {
     keyedLimitReached = false;
     keyedLimitRowCreated = false;
+    keyedLimit = helper.getKeyedLimit();
+    rowLimit = helper.getRowLimit();
+    if (helper.getFlags() & TIRlimitskips)
+        rowLimit = (unsigned __int64) -1;
+    stopAfter = helper.getChooseNLimit();
     keyedProcessed = 0;
     if(!gotLayoutTrans)
     {
@@ -1117,13 +1121,12 @@ protected:
 
 CHThorIndexNormalizeActivity::CHThorIndexNormalizeActivity(IAgentContext &_agent, unsigned _activityId, unsigned _subgraphId, IHThorIndexNormalizeArg &_arg, ThorActivityKind _kind, IDistributedFile * _df) : CHThorIndexReadActivityBase(_agent, _activityId, _subgraphId, _arg, _kind, _df), helper(_arg), outBuilder(NULL)
 {
-    keyedLimit = helper.getKeyedLimit();
+    keyedLimit = (unsigned __int64)-1;
     skipLimitReached = false;
     keyedProcessed = 0;
-    rowLimit = helper.getRowLimit();
-    if (helper.getFlags() & TIRlimitskips)
-        rowLimit = (unsigned __int64) -1;
-    stopAfter = helper.getChooseNLimit();
+    rowLimit = (unsigned __int64)-1;
+    stopAfter = (unsigned __int64)-1;
+    expanding = false;
 }
 
 CHThorIndexNormalizeActivity::~CHThorIndexNormalizeActivity()
@@ -1132,8 +1135,13 @@ CHThorIndexNormalizeActivity::~CHThorIndexNormalizeActivity()
 
 void CHThorIndexNormalizeActivity::ready()
 {
+    keyedLimit = helper.getKeyedLimit();
     skipLimitReached = false;
     keyedProcessed = 0;
+    rowLimit = helper.getRowLimit();
+    if (helper.getFlags() & TIRlimitskips)
+        rowLimit = (unsigned __int64) -1;
+    stopAfter = helper.getChooseNLimit();
     expanding = false;
     CHThorIndexReadActivityBase::ready();
     outBuilder.setAllocator(rowAllocator);
@@ -1406,6 +1414,8 @@ protected:
 CHThorIndexCountActivity::CHThorIndexCountActivity(IAgentContext &_agent, unsigned _activityId, unsigned _subgraphId, IHThorIndexCountArg &_arg, ThorActivityKind _kind, IDistributedFile * _df) 
     : CHThorIndexReadActivityBase(_agent, _activityId, _subgraphId, _arg, _kind, _df), helper(_arg)
 {
+    choosenLimit = (unsigned __int64)-1;
+    finished = false;
 }
 
 void CHThorIndexCountActivity::ready()
@@ -1514,6 +1524,8 @@ protected:
 
 CHThorIndexGroupAggregateActivity::CHThorIndexGroupAggregateActivity(IAgentContext &_agent, unsigned _activityId, unsigned _subgraphId, IHThorIndexGroupAggregateArg &_arg, ThorActivityKind _kind, IDistributedFile * _df) : CHThorIndexReadActivityBase(_agent, _activityId, _subgraphId, _arg, _kind, _df), helper(_arg), aggregated(_arg, _arg)
 {
+    eof = false;
+    gathered = false;
 }
 
 void CHThorIndexGroupAggregateActivity::ready()

Різницю між файлами не показано, бо вона завелика
+ 11 - 0
testing/regress/ecl/key/sqidxlimit.xml


+ 14 - 0
testing/regress/ecl/key/sqidxlimit2.xml

@@ -0,0 +1,14 @@
+<Dataset name='Result 1'>
+ <Row><cnt>3</cnt></Row>
+ <Row><cnt>1</cnt></Row>
+ <Row><cnt>0</cnt></Row>
+ <Row><cnt>0</cnt></Row>
+</Dataset>
+<Dataset name='Result 2'>
+ <Row><cnt>1</cnt></Row>
+ <Row><cnt>1</cnt></Row>
+ <Row><cnt>0</cnt></Row>
+ <Row><cnt>6</cnt></Row>
+ <Row><cnt>1</cnt></Row>
+ <Row><cnt>0</cnt></Row>
+</Dataset>

+ 48 - 0
testing/regress/ecl/sqidxlimit.ecl

@@ -0,0 +1,48 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+#option ('globalAutoHoist', false);
+
+//Thor doesn't currently support catch correctly, or in a child query, so disable.
+//nothor
+
+import $.setup;
+sq := setup.sq('hthor');
+
+
+filtered(STRING name, unsigned klimit, unsigned slimit) := FUNCTION
+    f := sq.SimplePersonBookIndex(surname = name);
+    lim := LIMIT(f, klimit, KEYED);
+    x := LIMIT(lim, slimit);
+    RETURN CATCH(x, SKIP);
+END;
+
+
+ds1 := DATASET([
+            {'Halliday', 4, 3},
+            {'Halliday', 3, 2}
+            ], { string name, unsigned klimit, unsigned slimit });
+
+p1 := TABLE(ds1, { cnt := COUNT(NOFOLD(filtered(name, klimit, slimit))) });
+
+
+
+sequential(
+output(filtered('Halliday', 4, 3));
+output(filtered('Halliday', 4, 2));
+output(p1);
+);

+ 58 - 0
testing/regress/ecl/sqidxlimit2.ecl

@@ -0,0 +1,58 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+#option ('globalAutoHoist', false);
+
+import $.setup;
+sq := setup.sq('hthor');
+
+
+ds2 := DATASET([
+            {'Halliday', 4},
+            {'Halliday', 1},
+            {'Halliday', 0}, // should be empty
+            {'Zingo', 2}
+            ], { string name, unsigned climit });
+
+filtered2(STRING name, unsigned climit) := FUNCTION
+    f := sq.SimplePersonBookIndex(surname = name);
+    RETURN CHOOSEN(f, climit);
+END;
+
+p2 := TABLE(ds2, { cnt := COUNT(NOFOLD(filtered2(name, climit))) });
+
+ds3 := DATASET([
+            {'Harper Lee', 4},
+            {'Harper Lee', 1},
+            {'Harper Lee', 0}, // should be empty
+            {'Various', 1000},
+            {'Various', 1},
+            {'Zingo', 2}
+            ], { string name, unsigned climit });
+
+filtered3(STRING searchname, unsigned climit) := FUNCTION
+    f := sq.SimplePersonBookIndex.books(author = searchname);
+    RETURN CHOOSEN(f, climit);
+END;
+
+p3 := TABLE(ds3, { cnt := COUNT(NOFOLD(filtered3(name, climit))) });
+
+
+sequential(
+output(p2);
+output(p3);
+);