Преглед изворни кода

Merge remote-tracking branch 'origin/candidate-5.0.4'

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman пре 10 година
родитељ
комит
dc85147d98

+ 5 - 2
ecl/hql/hqlgram.y

@@ -8734,13 +8734,16 @@ simpleDataSet
                             $$.setExpr(createDataset(no_preload, $3.getExpr(), $4.getExpr()));
                             $$.setPosition($1);
                         }
-    | SAMPLE '(' startTopFilter ',' const ')' endTopFilter
+    | SAMPLE '(' dataSet ',' expression ')'
                         {
+                            parser->normalizeExpression($5, type_int, false);
                             $$.setExpr(createDataset(no_sample, $3.getExpr(), $5.getExpr()));
                             $$.setPosition($1);
                         }
-    | SAMPLE '(' startTopFilter ',' const ',' const ')' endTopFilter
+    | SAMPLE '(' dataSet ',' expression ',' expression ')'
                         {
+                            parser->normalizeExpression($5, type_int, false);
+                            parser->normalizeExpression($7, type_int, false);
                             $$.setExpr(createDataset(no_sample, $3.getExpr(), createComma($5.getExpr(), $7.getExpr())));
                             $$.setPosition($1);
                         }

+ 4 - 7
ecl/hqlcpp/hqlhtcpp.cpp

@@ -15711,8 +15711,9 @@ ABoundActivity * HqlCppTranslator::doBuildActivitySample(BuildCtx & ctx, IHqlExp
 {
     StringBuffer s;
     IHqlExpression * dataset = expr->queryChild(0);
-    IHqlExpression * sampleExpr = queryRealChild(expr, 2);
-    unsigned sample = (unsigned)getIntValue(sampleExpr, 1);
+    LinkedHqlExpr sampleExpr = queryRealChild(expr, 2);
+    if (!sampleExpr)
+        sampleExpr.setown(getSizetConstant(1));
 
     Owned<ABoundActivity> boundDataset = buildCachedActivity(ctx, dataset);
 
@@ -15722,11 +15723,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivitySample(BuildCtx & ctx, IHqlExp
     buildInstancePrefix(instance);
 
     doBuildUnsignedFunction(instance->startctx, "getProportion", expr->queryChild(1));
-
-    BuildCtx funcctx2(instance->startctx);
-    funcctx2.addQuotedCompound("virtual unsigned getSampleNumber()");
-    s.clear().append("return ").append(sample).append(";");
-    funcctx2.addQuoted(s);
+    doBuildUnsignedFunction(instance->startctx, "getSampleNumber", sampleExpr);
 
     buildInstanceSuffix(instance);
     buildConnectInputOutput(ctx, instance, boundDataset, 0, 0);

+ 4 - 4
esp/src/eclwatch/GraphPageWidget.js

@@ -416,9 +416,9 @@ define([
 
         refreshData: function () {
             if (lang.exists("params.Wuid", this)) {
-                this.refreshGraphFromWU(this.wu, this.graphName);
+                this.loadGraphFromWu(this.wu, this.graphName, true);
             } else if (lang.exists("params.QueryId", this)) {
-                this.refreshGraphFromQuery(this.targetQuery, this.queryId, this.graphName);
+                this.loadGraphFromQuery(this.targetQuery, this.queryId, this.graphName);
             }
         },
 
@@ -477,7 +477,7 @@ define([
             this.loadEdges();
         },
 
-        loadGraphFromWu: function (wu, graphName) {
+        loadGraphFromWu: function (wu, graphName, refresh) {
             var deferred = new Deferred();
             this.overview.setMessage(this.i18n.FetchingData);
             this.main.setMessage(this.i18n.FetchingData);
@@ -489,7 +489,7 @@ define([
                 context.local.setMessage("");
                 context.loadGraphFromXGMML(xgmml, svg);
                 deferred.resolve();
-            });
+            }, refresh);
             return deferred.promise;
         },
 

+ 4 - 4
esp/src/eclwatch/GraphTreeWidget.js

@@ -421,9 +421,9 @@ define([
 
         refreshData: function () {
             if (lang.exists("params.Wuid", this)) {
-                this.refreshGraphFromWU(this.wu, this.graphName);
+                this.loadGraphFromWu(this.wu, this.graphName, true);
             } else if (lang.exists("params.QueryId", this)) {
-                this.refreshGraphFromQuery(this.targetQuery, this.queryId, this.graphName);
+                this.loadGraphFromQuery(this.targetQuery, this.queryId, this.graphName);
             }
         },
 
@@ -465,7 +465,7 @@ define([
             this.loadEdges();
         },
 
-        loadGraphFromWu: function (wu, graphName) {
+        loadGraphFromWu: function (wu, graphName, refresh) {
             var deferred = new Deferred();
             this.main.setMessage(this.i18n.FetchingData);
             var context = this;
@@ -473,7 +473,7 @@ define([
                 context.main.setMessage("");
                 context.loadGraphFromXGMML(xgmml, svg);
                 deferred.resolve();
-            });
+            }, refresh);
             return deferred.promise;
         },
 

+ 4 - 1
plugins/javaembed/javaembed.cpp

@@ -1297,13 +1297,16 @@ public:
         {
             prevtext.clear();
             // Name should be in the form class.method:signature
-            const char *funcname = strchr(text, '.');
+            const char *funcname = strrchr(text, '.');
             if (!funcname)
                 throw MakeStringException(MSGAUD_user, 0, "javaembed: Invalid import name %s - Expected classname.methodname:signature", text.str());
             const char *signature = strchr(funcname, ':');
             if (!signature)
                 throw MakeStringException(MSGAUD_user, 0, "javaembed: Invalid import name %s - Expected classname.methodname:signature", text.str());
             StringBuffer classname(funcname-text, text);
+            // While it's probably preferred for people to use . as the separator in nested classes (to match java import statement),
+            // we accept / too (to match what you would see in the jar)
+            classname.replace('/', '.');
             funcname++;  // skip the '.'
             StringBuffer methodname(signature-funcname, funcname);
             signature++; // skip the ':'

+ 6 - 1
roxie/ccd/ccdserver.cpp

@@ -19579,7 +19579,12 @@ public:
 
     virtual void stop(bool aborting)
     {
-        if (state != STATEstopped)
+        if (state == STATEreset)
+        {
+            stopDependencies(savedExtractSize, savedExtract, WhenSuccessId);
+            stopDependencies(savedExtractSize, savedExtract, WhenFailureId);
+        }
+        else if (state != STATEstopped)
         {
             stopDependencies(savedExtractSize, savedExtract, aborting ? WhenSuccessId : WhenFailureId);  // These ones don't get executed
             executeDependencies(savedExtractSize, savedExtract, aborting ? WhenFailureId : WhenSuccessId); // These ones do

+ 10 - 0
testing/regress/ecl/ifwhen.ecl

@@ -0,0 +1,10 @@
+ds1 := DATASET(['Should not appear'], {STRING msg});
+ds2 := DATASET(['Should not appear either'], {STRING msg});
+ds3 := DATASET(['Should appear'],{STRING msg});
+
+whenClause := OUTPUT(ds1);
+
+falsearm := WHEN(ds2, whenClause, SUCCESS);
+truearm := ds3;
+
+OUTPUT(IF(nofold(true), truearm, falsearm));

+ 3 - 0
testing/regress/ecl/key/ifwhen.xml

@@ -0,0 +1,3 @@
+<Dataset name='Result 2'>
+ <Row><msg>Should appear</msg></Row>
+</Dataset>

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

@@ -0,0 +1,14 @@
+<Dataset name='Result 1'>
+ <Row><letter>A</letter></Row>
+ <Row><letter>F</letter></Row>
+ <Row><letter>K</letter></Row>
+ <Row><letter>P</letter></Row>
+ <Row><letter>U</letter></Row>
+</Dataset>
+<Dataset name='Result 2'>
+ <Row><i>1</i><letters><Row><letter>A</letter></Row><Row><letter>F</letter></Row></letters></Row>
+ <Row><i>2</i><letters><Row><letter>B</letter></Row><Row><letter>G</letter></Row></letters></Row>
+ <Row><i>3</i><letters><Row><letter>C</letter></Row><Row><letter>H</letter></Row></letters></Row>
+ <Row><i>4</i><letters><Row><letter>D</letter></Row><Row><letter>I</letter></Row></letters></Row>
+ <Row><i>5</i><letters><Row><letter>E</letter></Row><Row><letter>J</letter></Row></letters></Row>
+</Dataset>

+ 31 - 0
testing/regress/ecl/sample2.ecl

@@ -0,0 +1,31 @@
+SomeFile1 := DATASET([{'A'},{'B'},{'C'},{'D'},{'E'},
+                     {'F'},{'G'},{'H'},{'I'},{'J'},
+                     {'K'},{'L'},{'M'},{'N'},{'O'},
+                     {'P'},{'Q'},{'R'},{'S'},{'T'},
+                     {'U'},{'V'},{'W'},{'X'},{'Y'}],
+                     {STRING1 Letter});
+
+Sample_interval := 5 : stored('x');
+Sample_number := 1 : stored('y');
+string1 Letter := 'Z' : stored('Letter');
+
+MySet1 := SAMPLE(SomeFile1,Sample_interval,IF(Letter='A',Sample_number*10, 1));
+
+MySet1;
+
+
+r1 := {unsigned i};
+r2 := {STRING1 Letter};
+r3 := RECORD(r1)
+    DATASET(r2) letters;
+END;
+
+ds := DATASET(5, transform({unsigned i}, SELF.i := COUNTER));
+
+
+r3 t(r1 l) := TRANSFORM
+    SELF.letters := CHOOSEN(SAMPLE(SOmeFile1, Sample_interval, l.i), 2);
+    SELF := l;
+END;
+
+OUTPUT(PROJECT(ds, t(LEFT)));

+ 1 - 1
thorlcr/activities/join/thjoinslave.cpp

@@ -502,7 +502,7 @@ public:
             ActPrintLog("JOIN barrier.1 raised");
 
             // primaryWriter will keep as much in memory as possible.
-            Owned<IRowWriterMultiReader> primaryWriter = createOverflowableBuffer(*this, this, false);
+            Owned<IRowWriterMultiReader> primaryWriter = createOverflowableBuffer(*this, primaryRowIf, false);
             primaryStream.setown(sorter->startMerge(totalrows));
             copyRowStream(primaryStream, primaryWriter);
             primaryStream.setown(primaryWriter->getReader()); // NB: rhsWriter no longer needed after this point