Skip to content

Comments

[SPARK-41149][PYTHON] Fix SparkSession.builder.config to support bool#38673

Closed
itholic wants to merge 2 commits intoapache:masterfrom
itholic:SPARK-41149
Closed

[SPARK-41149][PYTHON] Fix SparkSession.builder.config to support bool#38673
itholic wants to merge 2 commits intoapache:masterfrom
itholic:SPARK-41149

Conversation

@itholic
Copy link
Contributor

@itholic itholic commented Nov 16, 2022

What changes were proposed in this pull request?

This PR proposes to support bool type for SparkSession.builder.config when building the new SparkSession.

Why are the changes needed?

Currently, Python bool type True or False is not working correctly, since JVM side only treat the String type of "true" or "false" as a valid option value.

So, this PR basically fix the current behavior as below:

Before

>>> s1 = spark.builder.config("spark.sql.pyspark.jvmStacktrace.enabled", True).getOrCreate()
>>> s1.conf.get("spark.sql.pyspark.jvmStacktrace.enabled")
'True'  # invalid value, no effect for options.

After

>>> s1 = spark.builder.config("spark.sql.pyspark.jvmStacktrace.enabled", True).getOrCreate()
>>> s1.conf.get("spark.sql.pyspark.jvmStacktrace.enabled")
'true'  # the lower case "true" only valid for options.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Unittest added.

@HyukjinKwon
Copy link
Member

Merged to master.

SandishKumarHN pushed a commit to SandishKumarHN/spark that referenced this pull request Dec 12, 2022
### What changes were proposed in this pull request?

This PR proposes to support `bool` type for `SparkSession.builder.config` when building the new `SparkSession`.

### Why are the changes needed?

Currently, Python `bool` type `True` or `False` is not working correctly, since JVM side only treat the String type of "true" or "false" as a valid option value.

So, this PR basically fix the current behavior as below:

**Before**
```python
>>> s1 = spark.builder.config("spark.sql.pyspark.jvmStacktrace.enabled", True).getOrCreate()
>>> s1.conf.get("spark.sql.pyspark.jvmStacktrace.enabled")
'True'  # invalid value, no effect for options.
```

**After**
```python
>>> s1 = spark.builder.config("spark.sql.pyspark.jvmStacktrace.enabled", True).getOrCreate()
>>> s1.conf.get("spark.sql.pyspark.jvmStacktrace.enabled")
'true'  # the lower case "true" only valid for options.
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Unittest added.

Closes apache#38673 from itholic/SPARK-41149.

Authored-by: itholic <haejoon.lee@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 15, 2022
### What changes were proposed in this pull request?

This PR proposes to support `bool` type for `SparkSession.builder.config` when building the new `SparkSession`.

### Why are the changes needed?

Currently, Python `bool` type `True` or `False` is not working correctly, since JVM side only treat the String type of "true" or "false" as a valid option value.

So, this PR basically fix the current behavior as below:

**Before**
```python
>>> s1 = spark.builder.config("spark.sql.pyspark.jvmStacktrace.enabled", True).getOrCreate()
>>> s1.conf.get("spark.sql.pyspark.jvmStacktrace.enabled")
'True'  # invalid value, no effect for options.
```

**After**
```python
>>> s1 = spark.builder.config("spark.sql.pyspark.jvmStacktrace.enabled", True).getOrCreate()
>>> s1.conf.get("spark.sql.pyspark.jvmStacktrace.enabled")
'true'  # the lower case "true" only valid for options.
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Unittest added.

Closes apache#38673 from itholic/SPARK-41149.

Authored-by: itholic <haejoon.lee@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
### What changes were proposed in this pull request?

This PR proposes to support `bool` type for `SparkSession.builder.config` when building the new `SparkSession`.

### Why are the changes needed?

Currently, Python `bool` type `True` or `False` is not working correctly, since JVM side only treat the String type of "true" or "false" as a valid option value.

So, this PR basically fix the current behavior as below:

**Before**
```python
>>> s1 = spark.builder.config("spark.sql.pyspark.jvmStacktrace.enabled", True).getOrCreate()
>>> s1.conf.get("spark.sql.pyspark.jvmStacktrace.enabled")
'True'  # invalid value, no effect for options.
```

**After**
```python
>>> s1 = spark.builder.config("spark.sql.pyspark.jvmStacktrace.enabled", True).getOrCreate()
>>> s1.conf.get("spark.sql.pyspark.jvmStacktrace.enabled")
'true'  # the lower case "true" only valid for options.
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Unittest added.

Closes apache#38673 from itholic/SPARK-41149.

Authored-by: itholic <haejoon.lee@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
@itholic itholic deleted the SPARK-41149 branch April 22, 2023 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants