wangyum commented on a change in pull request #24391:
[SPARK-27402][SQL][test-hadoop3.2][test-maven] Fix hadoop-3.2 test
issue(except the hive-thriftserver module)
URL: https://github.com/apache/spark/pull/24391#discussion_r282976097
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -191,7 +191,17 @@ private[hive] class HiveClientImpl(
}
/** Returns the configuration for the current session. */
- def conf: HiveConf = state.getConf
+ def conf: HiveConf = {
+ val hiveConf = state.getConf
+ // Hive changed the default of datanucleus.schema.autoCreateAll from true
to false
+ // and hive.metastore.schema.verification from false to true since Hive
2.0.
+ // For details, see the JIRA HIVE-6113, HIVE-12463 and HIVE-1841.
+ // We hard-code these configurations here to allow bin/spark-shell,
bin/spark-sql
+ // and sbin/start-thriftserver.sh automatically creates Derby metastore.
+ hiveConf.setBoolean("hive.metastore.schema.verification", false)
+ hiveConf.setBoolean("datanucleus.schema.autoCreateAll", true)
Review comment:
I update it to:
```scala
def conf: HiveConf = {
val hiveConf = state.getConf
// Hive changed the default of datanucleus.schema.autoCreateAll from
true to false
// and hive.metastore.schema.verification from false to true since Hive
2.0.
// For details, see the JIRA HIVE-6113, HIVE-12463 and HIVE-1841.
// For the production environment. Either isDefaultMSUri or isDerbyMS
should not be true.
// We hard-code hive.metastore.schema.verification and
datanucleus.schema.autoCreateAll to allow
// bin/spark-shell, bin/spark-sql and sbin/start-thriftserver.sh to
automatically create the
// Derby Metastore when running Spark in the non-production environment.
val isDefaultMSUri =
hiveConf.getVar(METASTOREURIS).equals(METASTOREURIS.defaultStrVal)
val isDerbyMS =
hiveConf.getVar(METASTORECONNECTURLKEY).startsWith("jdbc:derby")
if (isDefaultMSUri && isDerbyMS) {
hiveConf.setBoolean("hive.metastore.schema.verification", false)
hiveConf.setBoolean("datanucleus.schema.autoCreateAll", true)
}
hiveConf
}
```
Because we don't know it's default value or set by user. so just set it for
non-production environment.
----------------------------------------------------------------
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]