Skip to content

Commit

Permalink
fix failed case
Browse files Browse the repository at this point in the history
  • Loading branch information
starocean999 committed Sep 10, 2024
1 parent 03f5155 commit ccdf83c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ public Expression visitScalarSubquery(ScalarSubquery scalar, T context) {
if (analyzedSubqueryPlan instanceof LogicalLimit) {
LogicalLimit limit = (LogicalLimit) analyzedSubqueryPlan;
if (limit.getOffset() == 0 && limit.getLimit() == 1) {
analyzedSubqueryPlan = (LogicalPlan) analyzedSubqueryPlan.child(0);
// skip useless limit node
analyzedResult = new AnalyzedResult((LogicalPlan) analyzedSubqueryPlan.child(0),
analyzedResult.correlatedSlots);
} else {
throw new AnalysisException("limit is not supported in correlated subquery "
+ analyzedResult.getLogicalPlan());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ suite("correlated_scalar_subquery") {

test {
sql """
select c1 from correlated_scalar_t1 where correlated_scalar_t1.c2 > (select c1 from correlated_scalar_t2 where correlated_scalar_t1.c1 = correlated_scalar_t2.c1 limit 1);
select c1 from correlated_scalar_t1 where correlated_scalar_t1.c2 > (select c1 from correlated_scalar_t2 where correlated_scalar_t1.c1 = correlated_scalar_t2.c1 limit 2);
"""
exception "limit is not supported in correlated subquery"
}
Expand Down

0 comments on commit ccdf83c

Please sign in to comment.