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


Java UniformSplit类代码示例

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


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

示例1: testCreatePresplitTableUniform

import org.apache.hadoop.hbase.util.RegionSplitter.UniformSplit; //导入依赖的package包/类
/**
 * Test creating a pre-split table using the UniformSplit algorithm.
 */
@Test
public void testCreatePresplitTableUniform() throws Exception {
  List<byte[]> expectedBounds = new ArrayList<byte[]>();
  expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY);
  expectedBounds.add(new byte[] {      0x10, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x20, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x30, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x40, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x50, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x60, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x70, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0x80, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0x90, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xa0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xb0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xc0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xd0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xe0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xf0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY);

  // Do table creation/pre-splitting and verification of region boundaries
  preSplitTableAndVerify(expectedBounds, UniformSplit.class.getSimpleName(),
    TableName.valueOf("NewUniformPresplitTable"));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:TestRegionSplitter.java

示例2: testCreatePresplitTableUniform

import org.apache.hadoop.hbase.util.RegionSplitter.UniformSplit; //导入依赖的package包/类
/**
 * Test creating a pre-split table using the UniformSplit algorithm.
 */
@Test
public void testCreatePresplitTableUniform() throws Exception {
  List<byte[]> expectedBounds = new ArrayList<byte[]>();
  expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY);
  expectedBounds.add(new byte[] {      0x10, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x20, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x30, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x40, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x50, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x60, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x70, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0x80, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0x90, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xa0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xb0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xc0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xd0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xe0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {(byte)0xf0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY);

  // Do table creation/pre-splitting and verification of region boundaries
  preSplitTableAndVerify(expectedBounds, UniformSplit.class.getSimpleName(),
    "NewUniformPresplitTable");
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:TestRegionSplitter.java

示例3: testCreatePresplitTableUniform

import org.apache.hadoop.hbase.util.RegionSplitter.UniformSplit; //导入依赖的package包/类
/**
 * Test creating a pre-split table using the UniformSplit algorithm.
 */
@Test
public void testCreatePresplitTableUniform() throws Exception {
  List<byte[]> expectedBounds = new ArrayList<>(17);
  expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY);
  expectedBounds.add(new byte[] {      0x10, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x20, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x30, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] {      0x40, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] { 0x50, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(new byte[] { 0x60, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(new byte[] { 0x70, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(new byte[] { (byte) 0x80, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(new byte[] { (byte) 0x90, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(new byte[] {(byte)0xa0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] { (byte) 0xb0, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(new byte[] { (byte) 0xc0, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(new byte[] { (byte) 0xd0, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(new byte[] {(byte)0xe0, 0, 0, 0, 0, 0, 0, 0});
  expectedBounds.add(new byte[] { (byte) 0xf0, 0, 0, 0, 0, 0, 0, 0 });
  expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY);

  // Do table creation/pre-splitting and verification of region boundaries
  preSplitTableAndVerify(expectedBounds, UniformSplit.class.getSimpleName(),
      TableName.valueOf(name.getMethodName()));
}
 
开发者ID:apache,项目名称:hbase,代码行数:29,代码来源:TestRegionSplitter.java

示例4: unitTestUniformSplit

import org.apache.hadoop.hbase.util.RegionSplitter.UniformSplit; //导入依赖的package包/类
/**
 * Unit tests for the UniformSplit algorithm. Makes sure it divides up the space of
 * keys in the way that we expect.
 */
@Test
public void unitTestUniformSplit() {
    UniformSplit splitter = new UniformSplit();

    // Check splitting while starting from scratch
    try {
        splitter.split(1);
        throw new AssertionError("Splitting into <2 regions should have thrown exception");
    } catch (IllegalArgumentException e) { }

    byte[][] twoRegionsSplits = splitter.split(2);
    assertEquals(1, twoRegionsSplits.length);
    assertArrayEquals(twoRegionsSplits[0],
        new byte[] { (byte) 0x80, 0, 0, 0, 0, 0, 0, 0 });

    byte[][] threeRegionsSplits = splitter.split(3);
    assertEquals(2, threeRegionsSplits.length);
    byte[] expectedSplit0 = new byte[] {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
    assertArrayEquals(expectedSplit0, threeRegionsSplits[0]);
    byte[] expectedSplit1 = new byte[] {(byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA,
            (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA};
    assertArrayEquals(expectedSplit1, threeRegionsSplits[1]);

    // Check splitting existing regions that have start and end points
    byte[] splitPoint = splitter.split(new byte[] {0x10}, new byte[] {0x30});
    assertArrayEquals(new byte[] {0x20}, splitPoint);

    byte[] lastRow = new byte[] {xFF, xFF, xFF, xFF, xFF, xFF, xFF, xFF};
    assertArrayEquals(lastRow, splitter.lastRow());
    byte[] firstRow = ArrayUtils.EMPTY_BYTE_ARRAY;
    assertArrayEquals(firstRow, splitter.firstRow());

    splitPoint = splitter.split(firstRow, new byte[] {0x20});
    assertArrayEquals(splitPoint, new byte[] {0x10});

    splitPoint = splitter.split(new byte[] {(byte)0xdf, xFF, xFF, xFF, xFF,
            xFF, xFF, xFF}, lastRow);
    assertArrayEquals(splitPoint,
            new byte[] {(byte)0xef, xFF, xFF, xFF, xFF, xFF, xFF, xFF});

    splitPoint = splitter.split(new byte[] {'a', 'a', 'a'}, new byte[] {'a', 'a', 'b'});
    assertArrayEquals(splitPoint, new byte[] {'a', 'a', 'a', (byte)0x80 });
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:48,代码来源:TestRegionSplitter.java

示例5: unitTestUniformSplit

import org.apache.hadoop.hbase.util.RegionSplitter.UniformSplit; //导入依赖的package包/类
/**
 * Unit tests for the UniformSplit algorithm. Makes sure it divides up the space of
 * keys in the way that we expect.
 */
@Test
public void unitTestUniformSplit() {
    UniformSplit splitter = new UniformSplit();

    // Check splitting while starting from scratch
    try {
        splitter.split(1);
        throw new AssertionError("Splitting into <2 regions should have thrown exception");
    } catch (IllegalArgumentException e) { }

    byte[][] twoRegionsSplits = splitter.split(2);
    assertEquals(1, twoRegionsSplits.length);
    assertArrayEquals(twoRegionsSplits[0],
        new byte[] { (byte) 0x80, 0, 0, 0, 0, 0, 0, 0 });

    byte[][] threeRegionsSplits = splitter.split(3);
    assertEquals(2, threeRegionsSplits.length);
    byte[] expectedSplit0 = new byte[] {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
    assertArrayEquals(expectedSplit0, threeRegionsSplits[0]);
    byte[] expectedSplit1 = new byte[] {(byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA,
            (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA};
    assertArrayEquals(expectedSplit1, threeRegionsSplits[1]);

    // Check splitting existing regions that have start and end points
    byte[] splitPoint = splitter.split(new byte[] {0x10}, new byte[] {0x30});
    assertArrayEquals(new byte[] {0x20}, splitPoint);

    byte[] lastRow = new byte[] {xFF, xFF, xFF, xFF, xFF, xFF, xFF, xFF};
    assertArrayEquals(lastRow, splitter.lastRow());
    byte[] firstRow = ArrayUtils.EMPTY_BYTE_ARRAY;
    assertArrayEquals(firstRow, splitter.firstRow());

    splitPoint = splitter.split(firstRow, new byte[] {0x20});
    assertArrayEquals(splitPoint, new byte[] {0x10});

    splitPoint = splitter.split(new byte[] {(byte)0xdf, xFF, xFF, xFF, xFF,
            xFF, xFF, xFF}, lastRow);
    assertArrayEquals(splitPoint,
            new byte[] {(byte)0xef, xFF, xFF, xFF, xFF, xFF, xFF, xFF});
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:45,代码来源:TestRegionSplitter.java

示例6: unitTestUniformSplit

import org.apache.hadoop.hbase.util.RegionSplitter.UniformSplit; //导入依赖的package包/类
/**
 * Unit tests for the UniformSplit algorithm. Makes sure it divides up the space of
 * keys in the way that we expect.
 */
@Test
public void unitTestUniformSplit() {
    UniformSplit splitter = new UniformSplit();

    // Check splitting while starting from scratch
    try {
        splitter.split(1);
        throw new AssertionError("Splitting into <2 regions should have thrown exception");
    } catch (IllegalArgumentException e) { }

    byte[][] twoRegionsSplits = splitter.split(2);
    assertEquals(1, twoRegionsSplits.length);
    assertArrayEquals(twoRegionsSplits[0], new byte[] { (byte) 0x80, 0, 0, 0, 0, 0, 0, 0 });

    byte[][] threeRegionsSplits = splitter.split(3);
    assertEquals(2, threeRegionsSplits.length);
    byte[] expectedSplit0 = new byte[] {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
    assertArrayEquals(expectedSplit0, threeRegionsSplits[0]);
    byte[] expectedSplit1 = new byte[] {(byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA,
            (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA};
    assertArrayEquals(expectedSplit1, threeRegionsSplits[1]);

    // Check splitting existing regions that have start and end points
    byte[] splitPoint = splitter.split(new byte[] {0x10}, new byte[] {0x30});
    assertArrayEquals(new byte[] { 0x20 }, splitPoint);

    byte[] lastRow = new byte[] {xFF, xFF, xFF, xFF, xFF, xFF, xFF, xFF};
    assertArrayEquals(lastRow, splitter.lastRow());
    byte[] firstRow = ArrayUtils.EMPTY_BYTE_ARRAY;
    assertArrayEquals(firstRow, splitter.firstRow());

    splitPoint = splitter.split(firstRow, new byte[] {0x20});
    assertArrayEquals(splitPoint, new byte[] { 0x10 });

    splitPoint = splitter.split(new byte[] {(byte)0xdf, xFF, xFF, xFF, xFF,
            xFF, xFF, xFF}, lastRow);
    assertArrayEquals(splitPoint, new byte[] { (byte) 0xef, xFF, xFF, xFF, xFF, xFF, xFF, xFF
    });

    splitPoint = splitter.split(new byte[] {'a', 'a', 'a'}, new byte[] {'a', 'a', 'b'});
    assertArrayEquals(splitPoint, new byte[] { 'a', 'a', 'a', (byte) 0x80 });

    // Check splitting region with multiple mappers per region
    byte[][] splits = splitter.split(new byte[] {'a', 'a', 'a'}, new byte[] {'a', 'a', 'd'}, 3, false);
    assertEquals(2, splits.length);
    assertArrayEquals(splits[0], new byte[]{'a', 'a', 'b'});
    assertArrayEquals(splits[1], new byte[]{'a', 'a', 'c'});

    splits = splitter.split(new byte[] {'a', 'a', 'a'}, new byte[] {'a', 'a', 'e'}, 2, true);
    assertEquals(3, splits.length);
    assertArrayEquals(splits[1], new byte[] { 'a', 'a', 'c'});
}
 
开发者ID:apache,项目名称:hbase,代码行数:57,代码来源:TestRegionSplitter.java


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