hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Purtell (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (HBASE-883) Secondary Indexes
Date Fri, 31 Oct 2008 23:29:44 GMT

    [ https://issues.apache.org/jira/browse/HBASE-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644456#action_12644456
] 

apurtell edited comment on HBASE-883 at 10/31/08 4:28 PM:
----------------------------------------------------------------

o.a.h.h.client.tableindexed.IndexScanner.ScannerWrapper needs next(int).

A suggestion:

{code}

    /** {@inheritDoc} */
    public RowResult next() throws IOException {
        RowResult[] result = next(1);
        if (result == null || result.length < 1)
          return null;
        return result[0];
    }

    /** {@inheritDoc} */
    public RowResult[] next(int nbRows) throws IOException {
      RowResult[] indexResult = indexScanner.next(nbRows);
      if (indexResult == null) {
        return null;
      }
      RowResult[] result = new RowResult[indexResult.length];
      for (int i = 0; i < indexResult.length; i++) {
        RowResult row = indexResult[i];
        byte[] baseRow = row.get(INDEX_BASE_ROW_COLUMN).getValue();
        LOG.debug("next index row [" + Bytes.toString(row.getRow())
            + "] -> base row [" + Bytes.toString(baseRow) + "]");
        HbaseMapWritable<byte[], Cell> colValues =
          new HbaseMapWritable<byte[], Cell>();
        if (columns != null && columns.length > 0) {
          LOG.debug("Going to base table for remaining columns");
          RowResult baseResult = IndexedTable.this.getRow(baseRow, columns);
          colValues.putAll(baseResult);
        }
        for (Entry<byte[], Cell> entry : row.entrySet()) {
          byte[] col = entry.getKey();
          if (HStoreKey.matchingFamily(INDEX_COL_FAMILY_NAME, col)) {
            continue;
          }
          colValues.put(col, entry.getValue());
        }
        result[i] = new RowResult(baseRow, colValues);
      }
      return result;
    }

{code}

      was (Author: apurtell):
    o.a.h.h.client.tableindexed.IndexScanner.ScannerWrapper needs next(int).

A suggestion:

{code}

    /** {@inheritDoc} */
    public RowResult next() throws IOException {
        RowResult[] result = next(1);
        if (result == null)
          return null;
        return result[0];
    }

    /** {@inheritDoc} */
    public RowResult[] next(int nbRows) throws IOException {
      RowResult[] indexResult = indexScanner.next(nbRows);
      if (indexResult == null) {
        return null;
      }
      RowResult[] result = new RowResult[indexResult.length];
      for (int i = 0; i < indexResult.length; i++) {
        RowResult row = indexResult[i];
        byte[] baseRow = row.get(INDEX_BASE_ROW_COLUMN).getValue();
        LOG.debug("next index row [" + Bytes.toString(row.getRow())
            + "] -> base row [" + Bytes.toString(baseRow) + "]");
        HbaseMapWritable<byte[], Cell> colValues =
          new HbaseMapWritable<byte[], Cell>();
        if (columns != null && columns.length > 0) {
          LOG.debug("Going to base table for remaining columns");
          RowResult baseResult = IndexedTable.this.getRow(baseRow, columns);
          colValues.putAll(baseResult);
        }
        for (Entry<byte[], Cell> entry : row.entrySet()) {
          byte[] col = entry.getKey();
          if (HStoreKey.matchingFamily(INDEX_COL_FAMILY_NAME, col)) {
            continue;
          }
          colValues.put(col, entry.getValue());
        }
        result[i] = new RowResult(baseRow, colValues);
      }
      return result;
    }

{code}
  
> Secondary Indexes
> -----------------
>
>                 Key: HBASE-883
>                 URL: https://issues.apache.org/jira/browse/HBASE-883
>             Project: Hadoop HBase
>          Issue Type: New Feature
>          Components: client, regionserver
>            Reporter: Clint Morgan
>            Assignee: Clint Morgan
>             Fix For: 0.19.0
>
>         Attachments: hbase-883.patch, hbase-883.patch, hbase-883.patch, hbase-883.patch,
hbase-883.patch, hbase-883.patch
>
>
> I'm working on a secondary index impl. The basic idea is to maintain a separate table
per index.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message