You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2017/11/04 17:10:02 UTC
[3/7] hbase git commit: HBASE-19179 Remove hbase-prefix-tree
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/TestColumnBuilder.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/TestColumnBuilder.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/TestColumnBuilder.java
deleted file mode 100644
index 19a6311..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/TestColumnBuilder.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.column;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.hadoop.hbase.nio.SingleByteBuff;
-import org.apache.hadoop.hbase.testclassification.MiscTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
-import org.apache.hadoop.hbase.codec.prefixtree.decode.column.ColumnReader;
-import org.apache.hadoop.hbase.codec.prefixtree.encode.column.ColumnSectionWriter;
-import org.apache.hadoop.hbase.codec.prefixtree.encode.other.ColumnNodeType;
-import org.apache.hadoop.hbase.codec.prefixtree.encode.tokenize.Tokenizer;
-import org.apache.hadoop.hbase.codec.prefixtree.encode.tokenize.TokenizerNode;
-import org.apache.hadoop.hbase.util.ByteRange;
-import org.apache.hadoop.hbase.util.ByteRangeUtils;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.byterange.impl.ByteRangeTreeSet;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-@Category({MiscTests.class, SmallTests.class})
-@RunWith(Parameterized.class)
-public class TestColumnBuilder {
-
- @Parameters
- public static Collection<Object[]> parameters() {
- return new TestColumnData.InMemory().getAllAsObjectArray();
- }
-
- /*********** fields **********************************/
-
- protected TestColumnData columns;
- protected ByteRangeTreeSet columnSorter;
- protected List<ByteRange> sortedUniqueColumns;
- protected PrefixTreeBlockMeta blockMeta;
- protected Tokenizer builder;
- protected ColumnSectionWriter writer;
- protected byte[] bytes;
- protected byte[] buffer;
- protected ColumnReader reader;
-
- /*************** construct ****************************/
-
- public TestColumnBuilder(TestColumnData columns) {
- this.columns = columns;
- List<ByteRange> inputs = columns.getInputs();
- this.columnSorter = new ByteRangeTreeSet(inputs);
- this.sortedUniqueColumns = columnSorter.compile().getSortedRanges();
- List<byte[]> copies = ByteRangeUtils.copyToNewArrays(sortedUniqueColumns);
- Assert.assertTrue(Bytes.isSorted(copies));
- this.blockMeta = new PrefixTreeBlockMeta();
- this.blockMeta.setNumMetaBytes(0);
- this.blockMeta.setNumRowBytes(0);
- this.builder = new Tokenizer();
- }
-
- /************* methods ********************************/
-
- @Test
- public void testReaderRoundTrip() throws IOException {
- for (int i = 0; i < sortedUniqueColumns.size(); ++i) {
- ByteRange column = sortedUniqueColumns.get(i);
- builder.addSorted(column);
- }
- List<byte[]> builderOutputArrays = builder.getArrays();
- for (int i = 0; i < builderOutputArrays.size(); ++i) {
- byte[] inputArray = sortedUniqueColumns.get(i).deepCopyToNewArray();
- byte[] outputArray = builderOutputArrays.get(i);
- boolean same = Bytes.equals(inputArray, outputArray);
- Assert.assertTrue(same);
- }
- Assert.assertEquals(sortedUniqueColumns.size(), builderOutputArrays.size());
-
- writer = new ColumnSectionWriter(blockMeta, builder, ColumnNodeType.QUALIFIER);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- writer.compile().writeBytes(baos);
- bytes = baos.toByteArray();
- buffer = new byte[blockMeta.getMaxQualifierLength()];
- reader = new ColumnReader(buffer, ColumnNodeType.QUALIFIER);
- reader.initOnBlock(blockMeta, new SingleByteBuff(ByteBuffer.wrap(bytes)));
-
- List<TokenizerNode> builderNodes = Lists.newArrayList();
- builder.appendNodes(builderNodes, true, true);
- int i = 0;
- for (TokenizerNode builderNode : builderNodes) {
- if (!builderNode.hasOccurrences()) {
- continue;
- }
- Assert.assertEquals(1, builderNode.getNumOccurrences());// we de-duped before adding to
- // builder
- int position = builderNode.getOutputArrayOffset();
- byte[] output = reader.populateBuffer(position).copyBufferToNewArray();
- boolean same = Bytes.equals(sortedUniqueColumns.get(i).deepCopyToNewArray(), output);
- Assert.assertTrue(same);
- ++i;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/TestColumnData.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/TestColumnData.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/TestColumnData.java
deleted file mode 100644
index d9315ab..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/TestColumnData.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.column;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.hadoop.hbase.codec.prefixtree.column.data.TestColumnDataRandom;
-import org.apache.hadoop.hbase.codec.prefixtree.column.data.TestColumnDataSimple;
-import org.apache.hadoop.hbase.util.ByteRange;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public interface TestColumnData {
-
- List<ByteRange> getInputs();
- List<ByteRange> getOutputs();
-
- class InMemory {
- public Collection<Object[]> getAllAsObjectArray() {
- List<Object[]> all = Lists.newArrayList();
- all.add(new Object[] { new TestColumnDataSimple() });
- for (int leftShift = 0; leftShift < 16; ++leftShift) {
- all.add(new Object[] { new TestColumnDataRandom(1 << leftShift) });
- }
- return all;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/data/TestColumnDataRandom.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/data/TestColumnDataRandom.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/data/TestColumnDataRandom.java
deleted file mode 100644
index 0fdc616..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/data/TestColumnDataRandom.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.column.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.column.TestColumnData;
-import org.apache.hadoop.hbase.util.ByteRange;
-import org.apache.hadoop.hbase.util.SimpleMutableByteRange;
-import org.apache.hadoop.hbase.util.byterange.ByteRangeSet;
-import org.apache.hadoop.hbase.util.byterange.impl.ByteRangeTreeSet;
-import org.apache.hadoop.hbase.util.RedundantKVGenerator;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestColumnDataRandom implements TestColumnData {
-
- private List<ByteRange> inputs = Lists.newArrayList();
- private List<ByteRange> outputs = Lists.newArrayList();
-
- public TestColumnDataRandom(int numColumns) {
- RedundantKVGenerator generator = new RedundantKVGenerator();
- ByteRangeSet sortedColumns = new ByteRangeTreeSet();
- List<KeyValue> d = generator.generateTestKeyValues(numColumns);
- for (KeyValue col : d) {
- ByteRange colRange = new SimpleMutableByteRange(CellUtil.cloneQualifier(col));
- inputs.add(colRange);
- sortedColumns.add(colRange);
- }
- for (ByteRange col : sortedColumns.compile().getSortedRanges()) {
- outputs.add(col);
- }
- }
-
- @Override
- public List<ByteRange> getInputs() {
- return inputs;
- }
-
- @Override
- public List<ByteRange> getOutputs() {
- return outputs;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/data/TestColumnDataSimple.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/data/TestColumnDataSimple.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/data/TestColumnDataSimple.java
deleted file mode 100644
index 721240a..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/column/data/TestColumnDataSimple.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.column.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.codec.prefixtree.column.TestColumnData;
-import org.apache.hadoop.hbase.util.ByteRange;
-import org.apache.hadoop.hbase.util.ByteRangeUtils;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestColumnDataSimple implements TestColumnData {
-
- @Override
- public List<ByteRange> getInputs() {
- List<String> d = Lists.newArrayList();
- d.add("abc");
- d.add("abcde");
- d.add("abc");
- d.add("bbc");
- d.add("abc");
- return ByteRangeUtils.fromArrays(Bytes.getUtf8ByteArrays(d));
- }
-
- @Override
- public List<ByteRange> getOutputs() {
- List<String> d = Lists.newArrayList();
- d.add("abc");
- d.add("abcde");
- d.add("bbc");
- return ByteRangeUtils.fromArrays(Bytes.getUtf8ByteArrays(d));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/BaseTestRowData.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/BaseTestRowData.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/BaseTestRowData.java
deleted file mode 100644
index d006740..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/BaseTestRowData.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellSearcher;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public abstract class BaseTestRowData implements TestRowData {
-
- @Override
- public List<Integer> getRowStartIndexes() {
- List<Integer> rowStartIndexes = Lists.newArrayList();
- rowStartIndexes.add(0);
- List<KeyValue> inputs = getInputs();
- for (int i = 1; i < inputs.size(); ++i) {
- KeyValue lastKv = inputs.get(i - 1);
- KeyValue kv = inputs.get(i);
- if (!CellUtil.matchingRows(lastKv, kv)) {
- rowStartIndexes.add(i);
- }
- }
- return rowStartIndexes;
- }
-
- @Override
- public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
- }
-
- @Override
- public void individualSearcherAssertions(CellSearcher searcher) {
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestPrefixTreeSearcher.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestPrefixTreeSearcher.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestPrefixTreeSearcher.java
deleted file mode 100644
index 0dbec21..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestPrefixTreeSearcher.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.PrivateCellUtil;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.KeyValueUtil;
-import org.apache.hadoop.hbase.nio.ByteBuff;
-import org.apache.hadoop.hbase.nio.SingleByteBuff;
-import org.apache.hadoop.hbase.testclassification.MiscTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.hbase.codec.prefixtree.decode.DecoderFactory;
-import org.apache.hadoop.hbase.codec.prefixtree.encode.PrefixTreeEncoder;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataSearchWithPrefix;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellScannerPosition;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellSearcher;
-import org.apache.hadoop.hbase.util.ByteBufferUtils;
-import org.apache.hadoop.hbase.util.CollectionUtils;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@Category({MiscTests.class, SmallTests.class})
-@RunWith(Parameterized.class)
-public class TestPrefixTreeSearcher {
-
- protected static int BLOCK_START = 7;
-
- @Parameters
- public static Collection<Object[]> parameters() {
- return TestRowData.InMemory.getAllAsObjectArray();
- }
-
- protected TestRowData rows;
- protected ByteBuff block;
-
- public TestPrefixTreeSearcher(TestRowData testRows) throws IOException {
- this.rows = testRows;
- ByteArrayOutputStream os = new ByteArrayOutputStream(1 << 20);
- PrefixTreeEncoder kvBuilder = new PrefixTreeEncoder(os, true);
- for (KeyValue kv : rows.getInputs()) {
- kvBuilder.write(kv);
- }
- kvBuilder.flush();
- byte[] outputBytes = os.toByteArray();
- ByteBuffer out = ByteBuffer.allocateDirect(outputBytes.length);
- ByteBufferUtils.copyFromArrayToBuffer(out, outputBytes, 0, outputBytes.length);
- out.position(0);
- this.block = new SingleByteBuff(out);
- }
-
- @Test
- public void testScanForwards() throws IOException {
- CellSearcher searcher = null;
- try {
- searcher = DecoderFactory.checkOut(block, true);
-
- int i = -1;
- while (searcher.advance()) {
- ++i;
- KeyValue inputCell = rows.getInputs().get(i);
- Cell outputCell = searcher.current();
-
- // check all 3 permutations of equals()
- Assert.assertEquals(inputCell, outputCell);
- Assert.assertEquals(outputCell, inputCell);
- Assert.assertTrue(CellUtil.equals(inputCell, outputCell));
- }
- Assert.assertEquals(rows.getInputs().size(), i + 1);
- } finally {
- DecoderFactory.checkIn(searcher);
- }
- }
-
-
- @Test
- public void testScanBackwards() throws IOException {
- CellSearcher searcher = null;
- try {
- searcher = DecoderFactory.checkOut(block, true);
- searcher.positionAfterLastCell();
- int i = -1;
- while (searcher.previous()) {
- ++i;
- int oppositeIndex = rows.getInputs().size() - i - 1;
- KeyValue inputKv = rows.getInputs().get(oppositeIndex);
- KeyValue outputKv = KeyValueUtil.copyToNewKeyValue(searcher.current());
- Assert.assertEquals(inputKv, outputKv);
- }
- Assert.assertEquals(rows.getInputs().size(), i + 1);
- } finally {
- DecoderFactory.checkIn(searcher);
- }
- }
-
-
- @Test
- public void testRandomSeekHits() throws IOException {
- CellSearcher searcher = null;
- try {
- searcher = DecoderFactory.checkOut(block, true);
- for (KeyValue kv : rows.getInputs()) {
- boolean hit = searcher.positionAt(kv);
- Assert.assertTrue(hit);
- Cell foundKv = searcher.current();
- Assert.assertTrue(CellUtil.equals(kv, foundKv));
- }
- } finally {
- DecoderFactory.checkIn(searcher);
- }
- }
-
- @Test
- public void testRandomSeekMisses() throws IOException {
- CellSearcher searcher = null;
- List<Integer> rowStartIndexes = rows.getRowStartIndexes();
- try {
- searcher = DecoderFactory.checkOut(block, true);
-
- //test both the positionAtOrBefore and positionAtOrAfter methods
- for(boolean beforeVsAfterOnMiss : new boolean[]{true, false}){
- for (int i=0; i < rows.getInputs().size(); ++i) {
- KeyValue kv = rows.getInputs().get(i);
-
- //nextRow
- Cell inputNextRow = PrivateCellUtil.createFirstOnNextRow(kv);
-
- CellScannerPosition position = beforeVsAfterOnMiss
- ? searcher.positionAtOrBefore(inputNextRow)
- : searcher.positionAtOrAfter(inputNextRow);
- boolean isFirstInRow = rowStartIndexes.contains(i);
- if(isFirstInRow){
- int rowIndex = rowStartIndexes.indexOf(i);
- if(rowIndex < rowStartIndexes.size() - 1){
- if(beforeVsAfterOnMiss){
- Assert.assertEquals(CellScannerPosition.BEFORE, position);
- }else{
- Assert.assertEquals(CellScannerPosition.AFTER, position);
- }
-
- int expectedInputIndex = beforeVsAfterOnMiss
- ? rowStartIndexes.get(rowIndex + 1) - 1
- : rowStartIndexes.get(rowIndex + 1);
- Assert.assertEquals(rows.getInputs().get(expectedInputIndex), searcher.current());
- }
- }
-
- //previous KV
- KeyValue inputPreviousKv = KeyValueUtil.previousKey(kv);
- boolean hit = searcher.positionAt(inputPreviousKv);
- Assert.assertFalse(hit);
- position = searcher.positionAtOrAfter(inputPreviousKv);
- if(CollectionUtils.isLastIndex(rows.getInputs(), i)){
- Assert.assertTrue(CellScannerPosition.AFTER_LAST == position);
- }else{
- Assert.assertTrue(CellScannerPosition.AFTER == position);
- /*
- * TODO: why i+1 instead of i?
- */
- Assert.assertEquals(rows.getInputs().get(i+1), searcher.current());
- }
- }
- }
- } finally {
- DecoderFactory.checkIn(searcher);
- }
- }
-
-
- @Test
- public void testRandomSeekIndividualAssertions() throws IOException {
- CellSearcher searcher = null;
- try {
- searcher = DecoderFactory.checkOut(block, true);
- rows.individualSearcherAssertions(searcher);
- } finally {
- DecoderFactory.checkIn(searcher);
- }
- }
-
- @Test
- public void testSeekWithPrefix() throws IOException {
- if (!(rows instanceof TestRowDataSearchWithPrefix)) {
- return;
- }
- CellSearcher searcher = null;
- try {
- searcher = DecoderFactory.checkOut(block, true);
- // seek with half bytes of second row key, should return second row
- KeyValue kv = rows.getInputs().get(1);
- KeyValue firstKVOnRow = KeyValueUtil.createFirstOnRow(Arrays.copyOfRange(
- kv.getRowArray(), kv.getRowOffset(),
- kv.getRowOffset() + kv.getRowLength() / 2));
- CellScannerPosition position = searcher.positionAtOrAfter(firstKVOnRow);
- Assert.assertEquals(CellScannerPosition.AFTER, position);
- Assert.assertEquals(kv, searcher.current());
- } finally {
- DecoderFactory.checkIn(searcher);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestRowData.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestRowData.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestRowData.java
deleted file mode 100644
index 8d18712..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestRowData.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataComplexQualifiers;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataDeeper;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataDifferentTimestamps;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataEmpty;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataExerciseFInts;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataNub;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataNumberStrings;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataQualifierByteOrdering;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataRandomKeyValues;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataRandomKeyValuesWithTags;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataSearchWithPrefix;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataSearcherRowMiss;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataSimple;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataSingleQualifier;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataTrivial;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataTrivialWithTags;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataUrls;
-import org.apache.hadoop.hbase.codec.prefixtree.row.data.TestRowDataUrlsExample;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellSearcher;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-/*
- * A master class for registering different implementations of TestRowData.
- */
-public interface TestRowData {
-
- List<KeyValue> getInputs();
- List<Integer> getRowStartIndexes();
-
- void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta);
-
- void individualSearcherAssertions(CellSearcher searcher);
-
- static class InMemory {
-
- /*
- * The following are different styles of data that the codec may encounter. Having these small
- * representations of the data helps pinpoint what is wrong if the encoder breaks.
- */
- public static Collection<TestRowData> getAll() {
- List<TestRowData> all = Lists.newArrayList();
- //simple
- all.add(new TestRowDataEmpty());
- all.add(new TestRowDataTrivial());
- all.add(new TestRowDataTrivialWithTags());
- all.add(new TestRowDataSimple());
- all.add(new TestRowDataDeeper());
-
- //more specific
- all.add(new TestRowDataSingleQualifier());
-// all.add(new TestRowDataMultiFamilies());//multiple families disabled in PrefixTreeEncoder
- all.add(new TestRowDataNub());
- all.add(new TestRowDataSearcherRowMiss());
- all.add(new TestRowDataQualifierByteOrdering());
- all.add(new TestRowDataComplexQualifiers());
- all.add(new TestRowDataDifferentTimestamps());
-
- //larger data volumes (hard to debug)
- all.add(new TestRowDataNumberStrings());
- all.add(new TestRowDataUrls());
- all.add(new TestRowDataUrlsExample());
- all.add(new TestRowDataExerciseFInts());
- all.add(new TestRowDataRandomKeyValues());
- all.add(new TestRowDataRandomKeyValuesWithTags());
-
- //test data for HBase-12078
- all.add(new TestRowDataSearchWithPrefix());
- return all;
- }
-
- public static Collection<Object[]> getAllAsObjectArray() {
- List<Object[]> all = Lists.newArrayList();
- for (TestRowData testRows : getAll()) {
- all.add(new Object[] { testRows });
- }
- return all;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestRowEncoder.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestRowEncoder.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestRowEncoder.java
deleted file mode 100644
index a8e5feb..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/TestRowEncoder.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.KeyValueUtil;
-import org.apache.hadoop.hbase.nio.ByteBuff;
-import org.apache.hadoop.hbase.nio.SingleByteBuff;
-import org.apache.hadoop.hbase.testclassification.MiscTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
-import org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeArraySearcher;
-import org.apache.hadoop.hbase.codec.prefixtree.encode.PrefixTreeEncoder;
-import org.apache.hadoop.hbase.util.ByteBufferUtils;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-@Category({MiscTests.class, SmallTests.class})
-@RunWith(Parameterized.class)
-public class TestRowEncoder {
-
- protected static int BLOCK_START = 7;
-
- @Parameters
- public static Collection<Object[]> parameters() {
- return TestRowData.InMemory.getAllAsObjectArray();
- }
-
- protected TestRowData rows;
- protected List<KeyValue> inputKvs;
- protected boolean includeMemstoreTS = true;
- protected ByteArrayOutputStream os;
- protected PrefixTreeEncoder encoder;
- protected int totalBytes;
- protected PrefixTreeBlockMeta blockMetaWriter;
- protected byte[] outputBytes;
- protected ByteBuff buffer;
- protected ByteArrayInputStream is;
- protected PrefixTreeBlockMeta blockMetaReader;
- protected byte[] inputBytes;
- protected PrefixTreeArraySearcher searcher;
-
- public TestRowEncoder(TestRowData testRows) {
- this.rows = testRows;
- }
-
- @Before
- public void compile() throws IOException {
- // Always run with tags. But should also ensure that KVs without tags work fine
- os = new ByteArrayOutputStream(1 << 20);
- encoder = new PrefixTreeEncoder(os, includeMemstoreTS);
-
- inputKvs = rows.getInputs();
- for (KeyValue kv : inputKvs) {
- encoder.write(kv);
- }
- encoder.flush();
- totalBytes = encoder.getTotalBytes();
- blockMetaWriter = encoder.getBlockMeta();
- outputBytes = os.toByteArray();
-
- // start reading, but save the assertions for @Test methods
- ByteBuffer out = ByteBuffer.allocateDirect(outputBytes.length);
- ByteBufferUtils.copyFromArrayToBuffer(out, outputBytes, 0, outputBytes.length);
- out.position(0);
- buffer = new SingleByteBuff(out);
- blockMetaReader = new PrefixTreeBlockMeta(buffer);
-
- searcher = new PrefixTreeArraySearcher(blockMetaReader, blockMetaReader.getRowTreeDepth(),
- blockMetaReader.getMaxRowLength(), blockMetaReader.getMaxQualifierLength(),
- blockMetaReader.getMaxTagsLength());
- searcher.initOnBlock(blockMetaReader, buffer, includeMemstoreTS);
- }
-
- @Test
- public void testEncoderOutput() throws IOException {
- Assert.assertEquals(totalBytes, outputBytes.length);
- Assert.assertEquals(blockMetaWriter, blockMetaReader);
- }
-
- @Test
- public void testForwardScanner() {
- int counter = -1;
- while (searcher.advance()) {
- ++counter;
- KeyValue inputKv = rows.getInputs().get(counter);
- KeyValue outputKv = KeyValueUtil.copyToNewKeyValue(searcher.current());
- assertKeyAndValueEqual(inputKv, outputKv);
- }
- // assert same number of cells
- Assert.assertEquals(rows.getInputs().size(), counter + 1);
- }
-
-
- /**
- * probably not needed since testReverseScannerWithJitter() below is more thorough
- */
- @Test
- public void testReverseScanner() {
- searcher.positionAfterLastCell();
- int counter = -1;
- while (searcher.previous()) {
- ++counter;
- int oppositeIndex = rows.getInputs().size() - counter - 1;
- KeyValue inputKv = rows.getInputs().get(oppositeIndex);
- KeyValue outputKv = KeyValueUtil.copyToNewKeyValue(searcher.current());
- assertKeyAndValueEqual(inputKv, outputKv);
- }
- Assert.assertEquals(rows.getInputs().size(), counter + 1);
- }
-
-
- /**
- * Exercise the nubCellsRemain variable by calling next+previous. NubCellsRemain is basically
- * a special fan index.
- */
- @Test
- public void testReverseScannerWithJitter() {
- searcher.positionAfterLastCell();
- int counter = -1;
- while (true) {
- boolean foundCell = searcher.previous();
- if (!foundCell) {
- break;
- }
- ++counter;
-
- // a next+previous should cancel out
- if (!searcher.isAfterLast()) {
- searcher.advance();
- searcher.previous();
- }
-
- int oppositeIndex = rows.getInputs().size() - counter - 1;
- KeyValue inputKv = rows.getInputs().get(oppositeIndex);
- KeyValue outputKv = KeyValueUtil.copyToNewKeyValue(searcher.current());
- assertKeyAndValueEqual(inputKv, outputKv);
- }
- Assert.assertEquals(rows.getInputs().size(), counter + 1);
- }
-
- @Test
- public void testIndividualBlockMetaAssertions() {
- rows.individualBlockMetaAssertions(blockMetaReader);
- }
-
-
- /**************** helper **************************/
-
- protected void assertKeyAndValueEqual(Cell expected, Cell actual) {
- // assert keys are equal (doesn't compare values)
- Assert.assertEquals(expected, actual);
- if (includeMemstoreTS) {
- Assert.assertEquals(expected.getSequenceId(), actual.getSequenceId());
- }
- // assert values equal
- Assert.assertTrue(Bytes.equals(expected.getValueArray(), expected.getValueOffset(),
- expected.getValueLength(), actual.getValueArray(), actual.getValueOffset(),
- actual.getValueLength()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataComplexQualifiers.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataComplexQualifiers.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataComplexQualifiers.java
deleted file mode 100644
index bee4eac..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataComplexQualifiers.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeTestConstants;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataComplexQualifiers extends BaseTestRowData{
-
- static byte[]
- Arow = Bytes.toBytes("Arow"),
- cf = PrefixTreeTestConstants.TEST_CF,
- v0 = Bytes.toBytes("v0");
-
- static List<byte[]> qualifiers = Lists.newArrayList();
- static {
- List<String> qualifierStrings = Lists.newArrayList();
- qualifierStrings.add("cq");
- qualifierStrings.add("cq0");
- qualifierStrings.add("cq1");
- qualifierStrings.add("cq2");
- qualifierStrings.add("dq0");// second root level fan
- qualifierStrings.add("dq1");// nub
- qualifierStrings.add("dq111");// leaf on nub
- qualifierStrings.add("dq11111a");// leaf on leaf
- for (String s : qualifierStrings) {
- qualifiers.add(Bytes.toBytes(s));
- }
- }
-
- static long ts = 55L;
-
- static List<KeyValue> d = Lists.newArrayList();
- static {
- for (byte[] qualifier : qualifiers) {
- d.add(new KeyValue(Arow, cf, qualifier, ts, v0));
- }
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataDeeper.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataDeeper.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataDeeper.java
deleted file mode 100644
index 3db52cc..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataDeeper.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.KeyValueUtil;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellScannerPosition;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellSearcher;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Assert;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-/*
- * Goes beyond a trivial trie to add a branch on the "cf" node
- */
-public class TestRowDataDeeper extends BaseTestRowData{
-
- static byte[]
- cdc = Bytes.toBytes("cdc"),
- cf6 = Bytes.toBytes("cf6"),
- cfc = Bytes.toBytes("cfc"),
- f = Bytes.toBytes("f"),
- q = Bytes.toBytes("q"),
- v = Bytes.toBytes("v");
-
- static long
- ts = 55L;
-
- static List<KeyValue> d = Lists.newArrayList();
- static{
- d.add(new KeyValue(cdc, f, q, ts, v));
- d.add(new KeyValue(cf6, f, q, ts, v));
- d.add(new KeyValue(cfc, f, q, ts, v));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
- @Override
- public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
- //0: token:c; fan:d,f
- //1: token:f; fan:6,c
- //2: leaves
- Assert.assertEquals(3, blockMeta.getRowTreeDepth());
- }
-
- @Override
- public void individualSearcherAssertions(CellSearcher searcher) {
- /**
- * The searcher should get a token mismatch on the "r" branch. Assert that it skips not only
- * rA, but rB as well.
- */
- KeyValue cfcRow = KeyValueUtil.createFirstOnRow(Bytes.toBytes("cfc"));
- CellScannerPosition position = searcher.positionAtOrAfter(cfcRow);
- Assert.assertEquals(CellScannerPosition.AFTER, position);
- Assert.assertEquals(d.get(2), searcher.current());
- searcher.previous();
- Assert.assertEquals(d.get(1), searcher.current());
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataDifferentTimestamps.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataDifferentTimestamps.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataDifferentTimestamps.java
deleted file mode 100644
index b7793ce..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataDifferentTimestamps.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Assert;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-/*
- * test different timestamps
- */
-public class TestRowDataDifferentTimestamps extends BaseTestRowData{
-
- static byte[]
- Arow = Bytes.toBytes("Arow"),
- Brow = Bytes.toBytes("Brow"),
- cf = Bytes.toBytes("fammy"),
- cq0 = Bytes.toBytes("cq0"),
- cq1 = Bytes.toBytes("cq1"),
- v0 = Bytes.toBytes("v0");
-
- static List<KeyValue> d = Lists.newArrayList();
- static{
- KeyValue kv0 = new KeyValue(Arow, cf, cq0, 0L, v0);
- kv0.setSequenceId(123456789L);
- d.add(kv0);
-
- KeyValue kv1 = new KeyValue(Arow, cf, cq1, 1L, v0);
- kv1.setSequenceId(3L);
- d.add(kv1);
-
- KeyValue kv2 = new KeyValue(Brow, cf, cq0, 12345678L, v0);
- kv2.setSequenceId(65537L);
- d.add(kv2);
-
- //watch out... Long.MAX_VALUE comes back as 1332221664203, even with other encoders
- //d.add(new KeyValue(Brow, cf, cq1, Long.MAX_VALUE, v0));
- KeyValue kv3 = new KeyValue(Brow, cf, cq1, Long.MAX_VALUE-1, v0);
- kv3.setSequenceId(1L);
- d.add(kv3);
-
- KeyValue kv4 = new KeyValue(Brow, cf, cq1, 999999999, v0);
- //don't set memstoreTS
- d.add(kv4);
-
- KeyValue kv5 = new KeyValue(Brow, cf, cq1, 12345, v0);
- kv5.setSequenceId(0L);
- d.add(kv5);
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
- @Override
- public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
- Assert.assertTrue(blockMeta.getNumMvccVersionBytes() > 0);
- Assert.assertEquals(12, blockMeta.getNumValueBytes());
-
- Assert.assertFalse(blockMeta.isAllSameTimestamp());
- Assert.assertNotNull(blockMeta.getMinTimestamp());
- Assert.assertTrue(blockMeta.getTimestampIndexWidth() > 0);
- Assert.assertTrue(blockMeta.getTimestampDeltaWidth() > 0);
-
- Assert.assertFalse(blockMeta.isAllSameMvccVersion());
- Assert.assertNotNull(blockMeta.getMinMvccVersion());
- Assert.assertTrue(blockMeta.getMvccVersionIndexWidth() > 0);
- Assert.assertTrue(blockMeta.getMvccVersionDeltaWidth() > 0);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataEmpty.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataEmpty.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataEmpty.java
deleted file mode 100644
index f36c7c7..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataEmpty.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.KeyValue.Type;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataEmpty extends BaseTestRowData{
-
- private static byte[] b = new byte[0];
-
- static List<KeyValue> d = Lists.newArrayList();
- static {
- d.add(new KeyValue(b, b, b, 0L, Type.Put, b));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataExerciseFInts.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataExerciseFInts.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataExerciseFInts.java
deleted file mode 100644
index 16ef39c..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataExerciseFInts.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeTestConstants;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.ByteRange;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.SimpleMutableByteRange;
-import org.apache.hadoop.hbase.util.byterange.impl.ByteRangeTreeSet;
-import org.junit.Assert;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-/*
- * test different timestamps
- *
- * http://pastebin.com/7ks8kzJ2
- * http://pastebin.com/MPn03nsK
- */
-public class TestRowDataExerciseFInts extends BaseTestRowData{
-
- static List<ByteRange> rows;
- static{
- List<String> rowStrings = new ArrayList<>(16);
- rowStrings.add("com.edsBlog/directoryAa/pageAaa");
- rowStrings.add("com.edsBlog/directoryAa/pageBbb");
- rowStrings.add("com.edsBlog/directoryAa/pageCcc");
- rowStrings.add("com.edsBlog/directoryAa/pageDdd");
- rowStrings.add("com.edsBlog/directoryBb/pageEee");
- rowStrings.add("com.edsBlog/directoryBb/pageFff");
- rowStrings.add("com.edsBlog/directoryBb/pageGgg");
- rowStrings.add("com.edsBlog/directoryBb/pageHhh");
- rowStrings.add("com.isabellasBlog/directoryAa/pageAaa");
- rowStrings.add("com.isabellasBlog/directoryAa/pageBbb");
- rowStrings.add("com.isabellasBlog/directoryAa/pageCcc");
- rowStrings.add("com.isabellasBlog/directoryAa/pageDdd");
- rowStrings.add("com.isabellasBlog/directoryBb/pageEee");
- rowStrings.add("com.isabellasBlog/directoryBb/pageFff");
- rowStrings.add("com.isabellasBlog/directoryBb/pageGgg");
- rowStrings.add("com.isabellasBlog/directoryBb/pageHhh");
- ByteRangeTreeSet ba = new ByteRangeTreeSet();
- for(String row : rowStrings){
- ba.add(new SimpleMutableByteRange(Bytes.toBytes(row)));
- }
- rows = ba.compile().getSortedRanges();
- }
-
- static List<String> cols = Lists.newArrayList();
- static{
- cols.add("Chrome");
- cols.add("Chromeb");
- cols.add("Firefox");
- cols.add("InternetExplorer");
- cols.add("Opera");
- cols.add("Safari");
- cols.add("Z1stBrowserWithHuuuuuuuuuuuugeQualifier");
- cols.add("Z2ndBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
- cols.add("Z3rdBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
- cols.add("Z4thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
- cols.add("Z5thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
- cols.add("Z6thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
- cols.add("Z7thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
- cols.add("Z8thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
- cols.add("Z9thBrowserWithEvenBiggerQualifierMoreMoreMoreMoreMore");
- }
-
- static long ts = 1234567890;
-
- static int MAX_VALUE = 50;
-
- static List<KeyValue> kvs = Lists.newArrayList();
- static {
- for (ByteRange row : rows) {
- for (String col : cols) {
- KeyValue kv = new KeyValue(row.deepCopyToNewArray(), PrefixTreeTestConstants.TEST_CF,
- Bytes.toBytes(col), ts, KeyValue.Type.Put, Bytes.toBytes("VALUE"));
- kvs.add(kv);
- }
- }
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return kvs;
- }
-
- @Override
- public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
- Assert.assertTrue(blockMeta.getNextNodeOffsetWidth() > 1);
- Assert.assertTrue(blockMeta.getQualifierOffsetWidth() > 1);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataMultiFamilies.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataMultiFamilies.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataMultiFamilies.java
deleted file mode 100644
index 90a580b..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataMultiFamilies.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataMultiFamilies extends BaseTestRowData{
-
- static byte[]
- rowA = Bytes.toBytes("rowA"),
- rowB = Bytes.toBytes("rowB"),
- famA = Bytes.toBytes("famA"),
- famB = Bytes.toBytes("famB"),
- famBB = Bytes.toBytes("famBB"),
- q0 = Bytes.toBytes("q0"),
- q1 = Bytes.toBytes("q1"),//start with a different character
- vvv = Bytes.toBytes("vvv");
-
- static long ts = 55L;
-
- static List<KeyValue> d = Lists.newArrayList();
- static {
- d.add(new KeyValue(rowA, famA, q0, ts, vvv));
- d.add(new KeyValue(rowA, famB, q1, ts, vvv));
- d.add(new KeyValue(rowA, famBB, q0, ts, vvv));
- d.add(new KeyValue(rowB, famA, q0, ts, vvv));
- d.add(new KeyValue(rowB, famA, q1, ts, vvv));
- d.add(new KeyValue(rowB, famB, q0, ts, vvv));
- d.add(new KeyValue(rowB, famBB, q0, ts, vvv));
- d.add(new KeyValue(rowB, famBB, q1, ts, vvv));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataNub.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataNub.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataNub.java
deleted file mode 100644
index c47cae5..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataNub.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeTestConstants;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataNub extends BaseTestRowData{
-
- static byte[]
- rowA = Bytes.toBytes("rowA"),
- rowB = Bytes.toBytes("rowB"),//nub
- rowBB = Bytes.toBytes("rowBB"),
- cf = PrefixTreeTestConstants.TEST_CF,
- cq0 = Bytes.toBytes("cq0"),
- cq1 = Bytes.toBytes("cq1"),
- v0 = Bytes.toBytes("v0");
-
- static long
- ts = 55L;
-
- static List<KeyValue> d = Lists.newArrayList();
- static{
- d.add(new KeyValue(rowA, cf, cq0, ts, v0));
- d.add(new KeyValue(rowA, cf, cq1, ts, v0));
- d.add(new KeyValue(rowB, cf, cq0, ts, v0));
- d.add(new KeyValue(rowB, cf, cq1, ts, v0));
- d.add(new KeyValue(rowBB, cf, cq0, ts, v0));
- d.add(new KeyValue(rowBB, cf, cq1, ts, v0));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataNumberStrings.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataNumberStrings.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataNumberStrings.java
deleted file mode 100644
index 5c4d008..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataNumberStrings.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.hadoop.hbase.CellComparatorImpl;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.KeyValue.Type;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataNumberStrings extends BaseTestRowData{
-
- static List<KeyValue> d = Lists.newArrayList();
- static {
-
- /**
- * Test a string-encoded list of numbers. 0, 1, 10, 11 will sort as 0, 1, 10, 11 if strings
- * <p/>
- * This helped catch a bug with reverse scanning where it was jumping from the last leaf cell to
- * the previous nub. It should do 11->10, but it was incorrectly doing 11->1
- */
- List<Integer> problematicSeries = Lists.newArrayList(0, 1, 10, 11);//sort this at the end
- for(Integer i : problematicSeries){
-// for(int i=0; i < 13; ++i){
- byte[] row = Bytes.toBytes(""+i);
- byte[] family = Bytes.toBytes("F");
- byte[] column = Bytes.toBytes("C");
- byte[] value = Bytes.toBytes("V");
-
- d.add(new KeyValue(row, family, column, 0L, Type.Put, value));
- }
- Collections.sort(d, CellComparatorImpl.COMPARATOR);
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataQualifierByteOrdering.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataQualifierByteOrdering.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataQualifierByteOrdering.java
deleted file mode 100644
index 6d45efa..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataQualifierByteOrdering.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataQualifierByteOrdering extends BaseTestRowData{
-
- static byte[]
- Arow = Bytes.toBytes("Arow"),
- Brow = Bytes.toBytes("Brow"),
- Brow2 = Bytes.toBytes("Brow2"),
- fam = Bytes.toBytes("HappyFam"),
- cq0 = Bytes.toBytes("cq0"),
- cq1 = Bytes.toBytes("cq1tail"),//make sure tail does not come back as liat
- cq2 = Bytes.toBytes("cq2"),
- v0 = Bytes.toBytes("v0");
-
- static long ts = 55L;
-
- static List<KeyValue> d = Lists.newArrayList();
- static {
- d.add(new KeyValue(Arow, fam, cq0, ts, v0));
- d.add(new KeyValue(Arow, fam, cq1, ts, v0));
- d.add(new KeyValue(Brow, fam, cq0, ts, v0));
- d.add(new KeyValue(Brow, fam, cq2, ts, v0));
- d.add(new KeyValue(Brow2, fam, cq1, ts, v0));
- d.add(new KeyValue(Brow2, fam, cq2, ts, v0));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataRandomKeyValues.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataRandomKeyValues.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataRandomKeyValues.java
deleted file mode 100644
index 7a58f2d..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataRandomKeyValues.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.RedundantKVGenerator;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataRandomKeyValues extends BaseTestRowData {
-
- static List<KeyValue> d = Lists.newArrayList();
- static RedundantKVGenerator generator = new RedundantKVGenerator();
- static {
- d = generator.generateTestKeyValues(1 << 10);
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataRandomKeyValuesWithTags.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataRandomKeyValuesWithTags.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataRandomKeyValuesWithTags.java
deleted file mode 100644
index bd15d3e..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataRandomKeyValuesWithTags.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.RedundantKVGenerator;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-/**
- * Generated KVs with tags
- */
-public class TestRowDataRandomKeyValuesWithTags extends BaseTestRowData {
- static List<KeyValue> d = Lists.newArrayList();
- static RedundantKVGenerator generator = new RedundantKVGenerator();
- static {
- d = generator.generateTestKeyValues(1 << 10, true);
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSearchWithPrefix.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSearchWithPrefix.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSearchWithPrefix.java
deleted file mode 100644
index 0c4bd5b..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSearchWithPrefix.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataSearchWithPrefix extends BaseTestRowData {
-
- static byte[] cf = Bytes.toBytes("cf");
-
- static byte[] cq = Bytes.toBytes("cq");
-
- static byte[] v = Bytes.toBytes("v");
-
- static List<KeyValue> d = Lists.newArrayList();
-
- static long ts = 55L;
-
- static byte[] createRowKey(int keyPart1, int keyPart2) {
- ByteArrayOutputStream bos = new ByteArrayOutputStream(16);
- DataOutputStream dos = new DataOutputStream(bos);
- try {
- dos.writeInt(keyPart1);
- dos.writeInt(keyPart2);
- } catch (IOException e) {
- // should not happen
- throw new RuntimeException(e);
- }
-
- return bos.toByteArray();
- }
-
- static {
- d.add(new KeyValue(createRowKey(1, 12345), cf, cq, ts, v));
- d.add(new KeyValue(createRowKey(12345, 0x01000000), cf, cq, ts, v));
- d.add(new KeyValue(createRowKey(12345, 0x01010000), cf, cq, ts, v));
- d.add(new KeyValue(createRowKey(12345, 0x02000000), cf, cq, ts, v));
- d.add(new KeyValue(createRowKey(12345, 0x02020000), cf, cq, ts, v));
- d.add(new KeyValue(createRowKey(12345, 0x03000000), cf, cq, ts, v));
- d.add(new KeyValue(createRowKey(12345, 0x03030000), cf, cq, ts, v));
- d.add(new KeyValue(createRowKey(12345, 0x04000000), cf, cq, ts, v));
- d.add(new KeyValue(createRowKey(12345, 0x04040000), cf, cq, ts, v));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSearcherRowMiss.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSearcherRowMiss.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSearcherRowMiss.java
deleted file mode 100644
index 2fbd4b4..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSearcherRowMiss.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellScannerPosition;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellSearcher;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Assert;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataSearcherRowMiss extends BaseTestRowData{
-
- static byte[]
- //don't let the rows share any common prefix bytes
- A = Bytes.toBytes("A"),
- AA = Bytes.toBytes("AA"),
- AAA = Bytes.toBytes("AAA"),
- B = Bytes.toBytes("B"),
- cf = Bytes.toBytes("fam"),
- cq = Bytes.toBytes("cq0"),
- v = Bytes.toBytes("v0");
-
- static long
- ts = 55L;
-
- static List<KeyValue> d = Lists.newArrayList();
- static{
- d.add(new KeyValue(A, cf, cq, ts, v));
- d.add(new KeyValue(AA, cf, cq, ts, v));
- d.add(new KeyValue(AAA, cf, cq, ts, v));
- d.add(new KeyValue(B, cf, cq, ts, v));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
- @Override
- public void individualSearcherAssertions(CellSearcher searcher) {
- assertRowOffsetsCorrect();
-
- searcher.resetToBeforeFirstEntry();
-
- //test first cell
- try {
- searcher.advance();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- Cell first = searcher.current();
- Assert.assertTrue(CellUtil.equals(d.get(0), first));
-
- //test first cell in second row
- Assert.assertTrue(searcher.positionAt(d.get(1)));
- Assert.assertTrue(CellUtil.equals(d.get(1), searcher.current()));
-
- testBetween1and2(searcher);
- testBetween2and3(searcher);
- }
-
- /************ private methods, call from above *******************/
-
- private void assertRowOffsetsCorrect(){
- Assert.assertEquals(4, getRowStartIndexes().size());
- }
-
- private void testBetween1and2(CellSearcher searcher){
- CellScannerPosition p;//reuse
- Cell betweenAAndAAA = new KeyValue(AA, cf, cq, ts-2, v);
-
- //test exact
- Assert.assertFalse(searcher.positionAt(betweenAAndAAA));
-
- //test atOrBefore
- p = searcher.positionAtOrBefore(betweenAAndAAA);
- Assert.assertEquals(CellScannerPosition.BEFORE, p);
- Assert.assertTrue(CellUtil.equals(searcher.current(), d.get(1)));
-
- //test atOrAfter
- p = searcher.positionAtOrAfter(betweenAAndAAA);
- Assert.assertEquals(CellScannerPosition.AFTER, p);
- Assert.assertTrue(CellUtil.equals(searcher.current(), d.get(2)));
- }
-
- private void testBetween2and3(CellSearcher searcher){
- CellScannerPosition p;//reuse
- Cell betweenAAAndB = new KeyValue(AAA, cf, cq, ts-2, v);
-
- //test exact
- Assert.assertFalse(searcher.positionAt(betweenAAAndB));
-
- //test atOrBefore
- p = searcher.positionAtOrBefore(betweenAAAndB);
- Assert.assertEquals(CellScannerPosition.BEFORE, p);
- Assert.assertTrue(CellUtil.equals(searcher.current(), d.get(2)));
-
- //test atOrAfter
- p = searcher.positionAtOrAfter(betweenAAAndB);
- Assert.assertEquals(CellScannerPosition.AFTER, p);
- Assert.assertTrue(CellUtil.equals(searcher.current(), d.get(3)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSimple.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSimple.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSimple.java
deleted file mode 100644
index edb6dde..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSimple.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellScannerPosition;
-import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellSearcher;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.CollectionUtils;
-import org.junit.Assert;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataSimple extends BaseTestRowData {
-
- static byte[]
- // don't let the rows share any common prefix bytes
- rowA = Bytes.toBytes("Arow"),
- rowB = Bytes.toBytes("Brow"), cf = Bytes.toBytes("fam"),
- cq0 = Bytes.toBytes("cq0"),
- cq1 = Bytes.toBytes("cq1tail"),// make sure tail does not come back as liat
- cq2 = Bytes.toBytes("dcq2"),// start with a different character
- v0 = Bytes.toBytes("v0");
-
- static long ts = 55L;
-
- static List<KeyValue> d = Lists.newArrayList();
- static {
- d.add(new KeyValue(rowA, cf, cq0, ts, v0));
- d.add(new KeyValue(rowA, cf, cq1, ts, v0));
- d.add(new KeyValue(rowA, cf, cq2, ts, v0));
- d.add(new KeyValue(rowB, cf, cq0, ts, v0));
- d.add(new KeyValue(rowB, cf, cq1, ts, v0));
- d.add(new KeyValue(rowB, cf, cq2, ts, v0));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
- @Override
- public void individualSearcherAssertions(CellSearcher searcher) {
- CellScannerPosition p;// reuse
- searcher.resetToBeforeFirstEntry();
-
- // test first cell
- try {
- searcher.advance();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- Cell first = searcher.current();
- Assert.assertTrue(CellUtil.equals(d.get(0), first));
-
- // test first cell in second row
- Assert.assertTrue(searcher.positionAt(d.get(3)));
- Assert.assertTrue(CellUtil.equals(d.get(3), searcher.current()));
-
- Cell between4And5 = new KeyValue(rowB, cf, cq1, ts - 2, v0);
-
- // test exact
- Assert.assertFalse(searcher.positionAt(between4And5));
-
- // test atOrBefore
- p = searcher.positionAtOrBefore(between4And5);
- Assert.assertEquals(CellScannerPosition.BEFORE, p);
- Assert.assertTrue(CellUtil.equals(searcher.current(), d.get(4)));
-
- // test atOrAfter
- p = searcher.positionAtOrAfter(between4And5);
- Assert.assertEquals(CellScannerPosition.AFTER, p);
- Assert.assertTrue(CellUtil.equals(searcher.current(), d.get(5)));
-
- // test when key falls before first key in block
- Cell beforeFirst = new KeyValue(Bytes.toBytes("A"), cf, cq0, ts, v0);
- Assert.assertFalse(searcher.positionAt(beforeFirst));
- p = searcher.positionAtOrBefore(beforeFirst);
- Assert.assertEquals(CellScannerPosition.BEFORE_FIRST, p);
- p = searcher.positionAtOrAfter(beforeFirst);
- Assert.assertEquals(CellScannerPosition.AFTER, p);
- Assert.assertTrue(CellUtil.equals(searcher.current(), d.get(0)));
- Assert.assertEquals(d.get(0), searcher.current());
-
- // test when key falls after last key in block
- Cell afterLast = new KeyValue(Bytes.toBytes("z"), cf, cq0, ts, v0);// must be lower case z
- Assert.assertFalse(searcher.positionAt(afterLast));
- p = searcher.positionAtOrAfter(afterLast);
- Assert.assertEquals(CellScannerPosition.AFTER_LAST, p);
- p = searcher.positionAtOrBefore(afterLast);
- Assert.assertEquals(CellScannerPosition.BEFORE, p);
- Assert.assertTrue(CellUtil.equals(searcher.current(), CollectionUtils.getLast(d)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f8c58930/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSingleQualifier.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSingleQualifier.java b/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSingleQualifier.java
deleted file mode 100644
index 294dc3f..0000000
--- a/hbase-prefix-tree/src/test/java/org/apache/hadoop/hbase/codec/prefixtree/row/data/TestRowDataSingleQualifier.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.codec.prefixtree.row.data;
-
-import java.util.List;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeTestConstants;
-import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
-
-public class TestRowDataSingleQualifier extends BaseTestRowData{
-
- static byte[]
- rowA = Bytes.toBytes("rowA"),
- rowB = Bytes.toBytes("rowB"),
- cf = PrefixTreeTestConstants.TEST_CF,
- cq0 = Bytes.toBytes("cq0"),
- v0 = Bytes.toBytes("v0");
-
- static long ts = 55L;
-
- static List<KeyValue> d = Lists.newArrayList();
- static {
- d.add(new KeyValue(rowA, cf, cq0, ts, v0));
- d.add(new KeyValue(rowB, cf, cq0, ts, v0));
- }
-
- @Override
- public List<KeyValue> getInputs() {
- return d;
- }
-
-}