當前位置: 首頁>>代碼示例>>Java>>正文


Java Scan.addColumn方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.Scan.addColumn方法的典型用法代碼示例。如果您正苦於以下問題:Java Scan.addColumn方法的具體用法?Java Scan.addColumn怎麽用?Java Scan.addColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.Scan的用法示例。


在下文中一共展示了Scan.addColumn方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testMaxWithInvalidRange

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Test(timeout = 300000)
public void testMaxWithInvalidRange() {
  AggregationClient aClient = new AggregationClient(conf);
  final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = 
      new DoubleColumnInterpreter();
  Scan scan = new Scan();
  scan.setStartRow(ROWS[4]);
  scan.setStopRow(ROWS[2]);
  scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
  double max = Double.MIN_VALUE;
  ;
  try {
    max = aClient.max(TEST_TABLE, ci, scan);
  } catch (Throwable e) {
    max = 0.00;
  }
  assertEquals(0.00, max, 0.00);// control should go to the catch block
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:19,代碼來源:TestDoubleColumnInterpreter.java

示例2: testRow

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Override
void testRow(final int i) throws IOException {
  Scan scan = new Scan(getRandomRow(this.rand, opts.totalRows));
  scan.setCaching(opts.caching);
  FilterList list = new FilterList();
  if (opts.addColumns) {
    scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
  } else {
    scan.addFamily(FAMILY_NAME);
  }
  if (opts.filterAll) {
    list.addFilter(new FilterAllFilter());
  }
  list.addFilter(new WhileMatchFilter(new PageFilter(120)));
  scan.setFilter(list);
  ResultScanner s = this.table.getScanner(scan);
  for (Result rr; (rr = s.next()) != null;) {
    updateValueSize(rr);
  }
  s.close();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:22,代碼來源:PerformanceEvaluation.java

示例3: testMaxWithInvalidRange

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Test (timeout=300000)
public void testMaxWithInvalidRange() {
  AggregationClient aClient = new AggregationClient(conf);
  final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
    new BigDecimalColumnInterpreter();
  Scan scan = new Scan();
  scan.setStartRow(ROWS[4]);
  scan.setStopRow(ROWS[2]);
  scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
  BigDecimal max = new BigDecimal(Long.MIN_VALUE);
  ;
  try {
    max = aClient.max(TEST_TABLE, ci, scan);
  } catch (Throwable e) {
    max = BigDecimal.ZERO;
  }
  assertEquals(BigDecimal.ZERO, max);// control should go to the catch block
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:19,代碼來源:TestBigDecimalColumnInterpreter.java

示例4: constructScan

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
protected Scan constructScan(byte[] valuePrefix) throws IOException {
  FilterList list = new FilterList();
  Filter filter = new SingleColumnValueFilter(
      FAMILY_NAME, COLUMN_ZERO, CompareFilter.CompareOp.EQUAL,
      new BinaryComparator(valuePrefix)
  );
  list.addFilter(filter);
  if(opts.filterAll) {
    list.addFilter(new FilterAllFilter());
  }
  Scan scan = new Scan();
  scan.setCaching(opts.caching);
  if (opts.addColumns) {
    scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
  } else {
    scan.addFamily(FAMILY_NAME);
  }
  scan.setFilter(list);
  return scan;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:21,代碼來源:PerformanceEvaluation.java

示例5: testRawScanWithColumns

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
/**
 * The ExplicitColumnTracker does not support "raw" scanning.
 */
@Test
public void testRawScanWithColumns() throws Exception {
  HTableDescriptor htd = hbu.createTableDescriptor(name.getMethodName(), 0, 3,
      HConstants.FOREVER, KeepDeletedCells.TRUE);
  HRegion region = hbu.createLocalHRegion(htd, null, null);

  Scan s = new Scan();
  s.setRaw(true);
  s.setMaxVersions();
  s.addColumn(c0, c0);

  try {
    region.getScanner(s);
    fail("raw scanner with columns should have failed");
  } catch (org.apache.hadoop.hbase.DoNotRetryIOException dnre) {
    // ok!
  }

  HRegion.closeHRegion(region);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:24,代碼來源:TestKeepDeletes.java

示例6: testRow

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Override
void testRow(final int i) throws IOException {
  Pair<byte[], byte[]> startAndStopRow = getStartAndStopRow();
  Scan scan = new Scan(startAndStopRow.getFirst(), startAndStopRow.getSecond());
  scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
  ResultScanner s = this.table.getScanner(scan);
  int count = 0;
  for (Result rr = null; (rr = s.next()) != null;) {
    count++;
  }

  if (i % 100 == 0) {
    LOG.info(String.format("Scan for key range %s - %s returned %s rows",
        Bytes.toString(startAndStopRow.getFirst()),
        Bytes.toString(startAndStopRow.getSecond()), count));
  }

  s.close();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:20,代碼來源:PerformanceEvaluation.java

示例7: testMaxWithInvalidRange2

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Test(timeout = 300000)
public void testMaxWithInvalidRange2() throws Throwable {
  double max = Double.MIN_VALUE;
  Scan scan = new Scan();
  scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
  scan.setStartRow(ROWS[4]);
  scan.setStopRow(ROWS[4]);
  try {
    AggregationClient aClient = new AggregationClient(conf);
    final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = 
        new DoubleColumnInterpreter();
    max = aClient.max(TEST_TABLE, ci, scan);
  } catch (Exception e) {
    max = 0.00;
  }
  assertEquals(0.00, max, 0.00);// control should go to the catch block
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:18,代碼來源:TestDoubleColumnInterpreter.java

示例8: testStdWithValidRange

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
/**
 * @throws Throwable
 */
@Test(timeout = 300000)
public void testStdWithValidRange() throws Throwable {
  AggregationClient aClient = new AggregationClient(conf);
  Scan scan = new Scan();
  scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
  final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = 
      new DoubleColumnInterpreter();
  double std = aClient.std(TEST_TABLE, ci, scan);
  assertEquals(5.766, std, 0.05d);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:14,代碼來源:TestDoubleColumnInterpreter.java

示例9: find

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Override
public <T> T find(TableName tableName, String family, String qualifier, final
ResultsExtractor<T> action) {
    Scan scan = new Scan();
    scan.addColumn(family.getBytes(getCharset()), qualifier.getBytes(getCharset()));
    return find(tableName, scan, action);
}
 
開發者ID:fchenxi,項目名稱:easyhbase,代碼行數:8,代碼來源:HbaseTemplate2.java

示例10: testMedianWithValidRange

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
/**
 * @throws Throwable
 */
@Test (timeout=300000)
public void testMedianWithValidRange() throws Throwable {
  AggregationClient aClient = new AggregationClient(conf);
  Scan scan = new Scan();
  scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
  final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci = 
      new LongColumnInterpreter();
  long median = aClient.median(TEST_TABLE, ci,
      scan);
  assertEquals(8L, median);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:TestAggregateProtocol.java

示例11: testAvgWithFilter

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Test(timeout = 300000)
public void testAvgWithFilter() throws Throwable {
  AggregationClient aClient = new AggregationClient(conf);
  Scan scan = new Scan();
  scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
  Filter f = new PrefixFilter(Bytes.toBytes("foo:bar"));
  scan.setFilter(f);
  final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci = 
      new DoubleColumnInterpreter();
  Double avg = null;
  avg = aClient.avg(TEST_TABLE, ci, scan);
  assertEquals(Double.NaN, avg, 0);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:14,代碼來源:TestDoubleColumnInterpreter.java

示例12: testSumWithValidRange

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
/**
 * @throws Throwable
 */
@Test (timeout=300000)
public void testSumWithValidRange() throws Throwable {
  AggregationClient aClient = new AggregationClient(conf);
  Scan scan = new Scan();
  scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
  final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
      new LongColumnInterpreter();
  long sum = aClient.sum(TEST_TABLE, ci,
      scan);
  assertEquals(190, sum);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:TestAggregateProtocol.java

示例13: testMaxWithValidRange

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
/**
 * give max for the entire table.
 * @throws Throwable
 */
@Test (timeout=300000)
public void testMaxWithValidRange() throws Throwable {
  AggregationClient aClient = new AggregationClient(conf);
  Scan scan = new Scan();
  scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
  final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
      new LongColumnInterpreter();
  long maximum = aClient.max(TEST_TABLE, ci, scan);
  assertEquals(19, maximum);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:TestAggregateProtocol.java

示例14: scannerOpen

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Override
public int scannerOpen(ByteBuffer tableName, ByteBuffer startRow,
    List<ByteBuffer> columns,
    Map<ByteBuffer, ByteBuffer> attributes) throws IOError {

  Table table = null;
  try {
    table = getTable(tableName);
    Scan scan = new Scan(getBytes(startRow));
    addAttributes(scan, attributes);
    if(columns != null && columns.size() != 0) {
      for(ByteBuffer column : columns) {
        byte [][] famQf = KeyValue.parseColumn(getBytes(column));
        if(famQf.length == 1) {
          scan.addFamily(famQf[0]);
        } else {
          scan.addColumn(famQf[0], famQf[1]);
        }
      }
    }
    return addScanner(table.getScanner(scan), false);
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(Throwables.getStackTraceAsString(e));
  } finally{
    closeTable(table);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:29,代碼來源:ThriftServerRunner.java

示例15: scannerOpenWithStop

import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
@Override
public int scannerOpenWithStop(ByteBuffer tableName, ByteBuffer startRow,
    ByteBuffer stopRow, List<ByteBuffer> columns,
    Map<ByteBuffer, ByteBuffer> attributes)
    throws IOError, TException {

  Table table = null;
  try {
    table = getTable(tableName);
    Scan scan = new Scan(getBytes(startRow), getBytes(stopRow));
    addAttributes(scan, attributes);
    if(columns != null && columns.size() != 0) {
      for(ByteBuffer column : columns) {
        byte [][] famQf = KeyValue.parseColumn(getBytes(column));
        if(famQf.length == 1) {
          scan.addFamily(famQf[0]);
        } else {
          scan.addColumn(famQf[0], famQf[1]);
        }
      }
    }
    return addScanner(table.getScanner(scan), false);
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(Throwables.getStackTraceAsString(e));
  } finally{
    closeTable(table);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:30,代碼來源:ThriftServerRunner.java


注:本文中的org.apache.hadoop.hbase.client.Scan.addColumn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。