Package org.apache.derby.iapi.store.access

Examples of org.apache.derby.iapi.store.access.SortObserver


      int[] baseColumnPositions =
                constants.irgs[index].baseColumnPositions();
      boolean[] isAscending     = constants.irgs[index].isAscending();
          
      int numColumnOrderings;
      SortObserver sortObserver = null;

      /* We can only reuse the wrappers when doing an
       * external sort if there is only 1 index.  Otherwise,
       * we could get in a situation where 1 sort reuses a
       * wrapper that is still in use in another sort.
View Full Code Here


      // Get the ConglomerateDescriptor for the index
      cd = td.getConglomerateDescriptor(constants.indexCIDS[index]);
      int[] baseColumnPositions = constants.irgs[index].baseColumnPositions();
      boolean[] isAscending = constants.irgs[index].isAscending();
      int numColumnOrderings;
      SortObserver sortObserver = null;
      if (cd.getIndexDescriptor().isUnique())
      {
        numColumnOrderings = baseColumnPositions.length;
        String[] columnNames = getColumnNames(baseColumnPositions);
View Full Code Here

       * We create a basic sort observer for non-unique indexes
       * so that we can reuse the wrappers during an external
       * sort.
       */
      int numColumnOrderings;
      SortObserver sortObserver = null;
      if (unique)
      {
        numColumnOrderings = baseColumnPositions.length;
        // if the index is a constraint, use constraintname in possible error messagge
        String indexOrConstraintName = indexName;
View Full Code Here

    {
      hasDistinctAggregate = true;
     
      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);
      distinctAggSortId = sortId;
      dropDistinctAggSort = true;
       
      while ((sourceRow = source.getNextRowCore())!=null)
      {
        sorter.insert(sourceRow.getRowArray());
        rowsInput++;
      }

      /*
      ** End the sort and open up the result set
      */
      source.close();
      sortProperties = sorter.getSortInfo().getAllSortInfo(sortProperties);
      sorter.completedInserts();

      scanController =
                tc.openSortScan(sortId, activation.getResultSetHoldability());
     
      /*
      ** Aggs are initialized and input rows
      ** are in order.  All we have to do is
      ** another sort to remove (merge) the
      ** duplicates in the distinct column
      */ 
      inOrder = true;
      inputRowCountEstimate = rowsInput;
 
      /*
      ** Drop the last column from the ordering.  The
      ** last column is the distinct column.  Don't
      ** pay any attention to the fact that the ordering
      ** object's name happens to correspond to a techo
      ** band from the 80's.
      **
      ** If there aren't any ordering columns other
      ** than the distinct (i.e. for scalar distincts)
      ** just skip the 2nd sort altogether -- we'll
      ** do the aggregate merge ourselves rather than
      ** force a 2nd sort.
      */
      if (order.length == 1)
      {
        return scanController;
      }

      ColumnOrdering[] newOrder = new ColumnOrdering[order.length - 1];
      System.arraycopy(order, 0, newOrder, 0, order.length - 1);
      currentOrdering = newOrder;
    }

    SortObserver sortObserver = new AggregateSortObserver(true, aggregates, aggregates,
                                sortTemplateRow);

    sortId = tc.createSort((Properties)null,
            sortTemplateRow.getRowArray(),
            currentOrdering,
View Full Code Here

    ** 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,
View Full Code Here

       * we could get in a situation where 1 sort reuses a
       * wrapper that is still in use in another sort.
       */
      boolean reuseWrappers = (numIndexes == 1);

      SortObserver    sortObserver =
                new BasicSortObserver(
                        false, false, indexRows[index], reuseWrappers);

      ordering[index] = new ColumnOrdering[numColumnOrderings];
      for (int ii =0; ii < numColumnOrderings - 1; ii++)
View Full Code Here

       * we could get in a situation where 1 sort reuses a
       * wrapper that is still in use in another sort.
       */
      boolean reuseWrappers = (numIndexes == 1);

      SortObserver    sortObserver =
                new BasicSortObserver(
                        false, false, indexRows[index], reuseWrappers);

      ordering[index] = new ColumnOrdering[numColumnOrderings];
      for (int ii =0; ii < numColumnOrderings - 1; ii++)
View Full Code Here

       * we could get in a situation where 1 sort reuses a
       * wrapper that is still in use in another sort.
       */
      boolean reuseWrappers = (numIndexes == 1);

      SortObserver    sortObserver =
                new BasicSortObserver(
                        false, false, indexRows[index], reuseWrappers);

      ordering[index] = new ColumnOrdering[numColumnOrderings];
      for (int ii =0; ii < numColumnOrderings - 1; ii++)
View Full Code Here

       * index should be valid.
       */
      int[] baseColumnPositions = compressIRGs[index].baseColumnPositions();
      boolean[] isAscending = compressIRGs[index].isAscending();
      int numColumnOrderings;
      SortObserver sortObserver = null;
      /* We can only reuse the wrappers when doing an
       * external sort if there is only 1 index.  Otherwise,
       * we could get in a situation where 1 sort reuses a
       * wrapper that is still in use in another sort.
       */
 
View Full Code Here

    {
      hasDistinctAggregate = true;
     
      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);
      distinctAggSortId = sortId;
      dropDistinctAggSort = true;
       
      while ((sourceRow = source.getNextRowCore())!=null)
      {
        sorter.insert(sourceRow.getRowArray());
        rowsInput++;
      }

      /*
      ** End the sort and open up the result set
      */
      source.close();
      sortProperties = sorter.getSortInfo().getAllSortInfo(sortProperties);
      sorter.close();

      scanController =
                tc.openSortScan(sortId, activation.getResultSetHoldability());
     
      /*
      ** Aggs are initialized and input rows
      ** are in order.  All we have to do is
      ** another sort to remove (merge) the
      ** duplicates in the distinct column
      */ 
      inOrder = true;
      inputRowCountEstimate = rowsInput;
 
      /*
      ** Drop the last column from the ordering.  The
      ** last column is the distinct column.  Don't
      ** pay any attention to the fact that the ordering
      ** object's name happens to correspond to a techo
      ** band from the 80's.
      **
      ** If there aren't any ordering columns other
      ** than the distinct (i.e. for scalar distincts)
      ** just skip the 2nd sort altogether -- we'll
      ** do the aggregate merge ourselves rather than
      ** force a 2nd sort.
      */
      if (order.length == 1)
      {
        return scanController;
      }

      ColumnOrdering[] newOrder = new ColumnOrdering[order.length - 1];
      System.arraycopy(order, 0, newOrder, 0, order.length - 1);
      currentOrdering = newOrder;
    }

    SortObserver sortObserver = new AggregateSortObserver(true, aggregates, aggregates,
                                sortTemplateRow);

    sortId = tc.createSort((Properties)null,
            sortTemplateRow.getRowArray(),
            currentOrdering,
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.store.access.SortObserver

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.