File tree Expand file tree Collapse file tree 5 files changed +12
-19
lines changed
main/java/com/alipay/oceanbase/rpc
protocol/payload/impl/execute/query
test/java/com/alipay/oceanbase/rpc
protocol/payload/impl/execute/query Expand file tree Collapse file tree 5 files changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -491,13 +491,12 @@ public void setScanRangeColumns(List<String> scanRangeColumns) {
491491 this .scanRangeColumns = scanRangeColumns ;
492492 }
493493
494- // This interface is just for OBKV-Hbase
495- public void setObKVParams (ObKVParams obKVParams ) {
496- if (!(obKVParams .getObParamsBase () instanceof ObHBaseParams )) {
497- throw new FeatureNotSupportedException ("only ObHBaseParams support currently" );
494+ public void setHBaseParams (ObHBaseParams obHBaseParams ) {
495+ if (obKVParams == null ) {
496+ this .obKVParams = new ObKVParams ();
498497 }
498+ this .obKVParams .setObParamsBase (obHBaseParams );
499499 this .isHbaseQuery = true ;
500- this .obKVParams = obKVParams ;
501500 }
502501
503502 public ObKVParams getObKVParams () {
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ public class ObHBaseParams extends ObKVParamsBase {
3333 private static final int FLAG_IS_CACHE_BLOCK = 1 << 1 ;
3434 private static final int FLAG_CHECK_EXISTENCE_ONLY = 1 << 2 ;
3535
36+ private static final int FLAG_BYTE_LENGTH = 1 ;
37+ private static final int BOOLEAN_BYTE_LENGTH = 1 ; // all boolean to one byte
38+
3639 public ObHBaseParams () {
3740 pType = paramType .HBase ;
3841 }
@@ -61,11 +64,6 @@ public void setCheckExistenceOnly(boolean checkExistenceOnly) {
6164 this .checkExistenceOnly = checkExistenceOnly ;
6265 }
6366
64- private int getContentSize () {
65- return 4 + Serialization .getNeedBytes (caching ) + Serialization .getNeedBytes (callTimeout )
66- + 1 ;
67- }
68-
6967 public int getCaching () {
7068 return caching ;
7169 }
@@ -134,8 +132,9 @@ public Object decode(ByteBuf buf) {
134132 }
135133
136134 public long getPayloadContentSize () {
137- return 1 + Serialization .getNeedBytes (caching ) + Serialization .getNeedBytes (callTimeout )
138- + 1 ; // all boolean to one byte
135+ return FLAG_BYTE_LENGTH
136+ + Serialization .getNeedBytes (caching ) + Serialization .getNeedBytes (callTimeout )
137+ + BOOLEAN_BYTE_LENGTH ;
139138 }
140139
141140 public String toString () {
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ public byte getValue() {
3333 }
3434 }
3535
36- public int byteSize ;
3736 public paramType pType ;
3837
3938 public paramType getType () {
Original file line number Diff line number Diff line change @@ -116,9 +116,7 @@ public void setOperationType(ObTableOperationType operationType) {
116116
117117 public void setObKVParams (ObTableQuery query ) {
118118 ObHBaseParams params = new ObHBaseParams ();
119- ObKVParams obKVParams = new ObKVParams ();
120- obKVParams .setObParamsBase (params );
121- query .setObKVParams (obKVParams );
119+ query .setHBaseParams (params );
122120 }
123121
124122 public ObTableAbstractOperationRequest obTableOperationRequest () {
Original file line number Diff line number Diff line change @@ -82,9 +82,7 @@ public void test_ObTableQueryWithHbaseQuery() {
8282 ObTableQuery obTableQuery = getObTableQuery ();
8383 obTableQuery .sethTableFilter (getObHTableFilter ());
8484 ObHBaseParams hBaseParams = new ObHBaseParams ();
85- ObKVParams kv_prams = new ObKVParams ();
86- kv_prams .setObParamsBase (hBaseParams );
87- obTableQuery .setObKVParams (kv_prams );
85+ obTableQuery .setHBaseParams (hBaseParams );
8886
8987 byte [] bytes = obTableQuery .encode ();
9088 ByteBuf buf = PooledByteBufAllocator .DEFAULT .buffer ();
You can’t perform that action at this time.
0 commit comments