trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sand...@apache.org
Subject [01/10] incubator-trafodion git commit: Changes to remove restriction to use vsbb for upserts on base table.
Date Tue, 14 Feb 2017 07:44:14 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 3d7a61258 -> 5881cf1c5


Changes to remove restriction to use vsbb for upserts on base table.


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

Branch: refs/heads/master
Commit: d92de579a7ee11ba46ce1990bd784f0e85b15c69
Parents: 8f06af3
Author: Sandhya Sundaresan <sandhya@apache.org>
Authored: Thu Jan 26 22:01:05 2017 +0000
Committer: Sandhya Sundaresan <sandhya@apache.org>
Committed: Thu Jan 26 22:01:05 2017 +0000

----------------------------------------------------------------------
 core/sql/executor/ExHbaseIUD.cpp    | 101 ++++++++++++++++++++++++++-----
 core/sql/generator/GenPreCode.cpp   |  12 +++-
 core/sql/generator/GenRelUpdate.cpp |  14 +++--
 3 files changed, 104 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d92de579/core/sql/executor/ExHbaseIUD.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHbaseIUD.cpp b/core/sql/executor/ExHbaseIUD.cpp
index 849e28f..74bf64e 100644
--- a/core/sql/executor/ExHbaseIUD.cpp
+++ b/core/sql/executor/ExHbaseIUD.cpp
@@ -912,8 +912,22 @@ ExWorkProcRetcode ExHbaseAccessUpsertVsbbSQTcb::work()
 	    copyRowIDToDirectBuffer(rowId_);
 
 	    currRowNum_++;
-	    matches_++;
-
+            // temp code below.WIll remove the envvar after this
+            //has got enough exposure in  testing.
+            if (getenv("TURN_OFF_RETURNROW")) 
+              matches_++;
+            else
+              {
+                if (!hbaseAccessTdb().returnRow())
+                  matches_++;
+                // if we are returning a row moveRowToUpQueue will increment matches_
+                else
+                  {
+                    step_ = RETURN_ROW;
+                    break;
+                  } 
+              }
+            
 	    if (currRowNum_ < hbaseAccessTdb().getHbaseRowsetVsbbSize())
 	      {
 		step_ = DONE;
@@ -924,6 +938,58 @@ ExWorkProcRetcode ExHbaseAccessUpsertVsbbSQTcb::work()
 	  }
 	  break;
 
