Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions be/src/pipeline/exec/table_function_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ TableFunctionOperatorX::TableFunctionOperatorX(ObjectPool* pool, const TPlanNode

Status TableFunctionOperatorX::_prepare_output_slot_ids(const TPlanNode& tnode) {
// Prepare output slot ids
if (tnode.table_function_node.outputSlotIds.empty()) {
return Status::InternalError("Output slots of table function node is empty");
}
SlotId max_id = -1;
for (auto slot_id : tnode.table_function_node.outputSlotIds) {
if (slot_id > max_id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.doris.nereids.trees.expressions.NamedExpression;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.functions.scalar.Uuid;
import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.PlanType;
import org.apache.doris.nereids.trees.plans.algebra.Project;
Expand Down Expand Up @@ -93,7 +94,7 @@ private LogicalProject(List<NamedExpression> projects, List<NamedExpression> exc
Preconditions.checkArgument(!projects.isEmpty() || !(child instanceof Unbound),
"projects can not be empty when child plan is unbound");
this.projects = projects.isEmpty()
? ImmutableList.of(ExpressionUtils.selectMinimumColumn(child.get(0).getOutput()))
? ImmutableList.of(new Alias(new TinyIntLiteral((byte) 1)))
: projects;
this.excepts = Utils.fastToImmutableList(excepts);
this.isDistinct = isDistinct;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ void testCountStarProject() {
logicalAggregate(
logicalProject().when(
project -> project.getProjects().size() == 1
&& project.getProjects().get(0) instanceof SlotReference
&& "o_orderdate".equals(project.getProjects().get(0).toSql()))))
&& !(project.getProjects().get(0) instanceof SlotReference)
)))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
package org.apache.doris.nereids.rules.rewrite;

import org.apache.doris.nereids.trees.expressions.NamedExpression;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.logical.LogicalProject;
import org.apache.doris.nereids.types.DoubleType;
import org.apache.doris.nereids.types.IntegerType;
import org.apache.doris.nereids.types.TinyIntType;
import org.apache.doris.nereids.util.MemoPatternMatchSupported;
import org.apache.doris.nereids.util.PlanChecker;
import org.apache.doris.utframe.TestWithFeService;
Expand Down Expand Up @@ -188,7 +189,7 @@ public void pruneCountStarStmt() {
logicalAggregate(
logicalProject(
logicalOlapScan()
).when(p -> p.getProjects().get(0).getDataType().equals(IntegerType.INSTANCE)
).when(p -> p.getProjects().get(0).getDataType().equals(TinyIntType.INSTANCE)
&& p.getProjects().size() == 1)
)
);
Expand All @@ -203,7 +204,7 @@ public void pruneCountConstantStmt() {
logicalAggregate(
logicalProject(
logicalOlapScan()
).when(p -> p.getProjects().get(0).getDataType().equals(IntegerType.INSTANCE)
).when(p -> p.getProjects().get(0).getDataType().equals(TinyIntType.INSTANCE)
&& p.getProjects().size() == 1)
)
);
Expand All @@ -218,7 +219,7 @@ public void pruneCountConstantAndSumConstantStmt() {
logicalAggregate(
logicalProject(
logicalOlapScan()
).when(p -> p.getProjects().get(0).getDataType().equals(IntegerType.INSTANCE)
).when(p -> p.getProjects().get(0).getDataType().equals(TinyIntType.INSTANCE)
&& p.getProjects().size() == 1)
)
);
Expand All @@ -233,7 +234,7 @@ public void pruneCountStarAndSumConstantStmt() {
logicalAggregate(
logicalProject(
logicalOlapScan()
).when(p -> p.getProjects().get(0).getDataType().equals(IntegerType.INSTANCE)
).when(p -> p.getProjects().get(0).getDataType().equals(TinyIntType.INSTANCE)
&& p.getProjects().size() == 1)
)
);
Expand Down Expand Up @@ -283,9 +284,7 @@ public void pruneColumnForOneSideOnCrossJoin() {
"internal.test.student.id",
"internal.test.student.name"))),
logicalProject(logicalRelation())
.when(p -> getOutputQualifiedNames(p)
.containsAll(ImmutableList.of(
"internal.test.score.sid")))
.when(p -> p.getProjects().stream().noneMatch(SlotReference.class::isInstance))
)
)
);
Expand Down

This file was deleted.

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

explain {
sql """select count(*) from ( select distinct col1 as a0, null as a1, null as a2 from agg_with_const_tbl)t"""
contains "projections: NULL"
contains "projections: col1"
}

}