You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/04/27 14:42:34 UTC

[GitHub] [incubator-kyuubi] turboFei opened a new pull request, #2491: [SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

turboFei opened a new pull request, #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491

   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
     2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   To close #2309 
   
   ### _How was this patch tested?_
   - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] codecov-commenter commented on pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#issuecomment-1111692246

   # [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2491](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9af0bd3) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/b41be9ebecabcc3a573cb6a12a97e3f833b76ba3?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b41be9e) will **decrease** coverage by `0.32%`.
   > The diff coverage is `8.57%`.
   
   > :exclamation: Current head 9af0bd3 differs from pull request most recent head 680ed8a. Consider uploading reports for the commit 680ed8a to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2491      +/-   ##
   ============================================
   - Coverage     63.71%   63.39%   -0.33%     
     Complexity       69       69              
   ============================================
     Files           371      372       +1     
     Lines         17642    17737      +95     
     Branches       2350     2359       +9     
   ============================================
   + Hits          11241    11244       +3     
   - Misses         5361     5454      +93     
   + Partials       1040     1039       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ache/kyuubi/server/KyuubiRestFrontendService.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvS3l1dWJpUmVzdEZyb250ZW5kU2VydmljZS5zY2FsYQ==) | `69.56% <0.00%> (-12.49%)` | :arrow_down: |
   | [.../apache/kyuubi/server/api/v1/BatchesResource.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvYXBpL3YxL0JhdGNoZXNSZXNvdXJjZS5zY2FsYQ==) | `0.00% <0.00%> (ø)` | |
   | [...in/scala/org/apache/kyuubi/server/api/v1/dto.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvYXBpL3YxL2R0by5zY2FsYQ==) | `67.94% <0.00%> (-4.66%)` | :arrow_down: |
   | [...g/apache/kyuubi/operation/BatchJobSubmission.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vQmF0Y2hKb2JTdWJtaXNzaW9uLnNjYWxh) | `72.22% <100.00%> (+0.39%)` | :arrow_up: |
   | [...g/apache/kyuubi/session/KyuubiSessionManager.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXNzaW9uL0t5dXViaVNlc3Npb25NYW5hZ2VyLnNjYWxh) | `86.48% <100.00%> (+0.18%)` | :arrow_up: |
   | [...in/java/org/apache/hive/beeline/KyuubiBeeLine.java](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWhpdmUtYmVlbGluZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaGl2ZS9iZWVsaW5lL0t5dXViaUJlZUxpbmUuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ache/kyuubi/operation/KyuubiOperationManager.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vS3l1dWJpT3BlcmF0aW9uTWFuYWdlci5zY2FsYQ==) | `85.24% <0.00%> (+1.63%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [b41be9e...680ed8a](https://codecov.io/gh/apache/incubator-kyuubi/pull/2491?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861552675


##########
kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/BatchesResourceSuite.scala:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.server.api.v1
+
+import javax.ws.rs.client.Entity
+import javax.ws.rs.core.MediaType
+
+import org.apache.kyuubi.{KyuubiFunSuite, RestFrontendTestHelper}
+import org.apache.kyuubi.config.KyuubiConf.{ENGINE_CHECK_INTERVAL, ENGINE_SPARK_MAX_LIFETIME}
+import org.apache.kyuubi.engine.spark.SparkProcessBuilder
+
+class BatchesResourceSuite extends KyuubiFunSuite with RestFrontendTestHelper {
+  test("open batch session") {
+    val sparkProcessBuilder = new SparkProcessBuilder("kyuubi", conf)
+    val requestObj = BatchRequest(
+      "spark",
+      sparkProcessBuilder.mainResource.get,
+      sparkProcessBuilder.mainClass,
+      "spark-batch-submission",
+      Map(
+        "spark.master" -> "local",
+        s"spark.${ENGINE_SPARK_MAX_LIFETIME.key}" -> "5000",
+        s"spark.${ENGINE_CHECK_INTERVAL.key}" -> "1000"),
+      Seq.empty[String])
+
+    val response = webTarget.path("api/v1/batches")
+      .request(MediaType.APPLICATION_JSON_TYPE)
+      .post(Entity.entity(requestObj, MediaType.APPLICATION_JSON_TYPE))
+
+    assert(200 == response.getStatus)
+
+    val batch = response.readEntity(classOf[Batch])
+    assert(batch.kyuubiInstance === fe.connectionUrl)
+  }

Review Comment:
   sure, I can add a test for invalid proxy user case.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861420102


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.server.api.v1
+
+import javax.ws.rs.{Consumes, POST, Produces}
+import javax.ws.rs.core.MediaType
+
+import io.swagger.v3.oas.annotations.media.Content
+import io.swagger.v3.oas.annotations.responses.ApiResponse
+import io.swagger.v3.oas.annotations.tags.Tag
+import org.apache.hive.service.rpc.thrift.TProtocolVersion
+
+import org.apache.kyuubi.Logging
+import org.apache.kyuubi.server.api.ApiRequestContext
+import org.apache.kyuubi.server.api.v1.BatchesResource.REST_BATCH_PROTOCOL
+import org.apache.kyuubi.server.http.authentication.AuthenticationFilter
+import org.apache.kyuubi.session.{KyuubiBatchSessionImpl, KyuubiSessionManager}
+
+@Tag(name = "Batch")
+@Produces(Array(MediaType.APPLICATION_JSON))
+private[v1] class BatchesResource extends ApiRequestContext with Logging {
+
+  private def sessionManager = fe.be.sessionManager.asInstanceOf[KyuubiSessionManager]
+
+  @ApiResponse(
+    responseCode = "200",
+    content = Array(new Content(
+      mediaType = MediaType.APPLICATION_JSON)),
+    description = "Open(create) a batch session")

Review Comment:
   create and open a batch session



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861527538


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala:
##########
@@ -180,4 +179,10 @@ object KyuubiSessionManager {
    * To keep compatibility, please do not change it.
    */
   val STATIC_BATCH_SECRET_UUID: UUID = UUID.fromString("c2ee5b97-3ea0-41fc-ac16-9bd708ed8f38")
+
+  /**
+   * The batch TProtocolVersion used for batch session handle.
+   * To keep compatibility, please do not change it.
+   */
+  val BATCH_PROTOCOL_VERSION: TProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10

Review Comment:
   ok, I see.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei closed pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
turboFei closed pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches
URL: https://github.com/apache/incubator-kyuubi/pull/2491


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861523956


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala:
##########
@@ -180,4 +179,10 @@ object KyuubiSessionManager {
    * To keep compatibility, please do not change it.
    */
   val STATIC_BATCH_SECRET_UUID: UUID = UUID.fromString("c2ee5b97-3ea0-41fc-ac16-9bd708ed8f38")
+
+  /**
+   * The batch TProtocolVersion used for batch session handle.
+   * To keep compatibility, please do not change it.
+   */
+  val BATCH_PROTOCOL_VERSION: TProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10

Review Comment:
   you have defined a another field in `BatchesResource`
   ```scala
   object BatchesResource {
     val REST_BATCH_PROTOCOL = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V11
   }
   ```



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861428308


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiRestFrontendService.scala:
##########
@@ -103,6 +103,19 @@ class KyuubiRestFrontendService(override val serverable: Serverable)
     }
   }
 
+  def getUserName(req: BatchRequest): String = {
+    val realUser: String = ServiceUtils.getShortName(
+      Option(AuthenticationFilter.getUserName).filter(_.nonEmpty).getOrElse("anonymous"))
+    if (req.proxyUser == null) {

Review Comment:
   sounds good



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#issuecomment-1111685225

   cc @zhaomin1423 
   I was busy recently, so just raise this pr today. It is the base for other batches api implementation.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#issuecomment-1111757851

   will rebase this pr after https://github.com/apache/incubator-kyuubi/pull/2496 merged


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861419732


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiRestFrontendService.scala:
##########
@@ -103,6 +103,19 @@ class KyuubiRestFrontendService(override val serverable: Serverable)
     }
   }
 
+  def getUserName(req: BatchRequest): String = {
+    val realUser: String = ServiceUtils.getShortName(
+      Option(AuthenticationFilter.getUserName).filter(_.nonEmpty).getOrElse("anonymous"))
+    if (req.proxyUser == null) {

Review Comment:
   shall we merge proxy user into req.conf ? In general, the usage of proxy user should be same with jdbc. So we can get proxy user from req.conf.HS2_PROXY_USER ?



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861513874


##########
kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/BatchesResourceSuite.scala:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.server.api.v1
+
+import javax.ws.rs.client.Entity
+import javax.ws.rs.core.MediaType
+
+import org.apache.kyuubi.{KyuubiFunSuite, RestFrontendTestHelper}
+import org.apache.kyuubi.config.KyuubiConf.{ENGINE_CHECK_INTERVAL, ENGINE_SPARK_MAX_LIFETIME}
+import org.apache.kyuubi.engine.spark.SparkProcessBuilder
+
+class BatchesResourceSuite extends KyuubiFunSuite with RestFrontendTestHelper {
+  test("open batch session") {
+    val sparkProcessBuilder = new SparkProcessBuilder("kyuubi", conf)
+    val requestObj = BatchRequest(
+      "spark",
+      sparkProcessBuilder.mainResource.get,
+      sparkProcessBuilder.mainClass,
+      "spark-batch-submission",
+      Map(
+        "spark.master" -> "local",
+        s"spark.${ENGINE_SPARK_MAX_LIFETIME.key}" -> "5000",
+        s"spark.${ENGINE_CHECK_INTERVAL.key}" -> "1000"),
+      Seq.empty[String])
+
+    val response = webTarget.path("api/v1/batches")
+      .request(MediaType.APPLICATION_JSON_TYPE)
+      .post(Entity.entity(requestObj, MediaType.APPLICATION_JSON_TYPE))
+
+    assert(200 == response.getStatus)
+
+    val batch = response.readEntity(classOf[Batch])
+    assert(batch.kyuubiInstance === fe.connectionUrl)
+  }

Review Comment:
   can we add a test for proxy user ?



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#issuecomment-1113142139

   thanks, merging to master.
   
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] zhaomin1423 commented on pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
zhaomin1423 commented on PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#issuecomment-1111739767

   > cc @zhaomin1423 I was busy recently, so just raise this pr today. It is the base for other batches api implementation.
   
   Thanks, I will follow up.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861517399


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala:
##########
@@ -180,4 +179,10 @@ object KyuubiSessionManager {
    * To keep compatibility, please do not change it.
    */
   val STATIC_BATCH_SECRET_UUID: UUID = UUID.fromString("c2ee5b97-3ea0-41fc-ac16-9bd708ed8f38")
+
+  /**
+   * The batch TProtocolVersion used for batch session handle.
+   * To keep compatibility, please do not change it.
+   */
+  val BATCH_PROTOCOL_VERSION: TProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10

Review Comment:
   It is a field of KyuubiBatchSession.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2491: [KYUUBI #2309][SUB-TASK][KPIP-4] Implement BatchesResource POST /batches

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2491:
URL: https://github.com/apache/incubator-kyuubi/pull/2491#discussion_r861513182


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala:
##########
@@ -180,4 +179,10 @@ object KyuubiSessionManager {
    * To keep compatibility, please do not change it.
    */
   val STATIC_BATCH_SECRET_UUID: UUID = UUID.fromString("c2ee5b97-3ea0-41fc-ac16-9bd708ed8f38")
+
+  /**
+   * The batch TProtocolVersion used for batch session handle.
+   * To keep compatibility, please do not change it.
+   */
+  val BATCH_PROTOCOL_VERSION: TProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10

Review Comment:
   unused



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org