Github user piaozhexiu commented on the pull request:
https://github.com/apache/spark/pull/7610#issuecomment-124167920
@vanzin thank you for your comments!
1) As for spark-sql, sorry I was wrong. spark-sql works with both `--name`
and `--conf spark.app.name`. So we're good here.
2) As to why `--conf spark.app.name` doesn't work in pyspark, if you look
at `context.py`, [line
#135](https://github.com/apache/spark/blob/master/python/pyspark/context.py#L135)
overwrites `spark.app.name` in conf if `appName` is passed via a constructor
parameter.
So if you run the following cmd-
```
pyspark --conf spark.app.name=MyName
```
It invokes the following cmd b/c `--name PySparkShell` is added by default-
```
spark-submit --name PySparkShell --conf spark.app.name=MyName
```
Since `PySparkShell` ends up being passed as a parameter to the
`SparkContext` constructor, it overwrites `spark.app.name`. So when we get to
[line
#153](https://github.com/apache/spark/blob/master/python/pyspark/context.py#L153)
later, `spark.app.name` is no longer `MyName` but `PySparkShell`.
In summary, `--name` always wins and is always added to the cmd. So `--conf
spark.app.name` never takes effect.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]