This is an automated email from the ASF dual-hosted git repository.
wangzhen pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.9 by this push:
new 594268639 [KYUUBI #6338] Support connecting Kyuubi using Hive JDBC
driver 4.0
594268639 is described below
commit 5942686395bbff6de0c7ec28118be8ccfcb499e0
Author: wforget <[email protected]>
AuthorDate: Mon Apr 29 14:06:53 2024 +0800
[KYUUBI #6338] Support connecting Kyuubi using Hive JDBC driver 4.0
# :mag: Description
## Issue References ๐
This pull request fixes #6338
## Describe Your Solution ๐ง
Support `kyuubi.server.thrift.resultset.default.fetchsize` conf to respect
`hive.server2.thrift.resultset.default.fetch.size` hive conf.
## Types of changes :bookmark:
- [ ] Bugfix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
## Test Plan ๐งช
#### Behavior Without This Pull Request :coffin:
#### Behavior With This Pull Request :tada:
#### Related Unit Tests
KyuubiTBinaryFrontendServiceSuite.test("test
kyuubi.server.thrift.resultset.default.fetch.size")
---
# Checklist ๐
- [X] This patch was not authored or co-authored using [Generative
Tooling](https://www.apache.org/legal/generative-tooling.html)
**Be nice. Be informative.**
Closes #6340 from wForget/KYUUBI-6338.
Closes #6338
acd73a16b [wforget] fix
5e64ed3a5 [wforget] comments
48b8ec6cd [wforget] fix style and address comments
ca653492c [wforget] [KYUUBI #6338] Support
`kyuubi.server.thrift.resultset.default.fetch.size` conf
Authored-by: wforget <[email protected]>
Signed-off-by: wforget <[email protected]>
(cherry picked from commit ef28a615a639bfd62228d67a80ee214d484a4b16)
Signed-off-by: wforget <[email protected]>
---
docs/configuration/settings.md | 1 +
.../scala/org/apache/kyuubi/config/KyuubiConf.scala | 19 +++++++++++++++++++
.../kyuubi/server/KyuubiTBinaryFrontendService.scala | 8 ++++++++
.../server/KyuubiTBinaryFrontendServiceSuite.scala | 13 +++++++++++++
4 files changed, 41 insertions(+)
diff --git a/docs/configuration/settings.md b/docs/configuration/settings.md
index fec770917..56639c271 100644
--- a/docs/configuration/settings.md
+++ b/docs/configuration/settings.md
@@ -430,6 +430,7 @@ You can configure the Kyuubi properties in
`$KYUUBI_HOME/conf/kyuubi-defaults.co
| kyuubi.server.name | <undefined>
| The name of Kyuubi Server.
| string | 1.5.0 |
| kyuubi.server.periodicGC.interval | PT30M
| How often to trigger a garbage collection.
| duration | 1.7.0 |
| kyuubi.server.redaction.regex | <undefined>
| Regex to decide which Kyuubi contain sensitive information. When this regex
matches a property key or value, the value is redacted from the various logs.
|| 1.6.0 |
+| kyuubi.server.thrift.resultset.default.fetch.size | 1000
| The number of rows sent in one Fetch RPC call by the server to the client, if
not specified by the client. Respect
`hive.server2.thrift.resultset.default.fetch.size` hive conf.
| int
| 1.9.1 |
### Session
diff --git
a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
index f06647ab7..5dc42c3dd 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
@@ -3483,4 +3483,23 @@ object KyuubiConf {
.version("1.8.1")
.booleanConf
.createWithDefault(false)
+
+ private val HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE:
ConfigEntry[Int] =
+ buildConf("hive.server2.thrift.resultset.default.fetch.size")
+ .doc("This is a hive server configuration used as a fallback conf" +
+ s" for `kyuubi.server.thrift.resultset.default.fetch.size`.")
+ .version("1.9.1")
+ .internal
+ .serverOnly
+ .intConf
+ .createWithDefault(1000)
+
+ val KYUUBI_SERVER_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE: ConfigEntry[Int] =
+ buildConf("kyuubi.server.thrift.resultset.default.fetch.size")
+ .doc("The number of rows sent in one Fetch RPC call by the server to the
client, if not" +
+ " specified by the client. Respect
`hive.server2.thrift.resultset.default.fetch.size`" +
+ " hive conf.")
+ .version("1.9.1")
+ .serverOnly
+ .fallbackConf(HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE)
}
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
index b46c1fec4..f95ea5947 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
@@ -24,6 +24,7 @@ import org.apache.hadoop.conf.Configuration
import org.apache.kyuubi.KyuubiSQLException
import org.apache.kyuubi.cli.Handle
import org.apache.kyuubi.config.KyuubiConf
+import
org.apache.kyuubi.config.KyuubiConf.KYUUBI_SERVER_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE
import org.apache.kyuubi.config.KyuubiReservedKeys._
import org.apache.kyuubi.ha.client.{KyuubiServiceDiscovery, ServiceDiscovery}
import org.apache.kyuubi.metrics.MetricsConstants._
@@ -49,6 +50,8 @@ final class KyuubiTBinaryFrontendService(
}
}
+ private lazy val defaultFetchSize =
conf.get(KYUUBI_SERVER_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE)
+
override def initialize(conf: KyuubiConf): Unit = synchronized {
super.initialize(conf)
@@ -94,6 +97,11 @@ final class KyuubiTBinaryFrontendService(
respConfiguration.put(KYUUBI_SESSION_ENGINE_LAUNCH_SUPPORT_RESULT,
true.toString)
+ // HIVE-23005(4.0.0), Hive JDBC driver supposes that server always
returns this conf
+ respConfiguration.put(
+ "hive.server2.thrift.resultset.default.fetch.size",
+ defaultFetchSize.toString)
+
resp.setSessionHandle(sessionHandle.toTSessionHandle)
resp.setConfiguration(respConfiguration)
resp.setStatus(OK_STATUS)
diff --git
a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendServiceSuite.scala
b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendServiceSuite.scala
index 9b41fb067..6347d7ae7 100644
---
a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendServiceSuite.scala
+++
b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendServiceSuite.scala
@@ -30,6 +30,7 @@ import
org.apache.kyuubi.shaded.hive.service.rpc.thrift.{TOpenSessionReq, TSessi
class KyuubiTBinaryFrontendServiceSuite extends WithKyuubiServer with
KyuubiFunSuite {
override protected val conf: KyuubiConf = KyuubiConf()
+ .set(KyuubiConf.KYUUBI_SERVER_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE, 500)
test("connection metrics") {
val totalConnections =
@@ -116,4 +117,16 @@ class KyuubiTBinaryFrontendServiceSuite extends
WithKyuubiServer with KyuubiFunS
Thread.sleep(3000L)
assert(server.backendService.sessionManager.allSessions().size ==
sessionCount)
}
+
+ test("test kyuubi.server.thrift.resultset.default.fetch.size") {
+ TClientTestUtils.withThriftClient(server.frontendServices.head) {
+ client =>
+ val req = new TOpenSessionReq()
+ req.setUsername(Utils.currentUser)
+ req.setPassword("anonymous")
+ val resp = client.OpenSession(req)
+ assertResult("500")(
+
resp.getConfiguration.get("hive.server2.thrift.resultset.default.fetch.size"))
+ }
+ }
}