[SPARK-59699][CONNECT] Make DataFrameReader options case-insensitive - #58951
Open
haoyangeng-db wants to merge 2 commits into
Open
haoyangeng-db wants to merge 2 commits into
haoyangeng-db wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR makes Spark Connect's Python
DataFrameReader.optionhandling case-insensitive.When a new option matches an existing key ignoring case, it removes the existing entry and stores
the newest spelling and value.
It also adds plan serialization coverage for both named-table and data-source reads.
Why are the changes needed?
Spark reader option keys are case-insensitive and later calls should override earlier values.
Spark Connect currently stores options in a regular Python dictionary, so differently cased forms
of the same logical key can both reach the protobuf map. The server then resolves those duplicates
from an unordered map, which can select a value that does not match the user's call order.
For example, this should deterministically produce one
versionAsOfoption with value2:The fix preserves the spelling of the most recent key instead of lowercasing keys, so vendor option
names such as
oracle.jdbc.timezoneAsRegionremain unchanged.Does this PR introduce any user-facing change?
Yes. Spark Connect Python reader options now follow case-insensitive, last-call-wins semantics,
matching the classic DataFrameReader behavior. Workloads that supplied the same logical option
using multiple casing variants now deterministically use the most recently supplied value.
How was this patch tested?
SparkConnectPlanTestsfor mixed-case named-table options andrepeated data-source options.
pyspark.sql.tests.connect.test_connect_plan: 83 tests passed before the clean rebase ontothe latest
upstream/master; the rebase did not change the patch.git diff --checkand line-length checks after rebasing.dependencies, and installing them was blocked by DNS resolution to PyPI.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex 0.154.0