Package org.apache.derby.iapi.sql.execute

Examples of org.apache.derby.iapi.sql.execute.ExecRow


   * @return the next row in the result
   */
  public ExecRow  getNextRowCore() throws StandardException
  {
      ExecIndexRow sortResult = null;
      ExecRow result = null;
      ExecIndexRow execIndexRow = null;
      ExecIndexRow aggResult = null;
    boolean  cloneArg = true;

    beginTime = getCurrentTimeMillis();
View Full Code Here


    */
  private ScanController loadSorter()
    throws StandardException
  {
    SortController       sorter;
    ExecRow         sourceRow;
    int            inputRowCountEstimate = (int) optimizerEstimatedRowCount;

    TransactionController tc = getTransactionController();

    /*
    ** We have a distinct aggregate so, we'll need
    ** to do a sort.  We use all of the sorting columns and
    ** drop the aggregation on the distinct column.  Then
    ** we'll feed this into the sorter again w/o the distinct
    ** column in the ordering list.
    */
    GenericAggregator[] aggsNoDistinct = getSortAggregators(aggInfoList, true,
        activation.getLanguageConnectionContext(), source);
    SortObserver sortObserver = new AggregateSortObserver(true, aggsNoDistinct, aggregates,
                                sortTemplateRow);

    sortId = tc.createSort((Properties)null,
          sortTemplateRow.getRowArray(),
          order,
          sortObserver,
          false,      // not in order
          inputRowCountEstimate,        // est rows, -1 means no idea 
          maxRowSize    // est rowsize
          );
    sorter = tc.openSort(sortId);
    dropDistinctAggSort = true;
       
    while ((sourceRow = source.getNextRowCore())!=null)
    {
      sorter.insert(sourceRow.getRowArray());
      rowsInput++;
    }

    /*
    ** End the sort and open up the result set
View Full Code Here

  public ExecRow getClone(FormatableBitSet clonedCols)
  {
    int numColumns = column.length;

    /* Get the right type of row */
    ExecRow rowClone = cloneMe();

    for (int colCtr = 0; colCtr < numColumns; colCtr++)
    {
      // Copy those columns whose bit isn't set (and there is a FormatableBitSet)
      if (clonedCols != null && !(clonedCols.get(colCtr + 1)))
      {
        /* Rows are 1-based, column[] is 0-based */
        rowClone.setColumn(colCtr + 1, (DataValueDescriptor) column[colCtr]);
        continue;
      }

      if (column[colCtr] != null)
      {
        /* Rows are 1-based, column[] is 0-based */
        rowClone.setColumn(colCtr + 1, column[colCtr].getClone());
      }
    }
    return rowClone;
  }
View Full Code Here

  // position is 1-based
  public ExecRow getNewNullRow()
  {
    int numColumns = column.length;
    ExecRow rowClone = cloneMe();


    for (int colCtr = 0; colCtr < numColumns; colCtr++)
    {
      if (column[colCtr] != null)
      {
        /* Rows are 1-based, column[] is 0-based */
        if (column[colCtr] instanceof RowLocation)
        {
          /*
          ** The getClone() method for a RowLocation has the same
          ** name as for DataValueDescriptor, but it's on a different
          ** interface, so the cast must be different.
          **
          */
          rowClone.setColumn(colCtr + 1, column[colCtr].getClone());
        }
        else
        {
          // otherwise, get a new null
          rowClone.setColumn(colCtr + 1,
            ((DataValueDescriptor) (column[colCtr])).getNewNull());
        }
      }
    }
    return rowClone;
View Full Code Here

      //we are searching for a row first time
      if((searchRow = getNextParentRow())!=null)
         openIndexScan(searchRow);
   
 
    ExecRow currentIndexRow = null;
      while(searchRow != null)
    {
      //get if the current search row has  more
      //than one row in the dependent tables
      currentIndexRow = fetchIndexRow();
View Full Code Here

  //this function will return the rows from the parent result sets
  private ExecRow  getNextParentRow() throws StandardException
  {

    ExecRow cRow;
    TemporaryRowHolder rowHolder;

    if(sourceOpened[sArrayIndex] == 0)
    {
      rowHolder = sourceRowHolders[sArrayIndex];
View Full Code Here

   * @exception StandardException ResultSetNotOpen thrown if not yet open.
   *
   * @return the next row in the result
   */
  public ExecRow  getNextRowCore() throws StandardException {
      ExecRow result = null;
    DataValueDescriptor[] columns = null;

    beginTime = getCurrentTimeMillis();
      if ( isOpen )
      {
View Full Code Here

   */
  /* RESOLVE - this should return activation.getCurrentRow(resultSetNumber),
   * once there is such a method.  (currentRow is redundant)
   */
  public ExecRow getCurrentRow() throws StandardException {
      ExecRow candidateRow = null;
      ExecRow result = null;
      boolean restrict = false;
      DataValueDescriptor restrictBoolean;

    if (SanityManager.DEBUG)
      SanityManager.ASSERT(isOpen, "PRRS is expected to be open");
View Full Code Here

    if (reuseResult && projRow != null)
    {
      return projRow;
    }

    ExecRow result;

    // Use reflection to do as much of projection as required
    if (projection != null)
    {
          result = (ExecRow) projection.invoke(activation);
    }
    else
    {
      result = mappedResultRow;
    }

    // Copy any mapped columns from the source
    for (int index = 0; index < projectMapping.length; index++)
    {
      if (projectMapping[index] != -1)
      {
        result.setColumn(index + 1, sourceRow.getColumn(projectMapping[index]));
      }
    }

    /* We need to reSet the current row after doing the projection */
    setCurrentRow(result);
 
View Full Code Here

   * @exception StandardException on error
   */
  public DataValueDescriptor[] getNextRowFromRowSource()
    throws StandardException
  {
    ExecRow execRow = source.getNextRowCore();

    /* Use the single table predicates, if any,
     * to filter out rows while populating the
     * hash table.
     */
     while (execRow != null)
    {
        boolean restrict = false;
        DataValueDescriptor restrictBoolean;

      rowsSeen++;

      /* If restriction is null, then all rows qualify */
            restrictBoolean = (DataValueDescriptor)
          ((singleTableRestriction == null) ? null : singleTableRestriction.invoke(activation));

            // if the result is null, we make it false --
      // so the row won't be returned.
            restrict = (restrictBoolean == null) ||
            ((! restrictBoolean.isNull()) &&
              restrictBoolean.getBoolean());
      if (!restrict)
      {
        execRow = source.getNextRowCore();
        continue;
      }

      if (targetResultSet != null)
      {
        /* Let the target preprocess the row.  For now, this
         * means doing an in place clone on any indexed columns
         * to optimize cloning and so that we don't try to drain
         * a stream multiple times.  This is where we also
         * enforce any check constraints.
         */
        clonedExecRow = targetResultSet.preprocessSourceRow(execRow);
      }


      /* Get a single ExecRow of the same size
       * on the way in so that we have a row
       * to use on the way out.
       */
      if (firstIntoHashtable)
      {
        nextCandidate = activation.getExecutionFactory().getValueRow(execRow.nColumns());
        firstIntoHashtable = false;
      }

      return execRow.getRowArray();
    }

    return null;
  }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.execute.ExecRow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.