@@ -801,7 +801,7 @@ private String getTargetTableName(List<? extends Row> actions) {
801
801
throw new FeatureNotSupportedException ("not supported yet'" );
802
802
} else {
803
803
Set <byte []> familySet = null ;
804
- if (action instanceof Get ){
804
+ if (action instanceof Get ) {
805
805
Get get = (Get ) action ;
806
806
familySet = get .familySet ();
807
807
} else {
@@ -921,7 +921,7 @@ private void processColumnFilters(NavigableSet<byte[]> columnFilters,
921
921
922
922
@ Override
923
923
public Result get (final Get get ) throws IOException {
924
- if (get .getFamilyMap ().keySet () == null || get . getFamilyMap (). keySet () .isEmpty ()) {
924
+ if (get .getFamilyMap ().keySet ().isEmpty ()) {
925
925
// check nothing, use table group;
926
926
} else {
927
927
checkFamilyViolation (get .getFamilyMap ().keySet (), false );
@@ -934,8 +934,7 @@ public Result call() throws IOException {
934
934
byte [] family = new byte [] {};
935
935
ObTableQuery obTableQuery ;
936
936
try {
937
- if (get .getFamilyMap ().keySet () == null
938
- || get .getFamilyMap ().keySet ().isEmpty ()
937
+ if (get .getFamilyMap ().keySet ().isEmpty ()
939
938
|| get .getFamilyMap ().size () > 1 ) {
940
939
// In a Get operation where the family map is greater than 1 or equal to 0,
941
940
// we handle this by appending the column family to the qualifier on the client side.
@@ -1024,8 +1023,7 @@ public ResultScanner call() throws IOException {
1024
1023
ObTableQuery obTableQuery ;
1025
1024
ObHTableFilter filter ;
1026
1025
try {
1027
- if (scan .getFamilyMap ().keySet () == null
1028
- || scan .getFamilyMap ().keySet ().isEmpty ()
1026
+ if (scan .getFamilyMap ().keySet ().isEmpty ()
1029
1027
|| scan .getFamilyMap ().size () > 1 ) {
1030
1028
// In a Scan operation where the family map is greater than 1 or equal to 0,
1031
1029
// we handle this by appending the column family to the qualifier on the client side.
@@ -1107,8 +1105,7 @@ public List<ResultScanner> call() throws IOException {
1107
1105
ObTableQuery obTableQuery ;
1108
1106
ObHTableFilter filter ;
1109
1107
try {
1110
- if (scan .getFamilyMap ().keySet () == null
1111
- || scan .getFamilyMap ().keySet ().isEmpty ()
1108
+ if (scan .getFamilyMap ().keySet ().isEmpty ()
1112
1109
|| scan .getFamilyMap ().size () > 1 ) {
1113
1110
// In a Scan operation where the family map is greater than 1 or equal to 0,
1114
1111
// we handle this by appending the column family to the qualifier on the client side.
@@ -1950,20 +1947,20 @@ public static ObTableBatchOperation buildObTableBatchOperation(List<Mutation> ro
1950
1947
Map <String , Integer > indexMap = new HashMap <>();
1951
1948
for (Mutation row : rowList ) {
1952
1949
if (row instanceof Put ) {
1953
- opType = OHOpType .INSERT_OR_UPDATE ;
1950
+ opType = OHOpType .Put ;
1954
1951
} else if (row instanceof Delete ) {
1955
1952
opType = OHOpType .Delete ;
1956
1953
} else if (row instanceof Increment ) {
1957
1954
opType = OHOpType .Increment ;
1958
1955
} else if (row instanceof Append ) {
1959
- opType = OHOpType .APPEND ;
1956
+ opType = OHOpType .Append ;
1960
1957
} else {
1961
1958
throw new FeatureNotSupportedException ("not supported other type" );
1962
1959
}
1963
1960
Set <Map .Entry <byte [], List <Cell >>> familyCellMap = row .getFamilyCellMap ().entrySet ();
1964
1961
1965
1962
for (Map .Entry <byte [], List <Cell >> familyWithCells : familyCellMap ) {
1966
- if (opType == OHOpType .Increment || opType == OHOpType .APPEND ) {
1963
+ if (opType == OHOpType .Increment || opType == OHOpType .Append ) {
1967
1964
indexMap .clear ();
1968
1965
for (int i = 0 ; i < familyWithCells .getValue ().size (); i ++) {
1969
1966
Cell cell = familyWithCells .getValue ().get (i );
@@ -2002,12 +1999,12 @@ private com.alipay.oceanbase.rpc.mutation.Mutation buildMutation(Cell kv,
2002
1999
property = new Object [] { CellUtil .cloneValue (new_cell ), TTL };
2003
2000
}
2004
2001
switch (operationType ) {
2005
- case INSERT_OR_UPDATE :
2002
+ case Put :
2006
2003
return com .alipay .oceanbase .rpc .mutation .Mutation .getInstance (INSERT_OR_UPDATE ,
2007
2004
ROW_KEY_COLUMNS ,
2008
2005
new Object [] { CellUtil .cloneRow (new_cell ), CellUtil .cloneQualifier (new_cell ),
2009
2006
new_cell .getTimestamp () }, property_columns , property );
2010
- case APPEND :
2007
+ case Append :
2011
2008
return com .alipay .oceanbase .rpc .mutation .Mutation .getInstance (APPEND ,
2012
2009
ROW_KEY_COLUMNS ,
2013
2010
new Object [] { CellUtil .cloneRow (new_cell ), CellUtil .cloneQualifier (new_cell ),
@@ -2116,7 +2113,7 @@ private BatchOperation buildBatchOperation(String tableName, List<? extends Row>
2116
2113
List <Cell > keyValueList = entry .getValue ();
2117
2114
for (Cell kv : keyValueList ) {
2118
2115
singleOpResultNum ++;
2119
- batch .addOperation (buildMutation (kv , OHOpType .INSERT_OR_UPDATE ,
2116
+ batch .addOperation (buildMutation (kv , OHOpType .Put ,
2120
2117
isTableGroup , family , put .getTTL ()));
2121
2118
}
2122
2119
}
@@ -2156,37 +2153,40 @@ public static ObTableOperation buildObTableOperation(Cell kv, OHOpType operation
2156
2153
property = new Object [] { CellUtil .cloneValue (kv ), TTL };
2157
2154
}
2158
2155
switch (operationType ) {
2159
- case INSERT_OR_UPDATE :
2160
- return getInstance (
2161
- INSERT_OR_UPDATE ,
2162
- new Object [] { CellUtil .cloneRow (kv ), CellUtil .cloneQualifier (kv ),
2163
- kv .getTimestamp () }, property_columns , property );
2156
+ case Put :
2164
2157
case Increment :
2158
+ case Append :
2159
+ ObTableOperationType type ;
2160
+ if (operationType == OHOpType .Put ) {
2161
+ type = INSERT_OR_UPDATE ;
2162
+ } else if (operationType == OHOpType .Increment ) {
2163
+ type = INCREMENT ;
2164
+ } else {
2165
+ type = APPEND ;
2166
+ }
2165
2167
return getInstance (
2166
- INCREMENT ,
2167
- new Object [] { CellUtil .cloneRow (kv ), CellUtil .cloneQualifier (kv ),
2168
- kv .getTimestamp () }, property_columns , property );
2169
- case APPEND :
2170
- return getInstance (
2171
- APPEND ,
2168
+ type ,
2172
2169
new Object [] { CellUtil .cloneRow (kv ), CellUtil .cloneQualifier (kv ),
2173
2170
kv .getTimestamp () }, property_columns , property );
2174
2171
case Delete :
2175
- Cell .Type type = kv .getType ();
2176
- if (type == Cell .Type .Delete ) {
2172
+ Cell .Type delType = kv .getType ();
2173
+ if (delType == Cell .Type .Delete ) {
2177
2174
return getInstance (
2178
2175
DEL ,
2179
2176
new Object [] { CellUtil .cloneRow (kv ), CellUtil .cloneQualifier (kv ),
2180
2177
kv .getTimestamp () }, null , null );
2181
- } else if (type == Cell .Type .DeleteColumn ) {
2178
+ } else if (delType == Cell .Type .DeleteColumn ) {
2182
2179
return getInstance (
2183
2180
DEL ,
2184
2181
new Object [] { CellUtil .cloneRow (kv ), CellUtil .cloneQualifier (kv ),
2185
2182
-kv .getTimestamp () }, null , null );
2183
+ } else if (delType == Cell .Type .DeleteFamily ) {
2184
+ return getInstance (DEL ,
2185
+ new Object [] { CellUtil .cloneRow (kv ), null , -kv .getTimestamp () }, null ,
2186
+ null );
2187
+ } else {
2188
+ throw new IllegalArgumentException ("illegal delete type " + operationType );
2186
2189
}
2187
- case DeleteFamily :
2188
- return getInstance (DEL ,
2189
- new Object [] { CellUtil .cloneRow (kv ), null , -kv .getTimestamp () }, null , null );
2190
2190
default :
2191
2191
throw new IllegalArgumentException ("illegal mutation type " + operationType );
2192
2192
}
@@ -2214,16 +2214,6 @@ private ObTableQueryAsyncRequest buildObTableQueryAsyncRequest(ObTableQuery obTa
2214
2214
return asyncRequest ;
2215
2215
}
2216
2216
2217
- public static ObTableBatchOperationRequest buildObTableBatchOperationRequest (ObTableBatchOperation obTableBatchOperation ,
2218
- String targetTableName ) {
2219
- ObTableBatchOperationRequest request = new ObTableBatchOperationRequest ();
2220
- request .setTableName (targetTableName );
2221
- request .setReturningAffectedRows (true );
2222
- request .setEntityType (ObTableEntityType .HKV );
2223
- request .setBatchOperation (obTableBatchOperation );
2224
- return request ;
2225
- }
2226
-
2227
2217
private ObTableQueryAndMutateRequest buildObTableQueryAndMutateRequest (ObTableQuery obTableQuery ,
2228
2218
ObTableBatchOperation obTableBatchOperation ,
2229
2219
String targetTableName ) {
@@ -2310,7 +2300,7 @@ public Pair<byte[][], byte[][]> getStartEndKeys() throws IOException {
2310
2300
}
2311
2301
2312
2302
public static enum OHOpType {
2313
- INSERT_OR_UPDATE , APPEND , Delete , DeleteAll , DeleteColumn , DeleteFamily , DeleteFamilyVersion , Increment
2303
+ Put , Append , Delete , DeleteAll , DeleteColumn , DeleteFamily , DeleteFamilyVersion , Increment
2314
2304
}
2315
2305
2316
2306
public static OHOpType getDeleteType (Cell .Type type ) {
0 commit comments