This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 2e79aa2c95 [KYUUBI #6884][FOLLOWUP] Support reassign batch with
BatchRestApi
2e79aa2c95 is described below
commit 2e79aa2c95dfeaf0e2cddaf7678fd934739f0679
Author: Wang, Fei <[email protected]>
AuthorDate: Wed Dec 10 23:09:49 2025 -0800
[KYUUBI #6884][FOLLOWUP] Support reassign batch with BatchRestApi
### Why are the changes needed?
Support reassign batch with BatchRestApi.
Followup #7037
### How was this patch tested?
GA.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #7263 from turboFei/api.
Closes #6884
98ce81fd3 [Wang, Fei] BatchRestApi
Authored-by: Wang, Fei <[email protected]>
Signed-off-by: Wang, Fei <[email protected]>
---
.../java/org/apache/kyuubi/client/BatchRestApi.java | 7 +++++++
.../org/apache/kyuubi/client/BatchRestClientTest.java | 17 +++++++++++++++++
.../java/org/apache/kyuubi/client/BatchTestServlet.java | 6 ++++++
3 files changed, 30 insertions(+)
diff --git
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/BatchRestApi.java
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/BatchRestApi.java
index b846067e0b..35e57c7b0a 100644
---
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/BatchRestApi.java
+++
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/BatchRestApi.java
@@ -174,6 +174,13 @@ public class BatchRestApi {
.delete(path, null, CloseBatchResponse.class, client.getAuthHeader(),
headers);
}
+ public ReassignBatchResponse reassignBatch(ReassignBatchRequest request) {
+ String path = String.format("%s/reassign", API_BASE_PATH);
+ String requestBody = JsonUtils.toJson(request);
+ return this.getClient()
+ .post(path, requestBody, ReassignBatchResponse.class,
client.getAuthHeader());
+ }
+
private IRestClient getClient() {
return this.client.getHttpClient();
}
diff --git
a/kyuubi-rest-client/src/test/java/org/apache/kyuubi/client/BatchRestClientTest.java
b/kyuubi-rest-client/src/test/java/org/apache/kyuubi/client/BatchRestClientTest.java
index 9715460ca5..e6d2bc71ac 100644
---
a/kyuubi-rest-client/src/test/java/org/apache/kyuubi/client/BatchRestClientTest.java
+++
b/kyuubi-rest-client/src/test/java/org/apache/kyuubi/client/BatchRestClientTest.java
@@ -26,6 +26,8 @@ import org.apache.kyuubi.client.api.v1.dto.BatchRequest;
import org.apache.kyuubi.client.api.v1.dto.CloseBatchResponse;
import org.apache.kyuubi.client.api.v1.dto.GetBatchesResponse;
import org.apache.kyuubi.client.api.v1.dto.OperationLog;
+import org.apache.kyuubi.client.api.v1.dto.ReassignBatchRequest;
+import org.apache.kyuubi.client.api.v1.dto.ReassignBatchResponse;
import org.apache.kyuubi.client.exception.KyuubiRestException;
import org.junit.After;
import org.junit.Before;
@@ -276,4 +278,19 @@ public class BatchRestClientTest {
response = basicBatchRestApi.deleteBatch("71535");
assertTrue(response.isSuccess());
}
+
+ @Test
+ public void reassignBatchTest() {
+ // test spnego auth
+ BatchTestServlet.setAuthSchema(NEGOTIATE_AUTH);
+ ReassignBatchRequest request = new
ReassignBatchRequest("http://127.0.0.1:10012");
+ ReassignBatchResponse response = spnegoBatchRestApi.reassignBatch(request);
+ assertTrue(response.getBatchIds().isEmpty());
+
+ // test basic auth
+ BatchTestServlet.setAuthSchema(BASIC_AUTH);
+ BatchTestServlet.allowAnonymous(false);
+ response = basicBatchRestApi.reassignBatch(request);
+ assertTrue(response.getBatchIds().isEmpty());
+ }
}
diff --git
a/kyuubi-rest-client/src/test/java/org/apache/kyuubi/client/BatchTestServlet.java
b/kyuubi-rest-client/src/test/java/org/apache/kyuubi/client/BatchTestServlet.java
index f8784e2cbd..9a651a4c73 100644
---
a/kyuubi-rest-client/src/test/java/org/apache/kyuubi/client/BatchTestServlet.java
+++
b/kyuubi-rest-client/src/test/java/org/apache/kyuubi/client/BatchTestServlet.java
@@ -28,6 +28,7 @@ import org.apache.kyuubi.client.api.v1.dto.Batch;
import org.apache.kyuubi.client.api.v1.dto.CloseBatchResponse;
import org.apache.kyuubi.client.api.v1.dto.GetBatchesResponse;
import org.apache.kyuubi.client.api.v1.dto.OperationLog;
+import org.apache.kyuubi.client.api.v1.dto.ReassignBatchResponse;
import org.apache.kyuubi.client.util.JsonUtils;
public class BatchTestServlet extends HttpServlet {
@@ -81,6 +82,11 @@ public class BatchTestServlet extends HttpServlet {
Batch batch = generateTestBatch();
resp.getWriter().write(JsonUtils.toJson(batch));
resp.getWriter().flush();
+ } else if (req.getPathInfo().equalsIgnoreCase("/api/v1/batches/reassign"))
{
+ resp.setStatus(HttpServletResponse.SC_OK);
+
+ resp.getWriter().write(JsonUtils.toJson(new ReassignBatchResponse()));
+ resp.getWriter().flush();
} else {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}