[fix](planner) fix bug of push down conjuncts through agg (#22202)
should use both contains and comeFrom method to check if the conjunct can be pushed down throgh agg node
This commit is contained in:
@ -261,6 +261,7 @@ public class DateLiteral extends LiteralExpr {
|
||||
} else {
|
||||
throw new AnalysisException("Error date literal type : " + type);
|
||||
}
|
||||
analysisDone();
|
||||
}
|
||||
|
||||
public DateLiteral(long year, long month, long day) {
|
||||
@ -271,6 +272,7 @@ public class DateLiteral extends LiteralExpr {
|
||||
this.month = month;
|
||||
this.day = day;
|
||||
this.type = ScalarType.getDefaultDateType(Type.DATE);
|
||||
analysisDone();
|
||||
}
|
||||
|
||||
public DateLiteral(long year, long month, long day, Type type) {
|
||||
@ -280,6 +282,7 @@ public class DateLiteral extends LiteralExpr {
|
||||
Preconditions.checkArgument(type.getPrimitiveType().equals(Type.DATE.getPrimitiveType())
|
||||
|| type.getPrimitiveType().equals(Type.DATEV2.getPrimitiveType()));
|
||||
this.type = type;
|
||||
analysisDone();
|
||||
}
|
||||
|
||||
public DateLiteral(long year, long month, long day, long hour, long minute, long second) {
|
||||
@ -290,6 +293,7 @@ public class DateLiteral extends LiteralExpr {
|
||||
this.month = month;
|
||||
this.day = day;
|
||||
this.type = ScalarType.getDefaultDateType(Type.DATETIME);
|
||||
analysisDone();
|
||||
}
|
||||
|
||||
public DateLiteral(long year, long month, long day, long hour, long minute, long second, long microsecond,
|
||||
@ -303,6 +307,7 @@ public class DateLiteral extends LiteralExpr {
|
||||
this.microsecond = microsecond;
|
||||
Preconditions.checkArgument(type.isDatetimeV2());
|
||||
this.type = type;
|
||||
analysisDone();
|
||||
}
|
||||
|
||||
public DateLiteral(long year, long month, long day, long hour, long minute, long second, Type type) {
|
||||
@ -315,6 +320,7 @@ public class DateLiteral extends LiteralExpr {
|
||||
Preconditions.checkArgument(type.getPrimitiveType().equals(Type.DATETIME.getPrimitiveType())
|
||||
|| type.getPrimitiveType().equals(Type.DATETIMEV2.getPrimitiveType()));
|
||||
this.type = type;
|
||||
analysisDone();
|
||||
}
|
||||
|
||||
public DateLiteral(LocalDateTime dateTime, Type type) {
|
||||
@ -328,6 +334,7 @@ public class DateLiteral extends LiteralExpr {
|
||||
this.second = dateTime.getSecond();
|
||||
this.microsecond = dateTime.get(ChronoField.MICRO_OF_SECOND);
|
||||
}
|
||||
analysisDone();
|
||||
}
|
||||
|
||||
public DateLiteral(DateLiteral other) {
|
||||
|
||||
@ -2794,7 +2794,7 @@ public class SingleNodePlanner {
|
||||
GroupByClause groupByClause = stmt.getGroupByClause();
|
||||
List<Expr> exprs = groupByClause.getGroupingExprs();
|
||||
final Expr srcExpr = sourceExpr;
|
||||
if (!exprs.stream().anyMatch(expr -> expr.comeFrom(srcExpr))) {
|
||||
if (!exprs.contains(srcExpr) && !exprs.stream().anyMatch(expr -> expr.comeFrom(srcExpr))) {
|
||||
// the sourceExpr doesn't come from any of the group by exprs
|
||||
isAllSlotReferToGroupBys = false;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user