You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2022/06/28 10:57:32 UTC
[incubator-kyuubi] branch master updated: [KYUUBI #2955] BatchRequest args fix: need toString operation for different data types
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/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new fbb434c43 [KYUUBI #2955] BatchRequest args fix: need toString operation for different data types
fbb434c43 is described below
commit fbb434c43fb3b815bde3ec632e63f82864f632d6
Author: Tianlin Liao <ti...@ebay.com>
AuthorDate: Tue Jun 28 18:57:23 2022 +0800
[KYUUBI #2955] BatchRequest args fix: need toString operation for different data types
### _Why are the changes needed?_
Refine the CreateBatchCommand.
### _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
Closes #2955 from lightning-L/fix.
Closes #2955
61ee0d05 [Tianlin Liao] move BatchType to request
be40748d [Tianlin Liao] BatchRequest args fix: need toString operation for different data types
Authored-by: Tianlin Liao <ti...@ebay.com>
Signed-off-by: Fei Wang <fw...@ebay.com>
---
.../org/apache/kyuubi/ctl/cmd/create/CreateBatchCommand.scala | 9 +++++----
kyuubi-ctl/src/test/resources/cli/batch.yaml | 1 +
.../org/apache/kyuubi/server/rest/client/BatchCliSuite.scala | 4 +++-
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/create/CreateBatchCommand.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/create/CreateBatchCommand.scala
index 90a375355..3d418d928 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/create/CreateBatchCommand.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/create/CreateBatchCommand.scala
@@ -16,8 +16,7 @@
*/
package org.apache.kyuubi.ctl.cmd.create
-import java.util.{Map => JMap}
-import java.util.ArrayList
+import java.util.{List => JList, Map => JMap}
import scala.collection.JavaConverters._
@@ -43,13 +42,15 @@ class CreateBatchCommand(cliConfig: CliConfig) extends Command[Batch](cliConfig)
val request = map.get("request").asInstanceOf[JMap[String, Object]]
val config = request.get("configs").asInstanceOf[JMap[Object, Object]].asScala
.map { case (k, v) => (k.toString, v.toString) }.asJava
+ val args = request.get("args").asInstanceOf[JList[Object]].asScala
+ .map(x => x.toString).asJava
val batchRequest = new BatchRequest(
- map.get("batchType").asInstanceOf[String],
+ request.get("batchType").asInstanceOf[String],
request.get("resource").asInstanceOf[String],
request.get("className").asInstanceOf[String],
request.get("name").asInstanceOf[String],
config,
- request.get("args").asInstanceOf[ArrayList[String]])
+ args)
batchRestApi.createBatch(batchRequest)
}
diff --git a/kyuubi-ctl/src/test/resources/cli/batch.yaml b/kyuubi-ctl/src/test/resources/cli/batch.yaml
index ee3d6bdd0..65e6e7f6b 100644
--- a/kyuubi-ctl/src/test/resources/cli/batch.yaml
+++ b/kyuubi-ctl/src/test/resources/cli/batch.yaml
@@ -18,6 +18,7 @@
apiVersion: v1
user: test_user
request:
+ batchType: Spark
name: test_batch
resource: /MySpace/kyuubi-spark-sql-engine_2.12-1.6.0-SNAPSHOT.jar
className: org.apache.kyuubi.engine.spark.SparkSQLEngine
diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala
index 39e33861a..8a0dcc0ba 100644
--- a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala
+++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala
@@ -45,15 +45,17 @@ class BatchCliSuite extends RestClientTestHelper with TestPrematureExit {
val sparkProcessBuilder = new SparkProcessBuilder("kyuubi", conf)
val batch_basic = s"""apiVersion: v1
- |batchType: Spark
|username: ${ldapUser}
|request:
+ | batchType: Spark
| name: ${appName}
| resource: ${sparkProcessBuilder.mainResource.get}
| className: ${sparkProcessBuilder.mainClass}
| args:
| - x1
| - x2
+ | - 123
+ | - true
| configs:
| spark.master: local
| wait.completion: true