Adding remaining 6 sets of SQL tests in quidem (#17583)

This is the 2nd part of the PR https://github.com/apache/druid/pull/17548. It migrates the remaining 6 sets of SQL tests to quidem.  These 6 sets cover aggregation, array, json, mv, reduction, and other scalar functions.

These tests use the existing kttm dataset.  They aim to exercise SQL queries in a more comprehensive way:

Aggregation functions:
Each aggregation function is exercised in 1 query shape:
group by query
Each query covers all operators in the predicates of the having clause.
All queries are designed to return 7 rows.
Scalar functions:
Each scalar function is exercised in 3 different query shapes:
simple query
subquery
group by query
Each query covers all operators in the predicates of the where clause.
All queries are select count(*) queries.  They are designed to all return the same result for easy maintenance and debugging.

Update array and mv tests to use the language column

This PR updates the array and the mv tests to use the MV column "language" instead of constructing the data in the queries.
This commit is contained in:
Andy Tsai 2024-12-18 22:24:07 -08:00 committed by GitHub
parent ca8f24edd3
commit 78ce97ac95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 12149 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,266 @@
!set useApproximateCountDistinct false
!use druidtest:///?componentSupplier=KttmNestedComponentSupplier
!set outputformat mysql
SELECT count(*) cnt
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00';
+-------+
| cnt |
+-------+
| 78197 |
+-------+
(1 row)
!ok
#-------------------------------------------------------------------------
# TEST_ID: A1: greatest
#-------------------------------------------------------------------------
SELECT count(*) cnt
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00'
AND ('1'||greatest(session_length, 1, NULL) IS NULL
OR ('1'||greatest(session_length, 1, NULL) = 1||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) IS NOT DISTINCT
FROM 1||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)
AND ('1'||greatest(session_length, 1, NULL) IS DISTINCT
FROM '0'||greatest(session_length, 1, NULL))
AND '1'||greatest(session_length, 1, NULL) > '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) >= '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) < 2||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) <= 2||greatest(session_length, 1, NULL)
AND ('1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)) IS TRUE
AND ('1'||greatest(session_length, 1, NULL) = '0'||greatest(session_length, 1, NULL)) IS NOT TRUE
AND ('1'||greatest(session_length, 1, NULL) = '0'||greatest(session_length, 1, NULL)) IS FALSE
AND ('1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)) IS NOT FALSE
AND '1'||greatest(session_length, 1, NULL) BETWEEN '0'||greatest(session_length, 1, NULL) AND 2||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) NOT BETWEEN '1'||greatest(session_length, 1, NULL) AND '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) like '%'
AND '1'||greatest(session_length, 1, NULL) not like '__DOES_NOT_EXIST__%'
AND '1'||greatest(session_length, 1, NULL) IN ('0'||greatest(session_length, 1, NULL),
1||greatest(session_length, 1, NULL),
2||greatest(session_length, 1, NULL))
AND '1'||greatest(session_length, 1, NULL) NOT IN ('0'||greatest(session_length, 1, NULL),
2||greatest(session_length, 1, NULL)))) ;
+-------+
| cnt |
+-------+
| 78197 |
+-------+
(1 row)
!ok
SELECT count(*) cnt
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00'
AND ('1'||greatest(session_length, 1, NULL) IS NULL
OR '1'||greatest(session_length, 1, NULL) IN
(SELECT '1'||greatest(session_length, 1, NULL)
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00'
AND ('1'||greatest(session_length, 1, NULL) IS NULL
OR ('1'||greatest(session_length, 1, NULL) = 1||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) IS NOT DISTINCT
FROM 1||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)
AND ('1'||greatest(session_length, 1, NULL) IS DISTINCT
FROM '0'||greatest(session_length, 1, NULL))
AND '1'||greatest(session_length, 1, NULL) > '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) >= '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) < 2||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) <= 2||greatest(session_length, 1, NULL)
AND ('1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)) IS TRUE
AND ('1'||greatest(session_length, 1, NULL) = '0'||greatest(session_length, 1, NULL)) IS NOT TRUE
AND ('1'||greatest(session_length, 1, NULL) = '0'||greatest(session_length, 1, NULL)) IS FALSE
AND ('1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)) IS NOT FALSE
AND '1'||greatest(session_length, 1, NULL) BETWEEN '0'||greatest(session_length, 1, NULL) AND 2||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) NOT BETWEEN '1'||greatest(session_length, 1, NULL) AND '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) like '%'
AND '1'||greatest(session_length, 1, NULL) not like '__DOES_NOT_EXIST__%'
AND '1'||greatest(session_length, 1, NULL) IN ('0'||greatest(session_length, 1, NULL),
1||greatest(session_length, 1, NULL),
2||greatest(session_length, 1, NULL))
AND '1'||greatest(session_length, 1, NULL) NOT IN ('0'||greatest(session_length, 1, NULL),
2||greatest(session_length, 1, NULL))))));
+-------+
| cnt |
+-------+
| 78197 |
+-------+
(1 row)
!ok
SELECT count(*) cnt
FROM
(SELECT __time, number, client_ip,
'1'||greatest(session_length, 1, NULL),
count(*)
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00'
AND ('1'||greatest(session_length, 1, NULL) IS NULL
OR ('1'||greatest(session_length, 1, NULL) = 1||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) IS NOT DISTINCT
FROM 1||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)
AND ('1'||greatest(session_length, 1, NULL) IS DISTINCT
FROM '0'||greatest(session_length, 1, NULL))
AND '1'||greatest(session_length, 1, NULL) > '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) >= '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) < 2||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) <= 2||greatest(session_length, 1, NULL)
AND ('1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)) IS TRUE
AND ('1'||greatest(session_length, 1, NULL) = '0'||greatest(session_length, 1, NULL)) IS NOT TRUE
AND ('1'||greatest(session_length, 1, NULL) = '0'||greatest(session_length, 1, NULL)) IS FALSE
AND ('1'||greatest(session_length, 1, NULL) <> '0'||greatest(session_length, 1, NULL)) IS NOT FALSE
AND '1'||greatest(session_length, 1, NULL) BETWEEN '0'||greatest(session_length, 1, NULL) AND 2||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) NOT BETWEEN '1'||greatest(session_length, 1, NULL) AND '0'||greatest(session_length, 1, NULL)
AND '1'||greatest(session_length, 1, NULL) like '%'
AND '1'||greatest(session_length, 1, NULL) not like '__DOES_NOT_EXIST__%'
AND '1'||greatest(session_length, 1, NULL) IN ('0'||greatest(session_length, 1, NULL),
1||greatest(session_length, 1, NULL),
2||greatest(session_length, 1, NULL))
AND '1'||greatest(session_length, 1, NULL) NOT IN ('0'||greatest(session_length, 1, NULL),
2||greatest(session_length, 1, NULL))))
GROUP BY 1,
2,
3,
4);
+-------+
| cnt |
+-------+
| 78197 |
+-------+
(1 row)
!ok
#-------------------------------------------------------------------------
# TEST_ID: A2: least
#-------------------------------------------------------------------------
SELECT count(*) cnt
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00'
AND ('1'||least(loaded_image, '1', NULL) IS NULL
OR ('1'||least(loaded_image, '1', NULL) = 1||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) IS NOT DISTINCT
FROM 1||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)
AND ('1'||least(loaded_image, '1', NULL) IS DISTINCT
FROM '0'||least(loaded_image, '1', NULL))
AND '1'||least(loaded_image, '1', NULL) > '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) >= '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) < 2||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) <= 2||least(loaded_image, '1', NULL)
AND ('1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)) IS TRUE
AND ('1'||least(loaded_image, '1', NULL) = '0'||least(loaded_image, '1', NULL)) IS NOT TRUE
AND ('1'||least(loaded_image, '1', NULL) = '0'||least(loaded_image, '1', NULL)) IS FALSE
AND ('1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)) IS NOT FALSE
AND '1'||least(loaded_image, '1', NULL) BETWEEN '0'||least(loaded_image, '1', NULL) AND 2||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) NOT BETWEEN '1'||least(loaded_image, '1', NULL) AND '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) like '%'
AND '1'||least(loaded_image, '1', NULL) not like '__DOES_NOT_EXIST__%'
AND '1'||least(loaded_image, '1', NULL) IN ('0'||least(loaded_image, '1', NULL),
1||least(loaded_image, '1', NULL),
2||least(loaded_image, '1', NULL))
AND '1'||least(loaded_image, '1', NULL) NOT IN ('0'||least(loaded_image, '1', NULL),
2||least(loaded_image, '1', NULL)))) ;
+-------+
| cnt |
+-------+
| 78197 |
+-------+
(1 row)
!ok
SELECT count(*) cnt
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00'
AND ('1'||least(loaded_image, '1', NULL) IS NULL
OR '1'||least(loaded_image, '1', NULL) IN
(SELECT '1'||least(loaded_image, '1', NULL)
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00'
AND ('1'||least(loaded_image, '1', NULL) IS NULL
OR ('1'||least(loaded_image, '1', NULL) = 1||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) IS NOT DISTINCT
FROM 1||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)
AND ('1'||least(loaded_image, '1', NULL) IS DISTINCT
FROM '0'||least(loaded_image, '1', NULL))
AND '1'||least(loaded_image, '1', NULL) > '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) >= '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) < 2||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) <= 2||least(loaded_image, '1', NULL)
AND ('1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)) IS TRUE
AND ('1'||least(loaded_image, '1', NULL) = '0'||least(loaded_image, '1', NULL)) IS NOT TRUE
AND ('1'||least(loaded_image, '1', NULL) = '0'||least(loaded_image, '1', NULL)) IS FALSE
AND ('1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)) IS NOT FALSE
AND '1'||least(loaded_image, '1', NULL) BETWEEN '0'||least(loaded_image, '1', NULL) AND 2||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) NOT BETWEEN '1'||least(loaded_image, '1', NULL) AND '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) like '%'
AND '1'||least(loaded_image, '1', NULL) not like '__DOES_NOT_EXIST__%'
AND '1'||least(loaded_image, '1', NULL) IN ('0'||least(loaded_image, '1', NULL),
1||least(loaded_image, '1', NULL),
2||least(loaded_image, '1', NULL))
AND '1'||least(loaded_image, '1', NULL) NOT IN ('0'||least(loaded_image, '1', NULL),
2||least(loaded_image, '1', NULL))))));
+-------+
| cnt |
+-------+
| 78197 |
+-------+
(1 row)
!ok
SELECT count(*) cnt
FROM
(SELECT __time, number, client_ip,
'1'||least(loaded_image, '1', NULL),
count(*)
FROM kttm_nested
WHERE time_floor(__time, 'PT1H') BETWEEN timestamp '2019-08-25 00:00:00' AND timestamp '2019-08-25 06:00:00'
AND ('1'||least(loaded_image, '1', NULL) IS NULL
OR ('1'||least(loaded_image, '1', NULL) = 1||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) IS NOT DISTINCT
FROM 1||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)
AND ('1'||least(loaded_image, '1', NULL) IS DISTINCT
FROM '0'||least(loaded_image, '1', NULL))
AND '1'||least(loaded_image, '1', NULL) > '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) >= '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) < 2||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) <= 2||least(loaded_image, '1', NULL)
AND ('1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)) IS TRUE
AND ('1'||least(loaded_image, '1', NULL) = '0'||least(loaded_image, '1', NULL)) IS NOT TRUE
AND ('1'||least(loaded_image, '1', NULL) = '0'||least(loaded_image, '1', NULL)) IS FALSE
AND ('1'||least(loaded_image, '1', NULL) <> '0'||least(loaded_image, '1', NULL)) IS NOT FALSE
AND '1'||least(loaded_image, '1', NULL) BETWEEN '0'||least(loaded_image, '1', NULL) AND 2||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) NOT BETWEEN '1'||least(loaded_image, '1', NULL) AND '0'||least(loaded_image, '1', NULL)
AND '1'||least(loaded_image, '1', NULL) like '%'
AND '1'||least(loaded_image, '1', NULL) not like '__DOES_NOT_EXIST__%'
AND '1'||least(loaded_image, '1', NULL) IN ('0'||least(loaded_image, '1', NULL),
1||least(loaded_image, '1', NULL),
2||least(loaded_image, '1', NULL))
AND '1'||least(loaded_image, '1', NULL) NOT IN ('0'||least(loaded_image, '1', NULL),
2||least(loaded_image, '1', NULL))))
GROUP BY 1,
2,
3,
4);
+-------+
| cnt |
+-------+
| 78197 |
+-------+
(1 row)
!ok
#-------------------------------------------------------------------------
# Total query count 7
#-------------------------------------------------------------------------