Przeglądaj źródła

Ensure GLOBAL(cluster) uses a constant expression

Fixes a core when a variable cluster name is used as the second
parameter of GLOBAL(action, <cluster>).

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 13 lat temu
rodzic
commit
12e663dd35
2 zmienionych plików z 9 dodań i 3 usunięć
  1. 6 1
      ecl/hql/hqlgram.y
  2. 3 2
      ecl/hqlcpp/hqlttcpp.cpp

+ 6 - 1
ecl/hql/hqlgram.y

@@ -2494,9 +2494,14 @@ actionStmt
                             $$.setExpr(createValue(no_distribution, makeVoidType(), dataset, fields, $7.getExpr()));
                         }
     | assertAction
+    | GLOBAL '(' action ')'
+                        {
+                            $$.setExpr($3.getExpr());
+                            $$.setPosition($1);
+                        }
     | GLOBAL '(' action ',' expression ')'
                         {
-                            parser->normalizeExpression($5, type_string, false);
+                            parser->normalizeExpression($5, type_string, true);
                             if (isBlankString($5.queryExpr()))
                             {
                                 $5.release();

+ 3 - 2
ecl/hqlcpp/hqlttcpp.cpp

@@ -11898,8 +11898,9 @@ protected:
     IHqlExpression * createSubstitutedChild(IHqlExpression * expr, IHqlExpression * cluster)
     {
         StringBuffer clusterText;
-        cluster->queryValue()->getStringValue(clusterText);
-        ctxCallback->noteCluster(clusterText.str());
+        getStringValue(clusterText, cluster);
+        if (clusterText.length())
+            ctxCallback->noteCluster(clusterText.str());
 #if 0
         Owned<IConstWUClusterInfo> clusterInfo = wu->getClusterInfo(clusterText.str());
         if (clusterInfo)