Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HTable$ClientScanner


    }
  }

  @SuppressWarnings("null")
  private void verify(Configuration conf, String tableName) throws IOException {
    HTable table = new HTable(conf, new Text(tableName));
   
    Text[] columns = {
        TEXT_INPUT_COLUMN,
        TEXT_OUTPUT_COLUMN
    };
    HScannerInterface scanner =
      table.obtainScanner(columns, HConstants.EMPTY_START_ROW);
   
    try {
      HStoreKey key = new HStoreKey();
      TreeMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
     
View Full Code Here


      // Populate a table into multiple regions
      MultiRegionTable.makeMultiRegionTable(conf, hCluster, null, 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) {
      if (dfsCluster != null) {
        dfsCluster.shutdown();
        dfsCluster = null;
View Full Code Here

    c.addFromXML(buffer.toString());
    return c.toString();
  }

  private void scanTable(Configuration c, long firstK) throws IOException {
    HTable table = new HTable(c, new Text(TABLE_NAME));
    Text[] columns = { TEXT_INPUT_COLUMN, TEXT_OUTPUT_COLUMN };
    HScannerInterface scanner = table.obtainScanner(columns,
        HConstants.EMPTY_START_ROW);
    long count = 0;
    try {
      HStoreKey key = new HStoreKey();
      TreeMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
View Full Code Here

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

      HTable table = new HTable(c, new Text(TABLE_NAME));
      Text[] columns = { TEXT_INPUT_COLUMN, TEXT_OUTPUT_COLUMN };
      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

    if (this.tableName.equals("") || this.rowKey == null ||
        this.columns.size() == 0) {
      return new ReturnMsg(0, "Syntax error : Please check 'Select' syntax.");
    }
    try {
      HTable table = new HTable(conf, this.tableName);
      HBaseAdmin admin = new HBaseAdmin(conf);
      int count = 0;
      if (this.whereClause) {
        count = compoundWherePrint(table, admin);
      } else {
View Full Code Here

    if (columnList == null) {
      throw new IllegalArgumentException("Column list is null");
    }
    try {
      HBaseAdmin admin = new HBaseAdmin(conf);
      HTable hTable = new HTable(conf, new Text(tableName));
      long lockID = hTable.startUpdate(new Text(rowKey));
      for (Text column : getColumnList(admin, hTable)) {
        hTable.delete(lockID, new Text(column));
      }
      hTable.commit(lockID);
      return new ReturnMsg(1, "Column(s) deleted successfully.");
    } catch (IOException e) {
      String[] msg = e.getMessage().split("[\n]");
      return new ReturnMsg(0, msg[0]);
    }
View Full Code Here

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

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

      for (int i = 0; i < this.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));
      }
      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

      @SuppressWarnings("unused") Progressable progress) throws IOException {
   
    // expecting exactly one path
   
    Text tableName = new Text(job.get(OUTPUT_TABLE));
    HTable table = null;
    try {
      table = new HTable(job, tableName);
    } catch(IOException e) {
      LOG.error(e);
      throw e;
    }
    return new TableRecordWriter(table);
View Full Code Here

    m_cols = new Text[colNames.length];
    for(int i = 0; i < m_cols.length; i++) {
      m_cols[i] = new Text(colNames[i]);
    }
    try {
      m_table = new HTable(job, m_tableName);
    } catch (Exception e) {
      LOG.error(e);
    }
  }
View Full Code Here

    LOG.info("Print table contents using scanner+filter before map/reduce for " + TABLE_NAME);
    scanTableWithRowFilter(TABLE_NAME, true);
  }

  private void scanTable(final String tableName, final boolean printValues) throws IOException {
    HTable table = new HTable(conf, new Text(tableName));

    HScannerInterface scanner = table.obtainScanner(columns, HConstants.EMPTY_START_ROW);
    int numFound = doScan(scanner, printValues);
    Assert.assertEquals(NUM_ROWS, numFound);
  }
View Full Code Here

TOP

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

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.