瀏覽代碼

Merge pull request #10098 from ghalliday/issue17784

HPCC-17784 Fix crash when using a superfile within a prefetch project

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 年之前
父節點
當前提交
c5fa17c5bd

+ 1 - 0
ecl/hthor/hthorkey.cpp

@@ -440,6 +440,7 @@ bool CHThorIndexReadActivityBase::doPreopenLimit(unsigned __int64 limit)
     if(superIterator)
     {
         superIterator->first();
+        superIndex = 0;
         do
         {
             df.set(&superIterator->query());

+ 24 - 0
testing/regress/ecl/key/prefetch2.xml

@@ -0,0 +1,24 @@
+<Dataset name='Result 1'>
+ <Row><word>boy  </word><doc>281474976710888</doc></Row>
+ <Row><word>sheep</word><doc>281474976710972</doc></Row>
+</Dataset>
+<Dataset name='Result 2'>
+ <Row><word>boy  </word><doc>281474976710888</doc></Row>
+ <Row><word>sheep</word><doc>281474976710972</doc></Row>
+</Dataset>
+<Dataset name='Result 3'>
+ <Row><word>boy  </word><doc>0</doc></Row>
+ <Row><word>sheep</word><doc>0</doc></Row>
+</Dataset>
+<Dataset name='Result 4'>
+ <Row><word>boy  </word><doc>0</doc></Row>
+ <Row><word>sheep</word><doc>0</doc></Row>
+</Dataset>
+<Dataset name='Result 5'>
+ <Row><word>boy  </word><doc>281474976710658</doc></Row>
+ <Row><word>sheep</word><doc>281474976710659</doc></Row>
+</Dataset>
+<Dataset name='Result 6'>
+ <Row><word>boy  </word><doc>281474976710658</doc></Row>
+ <Row><word>sheep</word><doc>281474976710659</doc></Row>
+</Dataset>

+ 62 - 0
testing/regress/ecl/prefetch2.ecl

@@ -0,0 +1,62 @@
+/*##############################################################################
+
+    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.
+############################################################################## */
+
+//class=file
+//version multiPart=true
+
+import ^ as root;
+multiPart := #IFDEFINED(root.multiPart, true);
+useLocal := #IFDEFINED(root.useLocal, false);
+useTranslation := #IFDEFINED(root.useTranslation, false);
+
+//--- end of version configuration ---
+
+#option ('layoutTranslationEnabled', useTranslation);
+
+import $.setup;
+import setup.TS;
+Files := setup.Files(multiPart, useLocal, useTranslation);
+
+in := dataset([{'boy'}, {'sheep'}], {string5 word});
+
+outrec := record
+  string5 word;
+  unsigned doc;
+END;
+
+outrec trans1(in L) := TRANSFORM
+  SELF.word := L.word;
+  SELF.doc := SORTED(Files.getSearchSuperIndex()(KEYED(kind = TS.kindType.TextEntry),keyed(word = l.word)), doc)[1].doc;
+END;
+
+outrec trans2(in L) := TRANSFORM
+  SELF.word := L.word;
+  SELF.doc := SORTED(Files.getSearchSuperIndex()(KEYED(kind = TS.kindType.TextEntry),keyed(word = 'gobbledegook'+l.word)), doc)[1].doc;
+END;
+
+outrec trans3(in L) := TRANSFORM
+  SELF.word := L.word;
+  SELF.doc := STEPPED(Files.getSearchSuperIndex()(KEYED(kind = TS.kindType.TextEntry),keyed(word = l.word)), doc)[1].doc;
+END;
+
+
+output(project(in, trans1(LEFT))) : independent;
+output(project(in, trans1(LEFT), PREFETCH(20))) : independent;
+output(project(in, trans2(LEFT))) : independent;
+output(project(in, trans2(LEFT), PREFETCH(20, PARALLEL))) : independent;
+output(project(in, trans3(LEFT))) : independent;
+output(project(in, trans3(LEFT), PREFETCH(20, PARALLEL))) : independent;

+ 1 - 0
testing/regress/ecl/setup/files.ecl

@@ -184,5 +184,6 @@ EXPORT NameWordIndex() := '~REGRESS::' + indexPrefix + '::wordIndex' + IF(useLoc
 EXPORT NameSearchIndex      := '~REGRESS::' + indexPrefix + '::searchIndex';
 EXPORT getWordIndex() := INDEX(TS.textSearchIndex, NameWordIndex());
 EXPORT getSearchIndex() := INDEX(TS.textSearchIndex, NameSearchIndex);
+EXPORT getSearchSuperIndex() := INDEX(TS.textSearchIndex, '{' + NameSearchIndex + ',' + NameWordIndex() + '}');
 
 END;