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

Improve query performance with HBase #2178

Closed
Closed
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 @@ -19,6 +19,7 @@

import java.io.IOException;
import java.io.InterruptedIOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -418,8 +419,17 @@ default R scan(String table, Set<byte[]> prefixes) {
*/
default R scan(String table, byte[] startRow, boolean inclusiveStart,
byte[] prefix) {
Scan scan = new Scan().withStartRow(startRow, inclusiveStart)
.setFilter(new PrefixFilter(prefix));
Scan scan = new Scan();
if (table.equals("g_oe") || table.equals("g_ie")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverse the equals, and seems we could use the Constant vars to avoid hard code? (search it)

Suggested change
if (table.equals("g_oe") || table.equals("g_ie")) {
if ("g_oe".equals(table) || "g_ie".equals(table)) {

@javeme @zyxxoo we could use suggestion for users to know the review clearly (and could also apply it directly)
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a method HbaseTables.Edge.isEdgeTable(table)

short value = (short) (((startRow[0] << 8) | (startRow[1] & 0xFF)) +1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format the code +1 (lack a space)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some comments for why?

byte[] endRow = ByteBuffer.allocate(2).putShort(value).array();
scan.withStartRow(startRow, inclusiveStart)
.withStopRow(endRow)
.setFilter(new PrefixFilter(prefix));
} else {
scan.withStartRow(startRow, inclusiveStart)
.setFilter(new PrefixFilter(prefix));
Comment on lines +430 to +431
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use one line if ≤ 100

}
return this.scan(table, scan);
}

Expand Down