Removed custom naming for DISTINCT COUNT (#39537)
(cherry picked from commit 9412a2ee01a60dd6449bbced1273ec0b37b65589)
This commit is contained in:
parent
ba44f28340
commit
06d0e0efad
|
@ -89,6 +89,8 @@ SELECT (emp_no % 3) + 1 AS e, (languages % 3) + 1 AS l FROM test_emp GROUP BY e,
|
|||
|
||||
// COUNT
|
||||
aggCountImplicit
|
||||
SELECT COUNT(*) FROM test_emp;
|
||||
aggCountImplicitAlias
|
||||
SELECT COUNT(*) AS count FROM test_emp;
|
||||
aggCountImplicitWithCast
|
||||
SELECT CAST(COUNT(*) AS INT) c FROM "test_emp";
|
||||
|
@ -109,6 +111,8 @@ SELECT gender g, CAST(COUNT(*) AS INT) c FROM "test_emp" WHERE emp_no < 10020 GR
|
|||
aggCountWithAlias
|
||||
SELECT gender g, COUNT(*) c FROM "test_emp" GROUP BY g ORDER BY gender;
|
||||
countDistinct
|
||||
SELECT COUNT(DISTINCT "hire_date") FROM test_emp;
|
||||
countDistinctAlias
|
||||
SELECT COUNT(DISTINCT hire_date) AS count FROM test_emp;
|
||||
countDistinctAndCountSimpleWithAlias
|
||||
SELECT COUNT(*) cnt, COUNT(DISTINCT first_name) as names, gender FROM test_emp GROUP BY gender ORDER BY gender;
|
||||
|
|
|
@ -63,16 +63,6 @@ public class Count extends AggregateFunction {
|
|||
return functionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
if (distinct()) {
|
||||
StringBuilder sb = new StringBuilder(super.name());
|
||||
sb.insert(sb.indexOf("(") + 1, "DISTINCT ");
|
||||
return sb.toString();
|
||||
}
|
||||
return super.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AggregateFunctionAttribute toAttribute() {
|
||||
// COUNT(*) gets its value from the parent aggregation on which _count is called
|
||||
|
|
Loading…
Reference in New Issue