Skip to content

Commit 1d3efa1

Browse files
committed
[Chore] fix review
1 parent 575aa00 commit 1d3efa1

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/query/ObTableQuery.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public byte[] encode() {
183183
} else {
184184
len = HTABLE_FILTER_DUMMY_BYTES.length;
185185
System.arraycopy(HTABLE_FILTER_DUMMY_BYTES, 0, bytes, idx, len);
186+
idx += len;
186187
}
187188

188189
return bytes;
@@ -484,7 +485,8 @@ public void setScanRangeColumns(List<String> scanRangeColumns) {
484485
this.scanRangeColumns = scanRangeColumns;
485486
}
486487

487-
public void setObKVParams(ObKVParams obKVParams) {
488+
// This interface is just for OBKV-Hbase
489+
public void setObHbaseParams(ObKVParams obKVParams) {
488490
this.isHbaseQuery = true;
489491
this.obKVParams = obKVParams;
490492
}

src/main/java/com/alipay/oceanbase/rpc/table/ObHBaseParams.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@
2323
import static com.alipay.oceanbase.rpc.util.Serialization.encodeObUniVersionHeader;
2424

2525
public class ObHBaseParams extends ObKVParamsBase {
26-
int caching = -1; // 限制scan返回的行的数量
27-
int callTimeout = -1; // scannerLeasePeriodTimeout,代表客户端scan的单个rpc超时时间以及服务端的scan的超时时间的一部分
28-
boolean allowPartialResults = true; // 是否允许行内部分返回
29-
boolean isCacheBlock = false; // 是否启用缓存
30-
boolean checkExistenceOnly = false; // 查看是否存在不返回数据
26+
int caching = -1; // limit the number of for each rpc call
27+
int callTimeout = -1; // scannerLeasePeriodTimeout in hbase, client rpc timeout
28+
boolean allowPartialResults = true; // whether allow partial row return or not
29+
boolean isCacheBlock = false; // whether enable server block cache and row cache or not
30+
boolean checkExistenceOnly = false; // check the existence only
31+
32+
private static final int FLAG_ALLOW_PARTIAL_RESULTS = 1 << 0;
33+
private static final int FLAG_IS_CACHE_BLOCK = 1 << 1;
34+
private static final int FLAG_CHECK_EXISTENCE_ONLY = 1 << 2;
3135

3236
public ObHBaseParams() {
3337
pType = paramType.HBase;
@@ -87,11 +91,11 @@ public byte[] booleansToByteArray() {
8791
byte[] bytes = new byte[1]; // 1 byte for 4 booleans
8892

8993
if (allowPartialResults)
90-
bytes[0] |= 0x01; // 00000010
94+
bytes[0] |= FLAG_ALLOW_PARTIAL_RESULTS;
9195
if (isCacheBlock)
92-
bytes[0] |= 0x02; // 00000100
96+
bytes[0] |= FLAG_IS_CACHE_BLOCK;
9397
if (checkExistenceOnly)
94-
bytes[0] |= 0x04; // 00001000
98+
bytes[0] |= FLAG_CHECK_EXISTENCE_ONLY;
9599

96100
return bytes;
97101
}
@@ -117,9 +121,9 @@ public byte[] encode() {
117121

118122
public void byteArrayToBooleans(ByteBuf bytes) {
119123
byte b = bytes.readByte();
120-
allowPartialResults = (b & 0x01) != 0;
121-
isCacheBlock = (b & 0x02) != 0;
122-
checkExistenceOnly = (b & 0x04) != 0;
124+
allowPartialResults = (b & FLAG_ALLOW_PARTIAL_RESULTS) != 0;
125+
isCacheBlock = (b & FLAG_IS_CACHE_BLOCK) != 0;
126+
checkExistenceOnly = (b & FLAG_CHECK_EXISTENCE_ONLY) != 0;
123127
}
124128

125129
public Object decode(ByteBuf buf) {

0 commit comments

Comments
 (0)