当前位置: 首页>>代码示例>>Java>>正文


Java MatchCode类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode的典型用法代码示例。如果您正苦于以下问题:Java MatchCode类的具体用法?Java MatchCode怎么用?Java MatchCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MatchCode类属于org.apache.hadoop.hbase.regionserver.ScanQueryMatcher包,在下文中一共展示了MatchCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkVersion

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
/**
 * Check whether this version should be retained.
 * There are 4 variables considered:
 * If this version is past max versions -> skip it
 * If this kv has expired or was deleted, check min versions
 * to decide whther to skip it or not.
 *
 * Increase the version counter unless this is a delete
 */
private MatchCode checkVersion(byte type, long timestamp) {
  if (!CellUtil.isDelete(type)) {
    currentCount++;
  }
  if (currentCount > maxVersions) {
    return ScanQueryMatcher.MatchCode.SEEK_NEXT_COL; // skip to next col
  }
  // keep the KV if required by minversions or it is not expired, yet
  if (currentCount <= minVersions || !isExpired(timestamp)) {
    setTSAndType(timestamp, type);
    return ScanQueryMatcher.MatchCode.INCLUDE;
  } else {
    return MatchCode.SEEK_NEXT_COL;
  }

}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:ScanWildcardColumnTracker.java

示例2: testMatch_ExplicitColumns

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
public void testMatch_ExplicitColumns()
throws IOException {
  //Moving up from the Tracker by using Gets and List<KeyValue> instead
  //of just byte []

  //Expected result
  List<MatchCode> expected = new ArrayList<ScanQueryMatcher.MatchCode>();
  expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_COL);
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL);
  expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_COL);
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL);
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW);
  expected.add(ScanQueryMatcher.MatchCode.DONE);

  _testMatch_ExplicitColumns(scan, expected);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:TestQueryMatcher.java

示例3: runTest

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
private void runTest(int maxVersions,
                     TreeSet<byte[]> trackColumns,
                     List<byte[]> scannerColumns,
                     List<MatchCode> expected) throws IOException {
  ColumnTracker exp = new ExplicitColumnTracker(
    trackColumns, 0, maxVersions, Long.MIN_VALUE);


  //Initialize result
  List<ScanQueryMatcher.MatchCode> result = new ArrayList<ScanQueryMatcher.MatchCode>();

  long timestamp = 0;
  //"Match"
  for(byte [] col : scannerColumns){
    result.add(ScanQueryMatcher.checkColumn(exp, col, 0, col.length, ++timestamp,
      KeyValue.Type.Put.getCode(), false));
  }

  assertEquals(expected.size(), result.size());
  for(int i=0; i< expected.size(); i++){
    assertEquals(expected.get(i), result.get(i));
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:TestExplicitColumnTracker.java

示例4: testGet_SingleVersion

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
@Test
public void testGet_SingleVersion() throws IOException{
  //Create tracker
  TreeSet<byte[]> columns = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR);
  //Looking for every other
  columns.add(col2);
  columns.add(col4);
  List<MatchCode> expected = new ArrayList<ScanQueryMatcher.MatchCode>();
  expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_COL);             // col1
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL); // col2
  expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_COL);             // col3
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW); // col4
  expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_ROW);             // col5
  int maxVersions = 1;

  //Create "Scanner"
  List<byte[]> scanner = new ArrayList<byte[]>();
  scanner.add(col1);
  scanner.add(col2);
  scanner.add(col3);
  scanner.add(col4);
  scanner.add(col5);

  runTest(maxVersions, columns, scanner, expected);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:TestExplicitColumnTracker.java

示例5: checkVersion

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
/**
 * Check whether this version should be retained. There are 4 variables considered: If this
 * version is past max versions -> skip it If this kv has expired or was deleted, check min
 * versions to decide whther to skip it or not. Increase the version counter unless this is a
 * delete
 */
private MatchCode checkVersion(byte type, long timestamp) {
  if (!KeyValue.isDelete(type)) {
    currentCount++;
  }
  if (currentCount > maxVersions) {
    return ScanQueryMatcher.MatchCode.SEEK_NEXT_COL; // skip to next col
  }
  // keep the KV if required by minversions or it is not expired, yet
  if (currentCount <= minVersions || !isExpired(timestamp)) {
    setTSAndType(timestamp, type);
    return ScanQueryMatcher.MatchCode.INCLUDE;
  } else {
    return MatchCode.SEEK_NEXT_COL;
  }

}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:23,代码来源:ScanWildcardColumnTracker.java

示例6: testMatch_ExplicitColumnsWithLookAhead

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
public void testMatch_ExplicitColumnsWithLookAhead()
throws IOException {
  //Moving up from the Tracker by using Gets and List<KeyValue> instead
  //of just byte []

  //Expected result
  List<MatchCode> expected = new ArrayList<ScanQueryMatcher.MatchCode>();
  expected.add(ScanQueryMatcher.MatchCode.SKIP);
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL);
  expected.add(ScanQueryMatcher.MatchCode.SKIP);
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL);
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW);
  expected.add(ScanQueryMatcher.MatchCode.DONE);

  Scan s = new Scan(scan);
  s.setAttribute(Scan.HINT_LOOKAHEAD, Bytes.toBytes(2));
  _testMatch_ExplicitColumns(s, expected);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:19,代码来源:TestQueryMatcher.java

