• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RowRange类的典型用法和代码示例

java 1次浏览

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

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

示例1: testRanges

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testRanges() throws IOException {
  byte[] key1Start = new byte[] {-3};
  byte[] key1End  = new byte[] {-2};

  byte[] key2Start = new byte[] {5};
  byte[] key2End  = new byte[] {6};

  byte[] badKey = new byte[] {-10};

  MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
    new MultiRowRangeFilter.RowRange(key1Start, true, key1End, false),
    new MultiRowRangeFilter.RowRange(key2Start, true, key2End, false)
      ));
  filter.filterRowKey(badKey, 0, 1);
  assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterKeyValue(null));
}
 

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

示例2: testOutOfOrderScannerNextException

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testOutOfOrderScannerNextException() throws Exception {
  MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
          new MultiRowRangeFilter.RowRange(Bytes.toBytes("b"), true, Bytes.toBytes("c"), true),
          new MultiRowRangeFilter.RowRange(Bytes.toBytes("d"), true, Bytes.toBytes("e"), true)
  ));
  filter.filterRowKey(Bytes.toBytes("a"), 0, 1);
  assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterKeyValue(null));
  filter.filterRowKey(Bytes.toBytes("b"), 0, 1);
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
  filter.filterRowKey(Bytes.toBytes("c"), 0, 1);
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
  filter.filterRowKey(Bytes.toBytes("d"), 0, 1);
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
  filter.filterRowKey(Bytes.toBytes("e"), 0, 1);
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
}
 

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

示例3: testMergeAndSortWithOverlap

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithOverlap() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(15), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(20), true, Bytes.toBytes(30), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(50), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(70), false));
  ranges.add(new RowRange(Bytes.toBytes(90), true, Bytes.toBytes(100), false));
  ranges.add(new RowRange(Bytes.toBytes(95), true, Bytes.toBytes(100), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<RowRange>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(70), false));
  expectedRanges.add(new RowRange(Bytes.toBytes(90), true, Bytes.toBytes(100), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

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

示例4: testMultiRowRangeFilterWithoutRangeOverlap

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithoutRangeOverlap() throws IOException {
  tableName = Bytes.toBytes("testMultiRowRangeFilterWithoutRangeOverlap");
  HTable ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(20), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(30), Bytes.toBytes(40), ht);
  List<Cell> results3 = getScanResult(Bytes.toBytes(60), Bytes.toBytes(70), ht);

  assertEquals(results1.size() + results2.size() + results3.size(), resultsSize);

  ht.close();
}
 

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

示例5: testMultiRowRangeFilterWithEmptyStartRow

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithEmptyStartRow() throws IOException {
  tableName = Bytes.toBytes("testMultiRowRangeFilterWithEmptyStartRow");
  HTable ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);
  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(10), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  List<Cell> results1 = getScanResult(Bytes.toBytes(""), Bytes.toBytes(10), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(30), Bytes.toBytes(40), ht);
  assertEquals(results1.size() + results2.size(), resultsSize);

  ht.close();
}
 

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

示例6: testMultiRowRangeFilterWithEmptyStopRow

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithEmptyStopRow() throws IOException {
  tableName = Bytes.toBytes("testMultiRowRangeFilterWithEmptyStopRow");
  HTable ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);
  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(""), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(""), ht);
  assertEquals(results1.size(), resultsSize);

  ht.close();
}
 

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

示例7: testMultiRowRangeFilterWithExclusive

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithExclusive() throws IOException {
  tableName = Bytes.toBytes("testMultiRowRangeFilterWithExclusive");
  HTable ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(65), true, Bytes.toBytes(75), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(40), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(65), Bytes.toBytes(75), ht);

  assertEquals((results1.size() - 1) + results2.size(), resultsSize);

  ht.close();
}
 

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

示例8: mergeRangeScans

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
public static Scan mergeRangeScans(List<Scan> rangeScans) {
  List<RowRange> ranges = Lists.newArrayList();
  
  for (Scan rangeScan : rangeScans) {
    byte[] startRow = rangeScan.getStartRow();
    byte[] stopRow = rangeScan.getStopRow();
    
    ranges.add(new RowRange(startRow, true, stopRow, false));
  }
  
  Scan mergedScan = new Scan();
  try {
    mergedScan.setFilter(new MultiRowRangeFilter(ranges));
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  
  return mergedScan;
}
 

开发者ID:cloudera-labs,
项目名称:envelope,
代码行数:20,
代码来源:HBaseUtils.java

示例9: testMergePrefixScans

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergePrefixScans() throws IOException {
  List<Scan> scans = Lists.newArrayList();
  
  byte[] startRow1 = Bytes.toBytes("hello");
  byte[] stopRow1 = Bytes.toBytes("hellp");
  Scan scan1 = new Scan(startRow1, stopRow1);
  scans.add(scan1);
  
  byte[] startRow2 = Bytes.toBytes("world");
  byte[] stopRow2 = Bytes.toBytes("worle");
  Scan scan2 = new Scan(startRow2, stopRow2);
  scans.add(scan2);
  
  Scan merged = HBaseUtils.mergeRangeScans(scans);
  
  assertEquals(MultiRowRangeFilter.class, merged.getFilter().getClass());
  MultiRowRangeFilter mergedFilter = (MultiRowRangeFilter)merged.getFilter();
  List<RowRange> ranges = mergedFilter.getRowRanges();
  assertEquals(2, ranges.size());
  assertTrue(ranges.get(0).getStartRow().equals(startRow1));
  assertTrue(ranges.get(0).getStopRow().equals(stopRow1));
  assertTrue(ranges.get(1).getStartRow().equals(startRow2));
  assertTrue(ranges.get(1).getStopRow().equals(stopRow2));
}
 

开发者ID:cloudera-labs,
项目名称:envelope,
代码行数:26,
代码来源:TestHBaseUtils.java

示例10: testRanges

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testRanges() throws IOException {
  byte[] key1Start = new byte[] {-3};
  byte[] key1End  = new byte[] {-2};

  byte[] key2Start = new byte[] {5};
  byte[] key2End  = new byte[] {6};

  byte[] badKey = new byte[] {-10};

  MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
    new MultiRowRangeFilter.RowRange(key1Start, true, key1End, false),
    new MultiRowRangeFilter.RowRange(key2Start, true, key2End, false)
      ));
  filter.filterRowKey(KeyValueUtil.createFirstOnRow(badKey));
  /*
   * FAILS -- includes BAD key!
   * Expected :SEEK_NEXT_USING_HINT
   * Actual   :INCLUDE
   * */
  assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterCell(null));
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:23,
代码来源:TestMultiRowRangeFilter.java

示例11: testOutOfOrderScannerNextException

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testOutOfOrderScannerNextException() throws Exception {
  MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
          new MultiRowRangeFilter.RowRange(Bytes.toBytes("b"), true, Bytes.toBytes("c"), true),
          new MultiRowRangeFilter.RowRange(Bytes.toBytes("d"), true, Bytes.toBytes("e"), true)
  ));
  filter.filterRowKey(KeyValueUtil.createFirstOnRow(Bytes.toBytes("a")));
  assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterCell(null));
  filter.filterRowKey(KeyValueUtil.createFirstOnRow(Bytes.toBytes("b")));
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterCell(null));
  filter.filterRowKey(KeyValueUtil.createFirstOnRow(Bytes.toBytes("c")));
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterCell(null));
  filter.filterRowKey(KeyValueUtil.createFirstOnRow(Bytes.toBytes("d")));
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterCell(null));
  filter.filterRowKey(KeyValueUtil.createFirstOnRow(Bytes.toBytes("e")));
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterCell(null));
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:18,
代码来源:TestMultiRowRangeFilter.java

