New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-32807][SQL] ThriftServer open session use direct API to init current DB #29656
Conversation
...iftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLSessionManager.scala
Outdated
Show resolved
Hide resolved
Test build #128331 has finished for PR 29656 at commit
|
Test build #128333 has finished for PR 29656 at commit
|
@@ -69,7 +69,7 @@ private[hive] class SparkSQLSessionManager(hiveServer: HiveServer2, sqlContext: | |||
setConfMap(ctx, hiveSessionState.getOverriddenConfigurations) | |||
setConfMap(ctx, hiveSessionState.getHiveVariables) | |||
if (sessionConf != null && sessionConf.containsKey("use:database")) { | |||
ctx.sql(s"use ${sessionConf.get("use:database")}") | |||
ctx.sessionState.catalog.setCurrentDatabase(sessionConf.get("use:database")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to be clear, is this just a small refactoring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to be clear, is this just a small refactoring?
In this way we can avoid a lot of process part, but seems I have miss a important problem that user may write a db name wrong such as aa.cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add extra tests to verify the behaviour in case of failures? Is it the same error thrown? Are we skipping some checks along the way by calling the catalog functions?
This may change how this skipped processing handles errors. I would add some tests that verify such behaviour. |
What I most want to do is make HiveClientImpl's client to be thread local var and remove lock to speed up query. |
What changes were proposed in this pull request?
When init current database, we can use direct API, don't need to call SQL
Why are the changes needed?
No
Does this PR introduce any user-facing change?
No
How was this patch tested?
Not need