// -------------------------------------------------------------------
// This method returns the child as a cut-op.
// If the child is a group it return a cut-op for that group.
// If the child is a RelExpr it return a cut-op that shares its GA
// -------------------------------------------------------------------
CutOp* MultiJoin::getJBBCCutOpExpr(CANodeId jbbc) const
{
  // everything here goes to statement heap
  CollHeap* outHeap = CmpCommon::statementHeap();

  CutOp* result = new (outHeap) CutOp(0, outHeap); // we set index to 0 cuz it does not matter

  ExprGroupId exprGroupId = childrenMap_.getExprGroupIdOfJBBC(jbbc);

  if (exprGroupId.getGroupId() == INVALID_GROUP_ID)
    result->setExpr(exprGroupId.getPtr());
  else
    result->setGroupIdAndAttr(exprGroupId.getGroupId());

  return result;
}
// -------------------------------------------------------------------
// This method returns the child as a RelExpr. If the child is
// a group it return a cut-op for that group.
// -------------------------------------------------------------------
RelExpr* MultiJoin::getJBBCRelExpr(CANodeId jbbc) const
{
  RelExpr* result = NULL;

  // everything here goes to statement heap
  CollHeap* outHeap = CmpCommon::statementHeap();

  ExprGroupId exprGroupId = childrenMap_.getExprGroupIdOfJBBC(jbbc);

  if (exprGroupId.getGroupId() == INVALID_GROUP_ID)
    result = exprGroupId.getPtr();
  else
  {
    result = new (outHeap) CutOp(exprGroupId.getGroupId(), outHeap);
    ((CutOp*)result)->setGroupIdAndAttr(exprGroupId.getGroupId());
    // may be we should re-use existing cut-op rather than creating
    // new one.
  }

  return result;
}