示例12: testMergeAndSortWithOverlap

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithOverlap() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(15), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(20), true, Bytes.toBytes(30), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(50), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(70), false));
  ranges.add(new RowRange(Bytes.toBytes(90), true, Bytes.toBytes(100), false));
  ranges.add(new RowRange(Bytes.toBytes(95), true, Bytes.toBytes(100), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(70), false));
  expectedRanges.add(new RowRange(Bytes.toBytes(90), true, Bytes.toBytes(100), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:17,
代码来源:TestMultiRowRangeFilter.java

示例13: testMultiRowRangeFilterWithoutRangeOverlap

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithoutRangeOverlap() throws IOException {
  tableName = TableName.valueOf(name.getMethodName());
  Table ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(20), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(30), Bytes.toBytes(40), ht);
  List<Cell> results3 = getScanResult(Bytes.toBytes(60), Bytes.toBytes(70), ht);

  assertEquals(results1.size() + results2.size() + results3.size(), resultsSize);

  ht.close();
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:27,
代码来源:TestMultiRowRangeFilter.java

示例14: testMultiRowRangeFilterWithEmptyStartRow

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithEmptyStartRow() throws IOException {
  tableName = TableName.valueOf(name.getMethodName());
  Table ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);
  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(10), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  List<Cell> results1 = getScanResult(Bytes.toBytes(""), Bytes.toBytes(10), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(30), Bytes.toBytes(40), ht);
  assertEquals(results1.size() + results2.size(), resultsSize);

  ht.close();
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:22,
代码来源:TestMultiRowRangeFilter.java

示例15: testMultiRowRangeFilterWithEmptyStopRow

点赞 3

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithEmptyStopRow() throws IOException {
  tableName = TableName.valueOf(name.getMethodName());
  Table ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);
  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(""), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(""), ht);
  assertEquals(results1.size(), resultsSize);

  ht.close();
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:21,
代码来源:TestMultiRowRangeFilter.java

示例16: testMergeAndSortWithEmptyStartRow

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithEmptyStartRow() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(15), true, Bytes.toBytes(40), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<RowRange>();
  expectedRanges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(40), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

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

示例17: testMergeAndSortWithEmptyStopRow

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithEmptyStopRow() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(15), true, Bytes.toBytes(""), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(70), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<RowRange>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

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

示例18: testMergeAndSortWithEmptyStartRowAndStopRow

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithEmptyStartRowAndStopRow() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(""), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(70), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<RowRange>();
  expectedRanges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

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

示例19: testMultiRowRangeWithInvalidRange

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test(expected=IllegalArgumentException.class)
public void testMultiRowRangeWithInvalidRange() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  // the start row larger than the stop row
  ranges.add(new RowRange(Bytes.toBytes(80), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(70), false));
  new MultiRowRangeFilter(ranges);
}
 

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

示例20: testMergeAndSortWithoutOverlap

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithoutOverlap() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<RowRange>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  expectedRanges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  expectedRanges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

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

示例21: testMergeAndSortWithStartRowInclusive

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithStartRowInclusive() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(20), true, Bytes.toBytes(""), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<RowRange>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

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

示例22: testMergeAndSortWithRowExclusive

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithRowExclusive() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(""), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<RowRange>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  expectedRanges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

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

示例23: testMergeAndSortWithRowInclusive

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithRowInclusive() throws IOException {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), true));
  ranges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(""), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<RowRange>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

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

示例24: assertRangesEqual

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
public void assertRangesEqual(List<RowRange> expected, List<RowRange> actual) {
  assertEquals(expected.size(), actual.size());
  for(int i = 0; i < expected.size(); i++) {
    Assert.assertTrue(Bytes.equals(expected.get(i).getStartRow(), actual.get(i).getStartRow()));
    Assert.assertTrue(expected.get(i).isStartRowInclusive() ==
        actual.get(i).isStartRowInclusive());
    Assert.assertTrue(Bytes.equals(expected.get(i).getStopRow(), actual.get(i).getStopRow()));
    Assert.assertTrue(expected.get(i).isStopRowInclusive() ==
        actual.get(i).isStopRowInclusive());
  }
}
 

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

