-
Notifications
You must be signed in to change notification settings - Fork 524
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add a method |
||
short value = (short) (((startRow[0] << 8) | (startRow[1] & 0xFF)) +1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. format the code There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use one line if ≤ 100 |
||
} | ||
return this.scan(table, scan); | ||
} | ||
|
||
|
There was a problem hiding this comment.
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)@javeme @zyxxoo we could use
suggestion
for users to know the review clearly (and could also apply it directly)