Browse Source

HPCC-10537 Generate a warning if MERGEJOIN is not specified as LOCAL

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 10 years ago
parent
commit
402d2e4cdb
2 changed files with 11 additions and 1 deletions
  1. 3 0
      ecl/hqlcpp/hqlcerrors.hpp
  2. 8 1
      ecl/hqlcpp/hqlstep.cpp

+ 3 - 0
ecl/hqlcpp/hqlcerrors.hpp

@@ -259,6 +259,7 @@
 #define HQLWRN_AmbiguousRollupNoGroup           4542
 #define HQLWRN_GlobalActionDependendOnScope     4543
 #define HQLWRN_NoThorContextDependent           4544
+#define HQLWRN_OnlyLocalMergeJoin               4545
 
 //Temporary errors
 #define HQLERR_OrderOnVarlengthStrings          4601
@@ -534,6 +535,8 @@
 #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 HQLWRN_OnlyLocalMergeJoin_Text          "Only LOCAL versions of %s are currently supported on THOR"
+
 #define HQLERR_DistributionVariableLengthX_Text "DISTRIBUTION does not support variable length field '%s'"
 #define HQLERR_DistributionUnsupportedTypeXX_Text "DISTRIBUTION does not support field '%s' with type %s"
 

+ 8 - 1
ecl/hqlcpp/hqlstep.cpp

@@ -848,10 +848,17 @@ ABoundActivity * HqlCppTranslator::doBuildActivityNWayMerge(BuildCtx & ctx, IHql
 
 ABoundActivity * HqlCppTranslator::doBuildActivityNWayMergeJoin(BuildCtx & ctx, IHqlExpression * expr)
 {
+    node_operator op = expr->getOperator();
+    if (targetThor() && !isLocalActivity(expr) && !isGroupedActivity(expr) && !insideChildQuery(ctx))
+    {
+        WARNING1(CategoryUnexpected, HQLWRN_OnlyLocalMergeJoin, getOpString(op));
+        OwnedHqlExpr localExpr = appendLocalAttribute(expr);
+        return doBuildActivityNWayMergeJoin(ctx, localExpr);
+    }
+
     IHqlExpression * dataset = expr->queryChild(0);
     CIArrayOf<ABoundActivity> inputs;
     bool isNWayInput = buildNWayInputs(inputs, ctx, dataset);
-    node_operator op = expr->getOperator();
 
     ThorActivityKind kind = (op == no_mergejoin) ? TAKnwaymergejoin : TAKnwayjoin;
     Owned<ActivityInstance> instance = new ActivityInstance(*this, ctx, kind, expr, "NWayMergeJoin");