Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-28578 Remove deprecated methods in HFileScanner #5885

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,13 @@ public Cell getKey() {
return delegate.getKey();
}

@Override
public String getKeyString() {
if (atEnd) return null;

return delegate.getKeyString();
}

@Override
public ByteBuffer getValue() {
if (atEnd) return null;

return delegate.getValue();
}

@Override
public String getValueString() {
if (atEnd) return null;

return delegate.getValueString();
}

@Override
public Cell getCell() {
if (atEnd) return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1040,16 +1040,6 @@ protected Cell getFirstKeyCellInBlock(HFileBlock curBlock) {
}
}

@Override
public String getKeyString() {
return CellUtil.toString(getKey(), false);
}

@Override
public String getValueString() {
return ByteBufferUtils.toStringBinary(getValue());
}

public int compareKey(CellComparator comparator, Cell key) {
blockBuffer.asSubByteBuffer(blockBuffer.position() + KEY_VALUE_LEN_SIZE, currKeyLen, pair);
this.bufBackedKeyOnlyKv.setKey(pair.getFirst(), pair.getSecond(), currKeyLen, rowLen);
Expand Down Expand Up @@ -1571,17 +1561,6 @@ public Cell getCell() {
return seeker.getCell();
}

@Override
public String getKeyString() {
return CellUtil.toString(getKey(), false);
}

@Override
public String getValueString() {
ByteBuffer valueBuffer = getValue();
return ByteBufferUtils.toStringBinary(valueBuffer);
}

private void assertValidSeek() {
if (this.curBlock == null) {
throw new NotSeekedException(reader.getPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,6 @@ public interface HFileScanner extends Shipper, Closeable {
/** Returns Instance of {@link org.apache.hadoop.hbase.Cell}. */
Cell getCell();

/**
* Convenience method to get a copy of the key as a string - interpreting the bytes as UTF8. You
* must call {@link #seekTo(Cell)} before this method.
* @return key as a string
* @deprecated Since hbase-2.0.0
*/
@Deprecated
String getKeyString();

/**
* Convenience method to get a copy of the value as a string - interpreting the bytes as UTF8. You
* must call {@link #seekTo(Cell)} before this method.
* @return value as a string
* @deprecated Since hbase-2.0.0
*/
@Deprecated
String getValueString();

/** Returns Reader that underlies this Scanner instance. */
HFile.Reader getReader();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.hadoop.hbase.Tag;
import org.apache.hadoop.hbase.testclassification.IOTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.ByteBufferUtils;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.ClassRule;
import org.junit.Test;
Expand Down Expand Up @@ -118,7 +119,7 @@ private void testReseekToInternals(TagUsage tagUsage) throws IOException {
long start = System.nanoTime();
scanner.seekTo(new KeyValue(Bytes.toBytes(key), Bytes.toBytes("family"),
Bytes.toBytes("qual"), Bytes.toBytes(value)));
assertEquals(value, scanner.getValueString());
assertEquals(value, ByteBufferUtils.toStringBinary(scanner.getValue()));
}

scanner.seekTo();
Expand All @@ -128,7 +129,7 @@ private void testReseekToInternals(TagUsage tagUsage) throws IOException {
long start = System.nanoTime();
scanner.reseekTo(new KeyValue(Bytes.toBytes(key), Bytes.toBytes("family"),
Bytes.toBytes("qual"), Bytes.toBytes(value)));
assertEquals("i is " + i, value, scanner.getValueString());
assertEquals("i is " + i, value, ByteBufferUtils.toStringBinary(scanner.getValue()));
}

reader.close();
Expand Down