bowenliang123 commented on code in PR #5871:
URL: https://github.com/apache/kyuubi/pull/5871#discussion_r1431396034


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/sql/plan/command/DescribeEngine.scala:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.sql.plan.command
+
+import scala.collection.mutable.ListBuffer
+
+import org.apache.kyuubi.operation.IterableFetchIterator
+import org.apache.kyuubi.session.{KyuubiSession, KyuubiSessionImpl}
+import org.apache.kyuubi.shaded.hive.service.rpc.thrift.TTypeId
+import org.apache.kyuubi.sql.schema.{Column, Row, Schema}
+
+/**
+ * A runnable node for description the current session.
+ *
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   [DESC|DESCRIBE] ENGINE;
+ * }}}
+ */
+case class DescribeEngine() extends RunnableCommand {
+
+  override def run(kyuubiSession: KyuubiSession): Unit = {
+    val rows = Seq(kyuubiSession).map { session =>
+      val client = session.asInstanceOf[KyuubiSessionImpl].client
+      val values = new ListBuffer[String]()
+      values += client.engineId.getOrElse("")
+      values += client.engineName.getOrElse("")
+      values += client.engineUrl.getOrElse("")
+      Row(values.toList)
+    }
+    iter = new IterableFetchIterator(rows)
+  }
+
+  override def resultSchema: Schema = {
+    Schema(DescribeEngine.outputCols().toList)
+  }
+
+  override val statement: String = "Describe Engine"
+}
+
+object DescribeEngine {
+
+  def outputCols(): Seq[Column] = {
+    Seq(
+      Column("engine id", TTypeId.STRING_TYPE, Some("Kyuubi engine identify")),
+      Column("name", TTypeId.STRING_TYPE, Some("Kyuubi engine name")),
+      Column("url", TTypeId.STRING_TYPE, Some("Kyuubi engine url")))

Review Comment:
   How about adding `ENGINE_` prefix for clearification as `ENGINE_ID`, 
`ENGINE_NAME`, `ENGINE_URL` ?



-- 
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]

Reply via email to