示例7: testDropDeletes

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
private void testDropDeletes(
    byte[] from, byte[] to, byte[][] rows, MatchCode... expected) throws IOException {
  long now = EnvironmentEdgeManager.currentTime();
  // Set time to purge deletes to negative value to avoid it ever happening.
  ScanInfo scanInfo = new ScanInfo(fam2, 0, 1, ttl, KeepDeletedCells.FALSE, -1L, rowComparator);
  NavigableSet<byte[]> cols = get.getFamilyMap().get(fam2);

  ScanQueryMatcher qm = new ScanQueryMatcher(scan, scanInfo, cols, Long.MAX_VALUE,
      HConstants.OLDEST_TIMESTAMP, HConstants.OLDEST_TIMESTAMP, now, from, to, null);
  List<ScanQueryMatcher.MatchCode> actual =
      new ArrayList<ScanQueryMatcher.MatchCode>(rows.length);
  byte[] prevRow = null;
  for (byte[] row : rows) {
    if (prevRow == null || !Bytes.equals(prevRow, row)) {
      qm.setRow(row, 0, (short)row.length);
      prevRow = row;
    }
    actual.add(qm.match(new KeyValue(row, fam2, null, now, Type.Delete)));
  }

  assertEquals(expected.length, actual.size());
  for (int i = 0; i < expected.length; i++) {
    if (PRINT) System.out.println("expected " + expected[i] + ", actual " + actual.get(i));
    assertEquals(expected[i], actual.get(i));
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:27,代码来源:TestQueryMatcher.java

示例8: runTest

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
private void runTest(int maxVersions,
                     TreeSet<byte[]> trackColumns,
                     List<byte[]> scannerColumns,
                     List<MatchCode> expected, int lookAhead) throws IOException {
  ColumnTracker exp = new ExplicitColumnTracker(
    trackColumns, 0, maxVersions, Long.MIN_VALUE, lookAhead);


  //Initialize result
  List<ScanQueryMatcher.MatchCode> result = new ArrayList<ScanQueryMatcher.MatchCode>();

  long timestamp = 0;
  //"Match"
  for(byte [] col : scannerColumns){
    result.add(ScanQueryMatcher.checkColumn(exp, col, 0, col.length, ++timestamp,
      KeyValue.Type.Put.getCode(), false));
  }

  assertEquals(expected.size(), result.size());
  for(int i=0; i< expected.size(); i++){
    assertEquals(expected.get(i), result.get(i));
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:24,代码来源:TestExplicitColumnTracker.java

示例9: testGet_SingleVersion

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
@Test
public void testGet_SingleVersion() throws IOException{
  //Create tracker
  TreeSet<byte[]> columns = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR);
  //Looking for every other
  columns.add(col2);
  columns.add(col4);
  List<MatchCode> expected = new ArrayList<ScanQueryMatcher.MatchCode>();
  expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_COL);             // col1
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL); // col2
  expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_COL);             // col3
  expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW); // col4
  expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_ROW);             // col5
  int maxVersions = 1;

  //Create "Scanner"
  List<byte[]> scanner = new ArrayList<byte[]>();
  scanner.add(col1);
  scanner.add(col2);
  scanner.add(col3);
  scanner.add(col4);
  scanner.add(col5);

  runTest(maxVersions, columns, scanner, expected, 0);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:26,代码来源:TestExplicitColumnTracker.java

示例10: checkVersion

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
/**
 * Check whether this version should be retained.
 * There are 4 variables considered:
 * If this version is past max versions -> skip it
 * If this kv has expired or was deleted, check min versions
 * to decide whther to skip it or not.
 *
 * Increase the version counter unless this is a delete
 */
private MatchCode checkVersion(byte type, long timestamp) {
  if (!KeyValue.isDelete(type)) {
    currentCount++;
  }
  if (currentCount > maxVersions) {
    return ScanQueryMatcher.MatchCode.SEEK_NEXT_COL; // skip to next col
  }
  // keep the KV if required by minversions or it is not expired, yet
  if (currentCount <= minVersions || !isExpired(timestamp)) {
    setTSAndType(timestamp, type);
    return ScanQueryMatcher.MatchCode.INCLUDE;
  } else {
    return MatchCode.SEEK_NEXT_COL;
  }

}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:26,代码来源:ScanWildcardColumnTracker.java

