-- ============================================================ -- count(distinct ...) 测试 -- ============================================================ -- 1. count(distinct 单字段) select count(distinct a_category) from /test/aaa/test_aggr /** output() **/ ; -- 2. count(distinct 数值字段) select count(distinct a_int) from /test/aaa/test_aggr /** output() **/ ; -- 3. count(distinct bool 字段) select count(distinct a_bool) from /test/aaa/test_aggr /** output() **/ ; -- 4. count(distinct) + where select count(distinct a_category) from /test/aaa/test_aggr where a_bool=true /** output() **/ ; -- 5. count(distinct) 空结果 select count(distinct a_category) from /test/aaa/test_aggr where a_int=9999 /** output() **/ ;