Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HTable


        LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
            + getText(startRow) + ", stop=" + getText(stopRow) + ", columns="
            + columns.toString());
      }
      try {
        HTable table = getTable(tableName);
        Text[] columnsText = new Text[columns.size()];
        for (int i = 0; i < columns.size(); ++i) {
          columnsText[i] = getText(columns.get(i));
        }
        HScannerInterface scanner = table.obtainScanner(columnsText,
            getText(startRow), getText(stopRow));
        return addScanner(scanner);
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      }
View Full Code Here


        LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
            + getText(startRow) + ", columns=" + columns.toString()
            + ", timestamp=" + timestamp);
      }
      try {
        HTable table = getTable(tableName);
        Text[] columnsText = new Text[columns.size()];
        for (int i = 0; i < columns.size(); ++i) {
          columnsText[i] = getText(columns.get(i));
        }
        HScannerInterface scanner = table.obtainScanner(columnsText,
            getText(startRow), timestamp);
        return addScanner(scanner);
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      }
View Full Code Here

        LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
            + getText(startRow) + ", stop=" + getText(stopRow) + ", columns="
            + columns.toString() + ", timestamp=" + timestamp);
      }
      try {
        HTable table = getTable(tableName);
        Text[] columnsText = new Text[columns.size()];
        for (int i = 0; i < columns.size(); ++i) {
          columnsText[i] = getText(columns.get(i));
        }
        HScannerInterface scanner = table.obtainScanner(columnsText,
            getText(startRow), getText(stopRow), timestamp);
        return addScanner(scanner);
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      }
View Full Code Here

        LOG.debug("getColumnDescriptors: table=" + new String(tableName));
      }
      try {
        HashMap<byte[], ColumnDescriptor> columns = new HashMap<byte[], ColumnDescriptor>();
       
        HTable table = getTable(tableName);
        HTableDescriptor desc = table.getMetadata();
       
        for (Entry<Text, HColumnDescriptor> e : desc.families().entrySet()) {
          ColumnDescriptor col = ThriftUtilities.colDescFromHbase(e.getValue());
          columns.put(col.name, col);
        }
View Full Code Here

      if (!conn.tableExists(tableName)) {
        return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
      }

      HBaseAdmin admin = new HBaseAdmin(conf);
      HTable hTable = new HTable(conf, tableName);

      if (rowKey != null) {
        long lockID = hTable.startUpdate(rowKey);
        for (Text column : getColumnList(admin, hTable)) {
          hTable.delete(lockID, new Text(column));
        }
        hTable.commit(lockID);
      } else {
        admin.disableTable(tableName);
        for (Text column : getColumnList(admin, hTable)) {
          admin.deleteColumn(tableName, new Text(column));
        }
View Full Code Here

    if (columnfamilies.size() != values.size())
      return new ReturnMsg(0,
          "Mismatch between values list and columnfamilies list.");

    try {
      HTable table = new HTable(conf, tableName);
      long lockId = table.startUpdate(getRow());

      for (int i = 0; i < values.size(); i++) {
        Text column = null;
        if (getColumn(i).toString().contains(":"))
          column = getColumn(i);
        else
          column = new Text(getColumn(i) + ":");
        table.put(lockId, column, getValue(i));
      }
     
      if(timestamp != null)
        table.commit(lockId, Long.parseLong(timestamp));
      else
        table.commit(lockId);

      return new ReturnMsg(1, "1 row inserted successfully.");
    } catch (IOException e) {
      String[] msg = e.getMessage().split("[\n]");
      return new ReturnMsg(0, msg[0]);
View Full Code Here

      HConnection conn = HConnectionManager.getConnection(conf);
      if (!conn.tableExists(tableName) && !isMetaTable()) {
        return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
      }

      HTable table = new HTable(conf, tableName);
      HBaseAdmin admin = new HBaseAdmin(conf);
      int count = 0;
      if (whereClause) {
        if (countFunction) {
          count = 1;
View Full Code Here

      // Populate a table into multiple regions
      makeMultiRegionTable(conf, hCluster, this.fs, TABLE_NAME, INPUT_COLUMN);

      // Verify table indeed has multiple regions
      HTable table = new HTable(conf, new Text(TABLE_NAME));
      Text[] startKeys = table.getStartKeys();
      assertTrue(startKeys.length > 1);
    } catch (Exception e) {
      StaticTestEnvironment.shutdownDfs(dfsCluster);
      throw e;
    }
View Full Code Here

    return c.toString();
  }

  private void scanTable(boolean printResults)
  throws IOException {
    HTable table = new HTable(conf, new Text(TABLE_NAME));
    HScannerInterface scanner = table.obtainScanner(columns,
        HConstants.EMPTY_START_ROW);
    try {
      HStoreKey key = new HStoreKey();
      TreeMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
      while (scanner.next(key, results)) {
View Full Code Here

        searcher = new MultiSearcher(searchers);
      } else {
        throw new IOException("no index directory found");
      }

      HTable table = new HTable(conf, new Text(TABLE_NAME));
      scanner = table.obtainScanner(columns, HConstants.EMPTY_START_ROW);

      HStoreKey key = new HStoreKey();
      TreeMap<Text, byte[]> results = new TreeMap<Text, byte[]>();

      IndexConfiguration indexConf = new IndexConfiguration();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.HTable

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.