[SPARK-50618] Make DataFrameReader and DataStreamReader leverage the analyzer more #49238
+234
−128
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?
Introduces two logical nodes:
UnresolvedDataSource
UnresolvedJDBCRelation
The DataFrameReader and DataStreamReader creates these unresolved nodes instead, and calls the analyzer to resolve these data sources. These then get analyzed as part of the
ResolveDataSource
rule. All logic in DataFrameReader and DataStreamReader has been moved here.There is still logic around text based format parsing on an existing Dataset. I will refactor this in a subsequent PR.
Why are the changes needed?
The DataFrameReader and DataStreamReader typically creates analyzed relations as part of their respective
.load()
methods.This creates inconsistencies for what rules get applied to the query plan as part of Catalyst depending on your API of choice, such as SQL vs Python or SQL vs Scala.
The goal of this Jira is to refactor the logic in DataFrameReader and DataStreamReader classes to create unresolved plans that get analyzed as part of Catalyst.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing unit tests and will add new tests
Was this patch authored or co-authored using generative AI tooling?
No