Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HStoreKey$StoreKeyComparator


      byte [] actualStopRow = null;
      byte [][] columns = {COLFAMILY_NAME1};
      scanner = region.getScanner(columns,
          arbitraryStartRow, HConstants.LATEST_TIMESTAMP,
          new WhileMatchRowFilter(new StopRowFilter(arbitraryStopRow)));
      HStoreKey key = new HStoreKey();
      TreeMap<byte [], Cell> value =
        new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
      while (scanner.next(key, value)) {
        if (actualStartRow == null) {
          actualStartRow = key.getRow();
        } else {
          actualStopRow = key.getRow();
        }
      }
      // Assert I got all out.
      assertColumnsPresent(region, actualStartRow);
      assertColumnsPresent(region, actualStopRow);
View Full Code Here


    HScannerInterface rootScanner = rootRegion.getScanner(
        HConstants.COL_REGIONINFO_ARRAY, HConstants.EMPTY_START_ROW,
        HConstants.LATEST_TIMESTAMP, null);

    try {
      HStoreKey key = new HStoreKey();
      SortedMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
      while (rootScanner.next(key, results)) {
        HRegionInfo info = Writables.getHRegionInfoOrNull(
            results.get(HConstants.COL_REGIONINFO));
        if (info == null) {
          LOG.warn("region info is null for row " + key.getRow() +
              " in table " + HConstants.ROOT_TABLE_NAME);
          continue;
        }
        if (!listener.processRow(info)) {
          break;
View Full Code Here

    HScannerInterface metaScanner = metaRegion.getScanner(
        HConstants.COL_REGIONINFO_ARRAY, HConstants.EMPTY_START_ROW,
        HConstants.LATEST_TIMESTAMP, null);

    try {
      HStoreKey key = new HStoreKey();
      SortedMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
      while (metaScanner.next(key, results)) {
        HRegionInfo info = Writables.getHRegionInfoOrNull(
            results.get(HConstants.COL_REGIONINFO));
        if (info == null) {
          LOG.warn("region info is null for row " + key.getRow() +
              " in table " + HConstants.META_TABLE_NAME);
          continue;
        }
        if (!listener.processRow(info)) {
          break;
View Full Code Here

  private int doScan(final HScannerInterface scanner, final boolean printValues) throws IOException {
    {
      int count = 0;

      try {
        HStoreKey key = new HStoreKey();
        TreeMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
        while (scanner.next(key, results)) {
          if (printValues) {
            LOG.info("row: " + key.getRow());

            for (Map.Entry<Text, byte[]> e : results.entrySet()) {
              LOG.info(" column: " + e.getKey() + " value: "
                  + new String(e.getValue(), HConstants.UTF8_ENCODING));
            }
View Full Code Here

  private void addRows(final Memcache hmc) {
    for (int i = 0; i < ROW_COUNT; i++) {
      long timestamp = System.currentTimeMillis();
      for (int ii = 0; ii < COLUMNS_COUNT; ii++) {
        byte [] k = getColumnName(i, ii);
        hmc.add(new HStoreKey(getRowName(i), k, timestamp), k);
      }
    }
  }
View Full Code Here

  /** Test getFull from memcache
   */
  public void testGetFull() {
    addRows(this.hmemcache);
    for (int i = 0; i < ROW_COUNT; i++) {
      HStoreKey hsk = new HStoreKey(getRowName(i));
      TreeMap<byte [], Cell> all =
        new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
      TreeMap<byte [], Long> deletes =
        new TreeMap<byte [], Long>(Bytes.BYTES_COMPARATOR);
      this.hmemcache.getFull(hsk, null, 1, deletes, all);
View Full Code Here

        cols[(ii + (i * COLUMNS_COUNT))] = getColumnName(i, ii);
      }
    }
    InternalScanner scanner =
      this.hmemcache.getScanner(timestamp, cols, HConstants.EMPTY_START_ROW);
    HStoreKey key = new HStoreKey();
    TreeMap<byte [], Cell> results =
      new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
    for (int i = 0; scanner.next(key, results); i++) {
      assertTrue("Row name",
          key.toString().startsWith(Bytes.toString(getRowName(i))));
      assertEquals("Count of columns", COLUMNS_COUNT,
          results.size());
      TreeMap<byte [], Cell> row =
        new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
      for(Map.Entry<byte [], Cell> e: results.entrySet() ) {
View Full Code Here

    hmemcache.getRowKeyAtOrBefore(t50, results);
    assertEquals(t40, results.lastKey().getRow());
  }
 
  private HStoreKey getHSKForRow(byte [] row) {
    return new HStoreKey(row, Bytes.toBytes("test_col:"), HConstants.LATEST_TIMESTAMP);
  }
View Full Code Here

    }
    //starting from each row, validate results should contain the starting row
    for (int startRowId = 0; startRowId < ROW_COUNT; startRowId++) {
      InternalScanner scanner = this.hmemcache.getScanner(timestamp,
          cols, getRowName(startRowId));
      HStoreKey key = new HStoreKey();
      TreeMap<byte[], Cell> results =
        new TreeMap<byte[], Cell>(Bytes.BYTES_COMPARATOR);
      for (int i = 0; scanner.next(key, results); i++) {
        int rowId = startRowId + i;
        assertTrue("Row name",
            key.toString().startsWith(Bytes.toString(getRowName(rowId))));
        assertEquals("Count of columns", COLUMNS_COUNT, results.size());
        TreeMap<byte[], Cell> row =
          new TreeMap<byte[], Cell>(Bytes.BYTES_COMPARATOR);
        for (Map.Entry<byte[], Cell> e : results.entrySet()) {
          row.put(e.getKey(),e.getValue());
View Full Code Here

      for (int ii = 0; ii < 3; ii++) {
        for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++) {
            TreeMap<HStoreKey, byte[]> edit = new TreeMap<HStoreKey, byte[]>();
            byte [] column = Bytes.toBytes(Integer.toString(j));
            edit.put(new HStoreKey(rowName, column, System.currentTimeMillis()),
              column);
            log.append(Bytes.toBytes(Integer.toString(i)), tableName, edit, false);
          }
        }
        log.rollWriter();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.HStoreKey$StoreKeyComparator

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.