-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-32708] Query optimization fails to reuse exchange with DataSourceV2 #29564
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
Changes from all commits
d46483f
5b1b9b3
dd0fb24
4ba92cc
704efbc
69ea44e
2fe41e0
a6e4709
98483c8
8b864e7
acadafe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -393,6 +393,29 @@ class DataSourceV2Suite extends QueryTest with SharedSQLContext { | |
| } | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-32708: same columns with different ExprIds should be equal after canonicalization ") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't have an end-to-end test, how about a low-level UT? Create two
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cloud-fan I think this test case creates two |
||
| def getV2ScanExec(query: DataFrame): DataSourceV2ScanExec = { | ||
| query.queryExecution.executedPlan.collect { | ||
| case d: DataSourceV2ScanExec => d | ||
| }.head | ||
| } | ||
|
|
||
| val df1 = spark.read.format(classOf[AdvancedDataSourceV2].getName).load() | ||
| val q1 = df1.select('i).filter('i > 6) | ||
| val df2 = spark.read.format(classOf[AdvancedDataSourceV2].getName).load() | ||
| val q2 = df2.select('i).filter('i > 6) | ||
| val scan1 = getV2ScanExec(q1) | ||
| val scan2 = getV2ScanExec(q2) | ||
| assert(scan1.sameResult(scan2)) | ||
| assert(scan1.doCanonicalize().equals(scan2.doCanonicalize())) | ||
|
|
||
| val q3 = df2.select('i).filter('i > 5) | ||
| val scan3 = getV2ScanExec(q3) | ||
| assert(!scan1.sameResult(scan3)) | ||
| assert(!scan1.doCanonicalize().equals(scan3.doCanonicalize())) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| class SimpleSinglePartitionSource extends DataSourceV2 with ReadSupport { | ||
|
|
||
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.
should we use
outputhere?Uh oh!
There was an error while loading. Please reload this page.
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.
Output here doesn't contain all predicate columns due to implementation at : https://github.com/apache/spark/blob/branch-2.4/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala#L108