protected ExpressionNode nonAggregate(ColumnExpression column) {
boolean isUnique = isUniqueGroupedTable(column.getTable());
ImplicitAggregateSetting setting = getImplicitAggregateSetting();
if ((setting == ImplicitAggregateSetting.ERROR) ||
((setting == ImplicitAggregateSetting.FIRST_IF_UNIQUE) && !isUnique))
throw new NoAggregateWithGroupByException(column.getSQLsource());
if (isUnique && source.getAggregates().isEmpty())
// Add unique as another key in hopes of turning the
// whole things into a distinct.
return addKey(column);
else