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
4 changes: 4 additions & 0 deletions x-pack/plugin/sql/qa/src/main/resources/agg.sql-spec
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ public String functionId() {
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
Expand Down