示例25: testMultiRowRangeFilterWithRangeOverlap

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithRangeOverlap() throws IOException {
  tableName = Bytes.toBytes("testMultiRowRangeFilterWithRangeOverlap");
  HTable ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(15), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(65), true, Bytes.toBytes(75), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, null, false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(80), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(40), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(60), Bytes.toBytes(""), ht);

  assertEquals(results1.size() + results2.size(), resultsSize);

  ht.close();
}
 

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

示例26: testMultiRowRangeFilterWithInclusive

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithInclusive() throws IOException {
  tableName = Bytes.toBytes("testMultiRowRangeFilterWithInclusive");
  HTable ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(20), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(65), true, Bytes.toBytes(75), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, null, false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(80), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(40), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(60), Bytes.toBytes(""), ht);

  assertEquals(results1.size() + results2.size(), resultsSize);

  ht.close();
}
 

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

示例27: testMultiRowRangeWithFilterListAndOperator

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeWithFilterListAndOperator() throws IOException {
  tableName = Bytes.toBytes("TestMultiRowRangeFilterWithFilterListAndOperator");
  HTable ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges1 = new ArrayList<RowRange>();
  ranges1.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges1.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  ranges1.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));

  MultiRowRangeFilter filter1 = new MultiRowRangeFilter(ranges1);

  List<RowRange> ranges2 = new ArrayList<RowRange>();
  ranges2.add(new RowRange(Bytes.toBytes(20), true, Bytes.toBytes(40), false));
  ranges2.add(new RowRange(Bytes.toBytes(80), true, Bytes.toBytes(90), false));

  MultiRowRangeFilter filter2 = new MultiRowRangeFilter(ranges2);

  FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);
  filterList.addFilter(filter1);
  filterList.addFilter(filter2);
  scan.setFilter(filterList);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(30), Bytes.toBytes(40), ht);

  assertEquals(results1.size(), resultsSize);

  ht.close();
}
 

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

示例28: testMultiRowRangeWithFilterListOrOperator

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeWithFilterListOrOperator() throws IOException {
  tableName = Bytes.toBytes("TestMultiRowRangeFilterWithFilterListOrOperator");
  HTable ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges1 = new ArrayList<RowRange>();
  ranges1.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  ranges1.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges1.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));

  MultiRowRangeFilter filter1 = new MultiRowRangeFilter(ranges1);

  List<RowRange> ranges2 = new ArrayList<RowRange>();
  ranges2.add(new RowRange(Bytes.toBytes(20), true, Bytes.toBytes(40), false));
  ranges2.add(new RowRange(Bytes.toBytes(80), true, Bytes.toBytes(90), false));

  MultiRowRangeFilter filter2 = new MultiRowRangeFilter(ranges2);

  FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE);
  filterList.addFilter(filter1);
  filterList.addFilter(filter2);
  scan.setFilter(filterList);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(40), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(60), Bytes.toBytes(70), ht);
  List<Cell> results3 = getScanResult(Bytes.toBytes(80), Bytes.toBytes(90), ht);

  assertEquals(results1.size() + results2.size() + results3.size(),resultsSize);

  ht.close();
}
 

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

示例29: testMultiRowRangeFilter

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilter() throws Exception {
  List<RowRange> ranges = new ArrayList<RowRange>();
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));

  MultiRowRangeFilter multiRowRangeFilter =
    new MultiRowRangeFilter(ranges);
  assertTrue(multiRowRangeFilter.areSerializedFieldsEqual(
    ProtobufUtil.toFilter(ProtobufUtil.toFilter(multiRowRangeFilter))));
}
 

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

