You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by su...@apache.org on 2015/09/17 22:04:06 UTC

[4/5] incubator-trafodion git commit: Review rework

Review rework


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/f55ef5cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/f55ef5cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/f55ef5cd

Branch: refs/heads/master
Commit: f55ef5cd84e8b222fff82e63f093be61c02cd599
Parents: 225d2e4
Author: Suresh Subbiah <su...@apache.org>
Authored: Thu Sep 17 18:11:51 2015 +0000
Committer: Suresh Subbiah <su...@apache.org>
Committed: Thu Sep 17 18:11:51 2015 +0000

----------------------------------------------------------------------
 core/sql/executor/ExHbaseIUD.cpp | 18 ++++++++----------
 core/sql/optimizer/Inlining.cpp  |  8 +++++++-
 2 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f55ef5cd/core/sql/executor/ExHbaseIUD.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHbaseIUD.cpp b/core/sql/executor/ExHbaseIUD.cpp
index 45077f7..5e810a4 100644
--- a/core/sql/executor/ExHbaseIUD.cpp
+++ b/core/sql/executor/ExHbaseIUD.cpp
@@ -440,7 +440,13 @@ ExWorkProcRetcode ExHbaseAccessInsertSQTcb::work()
 
 	case SETUP_INSERT:
 	  {
-	    step_ = EVAL_INSERT_EXPR;
+	    rc = evalInsDelPreCondExpr();
+	    if (rc == -1)
+	      step_ = HANDLE_ERROR;
+	    else if (rc == 0)
+	      step_ = INSERT_CLOSE;
+	    else // expr is true or does not exist
+	      step_ = EVAL_INSERT_EXPR;
 	  }
 	  break;
 
@@ -472,15 +478,7 @@ ExWorkProcRetcode ExHbaseAccessInsertSQTcb::work()
 	  {
 	    rc = applyPred(scanExpr());
 	    if (rc == 1) // expr is true or no expr
-	      {
-		 rc = evalInsDelPreCondExpr();
-		 if (rc == -1)
-		   step_ = HANDLE_ERROR;
-		 else if (rc == 0)
-		   step_ = INSERT_CLOSE;
-		 else
-		   step_ = CREATE_MUTATIONS;
-	      }
+	      step_ = CREATE_MUTATIONS;
 	    else if (rc == 0) // expr is false
 	      step_ = INSERT_CLOSE;
 	    else // error

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f55ef5cd/core/sql/optimizer/Inlining.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/Inlining.cpp b/core/sql/optimizer/Inlining.cpp
index 3384fc5..99f03cd 100644
--- a/core/sql/optimizer/Inlining.cpp
+++ b/core/sql/optimizer/Inlining.cpp
@@ -1891,7 +1891,8 @@ static RelExpr *createIMNode(BindWA *bindWA,
   // key belonging to a different row). Hence in this case, it is better to always
   // match not only the index key but also remaining columns in the index table
   // that correspond to the base table. Hence we introduce 
-  // robustDelete below. 
+  // robustDelete below. This flag could also be called 
+  // isIMOnAUniqueIndexForMerge
   NABoolean robustDelete = isForMerge && index->isUniqueIndex();
 
   tableCorrName.setCorrName((isIMInsert)?  NEWCorr : OLDCorr);
@@ -1919,6 +1920,11 @@ static RelExpr *createIMNode(BindWA *bindWA,
     colRefList->insert(colRef);
   }
 
+  // There are 4 cases here. Following table shows when precondition
+  // expression is addded
+  // Index Type/IM operation->  Delete  | Insert
+  // Non-unique Index           Yes        No 
+  // Unique Index               Yes        Yes
   if ((!isIMInsert && isForUpdate)||robustDelete)
     {
       // For delete nodes that are part of an update, generate a