Browse Source

Merge pull request #4998 from ghalliday/issue9947

HPCC-9947 Improve the warning for an invalid use of NOTHOR

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 years ago
parent
commit
8a8d98ff03
2 changed files with 7 additions and 2 deletions
  1. 3 1
      ecl/hqlcpp/hqlcerrors.hpp
  2. 4 1
      ecl/hqlcpp/hqlttcpp.cpp

+ 3 - 1
ecl/hqlcpp/hqlcerrors.hpp

@@ -253,6 +253,7 @@
 #define HQLWRN_AmbiguousRollupCondition         4541
 #define HQLWRN_AmbiguousRollupNoGroup           4542
 #define HQLWRN_GlobalActionDependendOnScope     4543
+#define HQLWRN_NoThorContextDependent           4544
 
 //Temporary errors
 #define HQLERR_OrderOnVarlengthStrings          4601
@@ -504,7 +505,7 @@
 #define HQLWRN_CsvMaxLengthMismatch_Text        "CSV read: Max length of record (%d) exceeds the max length (%d) specified on the csv attribute"
 #define HQLWRN_KeyedFoldedToGap_Text            "KEYED(%s) follows component %s which is always matched in the key%s"
 #define HQLWRN_FoldRemoveKeyed_Text             "The key condition for field (%s) on key%s is always true"
-#define HQLWRN_GlobalDoesntSeemToBe_Text        "Expression%s marked as global seems to be context dependent"
+#define HQLWRN_GlobalDoesntSeemToBe_Text        "Global expression%s appears to access a parent dataset - this may cause a dataset not active error"
 #define HQLWRN_GroupedJoinIsLookupJoin_Text     "JOIN(,GROUPED) is implemented as a MANY LOOKUP join.  This may be inefficient in thor."
 #define HQLWRN_ImplicitJoinLimit_Text           "Implicit LIMIT(%d) added to keyed join%s"
 #define HQLWRN_ImplicitReadLimit_Text           "Neither LIMIT() nor CHOOSEN() supplied for index read on %s"
@@ -527,6 +528,7 @@
 #define HQLWRN_AmbiguousRollupCondition_Text    "ROLLUP condition on '%s' is also modified in the transform"
 #define HQLWRN_AmbiguousRollupNoGroup_Text      "ROLLUP condition - no fields are preserved in the transform - not converted to GROUPed ROLLUP"
 #define HQLWRN_GlobalActionDependendOnScope_Text "Global action appears to be context dependent - this may cause a dataset not active error"
+#define HQLWRN_NoThorContextDependent_Text      "NOTHOR expression%s appears to access a parent dataset - this may cause a dataset not active error"
 
 #define HQLERR_OrderOnVarlengthStrings_Text     "Rank/Ranked not supported on variable length strings"
 #define HQLERR_DistributionNoSequence_Text      "DISTRIBUTION() only supported at the outer level"

+ 4 - 1
ecl/hqlcpp/hqlttcpp.cpp

@@ -7353,7 +7353,10 @@ IHqlExpression * ExplicitGlobalTransformer::createTransformed(IHqlExpression * e
                         if (symbol)
                             s.append(" in ").append(symbol->queryName());
                     }
-                    translator.reportWarning(queryActiveLocation(expr), ECODETEXT(HQLWRN_GlobalDoesntSeemToBe), s.str());
+                    if (op == no_nothor)
+                        translator.reportWarning(queryActiveLocation(expr), ECODETEXT(HQLWRN_NoThorContextDependent), s.str());
+                    else
+                        translator.reportWarning(queryActiveLocation(expr), ECODETEXT(HQLWRN_GlobalDoesntSeemToBe), s.str());
                 }
                 if (value->getOperator() == no_createset)
                 {