Skip to content

Commit

Permalink
Undo selectDistinct delegation to aggBy. aggBy will still route into …
Browse files Browse the repository at this point in the history
…selectDistinct when appropriate.
  • Loading branch information
devinrsmith committed Dec 3, 2021
1 parent cfcf7a4 commit c0ccbe6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1005,16 +1005,12 @@ protected Table getParent() {
@Override
public final Table aggBy(Collection<? extends Aggregation> aggregations,
Collection<? extends Selectable> groupByColumns) {
if (aggregations.isEmpty()) {
return selectDistinctImpl(groupByColumns);
if (aggregations.isEmpty() && !groupByColumns.isEmpty()) {
return selectDistinct(groupByColumns);
}
return aggByImpl(aggregations, groupByColumns);
}

protected Table selectDistinctImpl(Collection<? extends Selectable> columns) {
return aggByImpl(List.of(), columns);
}

protected abstract Table aggByImpl(Collection<? extends Aggregation> aggregations,
Collection<? extends Selectable> groupByColumns);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ protected Table doCoalesce() {
}

@Override
protected Table selectDistinctImpl(Collection<? extends Selectable> selectables) {
public Table selectDistinct(Collection<? extends Selectable> selectables) {
final SelectColumn[] columns = SelectColumn.from(selectables);
/* If the cachedResult table has already been created, we can just use that. */
if (getCoalesced() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public final Table where(final Collection<? extends Filter> filters) {
}

@Override
protected final Table selectDistinctImpl(Collection<? extends Selectable> groupByColumns) {
public final Table selectDistinct(Collection<? extends Selectable> groupByColumns) {
final SelectColumn[] selectColumns = SelectColumn.from(groupByColumns);
for (SelectColumn selectColumn : selectColumns) {
selectColumn.initDef(definition.getColumnNameMap());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2971,7 +2971,7 @@ private RowSetBuilderRandom getUngroupIndex(
}

@Override
protected Table selectDistinctImpl(Collection<? extends Selectable> groupByColumns) {
public Table selectDistinct(Collection<? extends Selectable> groupByColumns) {
return QueryPerformanceRecorder.withNugget("selectDistinct(" + groupByColumns + ")",
sizeForInstrumentation(),
() -> by(new SelectDistinctSpecImpl(), SelectColumn.from(groupByColumns)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,6 @@ default Table select() {
return select(getDefinition().getColumnNamesArray());
}

@Override
default Table selectDistinct(Collection<? extends Selectable> columns) {
return aggBy(Collections.emptyList(), columns);
}

@Override
@ConcurrentMethod
default Table selectDistinct(Selectable... columns) {
Expand Down

0 comments on commit c0ccbe6

Please sign in to comment.