diff --git a/pom.xml b/pom.xml
index 3b8fbf94..0a9a6022 100644
--- a/pom.xml
+++ b/pom.xml
@@ -198,6 +198,11 @@
1.2.12test
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.19.0
+
diff --git a/src/main/java/com/alipay/oceanbase/hbase/execute/AbstractObTableMetaExecutor.java b/src/main/java/com/alipay/oceanbase/hbase/execute/AbstractObTableMetaExecutor.java
index d6d99da1..1c5d51d4 100644
--- a/src/main/java/com/alipay/oceanbase/hbase/execute/AbstractObTableMetaExecutor.java
+++ b/src/main/java/com/alipay/oceanbase/hbase/execute/AbstractObTableMetaExecutor.java
@@ -1,3 +1,20 @@
+/*-
+ * #%L
+ * com.oceanbase:obkv-hbase-client
+ * %%
+ * Copyright (C) 2022 - 2025 OceanBase Group
+ * %%
+ * OBKV HBase Client Framework is licensed under Mulan PSL v2.
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
+ * You may obtain a copy of Mulan PSL v2 at:
+ * http://license.coscl.org.cn/MulanPSL2
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
+ * See the Mulan PSL v2 for more details.
+ * #L%
+ */
+
package com.alipay.oceanbase.hbase.execute;
import com.alipay.oceanbase.rpc.ObTableClient;
diff --git a/src/main/java/com/alipay/oceanbase/hbase/execute/ObTableMetaExecutor.java b/src/main/java/com/alipay/oceanbase/hbase/execute/ObTableMetaExecutor.java
index 4e8a0ffb..d55ff275 100644
--- a/src/main/java/com/alipay/oceanbase/hbase/execute/ObTableMetaExecutor.java
+++ b/src/main/java/com/alipay/oceanbase/hbase/execute/ObTableMetaExecutor.java
@@ -1,3 +1,20 @@
+/*-
+ * #%L
+ * com.oceanbase:obkv-hbase-client
+ * %%
+ * Copyright (C) 2022 - 2025 OceanBase Group
+ * %%
+ * OBKV HBase Client Framework is licensed under Mulan PSL v2.
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
+ * You may obtain a copy of Mulan PSL v2 at:
+ * http://license.coscl.org.cn/MulanPSL2
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
+ * See the Mulan PSL v2 for more details.
+ * #L%
+ */
+
package com.alipay.oceanbase.hbase.execute;
import com.alipay.oceanbase.rpc.ObTableClient;
diff --git a/src/main/java/com/alipay/oceanbase/hbase/util/OHCreateTableExecutor.java b/src/main/java/com/alipay/oceanbase/hbase/util/OHCreateTableExecutor.java
index a56e8097..4bab8e3b 100644
--- a/src/main/java/com/alipay/oceanbase/hbase/util/OHCreateTableExecutor.java
+++ b/src/main/java/com/alipay/oceanbase/hbase/util/OHCreateTableExecutor.java
@@ -17,7 +17,7 @@
package com.alipay.oceanbase.hbase.util;
-import com.alibaba.fastjson.JSON;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.alipay.oceanbase.hbase.execute.AbstractObTableMetaExecutor;
import com.alipay.oceanbase.rpc.ObTableClient;
import com.alipay.oceanbase.rpc.meta.ObTableMetaRequest;
@@ -53,7 +53,7 @@ public void createTable(TableDescriptor tableDescriptor, byte[][] splitKeys) thr
final ObTableMetaRequest request = new ObTableMetaRequest();
request.setMetaType(getMetaType());
Map requestData = new HashMap<>();
- requestData.put("htable_name", tableDescriptor.getTableName().getName());
+ requestData.put("htable_name", tableDescriptor.getTableName().getNameAsString());
Map> columnFamilies = new HashMap<>();
for (ColumnFamilyDescriptor columnDescriptor : tableDescriptor.getColumnFamilies()) {
Map columnFamily = new HashMap<>();
@@ -62,7 +62,8 @@ public void createTable(TableDescriptor tableDescriptor, byte[][] splitKeys) thr
columnFamilies.put(columnDescriptor.getNameAsString(), columnFamily);
}
requestData.put("column_families", columnFamilies);
- String jsonData = JSON.toJSONString(requestData);
+ ObjectMapper objectMapper = new ObjectMapper();
+ String jsonData = objectMapper.writeValueAsString(requestData);
request.setData(jsonData);
execute(client, request);
}
diff --git a/src/main/java/com/alipay/oceanbase/hbase/util/OHDeleteTableExecutor.java b/src/main/java/com/alipay/oceanbase/hbase/util/OHDeleteTableExecutor.java
index 47280128..1f689596 100644
--- a/src/main/java/com/alipay/oceanbase/hbase/util/OHDeleteTableExecutor.java
+++ b/src/main/java/com/alipay/oceanbase/hbase/util/OHDeleteTableExecutor.java
@@ -1,7 +1,23 @@
+/*-
+ * #%L
+ * com.oceanbase:obkv-hbase-client
+ * %%
+ * Copyright (C) 2022 - 2025 OceanBase Group
+ * %%
+ * OBKV HBase Client Framework is licensed under Mulan PSL v2.
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
+ * You may obtain a copy of Mulan PSL v2 at:
+ * http://license.coscl.org.cn/MulanPSL2
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
+ * See the Mulan PSL v2 for more details.
+ * #L%
+ */
+
package com.alipay.oceanbase.hbase.util;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.alipay.oceanbase.hbase.execute.AbstractObTableMetaExecutor;
import com.alipay.oceanbase.rpc.ObTableClient;
import com.alipay.oceanbase.rpc.meta.ObTableMetaRequest;
@@ -24,7 +40,6 @@ public ObTableRpcMetaType getMetaType() {
return ObTableRpcMetaType.HTABLE_DELETE_TABLE;
}
-
@Override
public Void parse(ObTableMetaResponse response) throws IOException {
// do nothing, error will be thrown from table
@@ -36,7 +51,8 @@ public Void deleteTable(String tableName) throws IOException {
request.setMetaType(getMetaType());
Map requestDataMap = new HashMap<>();
requestDataMap.put("table_name", tableName);
- String jsonData = JSON.toJSONString(requestDataMap);
+ ObjectMapper objectMapper = new ObjectMapper();
+ String jsonData = objectMapper.writeValueAsString(requestDataMap);
request.setData(jsonData);
return execute(tableClient, request);
}
diff --git a/src/main/java/com/alipay/oceanbase/hbase/util/OHRegionLocator.java b/src/main/java/com/alipay/oceanbase/hbase/util/OHRegionLocator.java
index ab99bc22..4894501c 100644
--- a/src/main/java/com/alipay/oceanbase/hbase/util/OHRegionLocator.java
+++ b/src/main/java/com/alipay/oceanbase/hbase/util/OHRegionLocator.java
@@ -1,3 +1,20 @@
+/*-
+ * #%L
+ * com.oceanbase:obkv-hbase-client
+ * %%
+ * Copyright (C) 2022 - 2025 OceanBase Group
+ * %%
+ * OBKV HBase Client Framework is licensed under Mulan PSL v2.
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
+ * You may obtain a copy of Mulan PSL v2 at:
+ * http://license.coscl.org.cn/MulanPSL2
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
+ * See the Mulan PSL v2 for more details.
+ * #L%
+ */
+
package com.alipay.oceanbase.hbase.util;
import com.alipay.oceanbase.rpc.ObTableClient;
@@ -13,16 +30,16 @@
import java.util.List;
public class OHRegionLocator implements RegionLocator {
- private byte[][] startKeys;
- private byte[][] endKeys;
- private ObTableClient tableClient;
- private TableName tableName;
+ private byte[][] startKeys;
+ private byte[][] endKeys;
+ private ObTableClient tableClient;
+ private TableName tableName;
private List regionLocations;
public OHRegionLocator(byte[][] startKeys, byte[][] endKeys,
- List regionLocations,
- TableName tableName, ObTableClient tableClient) {
+ List regionLocations, TableName tableName,
+ ObTableClient tableClient) {
this.startKeys = startKeys;
this.endKeys = endKeys;
this.regionLocations = regionLocations;
@@ -44,7 +61,8 @@ public HRegionLocation getRegionLocation(byte[] bytes) throws IOException {
@Override
public HRegionLocation getRegionLocation(byte[] bytes, boolean b) throws IOException {
if (b || regionLocations.isEmpty()) {
- OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor(tableName.toString(), tableClient);
+ OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor(tableName.toString(),
+ tableClient);
try {
RegionLocator location = executor.getRegionLocator(tableName.toString());
this.startKeys = location.getStartKeys();
@@ -52,7 +70,7 @@ public HRegionLocation getRegionLocation(byte[] bytes, boolean b) throws IOExcep
this.regionLocations = location.getAllRegionLocations();
} catch (IOException e) {
if (e.getCause() instanceof ObTableTransportException
- && ((ObTableTransportException) e.getCause()).getErrorCode() == TransportCodes.BOLT_TIMEOUT) {
+ && ((ObTableTransportException) e.getCause()).getErrorCode() == TransportCodes.BOLT_TIMEOUT) {
throw new TimeoutIOException(e.getCause());
} else {
throw e;
diff --git a/src/main/java/com/alipay/oceanbase/hbase/util/OHRegionLocatorExecutor.java b/src/main/java/com/alipay/oceanbase/hbase/util/OHRegionLocatorExecutor.java
index 435cd6f4..c901d4ad 100644
--- a/src/main/java/com/alipay/oceanbase/hbase/util/OHRegionLocatorExecutor.java
+++ b/src/main/java/com/alipay/oceanbase/hbase/util/OHRegionLocatorExecutor.java
@@ -1,13 +1,29 @@
+/*-
+ * #%L
+ * com.oceanbase:obkv-hbase-client
+ * %%
+ * Copyright (C) 2022 - 2025 OceanBase Group
+ * %%
+ * OBKV HBase Client Framework is licensed under Mulan PSL v2.
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
+ * You may obtain a copy of Mulan PSL v2 at:
+ * http://license.coscl.org.cn/MulanPSL2
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
+ * See the Mulan PSL v2 for more details.
+ * #L%
+ */
+
package com.alipay.oceanbase.hbase.util;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.alipay.oceanbase.hbase.execute.AbstractObTableMetaExecutor;
import com.alipay.oceanbase.rpc.ObTableClient;
import com.alipay.oceanbase.rpc.constant.Constants;
-import com.alipay.oceanbase.rpc.exception.ObTableException;
import com.alipay.oceanbase.rpc.exception.ObTableUnexpectedException;
-import com.alipay.oceanbase.rpc.location.model.TableEntry;
import com.alipay.oceanbase.rpc.meta.ObTableMetaRequest;
import com.alipay.oceanbase.rpc.meta.ObTableMetaResponse;
import com.alipay.oceanbase.rpc.meta.ObTableRpcMetaType;
@@ -19,7 +35,7 @@
import java.util.stream.IntStream;
public class OHRegionLocatorExecutor extends AbstractObTableMetaExecutor {
- private final String tableName;
+ private final String tableName;
private final ObTableClient client;
OHRegionLocatorExecutor(String tableName, ObTableClient client) {
@@ -42,7 +58,8 @@ public ObTableRpcMetaType getMetaType() {
public OHRegionLocator parse(ObTableMetaResponse response) throws IOException {
try {
final String jsonData = response.getData();
- final JSONObject jsonMap = Optional.ofNullable(JSON.parseObject(jsonData))
+ final ObjectMapper objectMapper = new ObjectMapper();
+ final JsonNode jsonMap = Optional.ofNullable(objectMapper.readTree(jsonData))
.orElseThrow(() -> new IOException("jsonMap is null"));
/*
{
@@ -77,14 +94,17 @@ public OHRegionLocator parse(ObTableMetaResponse response) throws IOException {
]
}
*/
-
- final List