This is an automated email from the ASF dual-hosted git repository.
bowenliang 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 224ae7cc4 [KYUUBI #5122][DOC] Hive KDF usage
224ae7cc4 is described below
commit 224ae7cc4f1617f9afb69452ba05f09837e5e42b
Author: senmiaoliu <[email protected]>
AuthorDate: Thu Aug 3 09:39:49 2023 +0800
[KYUUBI #5122][DOC] Hive KDF usage
### _Why are the changes needed?_
close #5122
### _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.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
locally before make a pull request
Closes #5125 from lsm1/features/kyuubi_5122.
Closes #5122
02d0769cc [senmiaoliu] add hive kdf docs
Authored-by: senmiaoliu <[email protected]>
Signed-off-by: liangbowen <[email protected]>
---
docs/extensions/engines/hive/functions.md | 30 ++++++++++
docs/extensions/engines/hive/index.rst | 1 +
externals/kyuubi-hive-sql-engine/pom.xml | 6 ++
.../hive/udf/KyuubiDefinedFunctionSuite.scala | 70 ++++++++++++++++++++++
4 files changed, 107 insertions(+)
diff --git a/docs/extensions/engines/hive/functions.md
b/docs/extensions/engines/hive/functions.md
new file mode 100644
index 000000000..24094ecce
--- /dev/null
+++ b/docs/extensions/engines/hive/functions.md
@@ -0,0 +1,30 @@
+<!--
+- 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.
+-->
+<!-- DO NOT MODIFY THIS FILE DIRECTLY, IT IS AUTO-GENERATED BY
[org.apache.kyuubi.engine.hive.udf.KyuubiDefinedFunctionSuite] -->
+
+# Auxiliary SQL Functions
+
+Kyuubi provides several auxiliary SQL functions as supplement to Hive's
[Built-in
Functions](https://cwiki.apache.org/confluence/display/hive/languagemanual+udf#LanguageManualUDF-Built-inFunctions)
+
+| Name | Description | Return Type | Since |
+|----------------|-------------------------------------|-------------|-------|
+| kyuubi_version | Return the version of Kyuubi Server | string | 1.8.0 |
+| engine_name | Return the name of engine | string | 1.8.0 |
+| engine_id | Return the id of engine | string | 1.8.0 |
+| system_user | Return the system user | string | 1.8.0 |
+| session_user | Return the session user | string | 1.8.0 |
+
diff --git a/docs/extensions/engines/hive/index.rst
b/docs/extensions/engines/hive/index.rst
index 8aeebf1bc..f43ec11e0 100644
--- a/docs/extensions/engines/hive/index.rst
+++ b/docs/extensions/engines/hive/index.rst
@@ -20,6 +20,7 @@ Extensions for Hive
:maxdepth: 2
../../../connector/hive/index
+ functions
.. warning::
This page is still in-progress.
diff --git a/externals/kyuubi-hive-sql-engine/pom.xml
b/externals/kyuubi-hive-sql-engine/pom.xml
index 6af94abe5..a6a28a958 100644
--- a/externals/kyuubi-hive-sql-engine/pom.xml
+++ b/externals/kyuubi-hive-sql-engine/pom.xml
@@ -163,6 +163,12 @@
<artifactId>HikariCP</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>com.vladsch.flexmark</groupId>
+ <artifactId>flexmark-all</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/externals/kyuubi-hive-sql-engine/src/test/scala/org/apache/kyuubi/engine/hive/udf/KyuubiDefinedFunctionSuite.scala
b/externals/kyuubi-hive-sql-engine/src/test/scala/org/apache/kyuubi/engine/hive/udf/KyuubiDefinedFunctionSuite.scala
new file mode 100644
index 000000000..2a7bfdfc2
--- /dev/null
+++
b/externals/kyuubi-hive-sql-engine/src/test/scala/org/apache/kyuubi/engine/hive/udf/KyuubiDefinedFunctionSuite.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.engine.hive.udf
+
+import java.nio.file.Paths
+
+import org.apache.kyuubi.{KyuubiFunSuite, MarkdownBuilder, MarkdownUtils,
Utils}
+
+// scalastyle:off line.size.limit
+/**
+ * End-to-end test cases for configuration doc file
+ * The golden result file is "docs/sql/functions.md".
+ *
+ * To run the entire test suite:
+ * {{{
+ * build/mvn clean test -pl externals/kyuubi-hive-sql-engine -am
-Pflink-provided,spark-provided,hive-provided
-DwildcardSuites=org.apache.kyuubi.engine.hive.udf.KyuubiDefinedFunctionSuite
+ * }}}
+ *
+ * To re-generate golden files for entire suite, run:
+ * {{{
+ * KYUUBI_UPDATE=1 build/mvn clean test -pl externals/kyuubi-hive-sql-engine
-am -Pflink-provided,spark-provided,hive-provided
-DwildcardSuites=org.apache.kyuubi.engine.hive.udf.KyuubiDefinedFunctionSuite
+ * }}}
+ */
+// scalastyle:on line.size.limit
+class KyuubiDefinedFunctionSuite extends KyuubiFunSuite {
+
+ private val kyuubiHome: String = Utils.getCodeSourceLocation(getClass)
+ .split("kyuubi-hive-sql-engine")(0)
+ private val markdown =
+ Paths.get(kyuubiHome, "..", "docs", "extensions", "engines", "hive",
"functions.md")
+ .toAbsolutePath
+
+ test("verify or update kyuubi hive sql functions") {
+ val builder = MarkdownBuilder(licenced = true, getClass.getName)
+
+ builder
+ .line("# Auxiliary SQL Functions")
+ .line("""Kyuubi provides several auxiliary SQL functions as supplement
to Hive's
+ | [Built-in
Functions](https://cwiki.apache.org/confluence/display/hive/languagemanual+udf#
+ |LanguageManualUDF-Built-inFunctions)""")
+ .lines("""
+ | Name | Description | Return Type | Since
+ | --- | --- | --- | ---
+ |""")
+ KDFRegistry.registeredFunctions.foreach { func =>
+ builder.line(s"${func.name} | ${func.description} | ${func.returnType} |
${func.since}")
+ }
+
+ MarkdownUtils.verifyOutput(
+ markdown,
+ builder,
+ getClass.getCanonicalName,
+ "externals/kyuubi-hive-sql-engine")
+ }
+}