Search in sources :

Example 16 with GridH2Row

use of org.apache.ignite.internal.processors.query.h2.opt.GridH2Row in project ignite by apache.

the class H2RowFactory method getRow.

/**
 * !!! This method must be invoked in read or write lock of referring index page. It is needed to
 * !!! make sure that row at this link will be invisible, when the link will be removed from
 * !!! from all the index pages, so that row can be safely erased from the data page.
 *
 * @param link Link.
 * @return Row.
 * @throws IgniteCheckedException If failed.
 */
public GridH2Row getRow(long link) throws IgniteCheckedException {
    // TODO Avoid extra garbage generation. In upcoming H2 1.4.193 Row will become an interface,
    // TODO we need to refactor all this to return CacheDataRowAdapter implementing Row here.
    final CacheDataRowAdapter rowBuilder = new CacheDataRowAdapter(link);
    rowBuilder.initFromLink(cctx.group(), CacheDataRowAdapter.RowData.FULL);
    GridH2Row row;
    try {
        row = rowDesc.createRow(rowBuilder);
    } catch (IgniteCheckedException e) {
        throw new IgniteException(e);
    }
    assert row.version() != null;
    return row;
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) GridH2Row(org.apache.ignite.internal.processors.query.h2.opt.GridH2Row) CacheDataRowAdapter(org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter)

Example 17 with GridH2Row

use of org.apache.ignite.internal.processors.query.h2.opt.GridH2Row in project ignite by apache.

the class H2ExtrasInnerIO method storeByOffset.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("ForLoopReplaceableByForEach")
@Override
public void storeByOffset(long pageAddr, int off, SearchRow row) {
    GridH2Row row0 = (GridH2Row) row;
    assert row0.link() != 0 : row0;
    List<InlineIndexHelper> inlineIdxs = InlineIndexHelper.getCurrentInlineIndexes();
    assert inlineIdxs != null : "no inline index helpers";
    int fieldOff = 0;
    for (int i = 0; i < inlineIdxs.size(); i++) {
        InlineIndexHelper idx = inlineIdxs.get(i);
        int size = idx.put(pageAddr, off + fieldOff, row.getValue(idx.columnIndex()), payloadSize - fieldOff);
        if (size == 0)
            break;
        fieldOff += size;
    }
    PageUtils.putLong(pageAddr, off + payloadSize, row0.link());
}
Also used : GridH2Row(org.apache.ignite.internal.processors.query.h2.opt.GridH2Row) InlineIndexHelper(org.apache.ignite.internal.processors.query.h2.database.InlineIndexHelper)

Aggregations

GridH2Row (org.apache.ignite.internal.processors.query.h2.opt.GridH2Row)13 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 Index (org.h2.index.Index)5 H2PkHashIndex (org.apache.ignite.internal.processors.query.h2.database.H2PkHashIndex)4 IndexingQueryCacheFilter (org.apache.ignite.spi.indexing.IndexingQueryCacheFilter)3 Random (java.util.Random)2 UUID (java.util.UUID)2 IgniteException (org.apache.ignite.IgniteException)2 H2Cursor (org.apache.ignite.internal.processors.query.h2.H2Cursor)2 H2TreeIndex (org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex)2 InlineIndexHelper (org.apache.ignite.internal.processors.query.h2.database.InlineIndexHelper)2 Cursor (org.h2.index.Cursor)2 SingleRowCursor (org.h2.index.SingleRowCursor)2 SearchRow (org.h2.result.SearchRow)2 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 Timestamp (java.sql.Timestamp)1 HashSet (java.util.HashSet)1