Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Add comparison IT and doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-chen committed Oct 27, 2020
1 parent 49ccd31 commit 261d86b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/user/dql/aggregations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ The aggregation could has expression as arguments::
| M | 202 |
+----------+--------+

COUNT Aggregations
------------------

Besides regular identifiers, ``COUNT`` aggregate function also accepts arguments such as ``*`` or literals like ``1``. The meaning of these different forms are as follows:

1. ``COUNT(field)`` will count only if given field (or expression) is not null or missing in the input rows.
2. ``COUNT(*)`` will count the number of all its input rows.
3. ``COUNT(1)`` is same as ``COUNT(*)`` because any non-null literal will count.

HAVING Clause
=============
Expand Down
8 changes: 8 additions & 0 deletions integ-test/src/test/resources/correctness/queries/groupby.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
SELECT COUNT(*) FROM kibana_sample_data_flights
SELECT COUNT(1) FROM kibana_sample_data_flights
SELECT COUNT('hello') FROM kibana_sample_data_flights
SELECT SUM(FlightDelayMin) FROM kibana_sample_data_flights
SELECT AVG(FlightDelayMin) FROM kibana_sample_data_flights
SELECT MIN(FlightDelayMin) FROM kibana_sample_data_flights
SELECT MAX(FlightDelayMin) FROM kibana_sample_data_flights
SELECT count(*), Avg(FlightDelayMin), sUm(FlightDelayMin) FROM kibana_sample_data_flights
SELECT COUNT(*) AS cnt, AVG(FlightDelayMin) AS a, SUM(FlightDelayMin) AS s FROM kibana_sample_data_flights
SELECT COUNT(*) FROM kibana_sample_data_flights WHERE FlightTimeMin > 0
SELECT COUNT(1) FROM kibana_sample_data_flights WHERE FlightTimeMin > 0
SELECT SUM(FlightDelayMin) FROM kibana_sample_data_flights WHERE FlightTimeMin > 0
SELECT AVG(FlightDelayMin) FROM kibana_sample_data_flights WHERE FlightTimeMin > 0
SELECT COUNT(*) FROM kibana_sample_data_flights GROUP BY OriginCountry
SELECT COUNT(FlightNum) FROM kibana_sample_data_flights GROUP BY OriginCountry
SELECT COUNT(FlightDelay) FROM kibana_sample_data_flights GROUP BY OriginCountry
Expand Down

0 comments on commit 261d86b

Please sign in to comment.