-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding remaining 6 sets of SQL tests in quidem (#17583)
This is the 2nd part of the PR #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.
- Loading branch information
1 parent
ca8f24e
commit 78ce97a
Showing
6 changed files
with
12,149 additions
and
0 deletions.
There are no files selected for viewing
1,146 changes: 1,146 additions & 0 deletions
1,146
quidem-ut/src/test/quidem/org.apache.druid.quidem.QTest/qaSQL_aggr_general.iq
Large diffs are not rendered by default.
Oops, something went wrong.
2,848 changes: 2,848 additions & 0 deletions
2,848
quidem-ut/src/test/quidem/org.apache.druid.quidem.QTest/qaSQL_array.iq
Large diffs are not rendered by default.
Oops, something went wrong.
1,653 changes: 1,653 additions & 0 deletions
1,653
quidem-ut/src/test/quidem/org.apache.druid.quidem.QTest/qaSQL_json.iq
Large diffs are not rendered by default.
Oops, something went wrong.
2,746 changes: 2,746 additions & 0 deletions
2,746
quidem-ut/src/test/quidem/org.apache.druid.quidem.QTest/qaSQL_mv.iq
Large diffs are not rendered by default.
Oops, something went wrong.
3,490 changes: 3,490 additions & 0 deletions
3,490
quidem-ut/src/test/quidem/org.apache.druid.quidem.QTest/qaSQL_scalar_other.iq
Large diffs are not rendered by default.
Oops, something went wrong.
266 changes: 266 additions & 0 deletions
266
quidem-ut/src/test/quidem/org.apache.druid.quidem.QTest/qaSQL_scalar_reduction.iq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
#------------------------------------------------------------------------- |