- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ06-10-2021 02:54 PM
We can set for example:
spark.conf.set('aaa.test.junk.config', 99999) , and then run spark.conf.get("aaa.test.junk.configโ) which will return a value.
The problem occurs when incorrectly setting to a similar matching property.
spark.conf.set('spark.sql.shuffle.partition', 999) ==> without the trailing โs'
Where the actual property is: โspark.sql.shuffle.partitions' ==> has a training โsโ
Running spark.conf.get('spark.sql.shuffle.partitionโ) will return a value ==> without the trailing โs'
I thought I could run the getAll() as a validation, but the getAll() may not return properties that are explicitly defined in a Notebook session.
Is there a way to check if what I have used as config parameter is actually valid or not? I don't see any error message either
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ06-17-2021 11:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ06-17-2021 11:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ07-30-2021 02:38 PM
You would solve this just like we solve this problem for all lose string references. Namely, that is to create a constant that represents the key-value you want to ensure doesn't get mistyped.
Naturally, if you type it wrong the first time, it will be wrong everywhere, but that is true for all software development. Beyond that, a simple assert will avoid regressions where someone might change your value.
The good news is that this has already been done for you and you could simply include it in your code if you wanted to as seen here:
If you are using Python, I would go ahead and create your own constants and assertions give that integrating with the underlying Scala code just wouldn't be worth it (in my opinion)

