-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24721][SQL] Extract Python UDFs at the end of optimizer #22104
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
27fd57d
Fix file strategy to exclude python UDF filters
icexelloss 499acde
Remove white space
icexelloss 595399e
Fix style
icexelloss 470d63a
Fix python style
icexelloss cfd568e
Add test for data source and data source v2; Fix projection in EvalPy…
icexelloss 24eebdc
Fix style
icexelloss 96d2570
Split tests; Fix EvalPythonExec
icexelloss 195ba5b
Fix python style
icexelloss f64854e
wip
icexelloss 4e63704
Disable data source v2 test for now
icexelloss ca0195e
Add require_test_compiled
icexelloss 7076820
Revert small changes
icexelloss d440cbf
Move ExtractPythonUDFs to end of optimize stage
icexelloss 2325a4f
Add more tests; Fix lint; Remove hardcoded scala-2.11 from require_te…
icexelloss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add test for data source and data source v2; Fix projection in EvalPy…
…thonExec; Move logic to ExtractPythonUDFs
- Loading branch information
commit cfd568e2fe429c7959264a759bc2fd0b34b03eea
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,8 @@ import org.apache.spark.sql.catalyst.expressions._ | |
| import org.apache.spark.sql.catalyst.expressions.aggregate.AggregateExpression | ||
| import org.apache.spark.sql.catalyst.plans.logical.{Aggregate, LogicalPlan, Project} | ||
| import org.apache.spark.sql.catalyst.rules.Rule | ||
| import org.apache.spark.sql.execution.{FilterExec, ProjectExec, SparkPlan} | ||
| import org.apache.spark.sql.execution._ | ||
| import org.apache.spark.sql.execution.datasources.v2.DataSourceV2ScanExec | ||
|
|
||
|
|
||
| /** | ||
|
|
@@ -133,6 +134,9 @@ object ExtractPythonUDFs extends Rule[SparkPlan] with PredicateHelper { | |
| } | ||
|
|
||
| def apply(plan: SparkPlan): SparkPlan = plan transformUp { | ||
| // SPARK-24721: Ignore Python UDFs in DataSourceScan and DataSourceV2Scan | ||
| case plan: DataSourceScanExec => plan | ||
|
||
| case plan: DataSourceV2ScanExec => plan | ||
| case plan: SparkPlan => extract(plan) | ||
| } | ||
|
|
||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably another bug I found in testing this - If the input node to EvalPythonExec doesn't produce UnsafeRow, and cast here will fail.
I found this in testing when I pass in an test data source scan node, which produces GeneralInternalRow, will throw exception here.
I am happy to submit this as a separate patch if people think it's necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.. This seems to break existing tests. Need to look into it.