示例11: testDropDeletes

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
private void testDropDeletes(
    byte[] from, byte[] to, byte[][] rows, MatchCode... expected) throws IOException {
  long now = EnvironmentEdgeManager.currentTimeMillis();
  // Set time to purge deletes to negative value to avoid it ever happening.
  ScanInfo scanInfo = new ScanInfo(fam2, 0, 1, ttl, false, -1L, rowComparator);
  NavigableSet<byte[]> cols = get.getFamilyMap().get(fam2);

  ScanQueryMatcher qm = new ScanQueryMatcher(scan, scanInfo, cols, Long.MAX_VALUE,
      HConstants.OLDEST_TIMESTAMP, HConstants.OLDEST_TIMESTAMP, from, to, null);
  List<ScanQueryMatcher.MatchCode> actual =
      new ArrayList<ScanQueryMatcher.MatchCode>(rows.length);
  byte[] prevRow = null;
  for (byte[] row : rows) {
    if (prevRow == null || !Bytes.equals(prevRow, row)) {
      qm.setRow(row, 0, (short)row.length);
      prevRow = row;
    }
    actual.add(qm.match(new KeyValue(row, fam2, null, now, Type.Delete)));
  }

  assertEquals(expected.length, actual.size());
  for (int i = 0; i < expected.length; i++) {
    if (PRINT) System.out.println("expected " + expected[i] + ", actual " + actual.get(i));
    assertEquals(expected[i], actual.get(i));
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:27,代码来源:TestQueryMatcher.java

示例12: checkVersionForTwoVersion

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
private MatchCode checkVersionForTwoVersion(long timestamp) {
  // keep the KV if required by minversions or it is not expired, yet
  if (timestamp > queryTimestamp) {
  	return ScanQueryMatcher.MatchCode.SKIP; // skip to next col
  }
  else if(timestamp > cubeTimestamp){
  	if(hasGetQueryVersion)
  		return MatchCode.SKIP;
  	else{
  	hasGetQueryVersion = true; 
       return ScanQueryMatcher.MatchCode.INCLUDE;
  	} 
  	
  }else if(hasGetQueryVersion){
  	return ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL;
  }else{
  	return ScanQueryMatcher.MatchCode.SEEK_NEXT_COL;
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:20,代码来源:ScanWildcardColumnTracker.java

示例13: testDropDeletes

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
private void testDropDeletes(
    byte[] from, byte[] to, byte[][] rows, MatchCode... expected) throws IOException {
  long now = EnvironmentEdgeManager.currentTimeMillis();
  // Set time to purge deletes to negative value to avoid it ever happening.
  ScanInfo scanInfo = new ScanInfo(fam2, 0, 1, ttl, false, -1L, rowComparator);
  NavigableSet<byte[]> cols = get.getFamilyMap().get(fam2);

  ScanQueryMatcher qm = new ScanQueryMatcher(scan, scanInfo, cols, Long.MAX_VALUE,
      HConstants.OLDEST_TIMESTAMP, HConstants.OLDEST_TIMESTAMP, from, to);
  List<ScanQueryMatcher.MatchCode> actual =
      new ArrayList<ScanQueryMatcher.MatchCode>(rows.length);
  byte[] prevRow = null;
  for (byte[] row : rows) {
    if (prevRow == null || !Bytes.equals(prevRow, row)) {
      qm.setRow(row, 0, (short)row.length);
      prevRow = row;
    }
    actual.add(qm.match(new KeyValue(row, fam2, null, now, Type.Delete)));
  }

  assertEquals(expected.length, actual.size());
  for (int i = 0; i < expected.length; i++) {
    if (PRINT) System.out.println("expected " + expected[i] + ", actual " + actual.get(i));
    assertEquals(expected[i], actual.get(i));
  }
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:27,代码来源:TestQueryMatcher.java

示例14: checkVersions

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
@Override
public ScanQueryMatcher.MatchCode checkVersions(byte[] bytes, int offset, int length,
    long timestamp, byte type, boolean ignoreCount) throws IOException {
  assert !CellUtil.isDelete(type);
  if (ignoreCount) return ScanQueryMatcher.MatchCode.INCLUDE;
  // Check if it is a duplicate timestamp
  if (sameAsPreviousTS(timestamp)) {
    // If duplicate, skip this Key
    return ScanQueryMatcher.MatchCode.SKIP;
  }
  int count = this.column.increment();
  if (count >= maxVersions || (count >= minVersions && isExpired(timestamp))) {
    // Done with versions for this column
    ++this.index;
    resetTS();
    if (done()) {
      // We have served all the requested columns.
      this.column = null;
      return ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW;
    }
    // We are done with current column; advance to next column
    // of interest.
    this.column = this.columns[this.index];
    return ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL;
  }
  setTS(timestamp);
  return ScanQueryMatcher.MatchCode.INCLUDE;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:ExplicitColumnTracker.java

示例15: getNextRowOrNextColumn

import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode; //导入依赖的package包/类
public MatchCode getNextRowOrNextColumn(byte[] bytes, int offset,
    int qualLength) {
  doneWithColumn(bytes, offset,qualLength);

  if (getColumnHint() == null) {
    return MatchCode.SEEK_NEXT_ROW;
  } else {
    return MatchCode.SEEK_NEXT_COL;
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:ExplicitColumnTracker.java


注:本文中的org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。