turboFei commented on code in PR #4390:
URL: https://github.com/apache/kyuubi/pull/4390#discussion_r1112603081
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala:
##########
@@ -210,22 +210,35 @@ private[v1] class BatchesResource extends
ApiRequestContext with Logging {
}
request.setBatchType(request.getBatchType.toUpperCase(Locale.ROOT))
- val userName = fe.getSessionUser(request.getConf.asScala.toMap)
- val ipAddress = fe.getIpAddress
- request.setConf(
- (request.getConf.asScala ++ Map(
- KYUUBI_CLIENT_IP_KEY -> ipAddress,
- KYUUBI_SERVER_IP_KEY -> fe.host,
- KYUUBI_SESSION_CONNECTION_URL_KEY -> fe.connectionUrl,
- KYUUBI_SESSION_BATCH_RESOURCE_UPLOADED_KEY ->
isResourceFromUpload.toString,
- KYUUBI_SESSION_REAL_USER_KEY -> fe.getRealUser())).asJava)
- val sessionHandle = sessionManager.openBatchSession(
- userName,
- "anonymous",
- ipAddress,
- request.getConf.asScala.toMap,
- request)
- buildBatch(sessionManager.getBatchSessionImpl(sessionHandle))
+ val userProvidedBatchId =
request.getConf.asScala.get(KYUUBI_SESSION_BATCH_ID_KEY)
+ // the user provides batch_id must be an UUID
+ .map { batchId => UUID.fromString(batchId); batchId }
+
+ userProvidedBatchId.flatMap { batchId =>
+ Option(sessionManager.getBatchFromMetadataStore(batchId))
+ } match {
+ case Some(batch) =>
+ warn(s"duplicated submission: ${batch.getId}, ignore and return the
existing batch.")
+ batch
+ case None =>
Review Comment:
if the existing batch is None.
we need remove the `KYUUBI_SESSION_BATCH_ID_KEY` from batchRequest.getConf
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]