Exemple #1
0
//
// Constructor for sort_grby_tcb
//
ex_sort_grby_tcb::ex_sort_grby_tcb(const ex_sort_grby_tdb &  sort_grby_tdb, 
				   const ex_tcb &    child_tcb,   // child queue pair
				   ex_globals * glob
				    ) : 
    ex_tcb( sort_grby_tdb, 1, glob),
    pool_(NULL)
{
  Space * space = (glob ? glob->getSpace() : 0);
  CollHeap * heap = (glob ? glob->getDefaultHeap() : 0);
  
  childTcb_ = &child_tcb;

  // Allocate the buffer pool
#pragma nowarn(1506)   // warning elimination 
  pool_ = new(space) ExSimpleSQLBuffer(sort_grby_tdb.numBuffers_,
				       sort_grby_tdb.bufferSize_,
		                       recLen(),
				       space);
#pragma warn(1506)  // warning elimination 

  // get the child queue pair
  qchild_  = child_tcb.getParentQueue(); 

  // Allocate the queue to communicate with parent
  allocateParentQueues(qparent_);

  // Intialize processedInputs_ to the next request to process
  processedInputs_ = qparent_.down->getTailIndex();

  // allocate work atp
  workAtp_ = allocateAtp(sort_grby_tdb.criDescUp_,getSpace());

  // fixup aggr expression
  if (aggrExpr())
    (void) aggrExpr()->fixup(0, getExpressionMode(), this, space, heap,
			     glob->computeSpace());

  // fixup move expression
  if (moveExpr())
    (void) moveExpr()->fixup(0, getExpressionMode(), this, space, heap,
			     glob->computeSpace());

  // fixup grby expression
  if (grbyExpr())
    (void) grbyExpr()->fixup(0, getExpressionMode(), this, space, heap,
			     glob->computeSpace());

  // fixup having expression
  if (havingExpr())
    (void) havingExpr()->fixup(0, getExpressionMode(), this, space, heap,
			       glob->computeSpace());

}
// ExSampleTcb constructor
//
// 1. Allocate buffer pool.
// 2. Allocate parent queues and initialize private state.
// 3. Fixup expressions.
//
ExSampleTcb::ExSampleTcb
(const ExSampleTdb &  myTdb, 
 const ex_tcb &    child_tcb,
 ex_globals * glob
 ) : 
  ex_tcb(myTdb, 1, glob)
{
  Space * space = (glob ? glob->getSpace() : 0);
  CollHeap * heap = (glob ? glob->getDefaultHeap() : 0);
  
  childTcb_ = &child_tcb;

   // get the queue that child use to communicate with me
  qchild_  = child_tcb.getParentQueue(); 

  // Allocate the queue to communicate with parent
  qparent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
							myTdb.queueSizeDown_,
				     myTdb.criDescDown_,
				     space);
  
  // Allocate the private state in each entry of the down queue
  ExSamplePrivateState *p 
    = new(space) ExSamplePrivateState(this);
  qparent_.down->allocatePstate(p, this);
  delete p;


  qparent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
				    myTdb.queueSizeUp_,
				    myTdb.criDescUp_,
				    space);

  // Intialized processedInputs_ to the next request to process
  processedInputs_ = qparent_.down->getTailIndex();

  // Fixup the sample expression
  //
  if (initExpr())
    initExpr()->fixup(0, getExpressionMode(), this, space, heap, FALSE, glob);

  if (balanceExpr())
    balanceExpr()->fixup(0, getExpressionMode(), this, space, heap, FALSE, glob);

  if (postPred())
    postPred()->fixup(0, getExpressionMode(), this, space, heap, FALSE, glob);
}
Exemple #3
0
//
// Constructor for ExIar tcb 
//
ExIarTcb::ExIarTcb (const ExIarTdb& iarTdb, 
		    ex_globals *glob
		   ) : ex_tcb( iarTdb, 1, glob)
{
   Space * space = (glob ? glob->getSpace() : 0);
   CollHeap * heap = (glob ? glob->getDefaultHeap() : 0);

   // Allocate the buffer pool
#pragma nowarn(1506)   // warning elimination
   pool_ = new(space) sql_buffer_pool(iarTdb.numBuffers_,
                                      iarTdb.bufferSize_,
                                      space);
#pragma warn(1506)  // warning elimination

   // Allocate the queue to communicate with parent.
   qparent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
                                       iarTdb.queueSizeDown_,
                                       iarTdb.criDescDown_,
                                       space
                                      );

   // Allocate the private state in each entry of the down queue
   ExIarPrivateState *p = new(space) ExIarPrivateState(this);
   qparent_.down->allocatePstate(p, this);
   delete p;

   qparent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
                                     iarTdb.queueSizeUp_,
                                     iarTdb.criDescUp_,
                                     space);

   // Fixup the column extraction expression, if any.
   if (iarTdb.getExtractExpr())
      iarTdb.getExtractExpr()->fixup(0, getExpressionMode(), this, space, heap);

   // Fixup the scan expression, if any.
   if (iarTdb.getScanExpr())
      iarTdb.getScanExpr()->fixup(0, getExpressionMode(), this, space, heap);

   // Fixup the projection expression.
   if (iarTdb.getProjExpr())
      iarTdb.getProjExpr()->fixup(0, getExpressionMode(), this, space, heap);

   // Allocate the work ATP.
   workAtp_ = allocateAtp(iarTdb.workCriDesc_, space);
};
/////////////////////////////////////////////////////////////////////////
//
//  TCB procedures
//
/////////////////////////////////////////////////////////////////////////
ExTupleFlowTcb::ExTupleFlowTcb(const ExTupleFlowTdb &  tuple_flow_tdb, 
			       const ex_tcb & src_tcb,    // src queue pair
			       const ex_tcb & tgt_tcb,    // tgt queue pair
			       ex_globals *glob
                         ) : ex_tcb( tuple_flow_tdb, 1, glob)
{
  CollHeap * space = glob->getSpace();
  
  // LCOV_EXCL_START
  // Allocate the buffer pool, if tgtExpr_ is present
  if (tuple_flow_tdb.tgtExpr_)
#pragma nowarn(1506)   // warning elimination 
    pool_ = new(glob->getSpace()) sql_buffer_pool(tuple_flow_tdb.numBuffers_,
						  tuple_flow_tdb.bufferSize_,
						  glob->getSpace());
#pragma warn(1506)  // warning elimination 
  // LCOV_EXCL_STOP
  
  tcbSrc_ = &src_tcb;
  tcbTgt_ = &tgt_tcb;

  // get the queues that src and tgt use to communicate with me
  qSrc_  = src_tcb.getParentQueue();
  qTgt_  = tgt_tcb.getParentQueue();

  ex_cri_desc * from_parent_cri = tuple_flow_tdb.criDescDown_;  
  ex_cri_desc * to_parent_cri   = tuple_flow_tdb.criDescUp_;

  // Allocate the queue to communicate with parent
  qParent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
				      tuple_flow_tdb.queueSizeDown_,
				      from_parent_cri,
				      space);

  // source atps will be copied to target atps. Allocate
  // target atps.
  qTgt_.down->allocateAtps(space);
  
  // Allocate the private state in each entry of the down queue
  ExTupleFlowPrivateState *p =
    new(space) ExTupleFlowPrivateState(this);
  qParent_.down->allocatePstate(p, this);
  delete p;

  qParent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
				    tuple_flow_tdb.queueSizeUp_,
				    to_parent_cri,
				    space);

  // LCOV_EXCL_START  
  // fixup expressions
  if (tflowTdb().tgtExpr_)
    (void) tflowTdb().tgtExpr_->fixup(0, getExpressionMode(), this,
  				      glob->getSpace(), glob->getDefaultHeap(), FALSE, glob);
  // LCOV_EXCL_STOP
    
}
//
// Constructor for firstn_tcb
//
ExFirstNTcb::ExFirstNTcb(const ExFirstNTdb & firstn_tdb, 
			 const ex_tcb & child_tcb,    // child queue pair
			 ex_globals *glob
			 ) : ex_tcb( firstn_tdb, 1, glob),
                             step_(INITIAL_)
{
  childTcb_ = &child_tcb;
  
  Space * space = glob->getSpace();
  CollHeap * heap = (glob ? glob->getDefaultHeap() : NULL);
  
  // Allocate the buffer pool
#pragma nowarn(1506)   // warning elimination 
  pool_ = new(space) sql_buffer_pool(firstn_tdb.numBuffers_,
				     firstn_tdb.bufferSize_,
				     space);
#pragma warn(1506)  // warning elimination 
  
  // get the queue that child use to communicate with me
  qchild_  = child_tcb.getParentQueue(); 
  
  // Allocate the queue to communicate with parent
  qparent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
				      firstn_tdb.queueSizeDown_,
				      firstn_tdb.criDescDown_,
				      space);
  
  // Allocate the private state in each entry of the down queue
  ExFirstNPrivateState p(this);
  qparent_.down->allocatePstate(&p, this);

  qparent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
				    firstn_tdb.queueSizeUp_,
				    firstn_tdb.criDescUp_,
				    space);

  workAtp_ = NULL;
  firstNParamVal_ = 0;
  if (firstn_tdb.workCriDesc_)
    {
      workAtp_ = allocateAtp(firstn_tdb.workCriDesc_, space);
      pool_->get_free_tuple(workAtp_->getTupp(firstn_tdb.workCriDesc_->noTuples()-1), 0);
      workAtp_->getTupp(firstn_tdb.workCriDesc_->noTuples()-1).
        setDataPointer((char*)&firstNParamVal_);
    }

  if (firstn_tdb.firstNRowsExpr_)
    {
      firstn_tdb.firstNRowsExpr_->fixup(0, getExpressionMode(), this,  space, heap, 
                                        FALSE, glob);
     }
};
////////////////////////////////////////////////////////////////
// Constructor for class ExTimeoutTcb
///////////////////////////////////////////////////////////////
ExTimeoutTcb::ExTimeoutTcb(const ExTimeoutTdb & timeout_tdb,
			   ExMasterStmtGlobals * glob)
  : ex_tcb( timeout_tdb, 1, glob)
{
  Space * space = (glob ? glob->getSpace() : 0);
  CollHeap * heap = (glob ? glob->getDefaultHeap() : 0);
  
  // Allocate the buffer pool
  pool_ = new(space) sql_buffer_pool(timeout_tdb.numBuffers_,
				     timeout_tdb.bufferSize_,
				     space);
  
  // Allocate the queue to communicate with parent
  qparent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
				      timeout_tdb.queueSizeDown_,
				      timeout_tdb.criDescDown_,
				      space);
  
  // Allocate the private state in each entry of the down queue
  ExTimeoutPrivateState *p = new(space) ExTimeoutPrivateState(this);
  qparent_.down->allocatePstate(p, this);
  delete p;
  
  qparent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
				    timeout_tdb.queueSizeUp_,
				    timeout_tdb.criDescUp_,
				    space);
  
  // Get the name of the table from the late-name-info in the root-tdb
  ex_root_tdb * rootTdb = (ex_root_tdb *) glob->getFragmentPtr(0) ;
  LateNameInfoList * lnil = rootTdb->getLateNameInfoList();
  ex_assert( lnil , "No late name info list in root TDB!");
  theTableName_ = lnil->getLateNameInfo(0).resolvedPhyName();
  ex_assert( theTableName_ , "No table name !");

  if (timeoutValueExpr())  {
    // allocate work atp to compute the timeout value
    workAtp_ = allocateAtp(timeout_tdb.workCriDesc_, space);
    
    // allocate tuple where the timeout value will be moved
    pool_->get_free_tuple(workAtp_->
			  getTupp(timeout_tdb.workCriDesc_->noTuples() - 1), 
			  sizeof(Lng32));
    
    (void) timeoutValueExpr()->fixup(0, getExpressionMode(), this,
				     space, heap, FALSE, glob);
  }
  else
    workAtp_ = 0;
}
ExVPJoinTcb::ExVPJoinTcb(const ExVPJoinTdb & vpjTdb,
			 const ex_tcb ** childTcbs,
			 ex_globals *glob)
  : ex_tcb(vpjTdb, 1, glob),
    childTcbs_(childTcbs)
{
  CollHeap * space = glob->getSpace();

  numChildren_ = vpjTdb.numChildren();

  // Allocate array of child queue pairs (i.e., queue pairs for
  // communicating with children.
  //
  qChild_ = (ex_queue_pair*) new (space) ex_queue_pair[numChildren_];

  // Initialize array.
  //
  Int32 i;
  for (i=0; i<numChildren_; i++)
    {
      qChild_[i] = childTcbs_[i]->getParentQueue();
    }

  // Allocate queue for passing requests from parent to this node,
  // and initialize private state associated with each queue entry.
  //
  qParent_.down = new (space) ex_queue(ex_queue::DOWN_QUEUE,
				       vpjTdb.fromParent_,
				       vpjTdb.givenCriDesc_,
				       space);
  ExVPJoinPrivateState ps(this);
  qParent_.down->allocatePstate(&ps, this);

  // Allocate queue for passing replies from this node to parent.
  //
  qParent_.up = new (space) ex_queue(ex_queue::UP_QUEUE,
				     vpjTdb.toParent_,
				     vpjTdb.returnedCriDesc_,
				     space);

  if (filterPred())
    (void) filterPred()->fixup(0, getExpressionMode(), this,
                               glob->getSpace(), glob->getDefaultHeap());

  // Record index of next down request.
  nextReqIx_ = qParent_.down->getHeadIndex();
}
////////////////////////////////////////////////////////////////
// Constructor for class ExExeUtilTcb
///////////////////////////////////////////////////////////////
ExExeUtilTcb::ExExeUtilTcb(const ComTdbExeUtil & exe_util_tdb,
			   const ex_tcb * child_tcb, // for child queue
			   ex_globals * glob)
     : ex_tcb( exe_util_tdb, 1, glob),
       workAtp_(NULL),
       query_(NULL),
       infoList_(NULL),
       infoListIsOutputInfo_(TRUE),
       explQuery_(NULL),
       childQueryId_(NULL),
       childQueryIdLen_(0),
       outputBuf_(NULL)
{
  Space * space = (glob ? glob->getSpace() : 0);
  CollHeap * heap = (glob ? glob->getDefaultHeap() : 0);

  // Allocate the buffer pool
#pragma nowarn(1506)   // warning elimination 
  pool_ = new(space) sql_buffer_pool(exe_util_tdb.numBuffers_,
				     exe_util_tdb.bufferSize_,
				     space);
#pragma warn(1506)  // warning elimination 
  
  childTcb_ = child_tcb;
  if (childTcb_)
    {
      qchild_  = childTcb_->getParentQueue();
    }

  // Allocate the queue to communicate with parent
  qparent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
				      exe_util_tdb.queueSizeDown_,
				      exe_util_tdb.criDescDown_,
				      space);
  
  qparent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
				    exe_util_tdb.queueSizeUp_,
				    exe_util_tdb.criDescUp_,
				    space);
  
  if (exe_util_tdb.workCriDesc_)
    {
      workAtp_ = allocateAtp(exe_util_tdb.workCriDesc_, glob->getSpace());
      pool_->get_free_tuple(workAtp_->getTupp(((ComTdbExeUtil&)exe_util_tdb).workAtpIndex()), 0);
    }
  
  tcbFlags_ = 0;
  
  if (exe_util_tdb.inputExpr_)
    (void)exe_util_tdb.inputExpr_->fixup(0, getExpressionMode(), this,
					 space, heap, FALSE, glob);
  if (exe_util_tdb.outputExpr_)
    (void)exe_util_tdb.outputExpr_->fixup(0, getExpressionMode(), this, 
					  space, heap, FALSE, glob);

  if (exe_util_tdb.scanExpr_)
    (void)exe_util_tdb.scanExpr_->fixup(0, getExpressionMode(), this, 
					  space, heap, FALSE, glob);

  ContextCli * currContext = 
    (glob->castToExExeStmtGlobals()->castToExMasterStmtGlobals() ?
     glob->castToExExeStmtGlobals()->castToExMasterStmtGlobals()->getStatement()->getContext() :
     NULL);
    
  // internal queries are already in isoMapping and do not need to be
  // translated before sending to mxcmp.
  // Set the ISO_MAPPING charset code to indicate that.
  char *parentQid;
  if (glob->castToExExeStmtGlobals()->castToExMasterStmtGlobals())
    parentQid = glob->castToExExeStmtGlobals()->castToExMasterStmtGlobals()->getStatement()->getUniqueStmtId();
  else
  if (glob->castToExExeStmtGlobals()->castToExEspStmtGlobals() &&
      glob->castToExExeStmtGlobals()->castToExEspStmtGlobals()->getStmtStats())
    parentQid = glob->castToExExeStmtGlobals()->castToExEspStmtGlobals()->getStmtStats()->getQueryId();
  else
    parentQid = NULL;

  cliInterface_ = new(heap) ExeCliInterface(heap,
					    SQLCHARSETCODE_ISO88591,  // ISO_MAPPING=ISO88591
					    currContext,
                                            parentQid);
  
  cliInterface2_ = new(heap) ExeCliInterface(heap,
					     SQLCHARSETCODE_ISO88591,  // ISO_MAPPING=ISO88591
					     currContext,
					     parentQid);
  
  //diagsArea_ = NULL;
  setDiagsArea(ComDiagsArea::allocate(getHeap()));

  pqStep_ = PROLOGUE_;

  VersionToString(COM_VERS_MXV, versionStr_);
  versionStrLen_ = DIGITS_IN_VERSION_NUMBER; 

  VersionToString(COM_VERS_MXV, sysVersionStr_);
  sysVersionStrLen_ = DIGITS_IN_VERSION_NUMBER;

  extractedPartsObj_ = NULL;
};
// ExSequenceTcb constructor
//
// 1. Allocate buffer pool.
// 2. Allocate parent queues and initialize private state.
// 3. Fixup expressions.
//
ExSequenceTcb::ExSequenceTcb (const ExSequenceTdb &  myTdb, 
                              const ex_tcb &    child_tcb,
                              ex_globals * glob) : 
  ex_tcb(myTdb, 1, glob),
  lastRow_(NULL),
  clusterDb_(NULL),
  cluster_(NULL),
  ioEventHandler_(NULL),
  OLAPBuffersFlushed_(FALSE),
  firstOLAPBuffer_(NULL),
  lastOLAPBuffer_(NULL),
  rc_(EXE_OK),
  olapBufferSize_(0),
  maxNumberOfOLAPBuffers_(0),
  numberOfOLAPBuffers_(0),
  minNumberOfOLAPBuffers_(0),
  memoryPressureDetected_(FALSE)
{

  Space * space = (glob ? glob->getSpace() : 0);
  CollHeap * heap = (glob ? glob->getDefaultHeap() : 0);
  heap_ = heap;

  childTcb_ = &child_tcb;

  // Allocate the buffer pool
#pragma nowarn(1506)   // warning elimination 
  pool_ = new(space) sql_buffer_pool(myTdb.numBuffers_,
    myTdb.bufferSize_,
    space);

  allocRowLength_ = ROUND8(myTdb.recLen_);

#pragma warn(1506)  // warning elimination 

  // Initialize the machinery for maintaining the row history for
  // computing sequence functions.
  //

  maxNumberHistoryRows_ = myTdb.maxHistoryRows_;
  minFollowing_ = myTdb.minFollowing_;
  unboundedFollowing_ = myTdb.isUnboundedFollowing();
  maxNumberOfOLAPBuffers_ = myTdb.maxNumberOfOLAPBuffers_;//testing
  olapBufferSize_ = myTdb.OLAPBufferSize_ ;
  maxRowsInOLAPBuffer_ = myTdb.maxRowsInOLAPBuffer_;
  minNumberOfOLAPBuffers_ = myTdb.minNumberOfOLAPBuffers_;
  numberOfWinOLAPBuffers_ = myTdb.numberOfWinOLAPBuffers_;
  overflowEnabled_ = ! myTdb.isNoOverflow();

  ex_assert( maxNumberOfOLAPBuffers_ >= minNumberOfOLAPBuffers_ ,
	     "maxNumberOfOLAPBuffers is too small");

  // Initialize history parameters
  // For unbounded following -- also create/initialize clusterDb, cluster
  initializeHistory();

  // get the queue that child use to communicate with me
  qchild_  = child_tcb.getParentQueue(); 

  // Allocate the queue to communicate with parent
  qparent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
    myTdb.initialQueueSizeDown_,
    myTdb.criDescDown_,
    space);

  // Allocate the private state in each entry of the down queue
  ExSequencePrivateState *p 
    = new(space) ExSequencePrivateState(this);
  qparent_.down->allocatePstate(p, this);
  delete p;

  qparent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
    myTdb.initialQueueSizeUp_,
    myTdb.criDescUp_,
    space);

  // Intialized processedInputs_ to the next request to process
  processedInputs_ = qparent_.down->getTailIndex();


  workAtp_ = allocateAtp(myTdb.criDescUp_, space);

  // Fixup the sequence function expression. This requires the standard
  // expression fixup plus initializing the GetRow method for the sequence
  // clauses.
  //
  if (sequenceExpr())
  {
    ((ExpSequenceExpression*)sequenceExpr())->seqFixup
      ((void*)this, GetHistoryRow, GetHistoryRowOLAP);
    sequenceExpr()->fixup(0, getExpressionMode(), this, space, heap_, FALSE, glob);
  }

  if (returnExpr())
  {
    ((ExpSequenceExpression*)returnExpr())->seqFixup
      ((void*)this, GetHistoryRow, GetHistoryRowFollowingOLAP);
    returnExpr()->fixup(0, getExpressionMode(), this, space, heap_, FALSE, glob);
  }

  if (postPred())
    postPred()->fixup(0, getExpressionMode(), this, space, heap_, FALSE, glob);


  if (cancelExpr())
    cancelExpr()->fixup(0, getExpressionMode(), this, space, heap_, FALSE, glob);

  if (checkPartitionChangeExpr())
  {
    ((ExpSequenceExpression*)checkPartitionChangeExpr())->seqFixup
      ((void*)this, GetHistoryRow, GetHistoryRowOLAP);
    checkPartitionChangeExpr()->fixup(0, getExpressionMode(), this, space, heap_, FALSE, glob);
  }
}
Exemple #10
0
// ExTransposeTcb::ExTransposeTcb() ------------------------------------
// Constructor for transpose TCB
//
ExTransposeTcb::ExTransposeTcb(const ExTransposeTdb &transTdbLocal,
			       const ex_tcb &childTcb,
			       ex_globals *glob) :
  ex_tcb(transTdbLocal, 1, glob) 
{
    
  childTcb_ = &childTcb;
  CollHeap *space = glob->getSpace();
  
  // Allocate the buffer pool
  //
  //pool_ = new(space) sql_buffer_pool(transTdb().numBuffers_,
  //transTdb().bufferSize_,
  //space);
  //
#pragma nowarn(1506)   // warning elimination 
  pool_ = new(space) ExSimpleSQLBuffer(transTdb().numBuffers_,
				       transTdb().bufferSize_, 
				       transTdb().transRowLen_,
				       space);
#pragma warn(1506)  // warning elimination
 
  // get the queue used by my child to communicate with me
  //
  childQueue_  = childTcb_->getParentQueue();
  
  // the Transpose TCB adds input tupps to its down queues, therefore we
  // need to allocate new ATPs for its children
  //
  childQueue_.down->allocateAtps(glob->getSpace());
  
  // Allocate the queue to communicate with parent
  // (Child allocates queue to communicate with Child)
  //
  qParent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
				      transTdb().queueSizeDown_,
				      transTdb().criDescDown_,
				      space);

  // Allocate the private state in each entry of the down queue
  //
  ExTransposePrivateState privateState(this);
  qParent_.down->allocatePstate(&privateState, this);


  // Initialize processedInputs_ to refer to the queue entry
  // which will be used next.
  //
  processedInputs_ = qParent_.down->getHeadIndex();
  
  // Allocate a queue to communicate with the parent node.
  //
  qParent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
				    transTdb().queueSizeUp_,
				    transTdb().criDescUp_,
				    space);

  // fixup all expressions expressions
  //

  // The transpose expressions.
  //
  for(Int32 i = 0; i < transTdb().numTransExprs_; i++) {
    if(transTdb().transColExprs_[i])
      transTdb().transColExprs_[i]->fixup(0,
					  getExpressionMode(), this,
					  glob->getSpace(),
					  glob->getDefaultHeap());
  }

  // Predicates to be applied after perform the transpose.
  //
  if(afterTransPred())
    afterTransPred()->fixup(0,
			    getExpressionMode(), this,
			    glob->getSpace(),
			    glob->getDefaultHeap());

}
ExFastExtractTcb::ExFastExtractTcb(
    const ExFastExtractTdb &fteTdb,
    const ex_tcb & childTcb,
    ex_globals *glob)
  : ex_tcb(fteTdb, 1, glob),
    workAtp_(NULL),
    outputPool_(NULL),
    inputPool_(NULL),
    childTcb_(&childTcb)
  , inSqlBuffer_(NULL)
  , childOutputTD_(NULL)
  , sourceFieldsConvIndex_(NULL)
  , currBuffer_(NULL)
  , bufferAllocFailuresCount_(0)
  , modTS_(-1)
{
  
  ex_globals *stmtGlobals = getGlobals();

  Space *globSpace = getSpace();
  CollHeap *globHeap = getHeap();

  heap_ = globHeap;

  //convert to non constant to access the members.
  ExFastExtractTdb *mytdb = (ExFastExtractTdb*)&fteTdb;
  numBuffers_ = mytdb->getNumIOBuffers();

  // Allocate queues to communicate with parent
  allocateParentQueues(qParent_);

  // get the queue that child use to communicate with me
  qChild_  = childTcb.getParentQueue();
    
  // Allocate the work ATP
  if (myTdb().getWorkCriDesc())
    workAtp_ = allocateAtp(myTdb().getWorkCriDesc(), globSpace);

  // Fixup expressions
  // NOT USED in M9
  /*
  if (myTdb().getInputExpression())
    myTdb().getInputExpression()->fixup(0, getExpressionMode(), this,
                                       globSpace, globHeap);

  if (myTdb().getOutputExpression())
    myTdb().getOutputExpression()->fixup(0, getExpressionMode(), this,
                                        globSpace, globHeap);
  */

  if (myTdb().getChildDataExpr())
    myTdb().getChildDataExpr()->fixup(0,getExpressionMode(),this,
                                       globSpace, globHeap, FALSE, glob);


  //maybe we can move the below few line to the init section od work methods??
  UInt32 numAttrs = myTdb().getChildTuple()->numAttrs();

   sourceFieldsConvIndex_ = (int *)((NAHeap *)heap_)->allocateAlignedHeapMemory((UInt32)(sizeof(int) * numAttrs), 512, FALSE);

  maxExtractRowLength_ = ROUND8(myTdb().getChildDataRowLen()) ;

  const ULng32 sqlBufferSize = maxExtractRowLength_ +
                               ROUND8(sizeof(SqlBufferNormal)) +
                               sizeof(tupp_descriptor) +
                               16 ;//just in case

  inSqlBuffer_ = (SqlBuffer *) new (heap_) char[sqlBufferSize];
  inSqlBuffer_->driveInit(sqlBufferSize, TRUE, SqlBuffer::NORMAL_);
  childOutputTD_ = inSqlBuffer_->add_tuple_desc(maxExtractRowLength_);

  endOfData_ = FALSE;

} // ExFastExtractTcb::ExFastExtractTcb
ExProbeCacheTcb::ExProbeCacheTcb(const ExProbeCacheTdb &probeCacheTdb, 
				   const ex_tcb &child_tcb,
				   ex_globals * glob
				    ) : 
    ex_tcb( probeCacheTdb, 1, glob),
    childTcb_(NULL),
    workAtp_(NULL),
    probeBytes_(NULL),
    pool_(NULL),
    pcm_(NULL),
    workUpTask_(NULL)
{
  Space * space = (glob ? glob->getSpace() : 0);
  CollHeap * heap = (glob ? glob->getDefaultHeap() : 0);

  qparent_.up = qparent_.down = NULL;
  
  childTcb_ = &child_tcb;

  // Allocate the buffer pool
  pool_ = new(space) ExSimpleSQLBuffer( probeCacheTdb.numInnerTuples_,
                                        probeCacheTdb.recLen_,
                                        space);

  // get the child queue pair
  qchild_  = child_tcb.getParentQueue(); 

  // Allocate the queue to communicate with parent
  allocateParentQueues(qparent_);

  // Intialize nextRequest_ to the next request to process
  nextRequest_ = qparent_.down->getTailIndex();

  // Allocate buffer for probeBytes_.
  probeBytes_ = new(space) char[ probeCacheTdb.probeLen_ ];

  // allocate work atp and initialize the two tupps.
  workAtp_ = allocateAtp(probeCacheTdb.criDescUp_,getSpace());

  probeHashTupp_.init(sizeof(probeHashVal_),
		    NULL,
		    (char *) (&probeHashVal_));
  workAtp_->getTupp(probeCacheTdb.hashValIdx_) = &probeHashTupp_;

  hashProbeExpr()->fixup(0, getExpressionMode(), this, space, heap,
                glob->computeSpace(), glob);

  probeEncodeTupp_.init(probeCacheTdb.probeLen_,
		    NULL,
		    (char *) (probeBytes_));
  workAtp_->getTupp(probeCacheTdb.encodedProbeDataIdx_) = &probeEncodeTupp_;

  encodeProbeExpr()->fixup(0, getExpressionMode(), this, space, heap,
                glob->computeSpace(), glob);

  if (moveInnerExpr())
    moveInnerExpr()->fixup(0, getExpressionMode(), this, space, heap,
                glob->computeSpace(), glob);

  if (selectPred())
    selectPred()->fixup(0, getExpressionMode(), this, space, heap,
                glob->computeSpace(), glob);

  pcm_ = new(space) ExPCMgr(space, 
                probeCacheTdb.cacheSize_, probeCacheTdb.probeLen_, this);

}