Skip to content

Commit

Permalink
[feat](Nereids): validate Project list. (#18868)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener authored Apr 22, 2023
1 parent c80dc91 commit 814f129
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class Validator extends PlanPostProcessor {

@Override
public Plan visitPhysicalProject(PhysicalProject<? extends Plan> project, CascadesContext context) {
Preconditions.checkArgument(!project.getProjects().isEmpty(), "Project list can't be empty");

Plan child = project.child();
// Forbidden project-project, we must merge project.
if (child instanceof PhysicalProject) {
Expand All @@ -54,7 +56,7 @@ public Plan visitPhysicalProject(PhysicalProject<? extends Plan> project, Cascad
@Override
public Plan visitPhysicalFilter(PhysicalFilter<? extends Plan> filter, CascadesContext context) {
Preconditions.checkArgument(!filter.getConjuncts().isEmpty()
&& filter.getPredicate() != BooleanLiteral.TRUE);
&& filter.getPredicate() != BooleanLiteral.TRUE, "Filter predicate can't be empty or true");

Plan child = filter.child();
// Forbidden filter-project, we must make filter-project -> project-filter.
Expand Down

0 comments on commit 814f129

Please sign in to comment.