+        case RETURN_ROW:
+          {
+            if (qparent_.up->isFull())
+	      return WORK_OK;
+	   
+	    if (returnUpdateExpr())
+	      {
+		ex_queue_entry * up_entry = qparent_.up->getTailEntry();
+
+	 	// allocate tupps where returned rows will be created
+                if (allocateUpEntryTupps(
+                         -1,
+                         0,
+                         hbaseAccessTdb().returnedTuppIndex_,
+                         hbaseAccessTdb().returnUpdatedRowLen_,
+                         FALSE,
+                         &rc))
+              return rc;
+
+                ex_expr::exp_return_type exprRetCode =
+		  returnUpdateExpr()->eval(up_entry->getAtp(), workAtp_);
+		if (exprRetCode == ex_expr::EXPR_ERROR)
+		  {
+		    step_ = HANDLE_ERROR;
+		    break;
+		  }
+		
+		rc = 0;
+		// moveRowToUpQueue also increments matches_
+		if (moveRowToUpQueue(&rc))
+		  return 1;
+              }
+            else
+	      {
+		rc = 0;
+		// moveRowToUpQueue also increments matches_
+		if (moveRowToUpQueue(convertRow_, hbaseAccessTdb().convertRowLen(), 
+				     &rc, FALSE))
+		  return 1;
+	      }
+
+            if (currRowNum_ < hbaseAccessTdb().getHbaseRowsetVsbbSize())
+              step_ = DONE;
+            else
+              step_ = PROCESS_INSERT_AND_CLOSE;
+
+            break;
+
+
+
+          }
+          break;
 	case PROCESS_INSERT_AND_CLOSE:
 	  {
             numRowsInVsbbBuffer_ = patchDirectRowBuffers();
@@ -1022,9 +1088,10 @@ ExWorkProcRetcode ExHbaseAccessUpsertVsbbSQTcb::work()
 	    if (NOT hbaseAccessTdb().computeRowsAffected())
 	      matches_ = 0;
 
-	    if ((step_ == DONE) &&
+             if ((step_ == DONE) &&
 		(qparent_.down->getLength() == 1))
 	      {
+                
 		// only one row in the down queue.
 
 		// Before we send input buffer to hbase, give parent
@@ -1042,7 +1109,10 @@ ExWorkProcRetcode ExHbaseAccessUpsertVsbbSQTcb::work()
 
 		numRetries_++;
 		return WORK_CALL_AGAIN;
-	      }
+                
+                step_ = PROCESS_INSERT_AND_CLOSE;
+                break;
+                }
 
 	    if (handleDone(rc, (step_ == ALL_DONE  ? matches_ : 0)))
 	      return rc;
@@ -1616,21 +1686,20 @@ ExWorkProcRetcode ExHbaseAccessBulkLoadPrepSQTcb::work()
       {
 	if (qparent_.up->isFull())
 	      return WORK_OK;
-	    
+
 	if (returnUpdateExpr())
 	{
-	  ex_queue_entry * up_entry = qparent_.up->getTailEntry();
-	  
-	  // allocate tupps where returned rows will be created
-	  if (allocateUpEntryTupps(
-				   -1,
-				   0,
-				   hbaseAccessTdb().returnedTuppIndex_,
-				   hbaseAccessTdb().returnUpdatedRowLen_,
-				   FALSE,
-				   &rc))
+	  ex_queue_entry * up_entry = qparent_.up->getTailEntry();	 
 	    return rc;
-	  
+            // allocate tupps where returned rows will be created
+            if (allocateUpEntryTupps(
+                 -1,
+                 0,
+                 hbaseAccessTdb().returnedTuppIndex_,
+                 hbaseAccessTdb().returnUpdatedRowLen_,
+                 FALSE,
+                 &rc))  
+              return 1;
 	  ex_expr::exp_return_type exprRetCode =
 	    returnUpdateExpr()->eval(up_entry->getAtp(), workAtp_);
 	  if (exprRetCode == ex_expr::EXPR_ERROR)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d92de579/core/sql/generator/GenPreCode.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenPreCode.cpp b/core/sql/generator/GenPreCode.cpp
index 6551132..b3373b7 100644
--- a/core/sql/generator/GenPreCode.cpp
+++ b/core/sql/generator/GenPreCode.cpp
@@ -5469,6 +5469,10 @@ RelExpr * HbaseInsert::preCodeGen(Generator * generator,
       (getInliningInfo().isEffectiveGU()))
     inlinedActions = TRUE;
 
+  // Allow projecting rows if the upsert has IM. 
+  if (inlinedActions && isUpsert())
+    setReturnRow(TRUE);
+
   if (((getTableDesc()->getNATable()->isHbaseRowTable()) ||
        (getTableDesc()->getNATable()->isHbaseCellTable())) &&
       (producesOutputs()))
@@ -5484,11 +5488,15 @@ RelExpr * HbaseInsert::preCodeGen(Generator * generator,
       ((getInsertType() == Insert::VSBB_INSERT_USER) ||
        (getInsertType() == Insert::UPSERT_LOAD)))
     {
-      if ((inlinedActions || producesOutputs())&& !getIsTrafLoadPrep())
- 	setInsertType(Insert::SIMPLE_INSERT);
+      // Remove this restriction
+      /* if ((inlinedActions || producesOutputs())&& !getIsTrafLoadPrep())
+         setInsertType(Insert::SIMPLE_INSERT);*/
+      
     }
 
   
+
+  
   // if there are blob columns, use simple inserts.
   if ( getTableDesc()->getNATable()->hasLobColumn())
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d92de579/core/sql/generator/GenRelUpdate.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelUpdate.cpp b/core/sql/generator/GenRelUpdate.cpp
index f3dbf58..a62aa7f 100644
--- a/core/sql/generator/GenRelUpdate.cpp
+++ b/core/sql/generator/GenRelUpdate.cpp
@@ -2173,9 +2173,13 @@ short HbaseInsert::codeGen(Generator *generator)
 
   // allocate a map table for the retrieved columns
   MapTable * last_map_table = generator->getLastMapTable();
+  NABoolean inlinedActions = FALSE;
+  if ((getInliningInfo().hasInlinedActions()) ||
+      (getInliningInfo().isEffectiveGU()))
+    inlinedActions = TRUE;
 
   NABoolean returnRow = getReturnRow(this, getIndexDesc());
-  if (getIsTrafLoadPrep())
+  if (getIsTrafLoadPrep() || (isUpsert() && inlinedActions))
     returnRow = isReturnRow();
 
   ex_cri_desc * givenDesc = generator->getCriDesc(Generator::DOWN);
@@ -2799,8 +2803,8 @@ short HbaseInsert::codeGen(Generator *generator)
 	  (noCheck()))
 	hbasescan_tdb->setHbaseSqlIUD(FALSE);
 
-      if (((getInsertType() == Insert::VSBB_INSERT_USER) && 
-                   generator->oltOptInfo()->multipleRowsReturned()) ||
+      if (((((getInsertType() == Insert::VSBB_INSERT_USER) || isUpsert() )&& 
+           generator->oltOptInfo()->multipleRowsReturned())) ||
 	  (getInsertType() == Insert::UPSERT_LOAD))
       {
 	hbasescan_tdb->setVsbbInsert(TRUE);
@@ -2810,8 +2814,8 @@ short HbaseInsert::codeGen(Generator *generator)
            setVsbbInsert(TRUE);
       }
 
-      if ((isUpsert()) &&
-	  (getInsertType() == Insert::UPSERT_LOAD))
+      
+        if (getInsertType() == Insert::UPSERT_LOAD)
 	{
 	  // this will cause tupleflow operator to send in an EOD to this upsert
 	  // operator. On seeing that, executor will flush the buffers.


Mime
View raw message