示例30: testMergeAndSortWithEmptyStartRow

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithEmptyStartRow() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(15), true, Bytes.toBytes(40), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<>();
  expectedRanges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(40), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:11,
代码来源:TestMultiRowRangeFilter.java

示例31: testMergeAndSortWithEmptyStopRow

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithEmptyStopRow() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(15), true, Bytes.toBytes(""), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(70), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:12,
代码来源:TestMultiRowRangeFilter.java

示例32: testMergeAndSortWithEmptyStartRowAndStopRow

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithEmptyStartRowAndStopRow() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(""), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(70), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<>();
  expectedRanges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:12,
代码来源:TestMultiRowRangeFilter.java

示例33: testMultiRowRangeWithInvalidRange

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test(expected=IllegalArgumentException.class)
public void testMultiRowRangeWithInvalidRange() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  // the start row larger than the stop row
  ranges.add(new RowRange(Bytes.toBytes(80), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(70), false));
  new MultiRowRangeFilter(ranges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:10,
代码来源:TestMultiRowRangeFilter.java

示例34: testMergeAndSortWithoutOverlap

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithoutOverlap() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  expectedRanges.add(new RowRange(Bytes.toBytes(30), true, Bytes.toBytes(40), false));
  expectedRanges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(70), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:14,
代码来源:TestMultiRowRangeFilter.java

示例35: testMergeAndSortWithStartRowInclusive

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithStartRowInclusive() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(20), true, Bytes.toBytes(""), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:11,
代码来源:TestMultiRowRangeFilter.java

示例36: testMergeAndSortWithRowExclusive

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithRowExclusive() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(""), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  expectedRanges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:12,
代码来源:TestMultiRowRangeFilter.java

示例37: testMergeAndSortWithRowInclusive

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMergeAndSortWithRowInclusive() throws IOException {
  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), true));
  ranges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(""), false));
  List<RowRange> actualRanges = MultiRowRangeFilter.sortAndMerge(ranges);
  List<RowRange> expectedRanges = new ArrayList<>();
  expectedRanges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(""), false));
  assertRangesEqual(expectedRanges, actualRanges);
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:11,
代码来源:TestMultiRowRangeFilter.java

示例38: testMultiRowRangeFilterWithRangeOverlap

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithRangeOverlap() throws IOException {
  tableName = TableName.valueOf(name.getMethodName());
  Table ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(15), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(65), true, Bytes.toBytes(75), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, null, false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(80), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(40), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(60), Bytes.toBytes(""), ht);

  assertEquals(results1.size() + results2.size(), resultsSize);

  ht.close();
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:28,
代码来源:TestMultiRowRangeFilter.java

示例39: testMultiRowRangeFilterWithInclusive

点赞 2

import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowRange; //导入依赖的package包/类
@Test
public void testMultiRowRangeFilterWithInclusive() throws IOException {
  tableName = TableName.valueOf(name.getMethodName());
  Table ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  generateRows(numRows, ht, family, qf, value);

  Scan scan = new Scan();
  scan.setMaxVersions();

  List<RowRange> ranges = new ArrayList<>();
  ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  ranges.add(new RowRange(Bytes.toBytes(20), true, Bytes.toBytes(40), false));
  ranges.add(new RowRange(Bytes.toBytes(65), true, Bytes.toBytes(75), false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, null, false));
  ranges.add(new RowRange(Bytes.toBytes(60), true, Bytes.toBytes(80), false));

  MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  scan.setFilter(filter);
  int resultsSize = getResultsSize(ht, scan);
  LOG.info("found " + resultsSize + " results");
  List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(40), ht);
  List<Cell> results2 = getScanResult(Bytes.toBytes(60), Bytes.toBytes(""), ht);

  assertEquals(results1.size() + results2.size(), resultsSize);

  ht.close();
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:28,
代码来源:TestMultiRowRangeFilter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)