Skip to content

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
Also add support for a QUALIFY clause in a query with a GROUP BY. In
this case, the QUALIFY expression may reference aggregate functions.
Previously such queries would give a ClassCastException (trying to
convert a LogicalAggregate to a LogicalProject).

If a QUALIFY expression references or duplicates an expression in the
SELECT clause, we no longer detect and deduplicate that. This has
made one or two plans more verbose. Potentially we would add back
deduplication.

Also converted a few collections from SqlNodeList to List<SqlNode>.
Wrapping the lists as a SqlNode was not buying us much. Added
method `SqlBasicVisitor.visitAll(List<SqlNode>)`.

Close #4061
  • Loading branch information
julianhyde committed Nov 22, 2024
1 parent 6c5940b commit cdff494
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.apache.calcite.sql.SqlNodeList;
import org.apache.calcite.sql.SqlOperator;

import java.util.List;

/**
* Visitor class, follows the
* {@link org.apache.calcite.util.Glossary#VISITOR_PATTERN visitor pattern}.
Expand Down Expand Up @@ -103,4 +105,9 @@ public interface SqlVisitor<R> {
default R visitNode(SqlNode n) {
return n.accept(this);
}

/** Visits all nodes in a list. */
default void visitAll(List<SqlNode> selectList) {
selectList.forEach(e -> e.accept(this));
}
}
Loading

0 comments on commit cdff494

Please sign in to comment.