cxzl25 commented on a change in pull request #23516: [SPARK-26598] Fix
HiveThriftServer2 set hiveconf and hivevar in every sql
URL: https://github.com/apache/spark/pull/23516#discussion_r319491134
##########
File path:
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/server/SparkSQLOperationManager.scala
##########
@@ -51,9 +50,6 @@ private[thriftserver] class SparkSQLOperationManager()
require(sqlContext != null, s"Session handle:
${parentSession.getSessionHandle} has not been" +
s" initialized or had already closed.")
val conf = sqlContext.sessionState.conf
- val hiveSessionState = parentSession.getSessionState
- setConfMap(conf, hiveSessionState.getOverriddenConfigurations)
- setConfMap(conf, hiveSessionState.getHiveVariables)
Review comment:
```
cat <<EOF > test.sql
select '\${a}', '\${b}';
set b=MOD_VALUE;
set b;
EOF
beeline -u jdbc:hive2://localhost:10000 --hiveconf a=avalue --hivevar
b=bvalue -f test.sql
```
Result:
```
+-----------------+-----------------+--+
| key | value |
+-----------------+-----------------+--+
| b | bvalue |
+-----------------+-----------------+--+
1 row selected (0.022 seconds)
```
It is wrong to set the hivevar/hiveconf variable in every operation, which
prevents variable updates.
The intention is just an initialized value, so setting it once in
SparkSQLSessionManager#openSession is enough.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]