Uh oh!
There was an error while loading. Please reload this page.
[SPARK-24665][PySpark] Use SQLConf in PySpark to manage all sql configs - #21648
[SPARK-24665][PySpark] Use SQLConf in PySpark to manage all sql configs#21648xuanyuanking wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
This duplicates codes in Scala side. What's a gain by doing this?
There was a problem hiding this comment.
Just want to remove the hard coding as we discussed in #21370 (comment). For the duplication of Scala code, currently I have an idea is just call buildConf and doc in Scala side to register the config and leave its doc, and manage the name also default value in python SQLConf. May I ask your suggestion? :) Thx.
There was a problem hiding this comment.
For current approach, It introduces another chunk of codes - 100 addition and it doesn't quite look extendable too. I suggested few possible thoughts below. If that's difficult or impossible, I wouldn't do this for now.
There was a problem hiding this comment.
Got it, thanks for your advice.
There was a problem hiding this comment.
Can we do this by wrapping existing SQLConf? We can make them static properties by, for example, this hack
There was a problem hiding this comment.
Great, thanks for your guidance, I'll take a look at them in detail.
There was a problem hiding this comment.
During see the currently implement, maybe we can directly use the SQLConf in SessionState? I do this in last commit 453004a. Please have a look when you have time, thanks :)
There was a problem hiding this comment.
I would also look up the attributes via Py4J and dynamically define the attributes here. It's internal purpose
There was a problem hiding this comment.
I'd make this "private" self._sql_conf
There was a problem hiding this comment.
BTW, does Scala side has such attribute? If no, I won't do it in this way.
There was a problem hiding this comment.
Got it, I'll try to do this by wrapping existing SQLConf.
There was a problem hiding this comment.
If this can be replaced by sql_conf access, we don't really need this private function.
SparkQA
commented
Jun 27, 2018
Test build #92372 has finished for PR 21648 at commit
|
xuanyuanking
commented
Jun 30, 2018
I changed the PR title and description cause maybe we can just use the SQLConf in SessionState, don't need to do a extra wrapping work. |
| """ | ||
| return self._jsqlContext | ||
| def conf(self): |
There was a problem hiding this comment.
Let's make this _conf with a property.
HyukjinKwon
commented
Jun 30, 2018
Seems fine if the tests pass. I (or someone else) should take another look before merging it though. |
xuanyuanking
commented
Jun 30, 2018
Got it, thanks again for your advise and guidance. |
SparkQA
commented
Jun 30, 2018
Test build #92496 has finished for PR 21648 at commit
|
SparkQA
commented
Jun 30, 2018
Test build #92497 has finished for PR 21648 at commit
|
| @property | ||
| def _conf(self): | ||
| """Get SQLConf from current SqlContext""" |
There was a problem hiding this comment.
nit: Accessor for the JVM SQL-specific configurations
There was a problem hiding this comment.
Thanks and done in next commit.
ueshin
commented
Jul 2, 2018
LGTM for the changes. |
HyukjinKwon
commented
Jul 2, 2018
I roughly double checked most of primitive types like Boolean, Long and String work via Py4J, and some codes related with it in Py4J. Some types like |
| @property | ||
| def _conf(self): | ||
| """Accessor for the JVM SQL-specific configurations""" | ||
| return self.sparkSession._jsparkSession.sessionState().conf() |
There was a problem hiding this comment.
What's the difference between this and SQLContext.getConf ? Can users being confused by two similar APIs?
There was a problem hiding this comment.
What's the difference between this and SQLContext.getConf ?
getConf returns the value of Spark SQL conf for given key and we add this _conf wants to access the helper methods in SQLConf. Actually this following the behavior in SQLContext.scala.
Can users being confused by two similar APIs?
Maybe we should add more comments to explain this? AFAIC its more natural than get conf in hard code config key.
There was a problem hiding this comment.
Btw, _conf sounds like a property internal to the class/object, why we have a underscore there?
There was a problem hiding this comment.
Maybe we should add more comments to explain this? AFAIC its more natural than get conf in hard code config key.
Yeah, I think this is good idea.
There was a problem hiding this comment.
This one should be considered as an internal API only to use it to reduce the hardcoded ones and the leading underscore implies it. I think we are fine with it.
There was a problem hiding this comment.
Thanks for your advise, I want to change the comments in
"""Accessor for the JVM SQL-specific configurations. This property returns a SQLConf which keep same behavior in scala SQLContext,
we mainly use this to call the helper methods in SQLConf.
"""
Do you think it's reasonable.
There was a problem hiding this comment.
I am okay too but let's just leave it. It's private and not a big deal though.
SparkQA
commented
Jul 2, 2018
Test build #92518 has finished for PR 21648 at commit
|
HyukjinKwon
commented
Jul 2, 2018
Merged to master. |
What changes were proposed in this pull request?
Use SQLConf for PySpark to manage all sql configs, drop all the hard code in config usage.
How was this patch tested?
Existing UT.