Skip to content

Commit

Permalink
fix some regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Nov 15, 2023
1 parent bf92ab4 commit 8f889c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
import org.apache.doris.nereids.trees.plans.LimitPhase;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.algebra.Aggregate;
import org.apache.doris.nereids.trees.plans.algebra.OneRowRelation;
import org.apache.doris.nereids.trees.plans.algebra.SetOperation.Qualifier;
import org.apache.doris.nereids.trees.plans.commands.AlterMTMVCommand;
import org.apache.doris.nereids.trees.plans.commands.Command;
Expand Down Expand Up @@ -2414,6 +2415,9 @@ private LogicalPlan withSelectQuerySpecification(
}
return new LogicalHaving<>(ExpressionUtils.extractConjunctionToSet(
getExpression((havingClause.get().booleanExpression()))), project);
} else if (inputRelation instanceof OneRowRelation) {
// If OneRowRelation should not add project, because slot will be wrong when analyze
return withHaving(aggregate, havingClause);
} else {
LogicalPlan having = withHaving(aggregate, havingClause);
return withProjection(having, selectColumnCtx, aggClause, isDistinct);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
["1970-01-01"]

-- !select --
[null]
[NULL]

Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ suite("bind_priority") {

test{
sql "SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=1"
exception "a is ambiguous: a#0, a#1."
exception "a is ambiguous: a#1, a#2."
}

sql "drop table if exists duplicate_slot";
Expand Down

0 comments on commit 8f889c2

Please sign in to comment.