Skip to content

Commit 4e80db0

Browse files
add test case
Signed-off-by: before-Sunrise <[email protected]>
1 parent 904bba6 commit 4e80db0

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

test/sql/test_max_min_by_not_filter_nulls_with_nulls/R/test_max_min_by_not_filter_nulls_with_nulls

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,4 +352,30 @@ select (sum(murmur_hash3_32(ifnull(c2,0))+murmur_hash3_32(ifnull(a,0))+murmur_h
352352
select (sum(murmur_hash3_32(ifnull(c0,0))+murmur_hash3_32(ifnull(a,0))+murmur_hash3_32(ifnull(b,0)))) as fingerprint from (select c0,max_by(c2,concat(coalesce(c2,'NULL'),c3)) over(partition by c1) a,min_by(c2,concat(coalesce(c2,'NULL'),c3)) over(partition by c1) b from t0) as t;
353353
-- result:
354354
25406211869
355+
-- !result
356+
-- name: test_max_min_by_support_window
357+
CREATE TABLE exam (
358+
subject_id INT,
359+
subject STRING,
360+
exam_result INT
361+
) DISTRIBUTED BY HASH(`subject_id`) PROPERTIES ("replication_num" = "1");
362+
-- result:
363+
-- !result
364+
insert into exam values
365+
(1,'math',90),
366+
(2,'english',70),
367+
(3,'physics',95),
368+
(4,'chemistry',85),
369+
(5,'music',95),
370+
(6,'biology',null);
371+
-- result:
372+
-- !result
373+
SELECT max_by(subject, exam_result) over(partition by subject_id) FROM exam;
374+
-- result:
375+
english
376+
None
377+
physics
378+
chemistry
379+
music
380+
math
355381
-- !result

test/sql/test_max_min_by_not_filter_nulls_with_nulls/T/test_max_min_by_not_filter_nulls_with_nulls

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,21 @@ select (sum(murmur_hash3_32(ifnull(__c_0,0))+murmur_hash3_32(ifnull(a,0))+murmu
112112
select (sum(murmur_hash3_32(ifnull(__c_0,0))+murmur_hash3_32(ifnull(a,0))+murmur_hash3_32(ifnull(b,0)))) as fingerprint from (select (count(DISTINCT c1)) as __c_0 ,max_by(c2,concat(coalesce(c2,'NULL'),c3)) a,min_by(c2,concat(coalesce(c2,'NULL'),c3)) b from t0) as t;
113113
select (sum(murmur_hash3_32(ifnull(c2,0))+murmur_hash3_32(ifnull(a,0))+murmur_hash3_32(ifnull(b,0)))) as fingerprint from (select c2,max_by(c0,coalesce(c0,0)*1000+c1) over(partition by c2) a,min_by(c0,coalesce(c0,0)*1000+c1) over(partition by c2) b from t0) as t;
114114
select (sum(murmur_hash3_32(ifnull(c0,0))+murmur_hash3_32(ifnull(a,0))+murmur_hash3_32(ifnull(b,0)))) as fingerprint from (select c0,max_by(c2,concat(coalesce(c2,'NULL'),c3)) over(partition by c1) a,min_by(c2,concat(coalesce(c2,'NULL'),c3)) over(partition by c1) b from t0) as t;
115+
116+
-- name: test_max_min_by_support_window
117+
CREATE TABLE exam (
118+
subject_id INT,
119+
subject STRING,
120+
exam_result INT
121+
) DISTRIBUTED BY HASH(`subject_id`) PROPERTIES ("replication_num" = "1");
122+
123+
124+
insert into exam values
125+
(1,'math',90),
126+
(2,'english',70),
127+
(3,'physics',95),
128+
(4,'chemistry',85),
129+
(5,'music',95),
130+
(6,'biology',null);
131+
132+
SELECT max_by(subject, exam_result) over(partition by subject_id) FROM exam;

0 commit comments

Comments
 (0)