Skip to content
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

[BugFix] Fix join on-subquery cast error #41498

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Conversation

Seaven
Copy link
Contributor

@Seaven Seaven commented Feb 23, 2024

Why I'm doing:

like sql:

a join b on xxx in ((((()))))....

java.lang.ClassCastException: class com.starrocks.sql.ast.SubqueryRelation cannot be cast to class com.starrocks.sql.ast.SelectRelation (com.starrocks.sql.ast.SubqueryRelation and com.starrocks.sql.ast.SelectRelation are in unnamed module of loader 'app')

	at com.starrocks.sql.optimizer.transformer.RelationTransformer.extractSubqueryRelation(RelationTransformer.java:1094)
	at com.starrocks.sql.optimizer.transformer.RelationTransformer.isJoinLeftRelatedSubquery(RelationTransformer.java:1026)
	at com.starrocks.sql.optimizer.transformer.RelationTransformer.parseJoinOnPredicate(RelationTransformer.java:939)
	at com.starrocks.sql.optimizer.transformer.RelationTransformer.visitJoin(RelationTransformer.java:796)
	at com.starrocks.sql.optimizer.transformer.RelationTransformer.visitJoin(RelationTransformer.java:142)
	at com.starrocks.sql.ast.JoinRelation.accept(JoinRelation.java:134)
	at com.starrocks.sql.ast.AstVisitor.visit(AstVisitor.java:68)
	at com.starrocks.sql.ast.AstVisitor.visit(AstVisitor.java:64)
	at com.starrocks.sql.optimizer.transformer.QueryTransformer.planFrom(QueryTransformer.java:165)
	at com.starrocks.sql.optimizer.transformer.QueryTransformer.plan(QueryTransformer.java:80)
	at com.starrocks.sql.optimizer.transformer.RelationTransformer.visitSelect(RelationTransformer.java:259)
	at com.starrocks.sql.optimizer.transformer.RelationTransformer.visitSelect(RelationTransformer.java:142)
	at com.starrocks.sql.ast.SelectRelation.accept(SelectRelation.java:242)
	at com.starrocks.sql.ast.AstVisitor.visit(AstVisitor.java:68)
	at com.starrocks.sql.ast.AstVisitor.visit(AstVisitor.java:64)
	at com.starrocks.sql.optimizer.transformer.RelationTransformer.transform(RelationTransformer.java:209)
	at com.starrocks.sql.optimizer.transformer.RelationTransformer.transformWithSelectLimit(RelationTransformer.java:177)
	at com.starrocks.sql.StatementPlanner.createQueryPlanWithReTry(StatementPlanner.java:241)
	at com.starrocks.sql.StatementPlanner.plan(StatementPlanner.java:134)
	at com.starrocks.sql.StatementPlanner.plan(StatementPlanner.java:91)
	at com.starrocks.utframe.UtFrameUtils.buildPlan(UtFrameUtils.java:486)
	at com.starrocks.utframe.UtFrameUtils.getPlanAndFragment(UtFrameUtils.java:527)
	at com.starrocks.sql.plan.PlanTestNoneDBBase.getFragmentPlan(PlanTestNoneDBBase.java:249)
	at com.starrocks.sql.plan.JoinTest.testJoinOnAnonymousSubquery(JoinTest.java:3194)

What I'm doing:

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.2
    • 3.1
    • 3.0
    • 2.5

Signed-off-by: Seaven <seaven_7@qq.com>
@Seaven Seaven requested review from a team as code owners February 23, 2024 03:06
@mergify mergify bot assigned Seaven Feb 23, 2024
Copy link

sonarcloud bot commented Feb 23, 2024

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 8 / 8 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/sql/optimizer/transformer/RelationTransformer.java 7 7 100.00% []
🔵 com/starrocks/sql/ast/SubqueryRelation.java 1 1 100.00% []

@packy92 packy92 merged commit 974d4a5 into StarRocks:main Feb 23, 2024
80 of 85 checks passed
Copy link

@Mergifyio backport branch-3.2

@github-actions github-actions bot removed the 3.2 label Feb 23, 2024
Copy link

@Mergifyio backport branch-3.1

Copy link

@Mergifyio backport branch-3.0

@github-actions github-actions bot removed the 3.1 label Feb 23, 2024
Copy link
Contributor

mergify bot commented Feb 23, 2024

backport branch-3.2

✅ Backports have been created

@github-actions github-actions bot removed the 3.0 label Feb 23, 2024
Copy link

@Mergifyio backport branch-2.5

Copy link
Contributor

mergify bot commented Feb 23, 2024

backport branch-3.1

✅ Backports have been created

@github-actions github-actions bot removed the 2.5 label Feb 23, 2024
Copy link
Contributor

mergify bot commented Feb 23, 2024

backport branch-3.0

✅ Backports have been created

Copy link
Contributor

mergify bot commented Feb 23, 2024

backport branch-2.5

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 23, 2024
Signed-off-by: Seaven <seaven_7@qq.com>
(cherry picked from commit 974d4a5)
mergify bot pushed a commit that referenced this pull request Feb 23, 2024
Signed-off-by: Seaven <seaven_7@qq.com>
(cherry picked from commit 974d4a5)
mergify bot pushed a commit that referenced this pull request Feb 23, 2024
Signed-off-by: Seaven <seaven_7@qq.com>
(cherry picked from commit 974d4a5)
mergify bot pushed a commit that referenced this pull request Feb 23, 2024
Signed-off-by: Seaven <seaven_7@qq.com>
(cherry picked from commit 974d4a5)

# Conflicts:
#	fe/fe-core/src/test/java/com/starrocks/sql/plan/JoinTest.java
Seaven added a commit to Seaven/starrocks that referenced this pull request Feb 23, 2024
wanpengfei-git pushed a commit that referenced this pull request Feb 23, 2024
wanpengfei-git pushed a commit that referenced this pull request Feb 23, 2024
wanpengfei-git pushed a commit that referenced this pull request Feb 23, 2024
@Seaven Seaven deleted the view branch February 23, 2024 08:00
kangkaisen pushed a commit that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants