aggSumWithColumnRepeatedWithOrderAsc SELECT gender AS g, gender, SUM(salary) AS s3, SUM(salary), SUM(salary) AS s5 FROM test_emp GROUP BY gender ORDER BY SUM(salary); g:s | gender:s | s3:l | SUM(salary):l | s5:l null |null |487605 |487605 |487605 F |F |1666196|1666196 |1666196 M |M |2671054|2671054 |2671054 ; aggSumWithAliasWithColumnRepeatedWithOrderDesc SELECT gender AS g, gender, SUM(salary) AS s3, SUM(salary), SUM(salary) AS s5 FROM test_emp GROUP BY g ORDER BY s5 DESC; g:s | gender:s | s3:l | SUM(salary):l | s5:l M |M |2671054|2671054 |2671054 F |F |1666196|1666196 |1666196 null |null |487605 |487605 |487605 ; aggSumWithNumericRefWithColumnRepeatedWithOrderDesc SELECT gender AS g, gender, SUM(salary) AS s3, SUM(salary), SUM(salary) AS s5 FROM test_emp GROUP BY 2 ORDER BY 3 DESC; g:s | gender:s | s3:l | SUM(salary):l | s5:l M |M |2671054|2671054 |2671054 F |F |1666196|1666196 |1666196 null |null |487605 |487605 |487605 ; histogramDateTimeWithCountAndOrder_1 schema::h:ts|c:l SELECT HISTOGRAM(birth_date, INTERVAL 1 YEAR) AS h, COUNT(*) as c FROM test_emp GROUP BY h ORDER BY h DESC, c ASC; h | c ------------------------+--------------- 1965-01-01T00:00:00.000Z|1 1964-01-01T00:00:00.000Z|4 1963-01-01T00:00:00.000Z|7 1962-01-01T00:00:00.000Z|6 1961-01-01T00:00:00.000Z|8 1960-01-01T00:00:00.000Z|8 1959-01-01T00:00:00.000Z|9 1958-01-01T00:00:00.000Z|7 1957-01-01T00:00:00.000Z|4 1956-01-01T00:00:00.000Z|5 1955-01-01T00:00:00.000Z|4 1954-01-01T00:00:00.000Z|8 1953-01-01T00:00:00.000Z|11 1952-01-01T00:00:00.000Z|8 null |10 ; histogramDateTimeWithCountAndOrder_2 schema::h:ts|c:l SELECT HISTOGRAM(birth_date, INTERVAL 1 YEAR) AS h, COUNT(*) as c FROM test_emp GROUP BY h ORDER BY c DESC, h ASC; h | c ------------------------+--------------- 1953-01-01T00:00:00.000Z|11 null |10 1959-01-01T00:00:00.000Z|9 1952-01-01T00:00:00.000Z|8 1954-01-01T00:00:00.000Z|8 1960-01-01T00:00:00.000Z|8 1961-01-01T00:00:00.000Z|8 1958-01-01T00:00:00.000Z|7 1963-01-01T00:00:00.000Z|7 1962-01-01T00:00:00.000Z|6 1956-01-01T00:00:00.000Z|5 1955-01-01T00:00:00.000Z|4 1957-01-01T00:00:00.000Z|4 1964-01-01T00:00:00.000Z|4 1965-01-01T00:00:00.000Z|1 ; aggGroupAndOrderByDerivedFieldAsc SELECT languages - 2 l, SUM(salary) s FROM test_emp GROUP BY l ORDER BY l; l:i | s:l ---------------+--------------- null |525196 -1 |758650 0 |915398 1 |891121 2 |859194 3 |875296 ; aggGroupAndOrderByDerivedFieldDesc SELECT languages - 2 l, SUM(salary) s FROM test_emp GROUP BY l ORDER BY l DESC; l:i | s:l ---------------+--------------- 3 |875296 2 |859194 1 |891121 0 |915398 -1 |758650 null |525196 ; orderByHistogramNullsLast SELECT HISTOGRAM(languages, 3) l, COUNT(*) c FROM test_emp GROUP BY l ORDER BY l NULLS LAST; l:bt | c:l ---------------+--------------- 0 |34 3 |56 null |10 ; orderByHistogramDescNullsFirst SELECT HISTOGRAM(languages, 3) l, COUNT(*) c FROM test_emp GROUP BY l ORDER BY l DESC NULLS FIRST; l:bt | c:l ---------------+--------------- null |10 3 |56 0 |34 ; orderByDateHistogramNullsLast SELECT HISTOGRAM(birth_date, INTERVAL 10 YEARS) b, COUNT(*) c FROM test_emp GROUP BY b ORDER BY b NULLS LAST; b:ts | c:l ------------------------+--------------- 1950-04-16T00:00:00.000Z|57 1960-02-23T00:00:00.000Z|33 null |10 ; orderByDateHistogramDescNullsFirst SELECT HISTOGRAM(birth_date, INTERVAL 10 YEARS) b, COUNT(*) c FROM test_emp GROUP BY b ORDER BY b DESC NULLS FIRST; b:ts | c:l ------------------------+--------------- null |10 1960-02-23T00:00:00.000Z|33 1950-04-16T00:00:00.000Z|57 ;