Skip to content

Conversation

@wangyum
Copy link
Member

@wangyum wangyum commented Jul 29, 2017

What changes were proposed in this pull request?

Since Spark 2.0.0, SET hive config commands do not pass the values to HiveClient, this PR point out user to set hive config before SparkSession is initialized when they try to set hive config.

How was this patch tested?

manual tests

spark-set

@SparkQA
Copy link

SparkQA commented Jul 29, 2017

Test build #80042 has finished for PR 18769 at commit 4bdc9ad.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 30, 2017

Test build #80050 has finished for PR 18769 at commit cee6838.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@wangyum
Copy link
Member Author

wangyum commented Jul 30, 2017

retest this please

@SparkQA
Copy link

SparkQA commented Jul 30, 2017

Test build #80051 has finished for PR 18769 at commit cee6838.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@viirya
Copy link
Member

viirya commented Jul 30, 2017

Please describe the issue to fix in the PR description, rather than just the codes to reproduce.

conf.get(key, defaultValue)
}

override def setConf(key: String, value: String): Unit = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add clientLoader.synchronized?

/** Returns the configuration for the given key in the current session. */
def getConf(key: String, defaultValue: String): String

/** Set the given configuration property. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ... in the current session.

val sourceTable = "sourceTable"
val targetTable = "targetTable"
(0 until cnt).map(i => (i, i)).toDF("c1", "c2").createOrReplaceTempView(sourceTable)
sql(s"create table $targetTable(c1 int) PARTITIONED BY(c2 int)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Usually we use upper case for SQL keywords like SELECT, CREATE TABLE, etc.

@wangyum
Copy link
Member Author

wangyum commented Jul 31, 2017

@viirya Spark does not support that. see:#17223 (comment)
@dongjoon-hyun How about throw exception when users try to change them as @cloud-fan said?
or document it?
I have test --conf spark.hadoop.hive.exec.max.dynamic.partitions=1001 both works for spark-shell and spark-sql, --hiveconf hive.exec.max.dynamic.partitions=1001 works for spark-sql.

@dongjoon-hyun
Copy link
Member

Yep. The workaround has been the solution for this.
And, +1 for the exception according to @cloud-fan 's suggestion, too.

@wangyum wangyum changed the title [SPARK-21574][SQL] Fix set hive.exec.max.dynamic.partitions lose effect. [SPARK-21574][SQL] Point out user to set hive config before SparkSession is initialized Aug 1, 2017
@wangyum
Copy link
Member Author

wangyum commented Aug 1, 2017

SetCommand.scala throws exception seems roughly. InsertIntoHiveTable throws exception seems too late. so I logWarning at SetCommand.scala

@SparkQA
Copy link

SparkQA commented Aug 1, 2017

Test build #80114 has finished for PR 18769 at commit 506050a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@viirya
Copy link
Member

viirya commented Aug 2, 2017

From the screenshot, it can't tell if the setting works or not. Please explicitly log that the setting doesn't work.

@SparkQA
Copy link

SparkQA commented Aug 2, 2017

Test build #80155 has finished for PR 18769 at commit 2eb39cb.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

case Some((key, Some(value))) =>
val runFunc = (sparkSession: SparkSession) => {
if (sparkSession.conf.get(CATALOG_IMPLEMENTATION.key).equals("hive")
&& key.startsWith("hive.")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Could you move this && to the line 91?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line length exceed 100:
maxlinelength

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (sparkSession.conf.get(CATALOG_IMPLEMENTATION.key).equals("hive") &&
    key.startsWith("hive.")) {

logWarning(s"SET $key=$value doesn't work, " +
s"because Spark doesn't support set hive config dynamically. " +
s"Please set hive config through " +
s"--conf spark.hadoop.$key=$value before SparkSession is initialized.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about?

'SET $key=$value' might not work, since Spark doesn't support changing the Hive config dynamically. Please passing the Hive-specific config by adding the prefix spark.hadoop (e.g.,spark.hadoop.$key) when starting a Spark application. For details, see the link: https://spark.apache.org/docs/latest/configuration.html#dynamically-loading-spark-properties.

@gatorsmile
Copy link
Member

@wangyum Could you help us submit a PR to fix the doc generation in https://spark.apache.org/docs/latest/configuration.html?

See many annoying syntax issues.

screen shot 2017-08-05 at 11 02 15 pm

@wangyum
Copy link
Member Author

wangyum commented Aug 6, 2017

OK, I will try.

s"Please set hive config through " +
s"--conf spark.hadoop.$key=$value before SparkSession is initialized.")
if (sparkSession.conf.get(CATALOG_IMPLEMENTATION.key).equals("hive") &&
key.startsWith("hive.")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could you add two more spaces before key?

s"the Hive config dynamically. Please passing the Hive-specific config by adding the " +
s"prefix spark.hadoop (e.g.,spark.hadoop.$key) when starting a Spark application. " +
s"For details, see the link: https://spark.apache.org/docs/latest/configuration.html#" +
s"dynamically-loading-spark-properties.")
Copy link
Member

@gatorsmile gatorsmile Aug 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except the line 93 and 95, the other lines do not need s

key.startsWith("hive.")) {
logWarning(s"'SET $key=$value' might not work, since Spark doesn't support changing " +
s"the Hive config dynamically. Please passing the Hive-specific config by adding the " +
s"prefix spark.hadoop (e.g.,spark.hadoop.$key) when starting a Spark application. " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a space after e.g.,

@gatorsmile
Copy link
Member

You can refer the description in https://github.com/apache/spark/tree/master/docs to build the documentation. Thanks!

@gatorsmile
Copy link
Member

LGTM pending a few minor comments.

@SparkQA
Copy link

SparkQA commented Aug 6, 2017

Test build #80297 has finished for PR 18769 at commit 8787cbc.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Aug 6, 2017

Test build #80298 has finished for PR 18769 at commit 03f5753.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@wangyum
Copy link
Member Author

wangyum commented Aug 6, 2017

retest this please

@SparkQA
Copy link

SparkQA commented Aug 6, 2017

Test build #80299 has finished for PR 18769 at commit 03f5753.

  • This patch fails SparkR unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@wangyum
Copy link
Member Author

wangyum commented Aug 6, 2017

retest this please

@SparkQA
Copy link

SparkQA commented Aug 6, 2017

Test build #80302 has finished for PR 18769 at commit 03f5753.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

Thanks! Merging to master.

@asfgit asfgit closed this in 10b3ca3 Aug 6, 2017
@wangyum
Copy link
Member Author

wangyum commented Aug 7, 2017

@gatorsmile Docs syntax issues was fixed by #18793.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants