Package org.apache.derby.iapi.sql.dictionary

Examples of org.apache.derby.iapi.sql.dictionary.IndexRowGenerator


    if (! cd.isIndex())
    {
      return false;
    }

    IndexRowGenerator irg =
      cd.getIndexDescriptor();

    // is this a unique index
    if (! irg.isUnique())
    {
      return false;
    }

    int[] baseColumnPositions = irg.baseColumnPositions();

    DataDictionary dd = getDataDictionary();

    // Do we have an exact match on the full key
    for (int index = 0; index < baseColumnPositions.length; index++)
View Full Code Here


          distinctConglomNums[distinctCount++] = cd.getConglomerateNumber();
          conglomVector.add( cd );
        }
      }

      IndexRowGenerator ixd = cd.getIndexDescriptor();
      int[] cols = ixd.baseColumnPositions();

      if (colBitSet != null)
      {
        for (int i = 0; i < cols.length; i++)
        {
View Full Code Here

      ordering  = new ColumnOrdering[numIndexes][];
      collation = new int[numIndexes][];

      for (int index = 0; index < numIndexes; index++)
      {
                IndexRowGenerator curIndex = compressIRGs[index];
        // create a single index row template for each index
                indexRows[index] = curIndex.getIndexRowTemplate();
                curIndex.getIndexRow(emptyHeapRow,
                        rl,
                        indexRows[index],
                        (FormatableBitSet) null);
        /* For non-unique indexes, we order by all columns + the RID.
         * For unique indexes, we just order by the columns.
         * No need to try to enforce uniqueness here as
         * index should be valid.
         */
                int[] baseColumnPositions = curIndex.baseColumnPositions();

                boolean[] isAscending = curIndex.isAscending();

        int numColumnOrderings;
        numColumnOrderings = baseColumnPositions.length + 1;
        ordering[index]    = new ColumnOrdering[numColumnOrderings];
                collation[index]   = curIndex.getColumnCollationIds(
                                                td.getColumnDescriptorList());

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

          distinctConglomNums[distinctCount++] = cd.getConglomerateNumber();
          conglomVector.addElement( cd );
        }
      }

      IndexRowGenerator ixd = cd.getIndexDescriptor();
      int[] cols = ixd.baseColumnPositions();

      if (colBitSet != null)
      {
        for (int i = 0; i < cols.length; i++)
        {
View Full Code Here

    String    keyString = "";
    String[]  columnNames = cd.getColumnNames();

    if (cd.isIndex() && columnNames != null )
    {
      IndexRowGenerator irg = cd.getIndexDescriptor();

      int[] keyColumns = irg.baseColumnPositions();

      keyString = ", key columns = {" + columnNames[keyColumns[0] - 1];
      for (int index = 1; index < keyColumns.length; index++)
      {
        keyString = keyString + ", " + columnNames[keyColumns[index] - 1];
View Full Code Here

                {
                    conglomerateNumber[i] = -1;
                    continue;
                }

                IndexRowGenerator irg = cds[i].getIndexDescriptor();

                // Skip single-column unique indexes unless we're told not to,
                // or we are running in soft-upgrade-mode on a pre 10.9 db.
                if (skipDisposableStats) {
                    if (irg.isUnique() && irg.numberOfOrderedColumns() == 1) {
                        conglomerateNumber[i] = -1;
                        continue;
                    }
                }
          
                // at this point have found a stat for an existing
                // index which is not a single column unique index, add it
                // to the list of "non disposable stats"
                conglomerateNumber[i]        = cds[i].getConglomerateNumber();
                non_disposable_objectUUID[i] = cds[i].getUUID();

                indexRow[i] = irg.getNullIndexRow(
                        td.getColumnDescriptorList(),
                        heapCC.newRowLocationTemplate());
            }
        }
        finally
View Full Code Here

    ExecIndexRow        indexableRow;
    int              numColumns;
    long            conglomId;
    RowLocation          rl;
    CatalogRowFactory      rf = ti.getCatalogRowFactory();
    IndexRowGenerator      irg;
    ConglomerateDescriptor  conglomerateDescriptor;

    initSystemIndexVariables(ti, indexNumber);

    irg = ti.getIndexRowGenerator(indexNumber);

    numColumns = ti.getIndexColumnCount(indexNumber);

    /* Is the index unique */
    isUnique = ti.isIndexUnique(indexNumber);

    // create an index row template
    indexableRow = irg.getIndexRowTemplate();

        baseRow = rf.makeEmptyRowForCurrentVersion();

    // Get a RowLocation template
    cc = tc.openConglomerate(
      heapConglomerateNumber, false, 0,
            TransactionController.MODE_RECORD,
      TransactionController.ISOLATION_REPEATABLE_READ);

    rl = cc.newRowLocationTemplate();
    cc.close();

    // Get an index row based on the base row
    irg.getIndexRow(baseRow, rl, indexableRow, (FormatableBitSet) null);

    // Describe the properties of the index to the store using Properties
    // RESOLVE: The following properties assume a BTREE index.
    Properties  indexProperties = ti.getCreateIndexProperties(indexNumber);

View Full Code Here

    boolean[] isAscending = new boolean[baseColumnPositions.length];
    for (int i = 0; i < baseColumnPositions.length; i++)
      isAscending[i]        = true;

        IndexRowGenerator irg = null;

        irg = new IndexRowGenerator(
                "BTREE", ti.isIndexUnique(indexNumber),
                false,
                false,
                false,
                baseColumnPositions,
View Full Code Here

    this.droppedConglomNum = srcCD.getConglomerateNumber();

    /* Plug in the rest of the information from the received
     * descriptors.
     */
    IndexRowGenerator irg = srcCD.getIndexDescriptor();
    this.unique = irg.isUnique();
    this.uniqueWithDuplicateNulls = irg.isUniqueWithDuplicateNulls();
        this.hasDeferrableChecking = false; // N/A such indexes are not shared
        this.uniqueDeferrable = false;      // N/A
        this.initiallyDeferred = false;     // N/A
        this.constraintType = -1;           // N/A
    this.indexType = irg.indexType();
    this.columnNames = srcCD.getColumnNames();
    this.isAscending = irg.isAscending();
    this.isConstraint = srcCD.isConstraint();
    this.conglomerateUUID = srcCD.getUUID();
    this.properties = properties;
    this.conglomId = -1L;

    /* The ConglomerateDescriptor may not know the names of
     * the columns it includes.  If that's true (which seems
     * to be the more common case) then we have to build the
     * list of ColumnNames ourselves.
     */
    if (columnNames == null)
    {
      int [] baseCols = irg.baseColumnPositions();
      columnNames = new String[baseCols.length];
      ColumnDescriptorList colDL = td.getColumnDescriptorList();
      for (int i = 0; i < baseCols.length; i++)
      {
        columnNames[i] =
View Full Code Here

       * 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.
       */
      boolean reuseWrappers = (numIndexes == 1);
            final IndexRowGenerator indDes = cd.getIndexDescriptor();
            Properties sortProperties = null;
            String indexOrConstraintName = cd.getConglomerateName();
            boolean deferred = false;
            boolean deferrable = false;

            UUID uniqueDeferrableConstraintId = null;
            if (cd.isConstraint())
            {
                // so, the index is backing up a constraint

                ConstraintDescriptor conDesc =
                        dd.getConstraintDescriptor(td, cd.getUUID());

                indexOrConstraintName = conDesc.getConstraintName();
                deferred = lcc.isEffectivelyDeferred(
                        lcc.getCurrentSQLSessionContext(activation),
                        conDesc.getUUID());
                deferrable = conDesc.deferrable();
                uniqueDeferrableConstraintId = conDesc.getUUID();
            }

            if (indDes.isUnique() || indDes.isUniqueDeferrable())
            {
                numColumnOrderings =
                        indDes.isUnique() ? baseColumnPositions.length :
                        baseColumnPositions.length + 1;

        sortObserver =
                    new UniqueIndexSortObserver(
                            lcc,
                            uniqueDeferrableConstraintId,
                            false, // don't clone rows
                            deferrable,
                            deferred,
                            indexOrConstraintName,
                            indexRows[index],
                            reuseWrappers,
                            td.getName());
            } else if (indDes.isUniqueWithDuplicateNulls())
            {
                numColumnOrderings = baseColumnPositions.length + 1;

                // tell transaction controller to use the unique with
                // duplicate nulls sorter, when making createSort() call.
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.dictionary.IndexRowGenerator

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.