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
Original file line number Diff line number Diff line change
Expand Up @@ -2896,10 +2896,6 @@ private LogicalPlan withSelectQuerySpecification(
SelectColumnClauseContext selectColumnCtx = selectClause.selectColumnClause();
LogicalPlan aggregate = withAggregate(filter, selectColumnCtx, aggClause);
boolean isDistinct = (selectClause.DISTINCT() != null);
if (isDistinct && aggregate instanceof Aggregate) {
throw new ParseException("cannot combine SELECT DISTINCT with aggregate functions or GROUP BY",
selectClause);
}
if (!(aggregate instanceof Aggregate) && havingClause.isPresent()) {
// create a project node for pattern match of ProjectToGlobalAggregate rule
// then ProjectToGlobalAggregate rule can insert agg node as LogicalHaving node's child
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,13 @@ suite("window_function") {
left join adj_nullable_2 on c1 = c4
where c6 is not null;
"""

// distinct with window
sql """
SELECT
DISTINCT dt,
count(dt2) over (partition by dt) as num
from
(select 1 as dt,2 as dt2)t
group by dt,dt2"""
}