Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-47965][CORE] Avoid orNull in TypedConfigBuilder and OptionalConfigEntry #46197

Closed
wants to merge 2 commits into from

Conversation

HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Apr 24, 2024

What changes were proposed in this pull request?

This PR proposes to avoid orNull in TypedConfigBuilder. Keys and values cannot be set null anyway, see RuntimeConfig and SparkConf.

Also, uses ConfigEntry.UNDEFINED in OptionalConfigEntry instead of null.

Why are the changes needed?

For code cleanup.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

CI in this PR should verify them.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the CORE label Apr 24, 2024
@HyukjinKwon HyukjinKwon changed the title [SPARK-47965][CORE] Avoid orNull in TypedConfigBuilder [SPARK-47965][CORE] Avoid orNull in TypedConfigBuilder and OptionalConfigEntry Apr 24, 2024
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

Do we really need to introduce this breaking change?

@@ -196,12 +196,6 @@ class ConfigEntrySuite extends SparkFunSuite {
assert(conversionError.getMessage === s"${conversionTest.key} should be double, but was abc")
}

test("default value handling is null-safe") {
Copy link
Member

Choose a reason for hiding this comment

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

Given that we have a test coverage, it seems that we remove a valid use case, @HyukjinKwon .

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

Anyway, since this is an internal Spark change at Apache Spark 4.0.0,
+1, LGTM.

@HyukjinKwon
Copy link
Member Author

yeah, it should not be a breaking change I believe. I checked the configuration related interface, and we don't allow setting nulls. The main idea is that code path that uses stringConverter assumes that it cannot be null (see ConfigHelpers) so it makes the code error-prone

@HyukjinKwon
Copy link
Member Author

Merged to master.

HyukjinKwon added a commit that referenced this pull request May 8, 2024
…ptionalConfigEntry`

### What changes were proposed in this pull request?

This PR partially reverts #46197 because of the behaviour change below:

```python
>>> spark.conf.get("spark.sql.optimizer.excludedRules")
'<undefined>'
```

### Why are the changes needed?

To avoid behaviour change.

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

No, the main change has not been released out yet.

### How was this patch tested?

Manually as described above.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #46472 from HyukjinKwon/SPARK-47965-followup.

Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
JacobZheng0927 pushed a commit to JacobZheng0927/spark that referenced this pull request May 11, 2024
…nfigEntry

### What changes were proposed in this pull request?

This PR proposes to avoid orNull in `TypedConfigBuilder`. Keys and values cannot be set `null` anyway, see `RuntimeConfig` and `SparkConf`.

Also, uses `ConfigEntry.UNDEFINED` in `OptionalConfigEntry` instead of `null`.

### Why are the changes needed?

For code cleanup.

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

No.

### How was this patch tested?

CI in this PR should verify them.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#46197 from HyukjinKwon/SPARK-47965.

Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
JacobZheng0927 pushed a commit to JacobZheng0927/spark that referenced this pull request May 11, 2024
…ptionalConfigEntry`

### What changes were proposed in this pull request?

This PR partially reverts apache#46197 because of the behaviour change below:

```python
>>> spark.conf.get("spark.sql.optimizer.excludedRules")
'<undefined>'
```

### Why are the changes needed?

To avoid behaviour change.

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

No, the main change has not been released out yet.

### How was this patch tested?

Manually as described above.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#46472 from HyukjinKwon/SPARK-47965-followup.

Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants