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-25061][SQL] Precedence for ThriftServer hiveconf commandline parameter #27041
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,9 +176,21 @@ private[hive] class HiveClientImpl( | |
// is not set to builtin. When spark.sql.hive.metastore.jars is builtin, the classpath | ||
// has hive-site.xml. So, HiveConf will use that to override its default values. | ||
// 2: we set all spark confs to this hiveConf. | ||
// 3: we set all entries in config to this hiveConf. | ||
// 3: we take the conf passed as --hiveconf which would be set as system properties | ||
// by org.apache.hive.service.server.HiveServer2.ServerOptionsProcessor.parse in | ||
// org.apache.spark.sql.hive.thriftserver.HiveThriftServer2.main. | ||
// 4: we set all entries in extraConfig to this hiveConf which have the highest precedence. | ||
// To summarize, the order of precedence will be | ||
// hadoopConf < sparkConf < overrideProps < extraConfig | ||
|
||
// not to lose command line overwritten properties | ||
// make a copy overridden props so that it can be reinserted finally | ||
// HiveConf.getConfSystemProperties returns all the system properties | ||
// which were considered on creation of HiveConf constructor | ||
// Refer: org.apache.hadoop.hive.conf.HiveConf#applySystemProperties | ||
val overriddenHiveProps = HiveConf.getConfSystemProperties.asScala | ||
val confMap = (hadoopConf.iterator().asScala.map(kv => kv.getKey -> kv.getValue) ++ | ||
sparkConf.getAll.toMap ++ extraConfig).toMap | ||
sparkConf.getAll.toMap ++ overriddenHiveProps ++ extraConfig).toMap | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems we should update https://github.com/apache/spark/pull/27041/files#diff-6fd847124f8eae45ba2de1cf7d6296feR170-R179 and also explain why extraConfig is at the end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yhuai Sure, I have updated the PR with reasonable pointers for the order. Does it suffice it now.? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you. As getConfSystemProperties will get all of hive confs that are in the system properties, it is possible that we will pull in a config that is not set by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, even without my changes in this PR, the |
||
confMap.foreach { case (k, v) => hiveConf.set(k, v) } | ||
SQLConf.get.redactOptions(confMap).foreach { case (k, v) => | ||
logDebug( | ||
|
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.
so we totally ignore the --hive-conf previously?
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.
it was handled as --hiveconf as part of HiveConf constructor i.e Refer https://github.com/apache/hive/blob/rel/release-2.3.5/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java#L4079 ,
i.e first it loads hive-site and then it adds --hiveconf properties on top.
But in spark we again add hadoopConf on top of it hence overwriting HiveConf order
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 you add more code comment to convince people that
HiveConf.getConfSystemProperties
contains only the --hiveconf?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.
@cloud-fan updated. is the comment adequate now?