[SPARK-50994][SQL] Perform RDD conversion under tracked execution #49678
+30
−5
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?
materializedRdd
is introduced which actualyl holds RDD after it is created (by executing plan).Dataset#rdd
is wrapped withinwithNewRDDExecutionId
, which takes care of important setup tasks, like updating Spark properties inSparkContext
's thread-locals, before executing theSparkPlan
to fetch dataDataset#rdd
acts like any other RDD operations likereduce
orforeachPartition
and operates onmaterializedRdd
with new execution id (and initialising it if not done yet)Why are the changes needed?
When
Dataset
is converted intoRDD
, It executesSpakPlan
without any execution context. This leads to:RDD
.RDD
execution context. This leads to these properties not being sent withTaskContext
but some operations like reading parquet files depend on these properties (eg, case-sesitivity).Test scenario:
In the above scenario,
.rdd
triggers execution which performs shuffle after reading parquetspark.sql.caseSensitive
is not set (even though it is passed during session creation) which is referred intoSQLConf
byparquet-mr
readerdropDuplicates
as it would drop duplicates by eithera
or 'A'. Expectation is to drop duplicates by columna
hadoopContext
hence is disabled.Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing testcases & new test case added for specific scenario
Was this patch authored or co-authored using generative AI tooling?
No