-
Notifications
You must be signed in to change notification settings - Fork 28.5k
[SPARK-33992][SQL] override transformUpWithNewOutput to add allowInvokingTransformsInAnalyzer #31013
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
Conversation
…peratorsUpWithNewOutput
cc @cloud-fan @maropu @dongjoon-hyun thanks very much |
@@ -451,6 +451,21 @@ trait CharVarcharTestSuite extends QueryTest with SQLTestUtils { | |||
Seq(Row("char(5)"), Row("varchar(3)"))) | |||
} | |||
} | |||
|
|||
test("SPARK-33992: char/varchar resolution in correlated sub query ") { |
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.
branch-3.0
has the same issue? The branch does not have PaddingAndLengthCheckForCharVarchar
though.
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.
nit: remove the unnecessary space in the end: in correlated sub query ")
-> in correlated sub query")
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.
yes
checkAnswer(sql( | ||
""" | ||
|SELECT v FROM t1 | ||
| WHERE 'a' IN (SELECT v FROM t2 WHERE t1.c = t2.c )""".stripMargin), |
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.
nit: | WHERE 'a' IN
-> |WHERE 'a' IN
?
This looks okay but maybe clean up the PR title and description a little bit? |
@viirya thanks for reminding me |
Kubernetes integration test starting |
Kubernetes integration test status failure |
GA passed, merging to master/3.1! |
…kingTransformsInAnalyzer ### What changes were proposed in this pull request? In #29643, we move the plan rewriting methods to QueryPlan. we need to override transformUpWithNewOutput to add allowInvokingTransformsInAnalyzer because it and resolveOperatorsUpWithNewOutput are called in the analyzer. For example, PaddingAndLengthCheckForCharVarchar could fail query when resolveOperatorsUpWithNewOutput with ```logtalk [info] - char/varchar resolution in sub query *** FAILED *** (367 milliseconds) [info] java.lang.RuntimeException: This method should not be called in the analyzer [info] at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.assertNotAnalysisRule(AnalysisHelper.scala:150) [info] at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.assertNotAnalysisRule$(AnalysisHelper.scala:146) [info] at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.assertNotAnalysisRule(LogicalPlan.scala:29) [info] at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.transformDown(AnalysisHelper.scala:161) [info] at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.transformDown$(AnalysisHelper.scala:160) [info] at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.transformDown(LogicalPlan.scala:29) [info] at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.transformDown(LogicalPlan.scala:29) [info] at org.apache.spark.sql.catalyst.plans.QueryPlan.org$apache$spark$sql$catalyst$plans$QueryPlan$$updateOuterReferencesInSubquery(QueryPlan.scala:267) ``` ### Why are the changes needed? trivial bugfix ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? new tests Closes #31013 from yaooqinn/SPARK-33992. Authored-by: Kent Yao <yao@apache.org> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit f0ffe0c) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
Test build #133609 has finished for PR 31013 at commit
|
What changes were proposed in this pull request?
In #29643, we move the plan rewriting methods to QueryPlan. we need to override transformUpWithNewOutput to add allowInvokingTransformsInAnalyzer
because it and resolveOperatorsUpWithNewOutput are called in the analyzer.
For example,
PaddingAndLengthCheckForCharVarchar could fail query when resolveOperatorsUpWithNewOutput
with
Why are the changes needed?
trivial bugfix
Does this PR introduce any user-facing change?
no
How was this patch tested?
new tests