Jelajahi Sumber

HPCC-9965 Add a ,UNSTABLE flag to a JOIN

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 11 tahun lalu
induk
melakukan
2a992a3534
4 mengubah file dengan 14 tambahan dan 1 penghapusan
  1. 10 0
      ecl/hql/hqlgram.y
  2. 2 0
      ecl/hqlcpp/hqlhtcpp.cpp
  3. 1 1
      ecl/regress/join.ecl
  4. 1 0
      rtl/include/eclhelper.hpp

+ 10 - 0
ecl/hql/hqlgram.y

@@ -10162,6 +10162,16 @@ JoinFlag
                             OwnedHqlExpr impliedAttr = createComma(createAttribute(lookupAtom), createAttribute(manyAtom));
                             $$.setExpr(createComma(groupAttr.getClear(), impliedAttr.getClear()), $1);
                         }
+    | STABLE
+                        {
+                            $$.setExpr(createExprAttribute(stableAtom));
+                            $$.setPosition($1);
+                        }
+    | UNSTABLE
+                        {
+                            $$.setExpr(createExprAttribute(unstableAtom));
+                            $$.setPosition($1);
+                        }
     ;
 
 

+ 2 - 0
ecl/hqlcpp/hqlhtcpp.cpp

@@ -11785,6 +11785,8 @@ ABoundActivity * HqlCppTranslator::doBuildActivityJoinOrDenormalize(BuildCtx & c
     if (isAlreadySorted(dataset2, joinInfo.queryRightSort(), true, true) || userPreventsSort(noSortAttr, no_right))
         flags.append("|JFrightSortedLocally");
     if (isSmartJoin) flags.append("|JFsmart|JFmanylookup");
+    if (isSmartJoin || expr->hasAttribute(unstableAtom))
+        flags.append("|JFunstable");
 
     if (flags.length())
         doBuildUnsignedFunction(instance->classctx, "getJoinFlags", flags.str()+1);

+ 1 - 1
ecl/regress/join.ecl

@@ -78,5 +78,5 @@ JoinedF := join (dNamesTable, dAddressTable,
 
 output(JoinedF,,'out.d00',overwrite);
 
-JoinedF2 := join (dNamesTable, dAddressTable, LEFT.surname != RIGHT.surname, JoinTransform (LEFT, RIGHT), ALL, parallel);
+JoinedF2 := join (dNamesTable, dAddressTable, LEFT.surname != RIGHT.surname, JoinTransform (LEFT, RIGHT), ALL, parallel,unstable);
 output(JoinedF2,,'out2.d00',overwrite);

+ 1 - 0
rtl/include/eclhelper.hpp

@@ -1577,6 +1577,7 @@ enum {
     JFleftSortedLocally          = 0x04000000,
     JFrightSortedLocally         = 0x08000000,
     JFsmart                      = 0x10000000,
+    JFunstable                   = 0x20000000, // can sorts be unstable?
 };
 
 // FetchFlags